adding CMS via comfortable mexican sofa gem

This commit is contained in:
Mackenzie Morgan
2015-02-01 00:27:04 -05:00
parent 0da121a48d
commit 6aa37e6e26
29 changed files with 474 additions and 1 deletions

View File

@@ -32,6 +32,8 @@ gem 'cancancan', '~> 1.9' # for checking member privileges
gem 'gibbon' # for Mailchimp newsletter subscriptions
gem 'csv_shaper' # CSV export
gem 'comfortable_mexican_sofa', '~> 1.12.0' # content management system
# vendored activemerchant for testing- needed for bogus paypal
# gateway monkeypatch
gem 'activemerchant', '1.33.0',

View File

@@ -33,6 +33,8 @@ GEM
activesupport (= 4.1.9)
builder (~> 3.1)
erubis (~> 2.7.0)
active_link_to (1.0.2)
actionpack
activemodel (4.1.9)
activesupport (= 4.1.9)
builder (~> 3.1)
@@ -48,6 +50,9 @@ GEM
tzinfo (~> 1.1)
addressable (2.3.6)
arel (5.0.1.20140414130214)
autoprefixer-rails (5.1.1)
execjs
json
bcrypt (3.1.9)
better_errors (2.0.0)
coderay (>= 1.0.0)
@@ -58,6 +63,10 @@ GEM
bluecloth (2.2.0)
bootstrap-datepicker-rails (1.3.0.2)
railties (>= 3.0)
bootstrap-sass (3.3.3)
autoprefixer-rails (>= 5.0.0.1)
sass (>= 3.2.19)
bootstrap_form (2.2.0)
builder (3.2.2)
byebug (3.5.1)
columnize (~> 0.8)
@@ -73,7 +82,13 @@ GEM
capybara-email (2.4.0)
capybara (~> 2.4)
mail
climate_control (0.0.3)
activesupport (>= 3.0)
cliver (0.3.2)
cocaine (0.5.5)
climate_control (>= 0.0.3, < 1.0)
codemirror-rails (4.8)
railties (>= 3.0, < 5)
coderay (1.1.0)
coffee-rails (4.1.0)
coffee-script (>= 2.2.0)
@@ -83,6 +98,21 @@ GEM
execjs
coffee-script-source (1.8.0)
columnize (0.9.0)
comfortable_mexican_sofa (1.12.7)
active_link_to (>= 1.0.0)
bootstrap-sass (>= 3.2.0)
bootstrap_form (>= 2.2.0)
codemirror-rails (>= 3.0.0)
coffee-rails (>= 3.1.0)
haml-rails (>= 0.3.0)
jquery-rails (>= 3.0.0)
jquery-ui-rails (>= 5.0.0)
kramdown (>= 1.0.0)
paperclip (>= 4.0.0)
plupload-rails (>= 1.2.1)
rails (>= 4.0.0, < 5)
rails-i18n (>= 4.0.0)
sass-rails (>= 4.0.3)
commonjs (0.2.7)
coveralls (0.7.1)
multi_json (~> 1.3)
@@ -171,6 +201,7 @@ GEM
sprockets-rails
json (1.8.2)
kgio (2.9.2)
kramdown (1.5.0)
launchy (2.4.3)
addressable (~> 2.3)
leaflet-markercluster-rails (0.7.0)
@@ -212,7 +243,14 @@ GEM
multi_json (~> 1.3)
omniauth-oauth (~> 1.0)
orm_adapter (0.5.0)
paperclip (4.2.1)
activemodel (>= 3.0.0)
activesupport (>= 3.0.0)
cocaine (~> 0.5.3)
mime-types
pg (0.17.1)
plupload-rails (1.2.1)
rails (>= 3.1)
poltergeist (1.5.1)
capybara (~> 2.1)
cliver (~> 0.3.1)
@@ -237,6 +275,9 @@ GEM
bundler (>= 1.3.0, < 2.0)
railties (= 4.1.9)
sprockets-rails (~> 2.0)
rails-i18n (4.0.3)
i18n (~> 0.6)
railties (~> 4.0)
rails_12factor (0.0.3)
rails_serve_static_assets
rails_stdout_logging
@@ -348,6 +389,7 @@ DEPENDENCIES
capybara
capybara-email
coffee-rails (~> 4.1.0)
comfortable_mexican_sofa (~> 1.12.0)
coveralls
csv_shaper
dalli

View File

@@ -0,0 +1 @@
# Custom JS for the admin area

