forked from solidusio/solidus
-
Notifications
You must be signed in to change notification settings - Fork 3
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 solidusio#6046 from tvdeyen/open-modal-content-rem…
…otely [Admin] Open edit and new forms in dialog with turbo frame
- Loading branch information
Showing
89 changed files
with
761 additions
and
1,494 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
10 changes: 1 addition & 9 deletions
10
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
class SolidusAdmin::AdjustmentReasons::Edit::Component < SolidusAdmin::BaseComponent | ||
def initialize(page:, adjustment_reason:) | ||
@page = page | ||
@adjustment_reason = adjustment_reason | ||
end | ||
|
||
def form_id | ||
dom_id(@adjustment_reason, "#{stimulus_id}_edit_adjustment_reason_form") | ||
end | ||
class SolidusAdmin::AdjustmentReasons::Edit::Component < SolidusAdmin::Resources::Edit::Component | ||
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
10 changes: 1 addition & 9 deletions
10
admin/app/components/solidus_admin/adjustment_reasons/new/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
class SolidusAdmin::AdjustmentReasons::New::Component < SolidusAdmin::BaseComponent | ||
def initialize(page:, adjustment_reason:) | ||
@page = page | ||
@adjustment_reason = adjustment_reason | ||
end | ||
|
||
def form_id | ||
dom_id(@adjustment_reason, "#{stimulus_id}_new_adjustment_reason_form") | ||
end | ||
class SolidusAdmin::AdjustmentReasons::New::Component < SolidusAdmin::Resources::New::Component | ||
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 |
---|---|---|
|
@@ -37,5 +37,6 @@ def self.stimulus_id | |
end | ||
|
||
delegate :stimulus_id, to: :class | ||
delegate :search_filter_params, to: :helpers | ||
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
10 changes: 1 addition & 9 deletions
10
admin/app/components/solidus_admin/properties/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
class SolidusAdmin::Properties::Edit::Component < SolidusAdmin::BaseComponent | ||
def initialize(page:, property:) | ||
@page = page | ||
@property = property | ||
end | ||
|
||
def form_id | ||
dom_id(@property, "#{stimulus_id}_edit_property_form") | ||
end | ||
class SolidusAdmin::Properties::Edit::Component < SolidusAdmin::Resources::Edit::Component | ||
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
10 changes: 1 addition & 9 deletions
10
admin/app/components/solidus_admin/properties/new/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
class SolidusAdmin::Properties::New::Component < SolidusAdmin::BaseComponent | ||
def initialize(page:, property:) | ||
@page = page | ||
@property = property | ||
end | ||
|
||
def form_id | ||
dom_id(@property, "#{stimulus_id}_new_property_form") | ||
end | ||
class SolidusAdmin::Properties::New::Component < SolidusAdmin::Resources::New::Component | ||
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
10 changes: 1 addition & 9 deletions
10
admin/app/components/solidus_admin/refund_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
class SolidusAdmin::RefundReasons::Edit::Component < SolidusAdmin::BaseComponent | ||
def initialize(page:, refund_reason:) | ||
@page = page | ||
@refund_reason = refund_reason | ||
end | ||
|
||
def form_id | ||
dom_id(@refund_reason, "#{stimulus_id}_edit_refund_reason_form") | ||
end | ||
class SolidusAdmin::RefundReasons::Edit::Component < SolidusAdmin::Resources::Edit::Component | ||
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
10 changes: 1 addition & 9 deletions
10
admin/app/components/solidus_admin/refund_reasons/new/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
class SolidusAdmin::RefundReasons::New::Component < SolidusAdmin::BaseComponent | ||
def initialize(page:, refund_reason:) | ||
@page = page | ||
@refund_reason = refund_reason | ||
end | ||
|
||
def form_id | ||
dom_id(@refund_reason, "#{stimulus_id}_new_refund_reason_form") | ||
end | ||
class SolidusAdmin::RefundReasons::New::Component < SolidusAdmin::Resources::New::Component | ||
end |
20 changes: 20 additions & 0 deletions
20
admin/app/components/solidus_admin/resources/base_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
class SolidusAdmin::Resources::BaseComponent < SolidusAdmin::BaseComponent | ||
def initialize(resource) | ||
@resource = resource | ||
instance_variable_set("@#{resource_name}", resource) | ||
end | ||
|
||
def back_url | ||
solidus_admin.send("#{plural_resource_name}_path") | ||
end | ||
|
||
def resource_name | ||
@resource.model_name.singular_route_key | ||
end | ||
|
||
def plural_resource_name | ||
@resource.model_name.route_key | ||
end | ||
end |
11 changes: 11 additions & 0 deletions
11
admin/app/components/solidus_admin/resources/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
class SolidusAdmin::Resources::Edit::Component < SolidusAdmin::Resources::BaseComponent | ||
def form_id | ||
dom_id(@resource, "#{stimulus_id}_edit_#{resource_name}_form") | ||
end | ||
|
||
def form_url | ||
solidus_admin.send("#{resource_name}_path", @resource, **search_filter_params) | ||
end | ||
end |
Oops, something went wrong.