mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
135 lines
6.1 KiB
Ruby
135 lines
6.1 KiB
Ruby
# encoding: utf-8
|
|
|
|
ComfortableMexicanSofa.configure do |config|
|
|
# Title of the admin area
|
|
# config.cms_title = 'ComfortableMexicanSofa CMS Engine'
|
|
|
|
# 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 = 'CmsSpreeAuth'
|
|
|
|
# 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 = 'ComfortableMexicanSofa::DummyAuth'
|
|
|
|
# Default url to access admin area is http://yourhost/cms-admin/
|
|
# You can change 'cms-admin' to 'admin', for example. To disable admin area
|
|
# entirely set this to '' or nil
|
|
# config.admin_route_prefix = 'cms-admin'
|
|
|
|
# When arriving at /cms-admin you may chose to redirect to arbirtary path,
|
|
# for example '/cms-admin/users'
|
|
# config.admin_route_redirect = ''
|
|
|
|
# Normally we include default routes from https://github.com/comfy/comfortable-mexican-sofa/blob/master/config/routes.rb
|
|
# If you want to include the routes manually set this to false
|
|
# config.use_default_routes = true
|
|
|
|
# /sitemap.xml that is used by search engines for indexing. It's enabled by
|
|
# default, but you may turn it off.
|
|
# config.enable_sitemap = true
|
|
|
|
# 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
|
|
config.upload_file_options = {
|
|
:storage => 's3',
|
|
:s3_credentials => {
|
|
:bucket => Spree::Config[:s3_bucket],
|
|
:access_key_id => Spree::Config[:s3_access_key],
|
|
:secret_access_key => Spree::Config[:s3_secret]
|
|
}
|
|
}
|
|
|
|
# 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
|
|
|
|
# If you want to keep your CMS tables in a location other than the default database
|
|
# add a database_config. For example, setting it to 'cms' will look for a cms_#{Rails.env}
|
|
# definition in your database.yml file
|
|
# config.database_config = 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.site_aliases = {'host.com' => 'host.inv', 'host_a.com' => ['host.lvh.me', 'host.dev']}
|
|
# Default is nil (not used)
|
|
# config.hostname_aliases = nil
|
|
|
|
end
|
|
|
|
module CmsSpreeAuth
|
|
def authenticate
|
|
unless spree_current_user && spree_current_user.has_spree_role?('admin')
|
|
redirect_to spree.login_path
|
|
end
|
|
end
|
|
end
|
|
|
|
# Default credentials for ComfortableMexicanSofa::HttpAuth
|
|
# YOU REALLY WANT TO CHANGE THIS BEFORE PUTTING YOUR SITE LIVE
|
|
ComfortableMexicanSofa::HttpAuth.username = 'username'
|
|
ComfortableMexicanSofa::HttpAuth.password = 'password'
|
|
|
|
# If you need to inject some html in cms admin views you can define what partial
|
|
# should be rendered into the following areas:
|
|
# ComfortableMexicanSofa::ViewHooks.add(:navigation, '/layouts/admin/navigation')
|
|
# ComfortableMexicanSofa::ViewHooks.add(:html_head, '/layouts/admin/html_head')
|
|
# ComfortableMexicanSofa::ViewHooks.add(:page_form, '/layouts/admin/page_form')
|
|
ComfortableMexicanSofa::ViewHooks.add(:navigation, 'layouts/cms_nav_spree')
|
|
|
|
# Provide some Spree helpers to the CMS controller so it can render Spree's layout
|
|
ComfortableMexicanSofa::CmsContentController.class_eval do
|
|
helper 'spree/base'
|
|
include Spree::Core::ControllerHelpers
|
|
include Spree::Core::Engine.routes.url_helpers
|
|
end
|