Sha256: c5e6c450625bd8bcfedc2b6897f689794360202b90a7496dda740ec7c667b334
Contents?: true
Size: 1.26 KB
Versions: 3
Compression:
Stored size: 1.26 KB
Contents
module Spina module Admin module PagesHelper def link_to_add_fields(f, association, &block) new_object = f.object.send(association).klass.new id = new_object.object_id fields = f.fields_for(association, new_object, child_index: id) do |builder| render(association.to_s.singularize + "_fields", f: builder) end link_to '#', class: "add_fields button", data: {id: id, fields: fields.gsub("\n", "")} do block.yield end end def link_to_add_structure(f, association, &block) new_object = f.object.send(association).klass.new id = new_object.object_id fields = f.fields_for(association, new_object, child_index: id) do |builder| current_theme.config.structures[f.object.page_part.name].each do |structure_part| structure_part = new_object.structure_parts.build(structure_part) structure_part.structure_partable = structure_part.structure_partable_type.constantize.new end render(association.to_s.singularize + "_fields", f: builder) end link_to '#', class: "add_structure button button-link", data: {id: id, fields: fields.gsub("\n", "")} do block.yield end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spina-0.6.16 | app/helpers/spina/admin/pages_helper.rb |
spina-0.6.15 | app/helpers/spina/admin/pages_helper.rb |
spina-0.6.14 | app/helpers/spina/admin/pages_helper.rb |