View File

@@ -0,0 +1 @@
// custom CSS for admin area

View File

@@ -0,0 +1,121 @@
# encoding: utf-8
ComfortableMexicanSofa.configure do |config|
# Title of the admin area
# config.cms_title = 'ComfortableMexicanSofa CMS Engine'
# Controller that is inherited from CmsAdmin::BaseController
# config.base_controller = 'ApplicationController'
# Module responsible for authentication. You can replace it with your own.
# It simply needs to have #authenticate method. See http_auth.rb for reference.
# config.admin_auth = 'ComfyAdminAuthentication'
# Module responsible for authorization on admin side. It should have #authorize
# method that returns true or false based on params and loaded instance
# variables available for a given controller.
# config.admin_authorization = 'ComfyAdminAuthorization'
# Module responsible for public authentication. Similar to the above. You also
# will have access to @cms_site, @cms_layout, @cms_page so you can use them in
# your logic. Default module doesn't do anything.
# config.public_auth = 'ComfyPublicAuthentication'
# When arriving at /cms-admin you may chose to redirect to arbirtary path,
# for example '/cms-admin/users'
# config.admin_route_redirect = ''
# File uploads use Paperclip and can support filesystem or s3 uploads. Override
# the upload method and appropriate settings based on Paperclip. For S3 see:
# http://rdoc.info/gems/paperclip/2.3.8/Paperclip/Storage/S3, and for
# filesystem see: http://rdoc.info/gems/paperclip/2.3.8/Paperclip/Storage/Filesystem
# If you are using S3 and HTTPS, pass :s3_protocol => '' to have URLs that use the protocol of the page
# config.upload_file_options = {:url => '/system/:class/:id/:attachment/:style/:filename'}
# Sofa allows you to setup entire site from files. Database is updated with each
# request (if necessary). Please note that database entries are destroyed if there's
# no corresponding file. Fixtures are disabled by default.
# config.enable_fixtures = false
# Path where fixtures can be located.
# config.fixtures_path = File.expand_path('db/cms_fixtures', Rails.root)
# Importing fixtures into Database
# To load fixtures into the database just run this rake task:
# local: $ rake comfortable_mexican_sofa:fixtures:import FROM=example.local TO=localhost
# Heroku: $ heroku run rake comfortable_mexican_sofa:fixtures:import FROM=example.local TO=yourapp.herokuapp.com
# From indicates folder the fixtures are in and to is the Site hostname you have defined in the database.
# Exporting fixtures into Files
# If you need to dump database contents into fixture files run:
# local: $ rake comfortable_mexican_sofa:fixtures:export FROM=localhost TO=example.local
# Heroku: $ heroku run rake comfortable_mexican_sofa:fixtures:export FROM=yourapp.herokuapp.com TO=example.local
# This will create example.local folder and dump all content from example.com Site.
# Content for Layouts, Pages and Snippets has a revision history. You can revert
# a previous version using this system. You can control how many revisions per
# object you want to keep. Set it to 0 if you wish to turn this feature off.
# config.revisions_limit = 25
# Locale definitions. If you want to define your own locale merge
# {:locale => 'Locale Title'} with this.
# config.locales = {:en => 'English', :es => 'Español'}
# Admin interface will respect the locale of the site being managed. However you can
# force it to English by setting this to `:en`
# config.admin_locale = nil
# A class that is included as a sweeper to admin base controller if it's set
# config.admin_cache_sweeper = nil
# By default you cannot have irb code inside your layouts/pages/snippets.
# Generally this is to prevent putting something like this:
# <% User.delete_all %> but if you really want to allow it...
# config.allow_irb = false
# Whitelist of all helper methods that can be used via {{cms:helper}} tag. By default
# all helpers are allowed except `eval`, `send`, `call` and few others. Empty array
# will prevent rendering of all helpers.
# config.allowed_helpers = nil
# Whitelist of partials paths that can be used via {{cms:partial}} tag. All partials
# are accessible by default. Empty array will prevent rendering of all partials.
# config.allowed_partials = nil
# Site aliases, if you want to have aliases for your site. Good for harmonizing
# production env with dev/testing envs.
# e.g. config.hostname_aliases = {'host.com' => 'host.inv', 'host_a.com' => ['host.lvh.me', 'host.dev']}
# Default is nil (not used)
# config.hostname_aliases = nil
# Reveal partials that can be overwritten in the admin area.
# Default is false.
# config.reveal_cms_partials = false
end
# Default credentials for ComfortableMexicanSofa::AccessControl::AdminAuthentication
# YOU REALLY WANT TO CHANGE THIS BEFORE PUTTING YOUR SITE LIVE
ComfortableMexicanSofa::AccessControl::AdminAuthentication.username = 'username'
ComfortableMexicanSofa::AccessControl::AdminAuthentication.password = 'password'
# Uncomment this module and `config.admin_auth` above to use custom admin authentication
# module ComfyAdminAuthentication
# def authenticate
# return true
# end
# end
# Uncomment this module and `config.admin_authorization` above to use custom admin authorization
# module ComfyAdminAuthorization
# def authorize
# return true
# end
# end
# Uncomment this module and `config.public_auth` above to use custom public authentication
# module ComfyPublicAuthentication
# def authenticate
# return true
# end
# end

