From d4932b468153da644851802f33236b1e5ec2403d Mon Sep 17 00:00:00 2001 From: aim2bpg Date: Sun, 13 Feb 2022 12:19:14 +0900 Subject: [PATCH 1/4] =?UTF-8?q?=E4=B8=80=E5=BA=A6=E5=85=AC=E9=96=8B?= =?UTF-8?q?=E3=81=97=E3=81=9F=E3=81=8A=E7=9F=A5=E3=82=89=E3=81=9B=E3=82=92?= =?UTF-8?q?=E8=AA=B0=E3=81=A7=E3=82=82=E5=85=AC=E9=96=8B=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=81=BE=E3=81=BE=E3=81=AB=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../announcements/_announcement.html.slim | 9 +++- app/views/announcements/_form.html.slim | 12 +++--- test/system/announcements_test.rb | 43 ++++++++++++++++--- 3 files changed, 51 insertions(+), 13 deletions(-) diff --git a/app/views/announcements/_announcement.html.slim b/app/views/announcements/_announcement.html.slim index 0ce0a9250e9..edf5873a5f6 100644 --- a/app/views/announcements/_announcement.html.slim +++ b/app/views/announcements/_announcement.html.slim @@ -44,7 +44,14 @@ .card-footer .card-main-actions ul.card-main-actions__items - - if @announcement.wip || admin_or_mentor_login? || @announcement.user_id == current_user.id + // 要デザイン(ここから) + - if announcement.published_at + li.card-main-actions__item + = link_to edit_announcement_path(announcement), class: 'card-main-actions__delete' do + i.fas.fa-pen#new + | 内容修正 + // 要デザイン(ここまで) + - else li.card-main-actions__item = link_to edit_announcement_path(announcement), class: 'card-main-actions__action a-button is-md is-secondary is-block', id: 'js-shortcut-edit' do i.fas.fa-pen#new diff --git a/app/views/announcements/_form.html.slim b/app/views/announcements/_form.html.slim index 74f85c2683e..b706879d981 100644 --- a/app/views/announcements/_form.html.slim +++ b/app/views/announcements/_form.html.slim @@ -39,19 +39,19 @@ ul.form-actions__items li.form-actions__item.is-main = f.submit 'WIP', class: 'a-button is-lg is-primary is-block', id: 'js-shortcut-wip' - - if admin_or_mentor_login? + - if admin_or_mentor_login? && announcement.new_record? li.form-actions__item.is-main.is-help - - if announcement.new_record? - = f.submit '作成', class: 'a-button is-lg is-warning is-block', id: 'js-shortcut-submit' - - else - = f.submit '公開', class: 'a-button is-lg is-warning is-block', id: 'js-shortcut-submit' + = f.submit '作成', class: 'a-button is-lg is-warning is-block', id: 'js-shortcut-submit' + - if admin_or_mentor_login? || announcement.published_at + li.form-actions__item.is-main.is-help + = f.submit '公開', class: 'a-button is-lg is-warning is-block', id: 'js-shortcut-submit' li.form-actions__item.is-sub - case params[:action] - when 'new', 'create' = link_to 'キャンセル', announcements_path, class: 'a-button is-md is-secondary is-block' - when 'edit', 'update' = link_to 'キャンセル', announcement_path, class: 'a-button is-md is-secondary is-block' - - unless admin_or_mentor_login? + - unless admin_or_mentor_login? || announcement.published_at .form-actions__description.a-short-text p | お知らせを作成しましたら、WIPで保存し、作成したお知らせのコメントから @mentor へ確認・公開の連絡をお願いします。 diff --git a/test/system/announcements_test.rb b/test/system/announcements_test.rb index 0bcc7cc850f..fe1bec1342f 100644 --- a/test/system/announcements_test.rb +++ b/test/system/announcements_test.rb @@ -140,20 +140,51 @@ class AnnouncementsTest < ApplicationSystemTestCase assert_no_text 'お知らせ「就活希望者のみお知らせします」' end - test "general user can't edit submitted announcement" do - announcement = announcements(:announcement1) - visit_with_auth announcement_path(announcement), 'kimura' + test "general user can't create announcement" do + visit_with_auth '/announcements', 'kimura' + click_link 'お知らせ作成' + assert has_no_button? '作成' + assert_text 'お知らせを作成しましたら、WIPで保存し、作成したお知らせのコメントから @mentor へ確認・公開の連絡をお願いします。' + end + + test 'admin user can publish wip announcement' do + announcement = announcements(:announcement_wip) + visit_with_auth announcement_path(announcement), 'komagata' within '.thread__inner' do - assert_no_text '内容修正' + click_link '内容修正' end + assert has_button? '公開' + assert_no_text 'お知らせを作成しましたら、WIPで保存し、作成したお知らせのコメントから @mentor へ確認・公開の連絡をお願いします。' end - test 'general user can edit wip announcement' do + test "general user can't publish wip announcement" do announcement = announcements(:announcement_wip) visit_with_auth announcement_path(announcement), 'kimura' within '.thread__inner' do - assert_text '内容修正' + click_link '内容修正' + end + assert has_no_button? '公開' + assert_text 'お知らせを作成しましたら、WIPで保存し、作成したお知らせのコメントから @mentor へ確認・公開の連絡をお願いします。' + end + + test 'adimin user can publish submitted announcement' do + announcement = announcements(:announcement1) + visit_with_auth announcement_path(announcement), 'komagata' + within '.thread__inner' do + click_link '内容修正' + end + assert has_button? '公開' + assert_no_text 'お知らせを作成しましたら、WIPで保存し、作成したお知らせのコメントから @mentor へ確認・公開の連絡をお願いします。' + end + + test 'general user can publish submitted announcement' do + announcement = announcements(:announcement1) + visit_with_auth announcement_path(announcement), 'kimura' + within '.thread__inner' do + click_link '内容修正' end + assert has_button? '公開' + assert_no_text 'お知らせを作成しましたら、WIPで保存し、作成したお知らせのコメントから @mentor へ確認・公開の連絡をお願いします。' end test 'general user can copy submitted announcement' do From a723267fdacef95d05e077de9ec15a54b418a013 Mon Sep 17 00:00:00 2001 From: teppei machida Date: Wed, 16 Feb 2022 19:04:48 +0900 Subject: [PATCH 2/4] =?UTF-8?q?=E7=9B=AE=E7=AB=8B=E3=81=9F=E3=81=AA?= =?UTF-8?q?=E3=81=84=E7=B7=A8=E9=9B=86=E3=83=AA=E3=83=B3=E3=82=AF=E3=81=AE?= =?UTF-8?q?=E3=83=AC=E3=82=A4=E3=82=A2=E3=82=A6=E3=83=88=E9=81=A9=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/stylesheets/blocks/card/_card-main-actions.sass | 3 ++- app/views/announcements/_announcement.html.slim | 7 ++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/assets/stylesheets/blocks/card/_card-main-actions.sass b/app/assets/stylesheets/blocks/card/_card-main-actions.sass index f6e8567f4e8..0ae82ffdb18 100644 --- a/app/assets/stylesheets/blocks/card/_card-main-actions.sass +++ b/app/assets/stylesheets/blocks/card/_card-main-actions.sass @@ -26,7 +26,8 @@ &.is-sub text-align: right -.card-main-actions__delete +.card-main-actions__delete, +.card-main-actions__muted-action +hover-link-reversal +text-block(.875rem 1.4, $muted-text) &:hover diff --git a/app/views/announcements/_announcement.html.slim b/app/views/announcements/_announcement.html.slim index edf5873a5f6..5ca62a06caa 100644 --- a/app/views/announcements/_announcement.html.slim +++ b/app/views/announcements/_announcement.html.slim @@ -44,13 +44,10 @@ .card-footer .card-main-actions ul.card-main-actions__items - // 要デザイン(ここから) - if announcement.published_at - li.card-main-actions__item - = link_to edit_announcement_path(announcement), class: 'card-main-actions__delete' do - i.fas.fa-pen#new + li.card-main-actions__item.is-sub + = link_to edit_announcement_path(announcement), class: 'card-main-actions__muted-action' do | 内容修正 - // 要デザイン(ここまで) - else li.card-main-actions__item = link_to edit_announcement_path(announcement), class: 'card-main-actions__action a-button is-md is-secondary is-block', id: 'js-shortcut-edit' do From e3ecfc1e950b9f60f867ce575a1e95f2a89d9b87 Mon Sep 17 00:00:00 2001 From: teppei machida Date: Wed, 16 Feb 2022 23:23:29 +0900 Subject: [PATCH 3/4] =?UTF-8?q?.card-main-actions=E3=81=AE=E3=83=AC?= =?UTF-8?q?=E3=82=A4=E3=82=A2=E3=82=A6=E3=83=88=E3=82=92=E3=83=AA=E3=83=95?= =?UTF-8?q?=E3=82=A1=E3=82=AF=E3=82=BF=E3=80=81=E7=9B=AE=E7=AB=8B=E3=81=9F?= =?UTF-8?q?=E3=81=AA=E3=81=84=E3=83=AA=E3=83=B3=E3=82=AF=E3=81=8C=E8=A4=87?= =?UTF-8?q?=E6=95=B0=E3=81=82=E3=81=A3=E3=81=9F=E5=A0=B4=E5=90=88=E3=81=AE?= =?UTF-8?q?=E3=83=AC=E3=82=A4=E3=82=A2=E3=82=A6=E3=83=88=E3=82=92=E6=96=B0?= =?UTF-8?q?=E8=A6=8F=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../blocks/card/_card-main-actions.sass | 15 +++++++++++---- app/views/announcements/_announcement.html.slim | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/assets/stylesheets/blocks/card/_card-main-actions.sass b/app/assets/stylesheets/blocks/card/_card-main-actions.sass index 0ae82ffdb18..2f537d899e1 100644 --- a/app/assets/stylesheets/blocks/card/_card-main-actions.sass +++ b/app/assets/stylesheets/blocks/card/_card-main-actions.sass @@ -5,14 +5,21 @@ .card-main-actions__items display: flex gap: .75rem - +position(relative) - justify-content: center - flex-wrap: wrap +media-breakpoint-up(md) - min-height: 1.875rem + +position(relative) + justify-content: center + flex-wrap: wrap align-items: flex-end + min-height: 1.875rem +media-breakpoint-down(sm) flex-direction: column + &.is-sub-actions + justify-content: flex-end + +media-breakpoint-down(sm) + flex-direction: row + .card-main-actions__item.is-sub + position: static + flex: 0 0 auto .card-main-actions__item +media-breakpoint-up(md) diff --git a/app/views/announcements/_announcement.html.slim b/app/views/announcements/_announcement.html.slim index 5ca62a06caa..84f864f455b 100644 --- a/app/views/announcements/_announcement.html.slim +++ b/app/views/announcements/_announcement.html.slim @@ -43,7 +43,7 @@ = render 'reactions/reactions', reactionable: @announcement .card-footer .card-main-actions - ul.card-main-actions__items + ul.card-main-actions__items(class="#{announcement.published_at ? 'is-sub-actions' : ''}") - if announcement.published_at li.card-main-actions__item.is-sub = link_to edit_announcement_path(announcement), class: 'card-main-actions__muted-action' do From 71c616005b45a6f82b5addac8fefc11caa1a091c Mon Sep 17 00:00:00 2001 From: teppei machida Date: Wed, 16 Feb 2022 19:08:40 +0900 Subject: [PATCH 4/4] =?UTF-8?q?=E7=9B=AE=E7=AB=8B=E3=81=9F=E3=81=AA?= =?UTF-8?q?=E3=81=84=E3=83=AA=E3=83=B3=E3=82=AF=E3=81=AEclass=E5=90=8D?= =?UTF-8?q?=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/stylesheets/blocks/card/_card-main-actions.sass | 1 - app/javascript/answer.vue | 2 +- app/javascript/check.vue | 2 +- app/javascript/comment.vue | 2 +- app/javascript/question-edit.vue | 2 +- app/javascript/report_template_modal.vue | 2 +- app/javascript/tag-edit-modal.vue | 2 +- app/views/announcements/_announcement.html.slim | 2 +- app/views/events/_event.html.slim | 2 +- app/views/pages/show.html.slim | 2 +- app/views/products/show.html.slim | 2 +- app/views/reports/show.html.slim | 2 +- app/views/shared/_modal_learning_completion.html.slim | 2 +- app/views/works/show.html.slim | 2 +- test/system/products_test.rb | 2 +- 15 files changed, 14 insertions(+), 15 deletions(-) diff --git a/app/assets/stylesheets/blocks/card/_card-main-actions.sass b/app/assets/stylesheets/blocks/card/_card-main-actions.sass index 2f537d899e1..92a265d937a 100644 --- a/app/assets/stylesheets/blocks/card/_card-main-actions.sass +++ b/app/assets/stylesheets/blocks/card/_card-main-actions.sass @@ -33,7 +33,6 @@ &.is-sub text-align: right -.card-main-actions__delete, .card-main-actions__muted-action +hover-link-reversal +text-block(.875rem 1.4, $muted-text) diff --git a/app/javascript/answer.vue b/app/javascript/answer.vue index d023eb18653..fe52828255c 100644 --- a/app/javascript/answer.vue +++ b/app/javascript/answer.vue @@ -60,7 +60,7 @@ li.card-main-actions__item.is-sub( v-if='answer.user.id == currentUser.id || isRole("mentor")' ) - button.card-main-actions__delete(@click='deleteAnswer') + button.card-main-actions__muted-action(@click='deleteAnswer') | 削除する .thread-comment-form__form.a-card(v-show='editing') .a-form-tabs.js-tabs diff --git a/app/javascript/check.vue b/app/javascript/check.vue index de25f8dfb97..4a79e81e6f9 100644 --- a/app/javascript/check.vue +++ b/app/javascript/check.vue @@ -25,7 +25,7 @@ ) li.card-main-actions__item(:class='checkId ? "is-sub" : ""') button#js-shortcut-check.is-block( - :class='checkId ? "card-main-actions__delete" : "a-button is-md is-danger"', + :class='checkId ? "card-main-actions__muted-action" : "a-button is-md is-danger"', @click='checkSad' ) | {{ buttonLabel }} diff --git a/app/javascript/comment.vue b/app/javascript/comment.vue index 16a1268f3b7..7bd529f6e0e 100644 --- a/app/javascript/comment.vue +++ b/app/javascript/comment.vue @@ -38,7 +38,7 @@ i.fas.fa-pen | 編集 li.card-main-actions__item.is-sub - button.card-main-actions__delete(@click='deleteComment') + button.card-main-actions__muted-action(@click='deleteComment') | 削除する .thread-comment-form__form.a-card(v-show='editing') .a-form-tabs.js-tabs diff --git a/app/javascript/question-edit.vue b/app/javascript/question-edit.vue index 80a19b79eda..d31695d975e 100644 --- a/app/javascript/question-edit.vue +++ b/app/javascript/question-edit.vue @@ -87,7 +87,7 @@ // - いい実装方法ではないが、 // - Rails特定の属性(data-confirm, data-method)を付与して、 // - 確認ダイアログとDELETE methodのリンクを実装する - a.js-delete.card-main-actions__delete( + a.js-delete.card-main-actions__muted-action( :href='`/questions/${question.id}`', data-confirm='本当によろしいですか?', data-method='delete' diff --git a/app/javascript/report_template_modal.vue b/app/javascript/report_template_modal.vue index 17df3d7a477..1ed17179a7b 100644 --- a/app/javascript/report_template_modal.vue +++ b/app/javascript/report_template_modal.vue @@ -44,7 +44,7 @@ @click.prevent='updateTemplate' ) 変更 li.card-main-actions__item.is-sub - .card-main-actions__delete(@click.prevent='closeModal') キャンセル + .card-main-actions__muted-action(@click.prevent='closeModal') キャンセル