Module: Spyro::ActionViewExtension::BasicWidgetsHelper
- Included in:
- WidgetsHelper
- Defined in:
- lib/spyro/helpers/action_view_extension.rb
Instance Method Summary collapse
- #alert(text, options = {}) ⇒ Object
- #button(name, link, options = {}) ⇒ Object
- #group(&block) ⇒ Object
- #mini_button(name, link, options = {}) ⇒ Object
Instance Method Details
#alert(text, options = {}) ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'lib/spyro/helpers/action_view_extension.rb', line 53 def alert text, = {} @has_alert = true [:class] ||= ['alert'] capture_haml do haml_tag :div, do haml_concat text end end end |
#button(name, link, options = {}) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/spyro/helpers/action_view_extension.rb', line 25 def name, link, = {} @has_button = true [:class] ||= ['btn btn-default'] text = "" text = I18n.t("#{params[:controller].gsub('/', '.')}.#{params[:action]}.button.#{name.downcase}", :default => I18n.t("scaffold.buttons.#{name.downcase}", :default => name.to_s.humanize)) unless name.blank? text = "<span class='glyphicon glyphicon-#{[:icon]}'></span>#{text}".html_safe if [:icon] link_to text, link, end |
#group(&block) ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/spyro/helpers/action_view_extension.rb', line 44 def group &block @has_group = true capture_haml do haml_tag :div, :class => ['btn-group'] do haml_concat capture(&block) end end end |
#mini_button(name, link, options = {}) ⇒ Object
11 12 13 14 |
# File 'lib/spyro/helpers/action_view_extension.rb', line 11 def name, link, = {} [:class] = ([:class] || []) + ['btn-xs', 'btn', 'btn-default'] name, link, end |