Sha256: fe274565bfd481c3af1384d0c0259d6e4e0badb8558bdfbe147a7373a2df5694

Contents?: true

Size: 1.83 KB

Versions: 3

Compression:

Stored size: 1.83 KB

Contents

module Enjoy
  module Admin
    module News
      def self.config(fields = {})
        Proc.new {
          # navigation_label I18n.t('enjoy.cms')
          list do
            scopes [:by_date, :enabled, nil]
          end

          field :enabled, :toggle
          field :time do
            sort_reverse true
          end
          field :name
          unless Enjoy.config.news_image_styles.nil?
            field :image, :jcrop do
              jcrop_options :image_jcrop_options
            end
          end
          field :excerpt, :enjoy_html
          # field :excerpt_html, :ck_editor
          # field :excerpt_clear, :toggle
          field :slugs, :enum do
            enum_method do
              :slugs
            end
            visible do
              bindings[:view].current_user.admin?
            end
            multiple do
              true
            end
          end
          field :text_slug

          list do
            sort_by :time
          end

          edit do
            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

            group :seo do
              active false
              field :seo do
                active true
              end
            end
            group :sitemap_data do
              active false
              field :sitemap_data do
                active true
              end
            end
          end

          if block_given?
            yield self
          end
        }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
enjoy_cms-0.3.1.2 lib/enjoy/admin/news.rb
enjoy_cms-0.3.1.1 lib/enjoy/admin/news.rb
enjoy_cms-0.3.1 lib/enjoy/admin/news.rb