View File

@@ -1,5 +1,10 @@
Growstuff::Application.routes.draw do
comfy_route :cms_admin, :path => '/admin'
# Make sure this routeset is defined last
comfy_route :cms, :path => '/', :sitemap => false
resources :plant_parts
devise_for :members, :controllers => { :registrations => "registrations", :passwords => "passwords" }

View File

@@ -0,0 +1 @@
- File Category

View File

@@ -0,0 +1 @@
- Page Category

View File

@@ -0,0 +1 @@
- Snippet Category

View File

@@ -0,0 +1,5 @@
label: Fixture File
description: Fixture Description
categories:
- category_a
- category_b

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@@ -0,0 +1 @@
label: Default Fixture Layout

View File

@@ -0,0 +1,5 @@
<html>
<body>
{{ cms:page:content }}
</body>
</html>

View File

@@ -0,0 +1 @@
// default js

View File

@@ -0,0 +1,2 @@
label: Default Fixture Nested Layout
position: 42

View File

@@ -0,0 +1,3 @@
{{ cms:page_file:thumbnail:url }}
.left {{ cms:page:left }}
.right {{ cms:page:right }}

View File

@@ -0,0 +1 @@
// nested js

View File

@@ -0,0 +1 @@
div{float:left}

View File

@@ -0,0 +1 @@
body{color: red}

View File

@@ -0,0 +1,6 @@
label: Home Fixture Page
layout: default
target_page: '/child'
categories:
- category_a
- category_b

View File

@@ -0,0 +1,3 @@
label: Child Fixture Page
layout: nested
position: 42

View File

@@ -0,0 +1 @@
= "Child Page Left Fixture Content"

View File

@@ -0,0 +1 @@
Child Page Right Fixture Content

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

@@ -0,0 +1,2 @@
Home Page Fixture Contént
{{ cms:snippet:default }}

View File

@@ -0,0 +1,4 @@
label: Default Fixture Snippet
categories:
- category_a
- category_b

View File

@@ -0,0 +1 @@
Fixture Content for Default Snippet

View File

