Module: Spark::TagHelper

Defined in:
app/helpers/spark/tag_helper.rb

Instance Method Summary collapse

Instance Method Details

#add_class(options, classnames) ⇒ Object

Takes an options hash, appends classnames (array or string)



5
6
7
8
9
# File 'app/helpers/spark/tag_helper.rb', line 5

def add_class( options, classnames )
  options = options.stringify_keys
  options['class'] = ([options['class']].flatten | [classnames].flatten).compact
  options
end

#search_input_tag(name, value = nil, options = {}, &block) ⇒ Object



22
23
24
# File 'app/helpers/spark/tag_helper.rb', line 22

def search_input_tag( name, value = nil, options = {}, &block )
  input_tag( :search, name, value, options, &block )
end

#select_input_tag(name, option_tags = nil, options = {}, &block) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'app/helpers/spark/tag_helper.rb', line 11

def select_input_tag( name, option_tags=nil, options={}, &block )
  if option_tags.is_a? Hash
    options = option_tags
    option_tags = nil
  end

  option_tags ||= capture( &block ).html_safe if block_given?

  input_tag( :select, name, option_tags, options )
end