Sha256: d5feab01d5cb9904294291b2ba991a9c436dad4763aa6f25ceee5c76f0a0de09

Contents?: true

Size: 1.65 KB

Versions: 3

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, :enjoy_html
          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
            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.0.4 lib/enjoy/admin/news.rb
enjoy_cms-0.3.0.3 lib/enjoy/admin/news.rb
enjoy_cms-0.3.0.2 lib/enjoy/admin/news.rb