-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
お問い合わせ一覧・個別ページを作成 #7387
Merged
Merged
お問い合わせ一覧・個別ページを作成 #7387
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
9a22c3d
ルーティングの設定
a-kuroki-gs 648af83
空のお問い合わせページを作成
a-kuroki-gs 1927eec
お問い合わせ一覧・個別ページを作成
a-kuroki-gs 9f58b8e
test/system/admin/home_test.rbのテストが通るよう修正
a-kuroki-gs cb7c06e
一つのお問い合わせを表示しているエリア全体をクリックできるようにする
a-kuroki-gs 860494c
共通していたコードをまとめてリファクタリング
a-kuroki-gs c39432a
お問い合わせの テストを追加
a-kuroki-gs 0eff3cf
お問い合わせ一覧、個別ページのデザインを整えた
machida 8e1442b
開発環境に初期データを追加
a-kuroki-gs c8902af
inquireをinquiryに修正
a-kuroki-gs ba2fb33
きちんとクリックできていなかったテストを修正
a-kuroki-gs a2221c2
送信者の表記をdecoratorで定義するよう変更
a-kuroki-gs 66e37a7
コントローラ内でお問い合わせを取得する際に、created_atの降順で並べるようにする
a-kuroki-gs 158d4ac
重い処理を減らすために、リンクのテストを削除
a-kuroki-gs 056f3c7
短い2行を1行にまとめるよう修正
a-kuroki-gs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,11 @@ | ||
# frozen_string_literal: true | ||
|
||
class Admin::InquiriesController < AdminController | ||
def index | ||
@inquiries = Inquiry.order(created_at: :desc) | ||
end | ||
|
||
def show | ||
@inquiry = Inquiry.find(params[:id]) | ||
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,7 @@ | ||
# frozen_string_literal: true | ||
|
||
module InquiryDecorator | ||
def sender_name_and_email | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
"#{name} 様 (#{email})" | ||
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
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,18 @@ | ||
.card-list-item | ||
.card-list-item__inner | ||
.card-list-item__rows | ||
.card-list-item__row | ||
.card-list-item-title | ||
h2.card-list-item-title__title | ||
= link_to admin_inquiry_path(inquiry), class: 'card-list-item-title__link a-text-link' do | ||
= inquiry.sender_name_and_email | ||
.card-list-item__row | ||
.card-list-item-meta | ||
.card-list-item-meta__items | ||
.card-list-item-meta__item | ||
.a-meta | ||
span.a-meta__label 受信日 | ||
span.a-meta__value = l inquiry.created_at | ||
.card-list-item__row | ||
.a-meta | ||
p = inquiry.body.truncate(100) |
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,20 @@ | ||
- title '管理ページ' | ||
|
||
header.page-header | ||
.container | ||
.page-header__inner | ||
h1.page-header__title = title | ||
|
||
= render 'admin/admin_page_tabs' | ||
|
||
header.page-main-header | ||
.container | ||
.page-main-header__inner | ||
h1.page-main-header__title お問い合わせ一覧 | ||
hr.a-border | ||
.page-body | ||
.page-body__inner | ||
.container.is-md | ||
.card-list.a-card | ||
.card-list__items | ||
= render partial: 'inquiries_item', collection: @inquiries, as: :inquiry |
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,33 @@ | ||
- title 'お問い合わせ' | ||
|
||
header.page-header | ||
.container | ||
.page-header__inner | ||
h1.page-header__title お問い合わせ | ||
.page-header-actions | ||
ul.page-header-actions__items | ||
li.page-header-actions__item | ||
= link_to admin_inquiries_path, class: 'a-button is-md is-secondary is-block is-back' do | ||
| お問い合わせ一覧へ | ||
hr.a-border | ||
.page-body | ||
.container.is-md | ||
.page-content | ||
header.page-content-header | ||
.page-content-header__end | ||
.page-content-header__row | ||
h1.page-content-header__title | ||
= @inquiry.sender_name_and_email | ||
.page-content-header__row | ||
.page-content-header-metas | ||
.page-content-header-metas__start | ||
.page-content-header-metas__meta | ||
.a-meta | ||
span.a-meta__label 受信日 | ||
span.a-meta__value = l @inquiry.created_at | ||
.page-content__body | ||
.a-card | ||
.card-body | ||
.card__description | ||
.a-long-text.is-md | ||
= auto_link(simple_format(@inquiry.body), html: { target: '_blank' }) |
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,11 @@ | ||
inquiry1: | ||
name: 'inquiry1' | ||
email: '[email protected]' | ||
created_at: '2017-01-01 00:00:00' | ||
body: 'お問い合わせのテスト1です。' | ||
|
||
inquiry2: | ||
name: 'inquiry2' | ||
email: '[email protected]' | ||
created_at: '2017-01-01 00:00:00' | ||
body: 'お問い合わせのテスト2です。' |
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,14 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'test_helper' | ||
require 'active_decorator_test_case' | ||
|
||
class InquiryDecoratorTest < ActiveDecoratorTestCase | ||
setup do | ||
@inquiry = decorate(inquiries(:inquiry1)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
end | ||
|
||
test '#sender_name_and_email' do | ||
assert_equal 'inquiry1 様 ([email protected])', @inquiry.sender_name_and_email | ||
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,11 @@ | ||
inquiry1: | ||
name: 'inquiry1' | ||
email: '[email protected]' | ||
created_at: '2017-01-01 00:00:00' | ||
body: 'お問い合わせのテスト1です。' | ||
|
||
inquiry2: | ||
name: 'inquiry2' | ||
email: '[email protected]' | ||
created_at: '2017-01-01 00:00:00' | ||
body: 'お問い合わせのテスト2です。' |
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,21 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'application_system_test_case' | ||
|
||
class Admin::InquiriesTest < ApplicationSystemTestCase | ||
test 'show listing inquiries' do | ||
visit_with_auth '/admin/inquiries', 'komagata' | ||
assert_equal '管理ページ | FBC', title | ||
assert_selector 'h1.page-main-header__title', text: 'お問い合わせ一覧' | ||
assert_text inquiries(:inquiry1).name | ||
assert_text inquiries(:inquiry2).name | ||
end | ||
|
||
test 'show inquiry details' do | ||
visit_with_auth "/admin/inquiries/#{inquiries(:inquiry1).id}", 'komagata' | ||
assert_text inquiries(:inquiry1).name | ||
assert_text inquiries(:inquiry1).email | ||
assert_text I18n.l inquiries(:inquiry1).created_at.to_date | ||
assert_text inquiries(:inquiry1).body | ||
end | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
orderをちゃんとしていしていて、created_atにしてるのがよいとおもいます~!