-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2935 from fjordllc/feature/add_dashboard_and_my_p…
…roducts_page_tabs_in_home ダッシュボード配下に自分の提出物一覧をページを作成
- Loading branch information
Showing
6 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
- title "#{@user.login_name}の提出物" | ||
header.page-header | ||
.container | ||
.page-header__inner | ||
h2.page-header__title | ||
= title | ||
.page-header-actions | ||
ul.page-header-actions__items | ||
li.page-header-actions__item | ||
= link_to users_path, class: 'a-button is-md is-secondary is-block is-back' do | ||
| ユーザー一覧 | ||
|
||
.page-tools | ||
= render 'home/page_tabs', user: @current_user | ||
|
||
.page-body | ||
.container | ||
- if @products.present? | ||
.thread-list.a-card | ||
= render partial: 'products/product', collection: @products, as: :product | ||
- else | ||
.o-empty-message | ||
.o-empty-message__icon | ||
i.far.fa-sad-tear | ||
p.o-empty-message__text | ||
| 提出物はまだありません。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# frozen_string_literal: true | ||
|
||
class CurrentUser::ProductsController < ApplicationController | ||
before_action :require_login | ||
before_action :set_user | ||
before_action :set_products | ||
|
||
def index; end | ||
|
||
private | ||
|
||
def set_user | ||
@user = current_user | ||
end | ||
|
||
def set_products | ||
@products = user.products.list | ||
end | ||
|
||
def user | ||
@user ||= current_user | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
- title '自分の提出物' | ||
header.page-header | ||
.container | ||
.page-header__inner | ||
h2.page-header__title | ||
| ダッシュボード | ||
|
||
.page-tools | ||
= render 'home/page_tabs', user: @user | ||
|
||
.page-body | ||
.container | ||
- if @products.present? | ||
.thread-list.a-card | ||
= render partial: 'products/product', collection: @products, as: :product | ||
- else | ||
.o-empty-message | ||
.o-empty-message__icon | ||
i.far.fa-sad-tear | ||
p.o-empty-message__text | ||
| 提出物はまだありません。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'application_system_test_case' | ||
|
||
class CurrentUser::ProductsTest < ApplicationSystemTestCase | ||
test 'show current_user products when current_user is student' do | ||
visit_with_auth '/current_user/products', 'kimura' | ||
assert_equal '自分の提出物 | FJORD BOOT CAMP(フィヨルドブートキャンプ)', title | ||
end | ||
end |