Module: Spyro::ActionViewExtension::BasicWidgetsHelper

Included in:
WidgetsHelper
Defined in:
lib/spyro/helpers/action_view_extension.rb

Instance Method Summary collapse

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, options = {}
  @has_alert = true
  options[:class] ||= ['alert']
  capture_haml do
    haml_tag :div, options 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 button name, link, options = {}
  @has_button = true
  options[: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-#{options[:icon]}'></span>#{text}".html_safe if options[:icon]
  link_to text, link, options
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 mini_button name, link, options = {}
  options[:class] = (options[:class] || []) + ['btn-xs', 'btn', 'btn-default']
  button name, link, options
end