Sha256: 2ae2dc3c1a184ee6169517a4eb1b605397064dd0eb09080974d147f6ea19ae0a
Contents?: true
Size: 1.17 KB
Versions: 10
Compression:
Stored size: 1.17 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.content_tag(:button,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
10 entries across 10 versions & 1 rubygems