forked from ManageIQ/manageiq
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generic toolbar button for skip, disable and error message
(transferred from ManageIQ/manageiq@5e9ecb1)
- Loading branch information
1 parent
4318639
commit a85cfb1
Showing
2 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
app/helpers/application_helper/button/generic_feature_button_with_disable.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 @@ | ||
class ApplicationHelper::Button::GenericFeatureButtonWithDisable < ApplicationHelper::Button::GenericFeatureButton | ||
needs_record | ||
|
||
def calculate_properties | ||
self[:enabled] = !(self[:title] = @error_message if disabled?) | ||
end | ||
|
||
def disabled? | ||
<<<<<<< HEAD | ||
!!(@error_message = @record.is_available_now_error_message(@feature)) | ||
======= | ||
begin | ||
begin | ||
@error_message = @record.try(:unsupported_reason, @feature) | ||
rescue NoMethodError | ||
@error_message = @record.try(:is_available_now_error_message, @feature) if @error_message.nil? | ||
end | ||
rescue | ||
@error_message = 'Feature is not supported.' | ||
true | ||
end | ||
>>>>>>> 407f786... fixup | ||
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