lib/fatcow/model.rb in fatcow-0.1.2 vs lib/fatcow/model.rb in fatcow-0.1.3

- old
+ new

@@ -14,36 +14,37 @@ edit: -> { persisted? }, add: -> { true } } included do - def show_icon + def show_icon(**options) current_state = find_icon_status(:FATCOW_ICON_SHOW_STATUSES) - return custom_icon(current_state) if current_state - custom_icon(nil) if current_state.nil? + return custom_icon(current_state, **options) if current_state + custom_icon(nil, **options) if current_state.nil? end - def form_icon + def form_icon(**options) current_state = find_icon_status(:FATCOW_ICON_FORM_STATUSES) - return custom_icon(current_state) if current_state - custom_icon(nil) if current_state.nil? + return custom_icon(current_state, **options) if current_state + custom_icon(nil, **options) if current_state.nil? end def find_icon_status(statuses_const_key) statuses = self.class.const_get statuses_const_key current_status = statuses.find { |status, proc| instance_exec(&proc) } return nil if current_status.nil? current_status[0] end - def custom_icon(status) + def custom_icon(status, **options) icon = self.class.const_get :FATCOW_ICON icon.app = self if icon.app.nil? icon.status = status if icon.status != status + icon.size = options[:size] if options[:size] icon end end