Sha256: 0faa980d81599faf6d356053bf554c20d7949ea9bd1bc901be56298b6f0cd4ce
Contents?: true
Size: 1.16 KB
Versions: 6
Compression:
Stored size: 1.16 KB
Contents
module JqueryUiForm module Helpers module ButtonHelper def button(name, options = {}) if use_i18n && !options.delete(:translate) name = I18n.t(name) elsif name == name.to_sym name = name.to_s.upcase.humanize end (options[:class] ||= "") << " ui-button" options[:type] ||= "submit" if (icon = options.delete(:icon)) options["data-icon"] = "ui-icon-#{icon}" end template.button_tag(name, options) end def submit(name=nil, options = {}) options.merge!(name) && name = nil if name.is_a?(Hash) options[:type] ||= "submit" options[:icon] ||= "check" name ||= (@object && @object.respond_to?(:new_record?) && @object.new_record? ? :create : :update ) button(name, options) end def cancel(name=nil, options = {}) options.merge!(name) && name = nil if name.is_a?(Hash) options[:type] ||= "reset" options[:icon] ||= "close" (options[:class] ||= "") << " ui-state-error" name ||= :cancel button(name, options) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems