mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-19 14:26:14 -04:00
Merge pull request #694 from maco/cms
Add comfortable mexican sofa CMS to growstuff & make footer use it
This commit is contained in:
2
Gemfile
2
Gemfile
@@ -33,6 +33,8 @@ gem 'gibbon' # for Mailchimp newsletter subscriptions
|
||||
gem 'csv_shaper' # CSV export
|
||||
gem 'ruby-units' # for unit conversion
|
||||
|
||||
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',
|
||||
|
||||
42
Gemfile.lock
42
Gemfile.lock
@@ -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)
|
||||
@@ -59,6 +64,10 @@ GEM
|
||||
bonsai-elasticsearch-rails (0.0.4)
|
||||
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)
|
||||
@@ -74,7 +83,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)
|
||||
@@ -84,6 +99,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)
|
||||
@@ -187,6 +217,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)
|
||||
@@ -229,7 +260,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)
|
||||
@@ -254,6 +292,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
|
||||
@@ -367,6 +408,7 @@ DEPENDENCIES
|
||||
capybara
|
||||
capybara-email
|
||||
coffee-rails (~> 4.1.0)
|
||||
comfortable_mexican_sofa (~> 1.12.0)
|
||||
coveralls
|
||||
csv_shaper
|
||||
dalli
|
||||
|
||||
1
app/assets/javascripts/comfy/admin/cms/custom.js.coffee
Normal file
1
app/assets/javascripts/comfy/admin/cms/custom.js.coffee
Normal file
@@ -0,0 +1 @@
|
||||
# Custom JS for the admin area
|
||||
1
app/assets/stylesheets/comfy/admin/cms/custom.sass
Normal file
1
app/assets/stylesheets/comfy/admin/cms/custom.sass
Normal file
@@ -0,0 +1 @@
|
||||
// custom CSS for admin area
|
||||
@@ -8,6 +8,7 @@
|
||||
%li= link_to "Roles", roles_path
|
||||
%li= link_to "Forums", forums_path
|
||||
%li= link_to "Newsletter subscribers", admin_newsletter_path
|
||||
%li= link_to "CMS", comfy_admin_cms_path
|
||||
|
||||
%h2 Orders
|
||||
|
||||
|
||||
@@ -2,28 +2,8 @@
|
||||
.container
|
||||
.row
|
||||
.col-md-4#about-growstuff
|
||||
%ul
|
||||
%li= link_to t('about'), "http://wiki.growstuff.org/index.php/About%20Growstuff"
|
||||
%li= link_to t('our_values'), "http://wiki.growstuff.org/index.php/Values"
|
||||
%li= link_to t('open_source'), "https://github.com/Growstuff/growstuff"
|
||||
%li= link_to t('growstuff_team'), "http://wiki.growstuff.org/index.php/Team"
|
||||
%li= link_to t('get_involved'), "http://wiki.growstuff.org/index.php/Get_involved"
|
||||
!= cms_snippet_content(:footer1)
|
||||
.col-md-4#policies
|
||||
%ul
|
||||
%li= link_to t('terms_of_service'), url_for(:controller => '/policy', :action => 'tos')
|
||||
%li= link_to t('privacy_policy'), url_for(:controller => '/policy', :action => 'privacy')
|
||||
%li= link_to t('data_use_policy'), url_for(:controller => '/policy', :action => 'api')
|
||||
%li= link_to t('community_guidelines'), url_for(:controller => '/policy', :action => 'community')
|
||||
!= cms_snippet_content(:footer2)
|
||||
.col-md-4#contact
|
||||
%ul
|
||||
%li= link_to t('support_'), url_for(:controller => '/support')
|
||||
%li= link_to t('contact'), url_for(:controller => '/about', :action => 'contact')
|
||||
%p
|
||||
= link_to('http://twitter.com/growstufforg', :target => "_blank") do
|
||||
= image_tag("twitter_32.png", :alt => 'Twitter: @growstufforg')
|
||||
|
||||
= link_to('https://www.facebook.com/Growstufforg', :target => "_blank") do
|
||||
= image_tag("facebook_32.png", :alt => 'Facebook')
|
||||
|
||||
= link_to('http://blog.growstuff.org/', :target => "_blank") do
|
||||
= image_tag("blog_32.png", :alt => 'Growstuff Blog')
|
||||
!= cms_snippet_content(:footer3)
|
||||
|
||||
@@ -65,8 +65,8 @@
|
||||
%li= link_to "Sign out", destroy_member_session_path, :method => :delete
|
||||
|
||||
- else
|
||||
%li= link_to 'Sign in', new_member_session_path
|
||||
%li= link_to 'Sign up', new_member_registration_path
|
||||
%li= link_to 'Sign in', new_member_session_path, :id => 'navbar-signin'
|
||||
%li= link_to 'Sign up', new_member_registration_path, :id => 'navbar-signup'
|
||||
|
||||
= form_tag crops_search_path, :method => :get, :class => 'navbar-form pull-right' do
|
||||
.input
|
||||
|
||||
103
config/initializers/comfortable_mexican_sofa.rb
Normal file
103
config/initializers/comfortable_mexican_sofa.rb
Normal file
@@ -0,0 +1,103 @@
|
||||
# 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 = 'CmsDeviseAuth'
|
||||
|
||||
# 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
|
||||
|
||||
module CmsDeviseAuth
|
||||
def authenticate
|
||||
unless current_member && current_member.has_role?(:admin)
|
||||
redirect_to root_path, :alert => 'Permission denied. Please sign in as an admin user to use the CMS admin area.'
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,5 +1,6 @@
|
||||
Growstuff::Application.routes.draw do
|
||||
|
||||
|
||||
resources :plant_parts
|
||||
|
||||
devise_for :members, :controllers => { :registrations => "registrations", :passwords => "passwords" }
|
||||
@@ -84,6 +85,8 @@ Growstuff::Application.routes.draw do
|
||||
get '/admin/newsletter' => 'admin#newsletter', :as => :admin_newsletter
|
||||
get '/admin/:action' => 'admin#:action'
|
||||
|
||||
|
||||
# CMS stuff -- must remain LAST
|
||||
comfy_route :cms_admin, :path => '/cms/admin'
|
||||
comfy_route :cms, :path => '/', :sitemap => false
|
||||
|
||||
end
|
||||
|
||||
140
db/migrate/20150201052245_create_cms.rb
Normal file
140
db/migrate/20150201052245_create_cms.rb
Normal 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
|
||||
|
||||
119
db/schema.rb
119
db/schema.rb
@@ -53,6 +53,125 @@ ActiveRecord::Schema.define(version: 20150209105410) 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
|
||||
|
||||
37
spec/features/cms_spec.rb
Normal file
37
spec/features/cms_spec.rb
Normal file
@@ -0,0 +1,37 @@
|
||||
require 'spec_helper'
|
||||
|
||||
feature "cms admin" do
|
||||
before(:each) do
|
||||
@member = FactoryGirl.create(:member)
|
||||
@admin_member = FactoryGirl.create(:admin_member)
|
||||
end
|
||||
|
||||
scenario "can't view CMS admin if not signed in" do
|
||||
visit comfy_admin_cms_path
|
||||
current_path.should == root_path
|
||||
page.should have_content("Please sign in as an admin user")
|
||||
end
|
||||
|
||||
scenario "can't view CMS admin if not an admin member" do
|
||||
# sign in as an ordinary member
|
||||
visit root_path
|
||||
click_link 'navbar-signin'
|
||||
fill_in 'Login', :with => @member.email
|
||||
fill_in 'Password', :with => @member.password
|
||||
click_button 'Sign in'
|
||||
visit comfy_admin_cms_path
|
||||
current_path.should == root_path
|
||||
page.should have_content("Please sign in as an admin user")
|
||||
end
|
||||
|
||||
scenario "admin members can view CMS admin area" do
|
||||
visit root_path
|
||||
# now we sign in as an admin member
|
||||
click_link 'navbar-signin'
|
||||
fill_in 'Login', :with => @admin_member.email
|
||||
fill_in 'Password', :with => @admin_member.password
|
||||
click_button 'Sign in'
|
||||
visit comfy_admin_cms_path
|
||||
current_path.should match /#{comfy_admin_cms_path}/ # match any CMS admin page
|
||||
end
|
||||
end
|
||||
@@ -2,19 +2,11 @@ require 'rails_helper'
|
||||
|
||||
feature "footer" do
|
||||
|
||||
scenario "has three columns" do
|
||||
scenario "footer is on home page" do
|
||||
visit root_path
|
||||
expect(page).to have_css 'footer #about-growstuff'
|
||||
expect(page).to have_css 'footer #policies'
|
||||
expect(page).to have_css 'footer #contact'
|
||||
expect(page).to have_css 'footer'
|
||||
end
|
||||
|
||||
# NB: not testing specific content in the footer since I'm going to put them
|
||||
# in the CMS and they'll be variable.
|
||||
|
||||
scenario "contact page has Twitter link" do
|
||||
visit root_path
|
||||
click_link 'Contact'
|
||||
page.should have_link '@growstufforg', :href => 'http://twitter.com/growstufforg'
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user