diff --git a/app/assets/stylesheets/application/blocks/side/_side-tabs-contents.sass b/app/assets/stylesheets/application/blocks/side/_side-tabs-contents.sass index 0fdb7fd59c1..e8c98e02fb9 100644 --- a/app/assets/stylesheets/application/blocks/side/_side-tabs-contents.sass +++ b/app/assets/stylesheets/application/blocks/side/_side-tabs-contents.sass @@ -10,6 +10,9 @@ #side-tabs-3:checked ~ .side-tabs-contents #side-tabs-content-3 display: block +#side-tabs-4:checked ~ .side-tabs-contents #side-tabs-content-4 + display: block + .side-tabs-contents__item display: none .a-card diff --git a/app/assets/stylesheets/application/blocks/side/_side-tabs-nav.sass b/app/assets/stylesheets/application/blocks/side/_side-tabs-nav.sass index 45854a7cabf..988569872cb 100644 --- a/app/assets/stylesheets/application/blocks/side/_side-tabs-nav.sass +++ b/app/assets/stylesheets/application/blocks/side/_side-tabs-nav.sass @@ -7,7 +7,8 @@ #side-tabs-1:checked ~ .side-tabs-nav #side-tabs-nav-1, #side-tabs-2:checked ~ .side-tabs-nav #side-tabs-nav-2, -#side-tabs-3:checked ~ .side-tabs-nav #side-tabs-nav-3 +#side-tabs-3:checked ~ .side-tabs-nav #side-tabs-nav-3, +#side-tabs-4:checked ~ .side-tabs-nav #side-tabs-nav-4 background-color: $base color: $default-text diff --git a/app/controllers/products_controller.rb b/app/controllers/products_controller.rb index ede31dbbeb2..9caf74afb8c 100644 --- a/app/controllers/products_controller.rb +++ b/app/controllers/products_controller.rb @@ -15,6 +15,11 @@ def show .limit(10) .includes(:comments, :checks) .order(reported_on: :DESC) + @products = @product.user + .products + .limit(10) + .not_wip + .order(published_at: :DESC) @practice = find_practice @learning = @product.learning # decoratorメソッド用にcontrollerでインスタンス変数化 @footprints = find_footprints diff --git a/app/views/products/show.html.slim b/app/views/products/show.html.slim index de5fa8d3948..4217c3c8cd4 100644 --- a/app/views/products/show.html.slim +++ b/app/views/products/show.html.slim @@ -53,6 +53,7 @@ header.page-header input.a-toggle-checkbox#side-tabs-1 type='radio' name='side-tabs-contents' checked='checked' input.a-toggle-checkbox#side-tabs-2 type='radio' name='side-tabs-contents' input.a-toggle-checkbox#side-tabs-3 type='radio' name='side-tabs-contents' + input.a-toggle-checkbox#side-tabs-4 type='radio' name='side-tabs-contents' .side-tabs-nav .side-tabs-nav__items .side-tabs-nav__item @@ -64,6 +65,9 @@ header.page-header .side-tabs-nav__item label.side-tabs-nav__item-link#side-tabs-nav-3 for='side-tabs-3' | ユーザーメモ + .side-tabs-nav__item + label.side-tabs-nav__item-link#side-tabs-nav-4 for='side-tabs-4' + | 提出物 .side-tabs-contents .side-tabs-contents__item#side-tabs-content-1 .card-list.a-card @@ -85,6 +89,19 @@ header.page-header = render 'users/user_secret_attributes', user: @product.user = render 'users/metas', user: @product.user #js-user-mentor-memo(data-user-id="#{@product.user.id}" data-products-mode="#{true}") + .side-tabs-contents__item#side-tabs-content-4 + .card-list.a-card + - if @products.present? + - @products.each do |product| + = render partial: 'product', locals: { product: product } + - else + .card-list__message + .container + .o-empty-message + .o-empty-message__icon + i.fa-regular.fa-sad-tear + .o-empty-message__text + | 提出物はまだありません。 - if !current_user.adviser? && @product.practice.open_product? .sticky-message diff --git a/test/system/products_test.rb b/test/system/products_test.rb index 9af781e02ee..eae97aad9e4 100644 --- a/test/system/products_test.rb +++ b/test/system/products_test.rb @@ -421,7 +421,7 @@ class ProductsTest < ApplicationSystemTestCase assert_text '直近の日報' assert_text 'プラクティスメモ' assert_text 'ユーザーメモ' - assert_selector '.side-tabs-nav__item-link', text: '提出物' + assert_selector '#side-tabs-nav-4', text: '提出物' end test 'students can not see block for mentors' do @@ -429,7 +429,7 @@ class ProductsTest < ApplicationSystemTestCase assert_no_text '直近の日報' assert_no_text 'プラクティスメモ' assert_no_text 'ユーザーメモ' - assert_no_selector '.side-tabs-nav__item-link', text: '提出物' + assert_no_selector '#side-tabs-nav-4', text: '提出物' end test 'display the user memos after click on user-memos tab' do @@ -465,6 +465,16 @@ class ProductsTest < ApplicationSystemTestCase click_button '保存する' end + test 'display a list of the 10 most recent products' do + user = users(:kimura) + visit_with_auth "/products/#{products(:product2).id}", 'mentormentaro' + page.find('#side-tabs-nav-4').click + products = user.products.not_wip.first(10) + products.each do |product| + assert_text "#{product.practice.title}の提出物" + end + end + test 'can see unassigned-tab' do visit_with_auth products_path, 'komagata' assert find('.page-tabs__item-link', text: '未アサイン')