Module: Blacksand::ApplicationHelper
- Defined in:
- app/helpers/blacksand/application_helper.rb
Instance Method Summary collapse
- #filed_options(f) ⇒ Object
- #page_options ⇒ Object
- #paginate(objects, options = {}) ⇒ Object
- #select_choices(f) ⇒ Object
- #set_page_options(hash) ⇒ Object
Instance Method Details
#filed_options(f) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/helpers/blacksand/application_helper.rb', line 10 def (f) = {} case f.object.field.field_type when 'date' then = {data: {provide: 'datepicker', 'date-format' => 'yyyy-mm-dd', 'date-language' => 'zh-CN', 'date-autoclose' => true}} when 'gallery' then = {multiple: true} when 'page' then = { class: 'test', data: {provide: 'select2'} } end return .merge({label: "#{f.object.field.description}", label_class: "#{'required' if f.object.field.required?}"}) end |
#page_options ⇒ Object
37 38 39 |
# File 'app/helpers/blacksand/application_helper.rb', line 37 def @_page_options || {} end |
#paginate(objects, options = {}) ⇒ Object
4 5 6 7 8 |
# File 'app/helpers/blacksand/application_helper.rb', line 4 def paginate objects, = {} .reverse_merge!(theme: 'twitter-bootstrap-3') super(objects, ) end |
#select_choices(f) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'app/helpers/blacksand/application_helper.rb', line 23 def select_choices(f) if f.object.value.present? page = f.object.content [['无', ''], ["##{page.id} #{page.title}", f.object.value]] else [['无', '']] end end |
#set_page_options(hash) ⇒ Object
32 33 34 35 |
# File 'app/helpers/blacksand/application_helper.rb', line 32 def (hash) @_page_options ||= {} @_page_options.merge!(hash) end |