From 4a1cb276fcc5be86f2901b23009e66291648694f Mon Sep 17 00:00:00 2001 From: a-terumoto-gs Date: Thu, 7 Mar 2024 16:11:40 +0900 Subject: [PATCH 1/5] =?UTF-8?q?=E3=81=8A=E7=9F=A5=E3=82=89=E3=81=9B?= =?UTF-8?q?=E3=81=AE=E5=80=8B=E5=88=A5=E3=83=9A=E3=83=BC=E3=82=B8=E3=81=AB?= =?UTF-8?q?=E6=9C=80=E6=96=B0=E3=81=AE=E3=81=8A=E7=9F=A5=E3=82=89=E3=81=9B?= =?UTF-8?q?=E3=82=9210=E4=BB=B6=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/announcements_controller.rb | 4 +++- .../announcements/_recent_announcements.html.slim | 14 ++++++++++++++ app/views/announcements/show.html.slim | 7 ++++--- 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 app/views/announcements/_recent_announcements.html.slim diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index 3124b60dc8c..95615c58c6a 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -6,7 +6,9 @@ class AnnouncementsController < ApplicationController def index; end - def show; end + def show + @announcements = Announcement.with_avatar.where(wip: false).order(published_at: :desc).limit(10) + end def new @announcement = Announcement.new(target: 'students') diff --git a/app/views/announcements/_recent_announcements.html.slim b/app/views/announcements/_recent_announcements.html.slim new file mode 100644 index 00000000000..8721f4f245c --- /dev/null +++ b/app/views/announcements/_recent_announcements.html.slim @@ -0,0 +1,14 @@ +.a-side-nav + .a-side-nav__inner + header.a-side-nav__header + h2.a-side-nav__title + | 最新のお知らせ + hr.a-border + .a-side-nav__body + .card-list + = render partial: 'home/announcement', collection: @announcements, as: :announcement + hr.a-border + footer.a-side-nav__footer + = link_to announcements_path, class: 'a-side-nav__footer-link' do + | 全てのお知らせ + diff --git a/app/views/announcements/show.html.slim b/app/views/announcements/show.html.slim index 3cc34e3aca0..b733405f4a2 100644 --- a/app/views/announcements/show.html.slim +++ b/app/views/announcements/show.html.slim @@ -16,6 +16,7 @@ header.page-header hr.a-border .page-body .container.is-md - = render 'announcement', announcement: @announcement - #js-comments(data-commentable-id="#{@announcement.id}" data-commentable-type='Announcement' data-current-user-id="#{current_user.id}") - div(data-vue='Footprints' data-vue-footprintable-id="#{@announcement.id}" data-vue-footprintable-type='Announcement') + = render 'announcement', announcement: @announcement + #js-comments(data-commentable-id="#{@announcement.id}" data-commentable-type='Announcement' data-current-user-id="#{current_user.id}") + div(data-vue='Footprints' data-vue-footprintable-id="#{@announcement.id}" data-vue-footprintable-type='Announcement') + = render partial: 'recent_announcements' From 4160b6bf8b156487c9b4bb421b65bc2ecb797f06 Mon Sep 17 00:00:00 2001 From: machida Date: Tue, 2 Apr 2024 14:55:53 +0900 Subject: [PATCH 2/5] =?UTF-8?q?=E3=81=8A=E7=9F=A5=E3=82=89=E3=81=9B?= =?UTF-8?q?=E5=80=8B=E5=88=A5=E3=81=AE=E6=9C=80=E6=96=B0=E3=81=AE=E3=81=8A?= =?UTF-8?q?=E7=9F=A5=E3=82=89=E3=81=9B=E4=B8=80=E8=A6=A7=E3=81=AE=E3=83=AC?= =?UTF-8?q?=E3=82=A4=E3=82=A2=E3=82=A6=E3=83=88=E3=82=92=E6=95=B4=E3=81=88?= =?UTF-8?q?=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/announcements/show.html.slim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/announcements/show.html.slim b/app/views/announcements/show.html.slim index b733405f4a2..1767bc2588d 100644 --- a/app/views/announcements/show.html.slim +++ b/app/views/announcements/show.html.slim @@ -15,8 +15,9 @@ header.page-header | お知らせ一覧へ hr.a-border .page-body - .container.is-md + .page-body__inner.has-side-nav + .container.is-md = render 'announcement', announcement: @announcement #js-comments(data-commentable-id="#{@announcement.id}" data-commentable-type='Announcement' data-current-user-id="#{current_user.id}") div(data-vue='Footprints' data-vue-footprintable-id="#{@announcement.id}" data-vue-footprintable-type='Announcement') - = render partial: 'recent_announcements' + = render partial: 'recent_announcements' From 62b9086661abaacf04b2bd7273cf92c74e560af5 Mon Sep 17 00:00:00 2001 From: a-terumoto-gs Date: Wed, 3 Apr 2024 16:51:17 +0900 Subject: [PATCH 3/5] =?UTF-8?q?=E3=82=B7=E3=82=B9=E3=83=86=E3=83=A0?= =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/system/announcements_test.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/system/announcements_test.rb b/test/system/announcements_test.rb index 426fe51116c..cbd0dbee371 100644 --- a/test/system/announcements_test.rb +++ b/test/system/announcements_test.rb @@ -268,4 +268,9 @@ class AnnouncementsTest < ApplicationSystemTestCase end assert_equal '.file-input', find('textarea.a-text-input')['data-input'] end + + test 'show the latest 10 announcements' do + visit_with_auth "/announcements/#{announcements(:announcement1).id}", 'kimura' + assert_text '最新のお知らせ' + end end From 2a4b5d5bbdbc4c0b7772f8607cd07a7275eeb9b7 Mon Sep 17 00:00:00 2001 From: a-terumoto-gs Date: Wed, 3 Apr 2024 16:52:47 +0900 Subject: [PATCH 4/5] =?UTF-8?q?=E3=82=B3=E3=83=BC=E3=83=89=E6=95=B4?= =?UTF-8?q?=E5=BD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/announcements/_recent_announcements.html.slim | 1 - 1 file changed, 1 deletion(-) diff --git a/app/views/announcements/_recent_announcements.html.slim b/app/views/announcements/_recent_announcements.html.slim index 8721f4f245c..c8f61b16c21 100644 --- a/app/views/announcements/_recent_announcements.html.slim +++ b/app/views/announcements/_recent_announcements.html.slim @@ -11,4 +11,3 @@ footer.a-side-nav__footer = link_to announcements_path, class: 'a-side-nav__footer-link' do | 全てのお知らせ - From e62e67744b67379831b14630f0c2c3ef1015bfb0 Mon Sep 17 00:00:00 2001 From: a-terumoto-gs Date: Mon, 8 Apr 2024 18:23:03 +0900 Subject: [PATCH 5/5] =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E5=90=8D?= =?UTF-8?q?=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/system/announcements_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/system/announcements_test.rb b/test/system/announcements_test.rb index cbd0dbee371..4a30294bb78 100644 --- a/test/system/announcements_test.rb +++ b/test/system/announcements_test.rb @@ -269,7 +269,7 @@ class AnnouncementsTest < ApplicationSystemTestCase assert_equal '.file-input', find('textarea.a-text-input')['data-input'] end - test 'show the latest 10 announcements' do + test 'show the latest announcements' do visit_with_auth "/announcements/#{announcements(:announcement1).id}", 'kimura' assert_text '最新のお知らせ' end