From b7c5853de5f0f04625eab6389cba9de8b02e48fb Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Mon, 12 May 2025 14:53:31 -0400 Subject: Added streams index --- app/views/streams/_stream.html.haml | 6 ++---- app/views/streams/index.html.haml | 19 +++++++++++++++++++ app/views/streams/show.html.haml | 2 +- 3 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 app/views/streams/index.html.haml (limited to 'app/views/streams') diff --git a/app/views/streams/_stream.html.haml b/app/views/streams/_stream.html.haml index 4a6b1e9..97d4813 100644 --- a/app/views/streams/_stream.html.haml +++ b/app/views/streams/_stream.html.haml @@ -2,9 +2,7 @@ %h2#stream-title= stream.title - unless stream.body.blank? %header#stream-intro.entry-content= markdown(stream.body) - - if stream.updates.size > 10 - = will_paginate @updates + = will_paginate @updates - unless @updates.empty? = render @updates - - if stream.updates.size > 10 - = will_paginate @updates + = will_paginate @updates diff --git a/app/views/streams/index.html.haml b/app/views/streams/index.html.haml new file mode 100644 index 0000000..bf5073f --- /dev/null +++ b/app/views/streams/index.html.haml @@ -0,0 +1,19 @@ +%table#streams-index + %tr#streams-index-header-row + %th Stream Topic + %th Updates + %th Last Post + - @streams.each do |stream| + %tr + %td + = link_to stream.title, stream, class: "stream-link" + %br + %time= stream.created_at.strftime("%B #{stream.created_at.day.ordinalize}, %Y at %-I:%M:%S%P") + %td= stream.updates.size + %td + - unless stream.updates.empty? + - latest_post = stream.updates.order(created_at: :desc).first + = link_to (stripped_markdown(latest_post.body)[0, 30] + "..."), stream + %br + %time= latest_post.created_at.strftime("%B #{latest_post.created_at.day.ordinalize}, %Y at %-I:%M:%S%P") += will_paginate @streams diff --git a/app/views/streams/show.html.haml b/app/views/streams/show.html.haml index 8365556..8d58f62 100644 --- a/app/views/streams/show.html.haml +++ b/app/views/streams/show.html.haml @@ -1,3 +1,3 @@ - title @stream.title -.breadcrumb= link_to "← Back to home page", root_path +.breadcrumb= link_to "← Back to streams", streams_path = render @stream -- cgit 1.4.1