lib/engine2/templates.rb in engine2-1.0.8 vs lib/engine2/templates.rb in engine2-1.0.9

- old
+ new

@@ -61,12 +61,17 @@ def datetime_picker {template: "fields/datetime", animation: BS_ANIMATION} end def list_select length, options = {} + template = if options[:multiple] + "fields/list_mselect" + else + options[:optional] ? "fields/list_select_opt" : "fields/list_select" + end options.merge({ - template: options[:optional] ? "fields/list_select_opt" : "fields/list_select", + template: template, length: length }) end def list_bsselect length, options = {} @@ -89,10 +94,16 @@ options.merge({ template: options[:optional] ? "fields/list_buttons_opt" : "fields/list_buttons" }) end + def list_mbuttons options = {} + options.merge({ + template: options[:optional] ? "fields/list_mbuttons_opt" : "fields/list_mbuttons" + }) + end + def select_picker options = {} options.merge({ template: options[:optional] ? "fields/select_picker_opt" : "fields/select_picker" }) end @@ -115,12 +126,12 @@ options.merge({ template: 'fields/scaffold_picker' }) end - def typeahead_picker - {template: "fields/typeahead_picker", animation: BS_ANIMATION} + def typeahead_picker options = {} + {template: "fields/typeahead_picker", length: 20, limit: 10, min_length: 0, animation: BS_ANIMATION}.merge(options) end def email length {template: "fields/email", length: length} end @@ -145,10 +156,14 @@ options.merge({ template: options[:optional] ? "fields/checkbox_buttons_opt" : "fields/checkbox_buttons" }) end + def checkbox_button options = {} + {template: "fields/checkbox_button"}.merge(options) + end + def radio_checkbox {template: "fields/radio_checkbox"} end def scaffold @@ -169,10 +184,17 @@ template: "search_fields/date_range", animation: BS_ANIMATION }) end + def date_picker options = {} + options.merge({ + template: "search_fields/date", + animation: BS_ANIMATION + }) + end + def integer_range {template: "search_fields/integer_range"} end def integer @@ -197,12 +219,12 @@ # template: options[:multiple] ? "search_fields/scaffold_picker" : "search_fields/scaffold_picker" template: "search_fields/scaffold_picker" }) end - def typeahead_picker - {template: "search_fields/typeahead_picker", animation: BS_ANIMATION} + def typeahead_picker options = {} + {template: "search_fields/typeahead_picker", limit: 10, min_length: 0, animation: BS_ANIMATION}.merge(options) end # def checkbox_search true_v = "1", false_v = "0" # { # template: "search_fields/checkbox2", @@ -228,11 +250,15 @@ def list_buttons {template: "search_fields/list_buttons"} end + def list_mbuttons + {template: "search_fields/list_mbuttons"} + end + def decimal_date {template: "search_fields/decimal_date_range", animation: BS_ANIMATION} end end end -end \ No newline at end of file +end