Sha256: 8a426362332e6041f503ca1cc9707abe6b7c96e66ef4336b9c13610c0a8b3766

Contents?: true

Size: 1.65 KB

Versions: 4

Compression:

Stored size: 1.65 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, :ck_editor
          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, :ck_editor
            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

4 entries across 4 versions & 1 rubygems

Version Path
enjoy_cms-0.2.1 lib/enjoy/admin/news.rb
enjoy_cms-0.2.0.3.2 lib/enjoy/admin/news.rb
enjoy_cms-0.2.0.3.1 lib/enjoy/admin/news.rb
enjoy_cms-0.2.0.3 lib/enjoy/admin/news.rb