Sha256: aaed2368af066f753b72283716a50b6c7f2825e075794ca8de89ba13a3eeaef9

Contents?: true

Size: 1.29 KB

Versions: 5

Compression:

Stored size: 1.29 KB

Contents

module Enjoy
  module Admin
    module PageBlock
      def self.config(fields = {})
        Proc.new {
          # navigation_label 'CMS'

          field :enabled, :toggle
          field :partial, :toggle
          field :name
          field :file_path, :string

          field :content, :enjoy_html
          # field :content_html, :ck_editor
          # field :content_clear, :toggle

          fields.each_pair do |name, type|
            if type.nil?
              field name
            else
              if type.is_a?(Array)
                field name, type[0], &type[1]
              else
                field name, type
              end
            end
          end

          # field :blocksets do
          #   read_only true
          #   help 'Список групп блоков'
          #
          #   pretty_value do
          #     bindings[:object].blocksets.to_a.map { |bs|
          #       route = (bindings[:view] || bindings[:controller])
          #       model_name = bs.rails_admin_model
          #       route.link_to(bs.name, route.rails_admin.show_path(model_name: model_name, id: bs.id), title: bs.name)
          #     }.join("<br>").html_safe
          #   end
          # end

          if block_given?
            yield self
          end
        }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
enjoy_cms-0.3.2.1 lib/enjoy/admin/page_block.rb
enjoy_cms-0.3.2 lib/enjoy/admin/page_block.rb
enjoy_cms-0.3.1.2 lib/enjoy/admin/page_block.rb
enjoy_cms-0.3.1.1 lib/enjoy/admin/page_block.rb
enjoy_cms-0.3.1 lib/enjoy/admin/page_block.rb