-
Notifications
You must be signed in to change notification settings - Fork 356
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 #6230 from ZitaNemeckova/fix_GOD_again
Change toolbar delete buttons for Button and Button Group to use generic code
- Loading branch information
Showing
8 changed files
with
58 additions
and
19 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
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
19 changes: 19 additions & 0 deletions
19
app/helpers/application_helper/button/generic_object_definition_button_button_delete.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,19 @@ | ||
class ApplicationHelper::Button::GenericObjectDefinitionButtonButtonDelete < ApplicationHelper::Button::Basic | ||
needs :@record | ||
|
||
def data(_data) | ||
{ | ||
'function' => 'sendDataWithRx', | ||
'function-data' => { | ||
:type => 'delete', | ||
:controller => 'toolbarActions', | ||
:payload => { | ||
:entity => "custom_buttons", | ||
:redirect_url => "/generic_object_definition/", | ||
:name => @record.name, | ||
:labels => { :single => _("Button") } | ||
} | ||
} | ||
} | ||
end | ||
end |
18 changes: 18 additions & 0 deletions
18
...helpers/application_helper/button/generic_object_definition_button_button_group_delete.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,5 +1,23 @@ | ||
class ApplicationHelper::Button::GenericObjectDefinitionButtonButtonGroupDelete < ApplicationHelper::Button::Basic | ||
needs :@record | ||
|
||
def disabled? | ||
!@record.custom_buttons.count.zero? | ||
end | ||
|
||
def data(_data) | ||
{ | ||
'function' => 'sendDataWithRx', | ||
'function-data' => { | ||
:type => 'delete', | ||
:controller => 'toolbarActions', | ||
:payload => { | ||
:entity => "custom_button_sets", | ||
:redirect_url => "/generic_object_definition/", | ||
:name => @record.name, | ||
:labels => { :single => _("Button Group") } | ||
} | ||
} | ||
} | ||
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
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