Sha256: cab43a89df9c9e75f49c4163ba99ecedc7ed4abda6551bfed31a89fa474dc670
Contents?: true
Size: 1.23 KB
Versions: 2
Compression:
Stored size: 1.23 KB
Contents
require 'polygallery' module Polygallery module SimpleFormHelper def self.simple_fields_for_polygallery(fb, title=:gallery, *args, &block) ( '<div class="polygallery-fields">' << fb.simple_fields_for(title, *args, &block) << '</div>' ).html_safe end def simple_fields_for_polygallery(fb, title=:gallery, *args, &block) defaults = { label: nil, add_btn: { text: 'Add Photo', partial: 'polygallery/photos/simple_fields_for', class: 'btn btn-default btn-sm pull-right', data: { association_insertion_method: 'append', association_insertion_node: "##{fb.object.send(title).polygallery_settings[:association_names][:photos]} .photo-receptacle" }}, remove_btn: { class: 'btn btn-default btn-sm' }, file_input: {}} settings = if (options = args.find{|a| a.is_a? Hash }).nil? then defaults else defaults.deep_merge options end new_block = block_given? ? block : ->(fb2) { render partial: 'polygallery/galleries/simple_fields_for', locals: { f: fb2, settings: settings } } SimpleFormHelper.simple_fields_for_polygallery( fb, title, *args, &new_block) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
polygallery-0.4.8 | lib/polygallery/simple_form_helper.rb |
polygallery-0.4.7 | lib/polygallery/simple_form_helper.rb |