-
Notifications
You must be signed in to change notification settings - Fork 75
ActionCompletedButtonComponentを再利用可能にする #9331
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
acb19dc
関数の記法をアロー関数式に統一
ryufuta 5238b34
`then`を`async/await`に置換
ryufuta 62cda93
`fetch`を`rails/request.js`に置換
ryufuta 8dda9f7
相談部屋の対応済フラグ変更時に明示的にレスポンスを返す
ryufuta 14acb5a
相談部屋の対応済フラグ変更失敗時により適切な情報を残す
ryufuta 26d5ec3
冗長な説明変数を削除
ryufuta 5097185
二重クリック防止
ryufuta 4b84b1d
ActionCompletedButtonComponentのメソッドをprivateにする
ryufuta cfea4fa
ActionCompletedButtonComponentを再利用可能にする
ryufuta 1186164
ActionCompletedButtonComponentの単体テストを追加
ryufuta 51c9269
早期リターンの書式をファイル内で統一
ryufuta 26a8edc
二重クリック防止の不要な処理を削除
ryufuta 7f39c06
可読性向上のためisActionCompletedによる条件分岐を1箇所にまとめた
ryufuta 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,10 +1,13 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| class ActionCompletedButtonComponent < ViewComponent::Base | ||
| attr_reader :is_action_completed, :commentable_id | ||
|
|
||
| def initialize(is_initial_action_completed:, commentable_id:) | ||
| def initialize(is_initial_action_completed:, update_path:, model_name:) | ||
| @is_action_completed = is_initial_action_completed | ||
| @commentable_id = commentable_id | ||
| @update_path = update_path | ||
| @model_name = model_name | ||
| end | ||
|
|
||
| private | ||
|
|
||
| attr_reader :is_action_completed, :update_path, :model_name | ||
| end |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require 'test_helper' | ||
|
|
||
| class ActionCompletedButtonComponentTest < ViewComponent::TestCase | ||
| test 'action is completed' do | ||
| # update_pathとmodel_nameは使用されないため値は任意 | ||
| render_inline(ActionCompletedButtonComponent.new(is_initial_action_completed: true, update_path: '/api/talks/1', model_name: 'talk')) | ||
|
|
||
| assert_text '対応済です' | ||
| end | ||
|
|
||
| test 'action is not completed' do | ||
| render_inline(ActionCompletedButtonComponent.new(is_initial_action_completed: false, update_path: '/api/talks/1', model_name: 'talk')) | ||
|
|
||
| assert_text '対応済にする' | ||
| 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.
Uh oh!
There was an error while loading. Please reload this page.