@@ -0,0 +1,140 @@
class CreateCms < ActiveRecord::Migration
def self.up
text_limit = case ActiveRecord::Base.connection.adapter_name
when 'PostgreSQL'
{ }
else
{ :limit => 16777215 }
end
# -- Sites --------------------------------------------------------------
create_table :comfy_cms_sites do |t|
t.string :label, :null => false
t.string :identifier, :null => false
t.string :hostname, :null => false
t.string :path
t.string :locale, :null => false, :default => 'en'
t.boolean :is_mirrored, :null => false, :default => false
end
add_index :comfy_cms_sites, :hostname
add_index :comfy_cms_sites, :is_mirrored
# -- Layouts ------------------------------------------------------------
create_table :comfy_cms_layouts do |t|
t.integer :site_id, :null => false
t.integer :parent_id
t.string :app_layout
t.string :label, :null => false
t.string :identifier, :null => false
t.text :content, text_limit
t.text :css, text_limit
t.text :js, text_limit
t.integer :position, :null => false, :default => 0
t.boolean :is_shared, :null => false, :default => false
t.timestamps
end
add_index :comfy_cms_layouts, [:parent_id, :position]
add_index :comfy_cms_layouts, [:site_id, :identifier], :unique => true
# -- Pages --------------------------------------------------------------
create_table :comfy_cms_pages do |t|
t.integer :site_id, :null => false
t.integer :layout_id
t.integer :parent_id
t.integer :target_page_id
t.string :label, :null => false
t.string :slug
t.string :full_path, :null => false
t.text :content_cache, text_limit
t.integer :position, :null => false, :default => 0
t.integer :children_count, :null => false, :default => 0
t.boolean :is_published, :null => false, :default => true
t.boolean :is_shared, :null => false, :default => false
t.timestamps
end
add_index :comfy_cms_pages, [:site_id, :full_path]
add_index :comfy_cms_pages, [:parent_id, :position]
# -- Page Blocks --------------------------------------------------------
create_table :comfy_cms_blocks do |t|
t.string :identifier, :null => false
t.text :content, text_limit
t.references :blockable, :polymorphic => true
t.timestamps
end
add_index :comfy_cms_blocks, [:identifier]
add_index :comfy_cms_blocks, [:blockable_id, :blockable_type]
# -- Snippets -----------------------------------------------------------
create_table :comfy_cms_snippets do |t|
t.integer :site_id, :null => false
t.string :label, :null => false
t.string :identifier, :null => false
t.text :content, text_limit
t.integer :position, :null => false, :default => 0
t.boolean :is_shared, :null => false, :default => false
t.timestamps
end
add_index :comfy_cms_snippets, [:site_id, :identifier], :unique => true
add_index :comfy_cms_snippets, [:site_id, :position]
# -- Files --------------------------------------------------------------
create_table :comfy_cms_files do |t|
t.integer :site_id, :null => false
t.integer :block_id
t.string :label, :null => false
t.string :file_file_name, :null => false
t.string :file_content_type, :null => false
t.integer :file_file_size, :null => false
t.string :description, :limit => 2048
t.integer :position, :null => false, :default => 0
t.timestamps
end
add_index :comfy_cms_files, [:site_id, :label]
add_index :comfy_cms_files, [:site_id, :file_file_name]
add_index :comfy_cms_files, [:site_id, :position]
add_index :comfy_cms_files, [:site_id, :block_id]
# -- Revisions -----------------------------------------------------------
create_table :comfy_cms_revisions, :force => true do |t|
t.string :record_type, :null => false
t.integer :record_id, :null => false
t.text :data, text_limit
t.datetime :created_at
end
add_index :comfy_cms_revisions, [:record_type, :record_id, :created_at],
:name => 'index_cms_revisions_on_rtype_and_rid_and_created_at'
# -- Categories ---------------------------------------------------------
create_table :comfy_cms_categories, :force => true do |t|
t.integer :site_id, :null => false
t.string :label, :null => false
t.string :categorized_type, :null => false
end
add_index :comfy_cms_categories, [:site_id, :categorized_type, :label], :unique => true,
:name => 'index_cms_categories_on_site_id_and_cat_type_and_label'
create_table :comfy_cms_categorizations, :force => true do |t|
t.integer :category_id, :null => false
t.string :categorized_type, :null => false
t.integer :categorized_id, :null => false
end
add_index :comfy_cms_categorizations, [:category_id, :categorized_type, :categorized_id], :unique => true,
:name => 'index_cms_categorizations_on_cat_id_and_catd_type_and_catd_id'
end
def self.down
drop_table :comfy_cms_sites
drop_table :comfy_cms_layouts
drop_table :comfy_cms_pages
drop_table :comfy_cms_snippets
drop_table :comfy_cms_blocks
drop_table :comfy_cms_files
drop_table :comfy_cms_revisions
drop_table :comfy_cms_categories
drop_table :comfy_cms_categorizations
end
end

View File

