app/helpers/adminpanel/adminpanel_form_builder.rb in adminpanel-3.0.0 vs app/helpers/adminpanel/adminpanel_form_builder.rb in adminpanel-3.1.0

- old
+ new

@@ -52,13 +52,12 @@ end def wysiwyg_field(method, *args) options = args.extract_options! - options.reverse_merge! class: 'wysihtml5 span7' - base_layout method, options, 'text_area_original' + hidden_field(method, id: "#{self.object.class.to_s.demodulize}-trix-#{method}") + base_layout(method, options, 'trix_field') end def text_area(method, *args) base_layout method, *args, 'text_area_original' end @@ -197,10 +196,22 @@ # ), # :class => "controls" # ) # end # end + + protected + def trix_field(method, *args) + options = args.extract_options! + options.reverse_merge! input: "#{self.object.class.to_s.demodulize}-trix-#{method}", id: "#{method}-trix-editor" + options[:class] << ' trix-content' + + @template.content_tag 'trix-editor', options do + self.object.send(method) + end + end + private def base_layout(method, *args, input_type) options = args.extract_options! options.reverse_merge! class: 'span7' @@ -218,10 +229,10 @@ def datepickerize_base(method, options) options['data'] ||= {} options['data']['date_format'] ||= 'dd-mm-yyyy' options['data']['date'] ||= Time.now.strftime("%d-%m-%Y") options['value'] = options['data']['date'] - + @template.content_tag( :div, class: 'input-append date datepicker datepicker-basic', data: options['data'] ) do