Module: Smithy::ApplicationHelper

Defined in:
app/helpers/smithy/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#render_markdown_input(fieldname, editor_name, form_builder) ⇒ Object



17
18
19
# File 'app/helpers/smithy/application_helper.rb', line 17

def render_markdown_input(fieldname, editor_name, form_builder)
  form_builder.input fieldname, as: 'markdown'
end


3
4
5
6
7
8
9
10
11
# File 'app/helpers/smithy/application_helper.rb', line 3

def smithy_link_to_add_fields(name, association, form_builder)
  html = (:div, :id => "#{association}_fields_blueprint", :style => "display:none;") do
    form_builder.semantic_fields_for(association, model_object(form_builder, association), :child_index => "new_#{association}") do |builder|
      form_builder.template.concat(raw render("#{form_builder.object.class.to_s.tableize}/#{association.to_s.singularize}_fields", :f => builder))
    end
  end
  form_builder.template.concat(html)
  form_builder.template.link_to(name, "javascript:void(0)", :class => "add_nested_fields", "data-association" => association)
end


13
14
15
# File 'app/helpers/smithy/application_helper.rb', line 13

def smithy_link_to_remove_fields(name, form_builder)
  form_builder.hidden_field(:_destroy) + @template.link_to(name, "javascript:void(0)", :class => "remove_nested_fields")
end