Class: Cms::FormBuilder

Inherits:
ActionView::Helpers::FormBuilder
  • Object
show all
Defined in:
app/helpers/cms/form_builder.rb

Instance Method Summary collapse

Instance Method Details

#cms_drop_down(method, choices, options = {}, html_options = {}) ⇒ Object



44
45
46
47
48
49
50
51
52
# File 'app/helpers/cms/form_builder.rb', line 44

def cms_drop_down(method, choices, options={}, html_options={})
  add_tabindex!(html_options)
  set_default_value!(method, options)    
  cms_options = options.extract!(:label, :instructions, :default_value)
  render_cms_form_partial :drop_down,
    :object_name => @object_name, :method => method,
    :choices => choices, :options => options, 
    :cms_options => cms_options, :html_options => html_options
end

#cms_tag_list(options = {}) ⇒ Object



54
55
56
57
58
59
60
# File 'app/helpers/cms/form_builder.rb', line 54

def cms_tag_list(options={})
  add_tabindex!(options)
  set_default_value!(:tag_list, options)    
  cms_options = options.extract!(:label, :instructions, :default_value)
  render_cms_form_partial :tag_list, 
    :options => options, :cms_options => cms_options
end

#cms_text_editor(method, options = {}) ⇒ Object



62
63
64
65
66
67
68
69
70
71
# File 'app/helpers/cms/form_builder.rb', line 62

def cms_text_editor(method, options = {})
  add_tabindex!(options)
  set_default_value!(method, options)    
  cms_options = options.extract!(:label, :instructions, :default_value)
  render_cms_form_partial :text_editor, 
    :id => (options[:id] || "#{@object_name}_#{method}"), 
    :editor_enabled => (cookies["editorEnabled"].blank? ? true : (cookies["editorEnabled"] == 'true' || cookies["editorEnabled"] == ['true'])),
    :object_name => @object_name, :method => method, 
    :options => options, :cms_options => cms_options
end

#date_picker(method, options = {}) ⇒ Object



18
19
20
# File 'app/helpers/cms/form_builder.rb', line 18

def date_picker(method, options={})
  text_field(method, {:size => 10, :class => "date_picker"}.merge(options))
end

A JavaScript/CSS styled select



6
7
8
# File 'app/helpers/cms/form_builder.rb', line 6

def drop_down(method, choices, options = {}, html_options = {})
  @template.drop_down(@object_name, method, choices, objectify_options(options), add_tabindex!(@default_options.merge(html_options)))
end

#tag_list(options = {}) ⇒ Object



22
23
24
25
# File 'app/helpers/cms/form_builder.rb', line 22

def tag_list(options={})
  field_name = options.delete(:name) || :tag_list
  text_field(field_name, {:size => 50, :class => "tag-list"}.merge(options))
end

#text_editor(method, options = {}) ⇒ Object



10
11
12
13
14
15
16
# File 'app/helpers/cms/form_builder.rb', line 10

def text_editor(method, options = {})
  @template.send(
    "text_editor",
    @object_name,
    method,
    objectify_options(options))
end