Skip to content

Commit

Permalink
Merge pull request #5347 from fjordllc/feature/add-products-tab-for-m…
Browse files Browse the repository at this point in the history
…entor

提出物個別ページのメンター用サイドカラムに提出物一覧を追加した
  • Loading branch information
komagata authored Aug 27, 2022
2 parents 2653b36 + 62cd3d4 commit 6ee1a63
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions app/controllers/products_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ def show
.limit(10)
.includes(:comments, :checks)
.order(reported_on: :DESC)
@products = @product.user
.products
.not_wip
.order(published_at: :DESC)
@practice = find_practice
@learning = @product.learning # decoratorメソッド用にcontrollerでインスタンス変数化
@footprints = find_footprints
Expand Down
8 changes: 8 additions & 0 deletions app/views/products/show.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -85,6 +89,10 @@ 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
- @products.each do |product|
= render partial: 'product', locals: { product: product }

- if !current_user.adviser? && @product.practice.open_product?
.sticky-message
Expand Down
12 changes: 12 additions & 0 deletions test/system/products_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -421,13 +421,15 @@ class ProductsTest < ApplicationSystemTestCase
assert_text '直近の日報'
assert_text 'プラクティスメモ'
assert_text 'ユーザーメモ'
assert_selector '#side-tabs-nav-4', text: '提出物'
end

test 'students can not see block for mentors' do
visit_with_auth "/products/#{products(:product2).id}", 'hatsuno'
assert_no_text '直近の日報'
assert_no_text 'プラクティスメモ'
assert_no_text 'ユーザーメモ'
assert_no_selector '#side-tabs-nav-4', text: '提出物'
end

test 'display the user memos after click on user-memos tab' do
Expand Down Expand Up @@ -463,6 +465,16 @@ class ProductsTest < ApplicationSystemTestCase
click_button '保存する'
end

test 'display a list of products in side-column' do
user = users(:kimura)
visit_with_auth "/products/#{products(:product2).id}", 'mentormentaro'
page.find('#side-tabs-nav-4').click
products = user.products.not_wip
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: '未アサイン')
Expand Down

0 comments on commit 6ee1a63

Please sign in to comment.