Sha256: 0e011c9889ca0b7b676d5dc083b5c673b1927112eee54fd694ed4bb70db1cac7

Contents?: true

Size: 1.82 KB

Versions: 2

Compression:

Stored size: 1.82 KB

Contents

= Sunrise CMS

Open source mini content management system for programmers.

== Instructions

=== ActiveRecord
  
  rails new [PROJECT_NAME] -d mysql -T -m https://raw.github.com/gist/2700424

=== Mongoid

  gem "mongoid"
  gem "bson_ext"
  gem "mongoid_nested_set"
  gem "carrierwave-mongoid", :require => "carrierwave/mongoid"
  gem "mongoid_nested_set"
  gem "mongoid-history"

  rails g sunrise:install --orm=mongoid

== Export data

=== XML, JSON, CSV

  GET /manage/users/export.xml
  GET /manage/users/export.csv
  
=== JSON

  GET /manage/users/export.json

For more info look at jbuilder https://rubygems.org/gems/jbuilder.

=== Excel

  gem "ruby2xlsx", "~> 0.0.1"

  GET /manage/users/export.xlsx

== Usage

Just create class:

  class SunriseProduct < Sunrise::AbstractModel
    self.resource_name = "Product"
    
    list :thumbs do
      scope { Product.includes(:picture) }
      preview { lambda { |product| product.picture.try(:url, :thumb) } }

      field :title
      field :price
      field :total_stock
    end
    
    show do
      field :title
      field :price
      field :total_stock
      field :sort_order
      field :is_visible
    end
    
    edit do
      field :title
      field :price
      field :total_stock
      field :notes

      group :sidebar, :holder => :sidebar do
        field :sale_limit_id, :collection => lambda { SaleLimit.all }, :include_blank => false
        field :sort_order
        field :is_visible, :boolean => true
      end

      group :bottom, :holder => :bottom do
        nested_attributes :variants do
          field :size
          field :total_stock
          field :item_model_id, :collection => lambda { ItemModel.all }, :include_blank => false
        end
      
        field :picture, :as => :uploader
      end
    end
  end


Copyright (c) 2012 Fodojo, released under the MIT license

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sunrise-cms-0.5.0.rc2 README.rdoc
sunrise-cms-0.5.0.rc1 README.rdoc