Skip to content

Commit

Permalink
Do not enable disabled button when items are selected
Browse files Browse the repository at this point in the history
  • Loading branch information
yaacov committed Apr 13, 2017
1 parent 5b58a49 commit f6a6db2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/helpers/application_helper/button/basic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,15 @@ def localized(key, value = nil)
# self[:prompt] -- the user has to confirm the action
# self[:hidden] -- the button is not displayed in the toolbar
# self[:text] -- text for the button
# self[:onwhen] -- enable button if items are selected
def calculate_properties
self[:enabled] = !disabled? if self[:enabled].nil?
self[:title] = @error_message if @error_message.present?
enabled = !disabled?
self[:enabled] = enabled if self[:enabled].nil?

unless self[:enabled] || enabled
self[:onwhen] = nil
self[:title] = @error_message if @error_message.present?
end
end

# Check if all instance variables for that button works with are set and
Expand Down
1 change: 1 addition & 0 deletions app/helpers/application_helper/button/smart_state_scan.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class ApplicationHelper::Button::SmartStateScan < ApplicationHelper::Button::Basic
def check_smart_roles
return
my_zone = MiqServer.my_server.my_zone
MiqServer::ServerSmartProxy::SMART_ROLES.each do |role|
unless MiqServer.all.any? { |s| s.has_active_role?(role) && (s.my_zone == my_zone) }
Expand Down

0 comments on commit f6a6db2

Please sign in to comment.