Sha256: 0c32bb7f48c262e252468133776cfb03ae06df6d9315b0c8ce6314dad582a83d

Contents?: true

Size: 1.11 KB

Versions: 5

Compression:

Stored size: 1.11 KB

Contents

module Blacksand
  module ApplicationHelper

    def paginate objects, options = {}
      options.reverse_merge!(theme: 'twitter-bootstrap-3')

      super(objects, options)
    end

    def filed_options(f)
      filed_options = {}
      case f.object.field.field_type
        when 'date' then
          filed_options = {data: {provide: 'datepicker', 'date-format' => 'yyyy-mm-dd', 'date-language' => 'zh-CN', 'date-autoclose' => true}}
        when 'gallery' then
          filed_options = {multiple: true}
        when 'page' then
          filed_options = { class: 'test', data: {provide: 'select2'} }
      end
      return filed_options.merge({label: "#{f.object.field.description}", label_class: "#{'required' if f.object.field.required?}"})
    end

    def select_choices(f)
      if f.object.value.present?
        page = f.object.content
        [['无', ''], ["##{page.id} #{page.title}", f.object.value]]
      else
        [['无', '']]
      end
    end

    def set_page_options(hash)
      @_page_options ||= {}
      @_page_options.merge!(hash)
    end

    def page_options
      @_page_options || {}
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
blacksand-2.5.0 app/helpers/blacksand/application_helper.rb
blacksand-2.4.1 app/helpers/blacksand/application_helper.rb
blacksand-2.4.0 app/helpers/blacksand/application_helper.rb
blacksand-2.3.0 app/helpers/blacksand/application_helper.rb
blacksand-2.2.2.1 app/helpers/blacksand/application_helper.rb