@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150127043022) do
ActiveRecord::Schema.define(version: 20150201052245) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -53,6 +53,125 @@ ActiveRecord::Schema.define(version: 20150127043022) do
add_index "authentications", ["member_id"], name: "index_authentications_on_member_id", using: :btree
create_table "comfy_cms_blocks", force: true do |t|
t.string "identifier", null: false
t.text "content"
t.integer "blockable_id"
t.string "blockable_type"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "comfy_cms_blocks", ["blockable_id", "blockable_type"], name: "index_comfy_cms_blocks_on_blockable_id_and_blockable_type", using: :btree
add_index "comfy_cms_blocks", ["identifier"], name: "index_comfy_cms_blocks_on_identifier", using: :btree
create_table "comfy_cms_categories", force: true do |t|
t.integer "site_id", null: false
t.string "label", null: false
t.string "categorized_type", null: false
end
add_index "comfy_cms_categories", ["site_id", "categorized_type", "label"], name: "index_cms_categories_on_site_id_and_cat_type_and_label", unique: true, using: :btree
create_table "comfy_cms_categorizations", force: true do |t|
t.integer "category_id", null: false
t.string "categorized_type", null: false
t.integer "categorized_id", null: false
end
add_index "comfy_cms_categorizations", ["category_id", "categorized_type", "categorized_id"], name: "index_cms_categorizations_on_cat_id_and_catd_type_and_catd_id", unique: true, using: :btree
create_table "comfy_cms_files", force: true do |t|
t.integer "site_id", null: false
t.integer "block_id"
t.string "label", null: false
t.string "file_file_name", null: false
t.string "file_content_type", null: false
t.integer "file_file_size", null: false
t.string "description", limit: 2048
t.integer "position", default: 0, null: false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "comfy_cms_files", ["site_id", "block_id"], name: "index_comfy_cms_files_on_site_id_and_block_id", using: :btree
add_index "comfy_cms_files", ["site_id", "file_file_name"], name: "index_comfy_cms_files_on_site_id_and_file_file_name", using: :btree
add_index "comfy_cms_files", ["site_id", "label"], name: "index_comfy_cms_files_on_site_id_and_label", using: :btree
add_index "comfy_cms_files", ["site_id", "position"], name: "index_comfy_cms_files_on_site_id_and_position", using: :btree
create_table "comfy_cms_layouts", force: true do |t|
t.integer "site_id", null: false
t.integer "parent_id"
t.string "app_layout"
t.string "label", null: false
t.string "identifier", null: false
t.text "content"
t.text "css"
t.text "js"
t.integer "position", default: 0, null: false
t.boolean "is_shared", default: false, null: false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "comfy_cms_layouts", ["parent_id", "position"], name: "index_comfy_cms_layouts_on_parent_id_and_position", using: :btree
add_index "comfy_cms_layouts", ["site_id", "identifier"], name: "index_comfy_cms_layouts_on_site_id_and_identifier", unique: true, using: :btree
create_table "comfy_cms_pages", force: true do |t|
t.integer "site_id", null: false
t.integer "layout_id"
t.integer "parent_id"
t.integer "target_page_id"
t.string "label", null: false
t.string "slug"
t.string "full_path", null: false
t.text "content_cache"
t.integer "position", default: 0, null: false
t.integer "children_count", default: 0, null: false
t.boolean "is_published", default: true, null: false
t.boolean "is_shared", default: false, null: false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "comfy_cms_pages", ["parent_id", "position"], name: "index_comfy_cms_pages_on_parent_id_and_position", using: :btree
add_index "comfy_cms_pages", ["site_id", "full_path"], name: "index_comfy_cms_pages_on_site_id_and_full_path", using: :btree
create_table "comfy_cms_revisions", force: true do |t|
t.string "record_type", null: false
t.integer "record_id", null: false
t.text "data"
t.datetime "created_at"
end
add_index "comfy_cms_revisions", ["record_type", "record_id", "created_at"], name: "index_cms_revisions_on_rtype_and_rid_and_created_at", using: :btree
create_table "comfy_cms_sites", force: true do |t|
t.string "label", null: false
t.string "identifier", null: false
t.string "hostname", null: false
t.string "path"
t.string "locale", default: "en", null: false
t.boolean "is_mirrored", default: false, null: false
end
add_index "comfy_cms_sites", ["hostname"], name: "index_comfy_cms_sites_on_hostname", using: :btree
add_index "comfy_cms_sites", ["is_mirrored"], name: "index_comfy_cms_sites_on_is_mirrored", using: :btree
create_table "comfy_cms_snippets", force: true do |t|
t.integer "site_id", null: false
t.string "label", null: false
t.string "identifier", null: false
t.text "content"
t.integer "position", default: 0, null: false
t.boolean "is_shared", default: false, null: false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "comfy_cms_snippets", ["site_id", "identifier"], name: "index_comfy_cms_snippets_on_site_id_and_identifier", unique: true, using: :btree
add_index "comfy_cms_snippets", ["site_id", "position"], name: "index_comfy_cms_snippets_on_site_id_and_position", using: :btree
create_table "comments", force: true do |t|
t.integer "post_id", null: false
t.integer "author_id", null: false
@@ -139,6 +258,7 @@ ActiveRecord::Schema.define(version: 20150127043022) do
t.decimal "weight_quantity"
t.string "weight_unit"
t.integer "plant_part_id"
t.float "si_weight"
end
create_table "harvests_photos", id: false, force: true do |t|