Module: Comable::Admin::NavigationsHelper

Defined in:
app/helpers/comable/admin/navigations_helper.rb

Instance Method Summary collapse

Instance Method Details

#add_fields_button_tag(name, f, association) ⇒ Object

アイテム追加ボタン設置



9
10
11
12
13
14
15
16
# File 'app/helpers/comable/admin/navigations_helper.rb', line 9

def add_fields_button_tag(name, f, association)
  new_object = f.object.send(association).klass.new
  index = new_object.object_id # 後で置換するために必要な文字を入れる
  fields = f.fields_for(association, new_object, child_index: index) do |builder|
    render(association.to_s.singularize + '_fields', f: builder)
  end
  button_tag(name, type: :button, class: 'add_fields btn btn-default pull-right', data: { index: index, fields: fields.delete("\n") })
end

#linkable_type_optionsObject



4
5
6
# File 'app/helpers/comable/admin/navigations_helper.rb', line 4

def linkable_type_options
  Comable::NavigationItem.linkable_params_lists.map { |attr| attr.slice(:name, :type).values }
end