Sha256: 6c965cec7ff122733495e89dd157a5f5b76355765da46e12b105c69de49b83f9

Contents?: true

Size: 791 Bytes

Versions: 3

Compression:

Stored size: 791 Bytes

Contents

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

      # アイテム追加ボタン設置
      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
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
comable-backend-0.7.1 app/helpers/comable/admin/navigations_helper.rb
comable-backend-0.7.0 app/helpers/comable/admin/navigations_helper.rb
comable-backend-0.7.0.beta2 app/helpers/comable/admin/navigations_helper.rb