-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: adjustment reason edit with turbo-frame link and turbo template …
…with no index
- Loading branch information
Showing
7 changed files
with
54 additions
and
10 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 |
---|---|---|
|
@@ -24,4 +24,3 @@ | |
<% end %> | ||
<% end %> | ||
<% end %> | ||
<%= render component("adjustment_reasons/index").new(page: @page) %> |
3 changes: 1 addition & 2 deletions
3
admin/app/components/solidus_admin/adjustment_reasons/edit/component.rb
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
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
24 changes: 24 additions & 0 deletions
24
admin/app/controllers/solidus_admin/controller_helpers/turbo_actions.rb
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,24 @@ | ||
# frozen_string_literal: true | ||
|
||
module SolidusAdmin::ControllerHelpers::TurboActions | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
class_attribute :registered_turbo_actions, instance_writer: false, default: [] | ||
before_action :ensure_turbo_frame_request, if: ->(controller) do | ||
registered_turbo_actions.include?(controller.action_name.to_sym) | ||
end | ||
end | ||
|
||
class_methods do | ||
def turbo_actions(*actions) | ||
self.registered_turbo_actions += actions.map(&:to_sym) | ||
end | ||
end | ||
|
||
private | ||
|
||
def ensure_turbo_frame_request | ||
redirect_to action: :index unless turbo_frame_request? | ||
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