comfortable_mexican_sofa 1.6.31 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +7 -2
- data/Gemfile +11 -2
- data/README.md +2 -3
- data/Rakefile +18 -0
- data/VERSION +1 -0
- data/app/assets/images/comfortable_mexican_sofa/bootstrap/glyphicons-halflings-white.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/bootstrap/glyphicons-halflings.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/{icon_regular.gif → icon_file.gif} +0 -0
- data/app/assets/images/comfortable_mexican_sofa/icon_page.gif +0 -0
- data/app/assets/images/comfortable_mexican_sofa/icon_site.gif +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/application.js +61 -93
- data/app/assets/javascripts/comfortable_mexican_sofa/lib/bootstrap-datetimepicker.js +21 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/lib/bootstrap-wysihtml5.js +492 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/lib/bootstrap.js +6 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/lib/codemirror.js +10 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/lib/wysihtml5.js +261 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/application.css.sass +9 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/base.css.sass +328 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/base_overrides.css.sass +6 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/bootstrap_overrides.css.sass +43 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/codemirror_overrides.css.sass +27 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/lib/bootstrap-datetimepicker.css +9 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/lib/bootstrap-wysihtml5.css +102 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/lib/bootstrap.css +9 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/lib/codemirror.css +240 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/wysihtml5_overrides.css.sass +5 -0
- data/app/controllers/cms_admin/files_controller.rb +3 -3
- data/app/controllers/cms_admin/layouts_controller.rb +3 -3
- data/app/controllers/cms_admin/pages_controller.rb +3 -3
- data/app/controllers/cms_admin/revisions_controller.rb +1 -1
- data/app/controllers/cms_admin/sites_controller.rb +3 -3
- data/app/controllers/cms_admin/snippets_controller.rb +3 -3
- data/app/models/cms/file.rb +5 -3
- data/app/models/cms/page.rb +1 -14
- data/app/models/cms/site.rb +2 -2
- data/app/views/cms_admin/categories/_categories.html.haml +3 -0
- data/app/views/cms_admin/categories/_edit.html.haml +6 -0
- data/app/views/cms_admin/categories/_form.html.haml +8 -0
- data/app/views/cms_admin/categories/_index.html.haml +24 -0
- data/app/views/cms_admin/categories/_show.html.haml +13 -0
- data/app/views/cms_admin/categories/create.js.erb +3 -3
- data/app/views/cms_admin/categories/update.js.erb +1 -1
- data/app/views/cms_admin/files/_file.html.haml +14 -0
- data/app/views/cms_admin/files/_form.html.haml +13 -0
- data/app/views/cms_admin/files/_index.html.haml +12 -0
- data/app/views/cms_admin/files/_page_form.html.haml +9 -0
- data/app/views/cms_admin/files/create.js.erb +1 -1
- data/app/views/cms_admin/files/edit.html.haml +5 -0
- data/app/views/cms_admin/files/index.html.haml +26 -0
- data/app/views/cms_admin/files/new.html.haml +5 -0
- data/app/views/cms_admin/layouts/_form.html.haml +17 -0
- data/app/views/cms_admin/layouts/_index_branch.html.haml +23 -0
- data/app/views/cms_admin/layouts/edit.html.haml +9 -0
- data/app/views/cms_admin/layouts/index.html.haml +9 -0
- data/app/views/cms_admin/layouts/new.html.haml +5 -0
- data/app/views/cms_admin/pages/_form.html.haml +35 -0
- data/app/views/cms_admin/pages/_form_blocks.html.haml +28 -0
- data/app/views/cms_admin/pages/_index_branch.html.haml +35 -0
- data/app/views/cms_admin/pages/edit.html.haml +9 -0
- data/app/views/cms_admin/pages/form_blocks.js.erb +2 -3
- data/app/views/cms_admin/pages/index.html.haml +11 -0
- data/app/views/cms_admin/pages/new.html.haml +5 -0
- data/app/views/cms_admin/revisions/show.html.haml +28 -0
- data/app/views/cms_admin/sites/_form.html.haml +10 -0
- data/app/views/cms_admin/sites/_mirrors.html.haml +17 -0
- data/app/views/cms_admin/sites/edit.html.haml +5 -0
- data/app/views/cms_admin/sites/index.html.haml +24 -0
- data/app/views/cms_admin/sites/new.html.haml +5 -0
- data/app/views/cms_admin/snippets/_form.html.haml +11 -0
- data/app/views/cms_admin/snippets/edit.html.haml +9 -0
- data/app/views/cms_admin/snippets/index.html.haml +28 -0
- data/app/views/cms_admin/snippets/new.html.haml +5 -0
- data/app/views/layouts/cms_admin.html.haml +4 -0
- data/app/views/layouts/cms_admin/_body.html.haml +16 -0
- data/app/views/layouts/cms_admin/_center.html.haml +7 -0
- data/app/views/layouts/cms_admin/_head.html.haml +13 -0
- data/app/views/layouts/cms_admin/_left.html.haml +10 -0
- data/app/views/layouts/cms_admin/_right.html.haml +1 -0
- data/comfortable_mexican_sofa.gemspec +323 -21
- data/config/application.rb +22 -14
- data/config/environments/development.rb +16 -2
- data/config/environments/production.rb +22 -7
- data/config/environments/test.rb +6 -6
- data/config/initializers/comfortable_mexican_sofa.rb +1 -1
- data/db/migrate/01_create_cms.rb +1 -1
- data/doc/preview.png +0 -0
- data/lib/comfortable_mexican_sofa.rb +0 -5
- data/lib/comfortable_mexican_sofa/configuration.rb +1 -1
- data/lib/comfortable_mexican_sofa/engine.rb +8 -2
- data/lib/comfortable_mexican_sofa/extensions/rails.rb +2 -2
- data/lib/comfortable_mexican_sofa/form_builder.rb +27 -82
- data/lib/comfortable_mexican_sofa/tag.rb +1 -1
- data/lib/comfortable_mexican_sofa/tags/page_markdown.rb +22 -0
- data/lib/comfortable_mexican_sofa/version.rb +6 -2
- data/lib/comfortable_mexican_sofa/view_methods.rb +5 -8
- data/test/functional/cms_admin/files_controller_test.rb +4 -4
- data/test/functional/cms_admin/layouts_controller_test.rb +3 -3
- data/test/functional/cms_admin/pages_controller_test.rb +20 -12
- data/test/functional/cms_admin/revisions_controller_test.rb +3 -3
- data/test/functional/cms_admin/sites_controller_test.rb +3 -3
- data/test/functional/cms_admin/snippets_controller_test.rb +3 -3
- data/test/functional/cms_content_controller_test.rb +1 -1
- data/test/gemfiles/Gemfile.rails.3.1 +10 -4
- data/test/gemfiles/Gemfile.rails.3.2 +10 -4
- data/test/gemfiles/Gemfile.rails.4.0 +16 -0
- data/test/test_helper.rb +1 -16
- data/test/unit/configuration_test.rb +1 -3
- data/test/unit/models/page_test.rb +1 -19
- data/test/unit/models/site_test.rb +1 -5
- data/test/unit/tags/page_file_test.rb +6 -5
- data/test/unit/tags/page_files_test.rb +5 -3
- data/test/unit/tags/page_markdown_test.rb +48 -0
- metadata +195 -131
- checksums.yaml +0 -7
- data/.gitignore +0 -14
- data/app/assets/images/comfortable_mexican_sofa/elrte/elrte-toolbar.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/google-maps.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/iframe.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/media-director.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/media-flash.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/media-quicktime.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/media-realaudio.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/media-rutube.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/media-vimeo.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/media-winmedia.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/media-youtube.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/outline-div.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/outline-p.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/pagebreak.gif +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/pixel.gif +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/evilgrin.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/grin.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/happy.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/smile.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/surprised.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/tongue.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/unhappy.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/waii.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/elrte/smileys/wink.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-bg_inset-soft_95_fef1ec_1x100.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-icons_222222_256x240.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-icons_2e83ff_256x240.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-icons_454545_256x240.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-icons_888888_256x240.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-icons_cd0a0a_256x240.png +0 -0
- data/app/assets/images/comfortable_mexican_sofa/x.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/codemirror/codemirror.js +0 -1
- data/app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.codemirror.js +0 -36
- data/app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.js +0 -267
- data/app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.sofa_image.js +0 -69
- data/app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.sofa_link.js +0 -58
- data/app/assets/javascripts/comfortable_mexican_sofa/jquery.js +0 -4
- data/app/assets/javascripts/comfortable_mexican_sofa/jquery_ui.js +0 -791
- data/app/assets/javascripts/comfortable_mexican_sofa/jquery_ui_timepicker.js +0 -12
- data/app/assets/javascripts/comfortable_mexican_sofa/rails.js +0 -315
- data/app/assets/stylesheets/comfortable_mexican_sofa/application.css +0 -13
- data/app/assets/stylesheets/comfortable_mexican_sofa/codemirror.css +0 -121
- data/app/assets/stylesheets/comfortable_mexican_sofa/content.css +0 -271
- data/app/assets/stylesheets/comfortable_mexican_sofa/dialogs.css +0 -45
- data/app/assets/stylesheets/comfortable_mexican_sofa/elrte.css +0 -173
- data/app/assets/stylesheets/comfortable_mexican_sofa/files.css +0 -82
- data/app/assets/stylesheets/comfortable_mexican_sofa/form.css +0 -232
- data/app/assets/stylesheets/comfortable_mexican_sofa/jquery_ui.css +0 -568
- data/app/assets/stylesheets/comfortable_mexican_sofa/reset.css +0 -1
- data/app/assets/stylesheets/comfortable_mexican_sofa/structure.css +0 -157
- data/app/assets/stylesheets/comfortable_mexican_sofa/typography.css +0 -39
- data/app/assets/stylesheets/comfortable_mexican_sofa/widgets.css +0 -29
- data/app/controllers/cms_admin/dialogs_controller.rb +0 -13
- data/app/views/cms_admin/categories/_categories.html.erb +0 -6
- data/app/views/cms_admin/categories/_edit.html.erb +0 -7
- data/app/views/cms_admin/categories/_form.html.erb +0 -12
- data/app/views/cms_admin/categories/_index.html.erb +0 -31
- data/app/views/cms_admin/categories/_show.html.erb +0 -16
- data/app/views/cms_admin/dialogs/image.html.erb +0 -7
- data/app/views/cms_admin/dialogs/link.html.erb +0 -5
- data/app/views/cms_admin/files/_file.html.erb +0 -18
- data/app/views/cms_admin/files/_form.html.erb +0 -16
- data/app/views/cms_admin/files/_index.html.erb +0 -16
- data/app/views/cms_admin/files/_page_form.html.erb +0 -12
- data/app/views/cms_admin/files/edit.html.erb +0 -5
- data/app/views/cms_admin/files/index.html.erb +0 -29
- data/app/views/cms_admin/files/new.html.erb +0 -5
- data/app/views/cms_admin/layouts/_form.html.erb +0 -20
- data/app/views/cms_admin/layouts/_index_branch.html.erb +0 -27
- data/app/views/cms_admin/layouts/edit.html.erb +0 -11
- data/app/views/cms_admin/layouts/index.html.erb +0 -10
- data/app/views/cms_admin/layouts/new.html.erb +0 -5
- data/app/views/cms_admin/pages/_form.html.erb +0 -39
- data/app/views/cms_admin/pages/_form_blocks.html.erb +0 -41
- data/app/views/cms_admin/pages/_index_branch.html.erb +0 -43
- data/app/views/cms_admin/pages/edit.html.erb +0 -11
- data/app/views/cms_admin/pages/index.html.erb +0 -12
- data/app/views/cms_admin/pages/new.html.erb +0 -5
- data/app/views/cms_admin/revisions/show.html.erb +0 -36
- data/app/views/cms_admin/sites/_form.html.erb +0 -10
- data/app/views/cms_admin/sites/_mirrors.html.erb +0 -20
- data/app/views/cms_admin/sites/edit.html.erb +0 -5
- data/app/views/cms_admin/sites/index.html.erb +0 -23
- data/app/views/cms_admin/sites/new.html.erb +0 -5
- data/app/views/cms_admin/snippets/_form.html.erb +0 -13
- data/app/views/cms_admin/snippets/edit.html.erb +0 -10
- data/app/views/cms_admin/snippets/index.html.erb +0 -33
- data/app/views/cms_admin/snippets/new.html.erb +0 -5
- data/app/views/layouts/cms_admin.html.erb +0 -5
- data/app/views/layouts/cms_admin/_body.html.erb +0 -23
- data/app/views/layouts/cms_admin/_center.html.erb +0 -6
- data/app/views/layouts/cms_admin/_head.html.erb +0 -43
- data/app/views/layouts/cms_admin/_left.html.erb +0 -10
- data/app/views/layouts/cms_admin/_right.html.erb +0 -1
- data/test/functional/cms_admin/dialogs_controller_test.rb +0 -24
- data/test/gemfiles/Gemfile.rails.3.0 +0 -10
- data/test/unit/form_builder_test.rb +0 -69
data/config/application.rb
CHANGED
@@ -2,9 +2,12 @@ require File.expand_path('../boot', __FILE__)
|
|
2
2
|
|
3
3
|
require 'rails/all'
|
4
4
|
|
5
|
-
|
6
|
-
# you
|
7
|
-
Bundler.require(
|
5
|
+
if defined?(Bundler)
|
6
|
+
# If you precompile assets before deploying to production, use this line
|
7
|
+
Bundler.require(*Rails.groups(:assets => %w(development test)))
|
8
|
+
# If you want your assets lazily compiled in production, use this line
|
9
|
+
# Bundler.require(:default, :assets, Rails.env)
|
10
|
+
end
|
8
11
|
|
9
12
|
module ComfortableMexicanSofa
|
10
13
|
class Application < Rails::Application
|
@@ -33,28 +36,33 @@ module ComfortableMexicanSofa
|
|
33
36
|
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
34
37
|
# config.i18n.default_locale = :de
|
35
38
|
|
36
|
-
# JavaScript files you want as :defaults (application.js is always included).
|
37
|
-
|
38
39
|
# Configure the default encoding used in templates for Ruby 1.9.
|
39
40
|
config.encoding = "utf-8"
|
40
41
|
|
41
42
|
# Configure sensitive parameters which will be filtered from the log file.
|
42
43
|
config.filter_parameters += [:password]
|
43
|
-
|
44
|
+
|
45
|
+
# Enable escaping HTML in JSON.
|
46
|
+
config.active_support.escape_html_entities_in_json = true
|
47
|
+
|
48
|
+
# Use SQL instead of Active Record's schema dumper when creating the database.
|
49
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
50
|
+
# like if you have constraints or database-specific column types
|
51
|
+
# config.active_record.schema_format = :sql
|
52
|
+
|
44
53
|
# Enforce whitelist mode for mass assignment.
|
45
54
|
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
46
55
|
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
47
56
|
# parameters by using an attr_accessible or attr_protected declaration.
|
48
|
-
|
49
|
-
|
50
|
-
end
|
51
|
-
|
57
|
+
config.active_record.whitelist_attributes = true
|
58
|
+
|
52
59
|
# Enable the asset pipeline
|
53
|
-
|
54
|
-
|
55
|
-
|
60
|
+
config.assets.enabled = true
|
61
|
+
|
62
|
+
# Version of your assets, change this if you want to expire all your assets
|
63
|
+
config.assets.version = '1.0'
|
56
64
|
|
57
|
-
config.session_store :cookie_store, :key => '
|
65
|
+
config.session_store :cookie_store, :key => '_comfy_session'
|
58
66
|
config.secret_token = 'e0fef4ab56c1cacd8845864fe2cb2a27f5caad72823419f87b2774785187090a654b83229bf9cef70ce475a83bfa561dbbaa2015788181ea837c456964c1e0f6'
|
59
67
|
|
60
68
|
end
|
@@ -2,7 +2,7 @@ defined?(ComfortableMexicanSofa::Application) && ComfortableMexicanSofa::Applica
|
|
2
2
|
# Settings specified here will take precedence over those in config/application.rb
|
3
3
|
|
4
4
|
# In the development environment your application's code is reloaded on
|
5
|
-
# every request.
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
6
|
# since you don't have to restart the web server when you make code changes.
|
7
7
|
config.cache_classes = false
|
8
8
|
|
@@ -21,5 +21,19 @@ defined?(ComfortableMexicanSofa::Application) && ComfortableMexicanSofa::Applica
|
|
21
21
|
|
22
22
|
# Only use best-standards-support built into browsers
|
23
23
|
config.action_dispatch.best_standards_support = :builtin
|
24
|
-
end
|
25
24
|
|
25
|
+
unless Rails.version <= '3.2.0'
|
26
|
+
# Raise exception on mass assignment protection for Active Record models
|
27
|
+
config.active_record.mass_assignment_sanitizer = :strict
|
28
|
+
|
29
|
+
# Log the query plan for queries taking more than this (works
|
30
|
+
# with SQLite, MySQL, and PostgreSQL)
|
31
|
+
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
32
|
+
end
|
33
|
+
|
34
|
+
# Do not compress assets
|
35
|
+
config.assets.compress = false
|
36
|
+
|
37
|
+
# Expands the lines which load the assets
|
38
|
+
config.assets.debug = true
|
39
|
+
end
|
@@ -11,13 +11,21 @@ defined?(ComfortableMexicanSofa::Application) && ComfortableMexicanSofa::Applica
|
|
11
11
|
# Disable Rails's static asset server (Apache or nginx will already do this)
|
12
12
|
config.serve_static_assets = false
|
13
13
|
|
14
|
-
# Compress
|
15
|
-
|
16
|
-
|
14
|
+
# Compress JavaScripts and CSS
|
15
|
+
config.assets.compress = true
|
16
|
+
|
17
|
+
# Don't fallback to assets pipeline if a precompiled asset is missed
|
18
|
+
config.assets.compile = false
|
19
|
+
|
20
|
+
# Generate digests for assets URLs
|
21
|
+
config.assets.digest = true
|
22
|
+
|
23
|
+
# Defaults to nil and saved in location specified by config.assets.prefix
|
24
|
+
# config.assets.manifest = YOUR_PATH
|
17
25
|
|
18
26
|
# Specifies the header that your server uses for sending files
|
19
|
-
#
|
20
|
-
config.action_dispatch.x_sendfile_header =
|
27
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
28
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
21
29
|
|
22
30
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
23
31
|
# config.force_ssl = true
|
@@ -25,13 +33,16 @@ defined?(ComfortableMexicanSofa::Application) && ComfortableMexicanSofa::Applica
|
|
25
33
|
# See everything in the log (default is :info)
|
26
34
|
# config.log_level = :debug
|
27
35
|
|
36
|
+
# Prepend all log lines with the following tags
|
37
|
+
# config.log_tags = [ :subdomain, :uuid ]
|
38
|
+
|
28
39
|
# Use a different logger for distributed setups
|
29
|
-
# config.logger = SyslogLogger.new
|
40
|
+
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
30
41
|
|
31
42
|
# Use a different cache store in production
|
32
43
|
# config.cache_store = :mem_cache_store
|
33
44
|
|
34
|
-
# Enable serving of images, stylesheets, and
|
45
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
35
46
|
# config.action_controller.asset_host = "http://assets.example.com"
|
36
47
|
|
37
48
|
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
@@ -49,4 +60,8 @@ defined?(ComfortableMexicanSofa::Application) && ComfortableMexicanSofa::Applica
|
|
49
60
|
|
50
61
|
# Send deprecation notices to registered listeners
|
51
62
|
config.active_support.deprecation = :notify
|
63
|
+
|
64
|
+
# Log the query plan for queries taking more than this (works
|
65
|
+
# with SQLite, MySQL, and PostgreSQL)
|
66
|
+
# config.active_record.auto_explain_threshold_in_seconds = 0.5
|
52
67
|
end
|
data/config/environments/test.rb
CHANGED
@@ -2,9 +2,9 @@ defined?(ComfortableMexicanSofa::Application) && ComfortableMexicanSofa::Applica
|
|
2
2
|
# Settings specified here will take precedence over those in config/application.rb
|
3
3
|
|
4
4
|
# The test environment is used exclusively to run your application's
|
5
|
-
# test suite.
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
6
|
# your test database is "scratch space" for the test suite and is wiped
|
7
|
-
# and recreated between test runs.
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
8
|
config.cache_classes = true
|
9
9
|
|
10
10
|
# Configure static asset server for tests with Cache-Control for performance
|
@@ -29,10 +29,10 @@ defined?(ComfortableMexicanSofa::Application) && ComfortableMexicanSofa::Applica
|
|
29
29
|
# ActionMailer::Base.deliveries array.
|
30
30
|
config.action_mailer.delivery_method = :test
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
unless Rails.version <= '3.2.0'
|
33
|
+
# Raise exception on mass assignment protection for Active Record models
|
34
|
+
config.active_record.mass_assignment_sanitizer = :strict
|
35
|
+
end
|
36
36
|
|
37
37
|
# Print deprecation notices to the stderr
|
38
38
|
config.active_support.deprecation = :stderr
|
@@ -93,7 +93,7 @@ ComfortableMexicanSofa.configure do |config|
|
|
93
93
|
|
94
94
|
# Site aliases, if you want to have aliases for your site. Good for harmonizing
|
95
95
|
# production env with dev/testing envs.
|
96
|
-
# e.g. config.
|
96
|
+
# e.g. config.hostname_aliases = {'host.com' => 'host.inv', 'host_a.com' => ['host.lvh.me', 'host.dev']}
|
97
97
|
# Default is nil (not used)
|
98
98
|
# config.hostname_aliases = nil
|
99
99
|
|
data/db/migrate/01_create_cms.rb
CHANGED
@@ -61,7 +61,7 @@ class CreateCms < ActiveRecord::Migration
|
|
61
61
|
create_table :cms_blocks do |t|
|
62
62
|
t.integer :page_id, :null => false
|
63
63
|
t.string :identifier, :null => false
|
64
|
-
t.text :content
|
64
|
+
t.text :content, text_limit
|
65
65
|
t.timestamps
|
66
66
|
end
|
67
67
|
add_index :cms_blocks, [:page_id, :identifier]
|
data/doc/preview.png
CHANGED
Binary file
|
@@ -46,11 +46,6 @@ module ComfortableMexicanSofa
|
|
46
46
|
end
|
47
47
|
alias :config :configuration
|
48
48
|
|
49
|
-
# Checking if Rails3.1+ asset pipeline is enabled
|
50
|
-
def asset_pipeline_enabled?
|
51
|
-
Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR >= 1 && Rails.configuration.assets.enabled
|
52
|
-
end
|
53
|
-
|
54
49
|
# Establishing database connection if custom one is defined
|
55
50
|
def establish_connection(klass)
|
56
51
|
if ComfortableMexicanSofa.config.database_config && !Rails.env.test?
|
@@ -85,7 +85,7 @@ class ComfortableMexicanSofa::Configuration
|
|
85
85
|
@admin_route_redirect = ''
|
86
86
|
@use_default_routes = true
|
87
87
|
@enable_sitemap = true
|
88
|
-
@upload_file_options = {
|
88
|
+
@upload_file_options = { }
|
89
89
|
@enable_fixtures = false
|
90
90
|
@fixtures_path = File.expand_path('db/cms_fixtures', Rails.root)
|
91
91
|
@revisions_limit = 25
|
@@ -1,8 +1,14 @@
|
|
1
|
+
require 'rubygems'
|
1
2
|
require 'comfortable_mexican_sofa'
|
2
3
|
require 'rails'
|
3
|
-
require '
|
4
|
+
require 'formatted_form'
|
4
5
|
require 'active_link_to'
|
5
|
-
require '
|
6
|
+
require 'paperclip'
|
7
|
+
require 'redcarpet'
|
8
|
+
require 'jquery-rails'
|
9
|
+
require 'haml-rails'
|
10
|
+
require 'sass-rails'
|
11
|
+
require 'coffee-rails'
|
6
12
|
|
7
13
|
module ComfortableMexicanSofa
|
8
14
|
class Engine < ::Rails::Engine
|
@@ -1,97 +1,38 @@
|
|
1
|
-
class ComfortableMexicanSofa::FormBuilder <
|
2
|
-
|
3
|
-
helpers = field_helpers -
|
4
|
-
%w(hidden_field fields_for) +
|
5
|
-
%w(select collection_select)
|
6
|
-
|
7
|
-
helpers.each do |name|
|
8
|
-
class_eval %Q^
|
9
|
-
def #{name}(field, *args)
|
10
|
-
options = args.extract_options!
|
11
|
-
args << options
|
12
|
-
return super if options.delete(:disable_builder)
|
13
|
-
default_field('#{name}', field, options){ super }
|
14
|
-
end
|
15
|
-
^
|
16
|
-
end
|
17
|
-
|
18
|
-
def default_field(type, field, options = {}, &block)
|
19
|
-
errors = if object.respond_to?(:errors) && object.errors[field].present?
|
20
|
-
"<div class='errors'>#{[object.errors[field]].flatten.first}</div>"
|
21
|
-
end
|
22
|
-
if desc = options.delete(:desc)
|
23
|
-
desc = "<div class='desc'>#{desc}</div>"
|
24
|
-
end
|
25
|
-
%(
|
26
|
-
<div class='form_element #{type}_element #{'errors' if errors}'>
|
27
|
-
<div class='label'>#{label_for(field, options)}</div>
|
28
|
-
<div class='value'>#{yield}</div>
|
29
|
-
#{desc}
|
30
|
-
#{errors}
|
31
|
-
</div>
|
32
|
-
).html_safe
|
33
|
-
end
|
34
|
-
|
35
|
-
def simple_field(label = nil, content = nil, options = {}, &block)
|
36
|
-
content ||= @template.capture(&block) if block_given?
|
37
|
-
%(
|
38
|
-
<div class='form_element simple_field #{options.delete(:class)}'>
|
39
|
-
<div class='label'>#{label}</div>
|
40
|
-
<div class='value'>#{content}</div>
|
41
|
-
</div>
|
42
|
-
).html_safe
|
43
|
-
end
|
44
|
-
|
45
|
-
def label_for(field, options={})
|
46
|
-
label = options.delete(:label) || object.class.human_attribute_name(field)
|
47
|
-
for_value = options[:id] || "#{object_name}_#{field}"
|
48
|
-
%Q{<label for="#{for_value}">#{label}</label>}.html_safe
|
49
|
-
end
|
50
|
-
|
51
|
-
def submit(value, options = {}, &block)
|
52
|
-
return super if options.delete(:disable_builder)
|
53
|
-
extra_content = @template.capture(&block) if block_given?
|
54
|
-
simple_field(nil, "#{super(value, options)} #{extra_content}", :class => 'submit_element')
|
55
|
-
end
|
1
|
+
class ComfortableMexicanSofa::FormBuilder < FormattedForm::FormBuilder
|
56
2
|
|
57
3
|
# -- Tag Field Fields -----------------------------------------------------
|
58
|
-
def default_tag_field(tag, index, options = {})
|
59
|
-
|
4
|
+
def default_tag_field(tag, index, method = :text_field_tag, options = {})
|
5
|
+
|
60
6
|
label = tag.page.class.human_attribute_name(tag.identifier.to_s)
|
61
7
|
css_class = tag.class.to_s.demodulize.underscore
|
62
8
|
content = ''
|
63
9
|
|
64
|
-
input_class = case tag
|
65
|
-
when ComfortableMexicanSofa::Tag::PageDateTime, ComfortableMexicanSofa::Tag::FieldDateTime
|
66
|
-
'datetime'
|
67
|
-
when ComfortableMexicanSofa::Tag::PageText, ComfortableMexicanSofa::Tag::FieldText
|
68
|
-
'code'
|
69
|
-
when ComfortableMexicanSofa::Tag::PageRichText, ComfortableMexicanSofa::Tag::FieldRichText
|
70
|
-
'rich_text'
|
71
|
-
end
|
72
|
-
|
73
10
|
case method
|
74
11
|
when :file_field_tag
|
75
|
-
input_params = {:id => nil
|
76
|
-
input_params.merge!(:multiple => true) if options[:multiple]
|
12
|
+
input_params = {:id => nil}
|
77
13
|
name = "page[blocks_attributes][#{index}][content]"
|
78
|
-
|
14
|
+
|
15
|
+
if options.delete(:multiple)
|
16
|
+
input_params.merge!(:multiple => true)
|
17
|
+
name << '[]'
|
18
|
+
end
|
19
|
+
|
79
20
|
content << @template.send(method, name, input_params)
|
80
21
|
content << @template.render(:partial => 'cms_admin/files/page_form', :object => tag.block)
|
81
22
|
else
|
82
|
-
content << @template.send(method, "page[blocks_attributes][#{index}][content]", tag.content,
|
23
|
+
content << @template.send(method, "page[blocks_attributes][#{index}][content]", tag.content, options)
|
83
24
|
end
|
84
25
|
content << @template.hidden_field_tag("page[blocks_attributes][#{index}][identifier]", tag.identifier, :id => nil)
|
85
26
|
|
86
|
-
|
27
|
+
element(label, content.html_safe)
|
87
28
|
end
|
88
29
|
|
89
30
|
def field_date_time(tag, index)
|
90
|
-
default_tag_field(tag, index)
|
31
|
+
default_tag_field(tag, index, :text_field_tag, :data => {:datetime => true})
|
91
32
|
end
|
92
33
|
|
93
34
|
def field_integer(tag, index)
|
94
|
-
default_tag_field(tag, index, :
|
35
|
+
default_tag_field(tag, index, :number_field_tag)
|
95
36
|
end
|
96
37
|
|
97
38
|
def field_string(tag, index)
|
@@ -99,19 +40,19 @@ class ComfortableMexicanSofa::FormBuilder < ActionView::Helpers::FormBuilder
|
|
99
40
|
end
|
100
41
|
|
101
42
|
def field_text(tag, index)
|
102
|
-
default_tag_field(tag, index, :
|
43
|
+
default_tag_field(tag, index, :text_area_tag, :data => {:cm_mode => 'text/html'})
|
103
44
|
end
|
104
45
|
|
105
46
|
def field_rich_text(tag, index)
|
106
|
-
default_tag_field(tag, index, :
|
47
|
+
default_tag_field(tag, index, :text_area_tag, :data => {:rich_text => true})
|
107
48
|
end
|
108
49
|
|
109
50
|
def page_date_time(tag, index)
|
110
|
-
default_tag_field(tag, index)
|
51
|
+
default_tag_field(tag, index, :text_field_tag, :data => {:datetime => true})
|
111
52
|
end
|
112
53
|
|
113
54
|
def page_integer(tag, index)
|
114
|
-
default_tag_field(tag, index, :
|
55
|
+
default_tag_field(tag, index, :number_field_tag)
|
115
56
|
end
|
116
57
|
|
117
58
|
def page_string(tag, index)
|
@@ -119,19 +60,23 @@ class ComfortableMexicanSofa::FormBuilder < ActionView::Helpers::FormBuilder
|
|
119
60
|
end
|
120
61
|
|
121
62
|
def page_text(tag, index)
|
122
|
-
default_tag_field(tag, index, :
|
63
|
+
default_tag_field(tag, index, :text_area_tag, :data => {:cm_mode => 'text/html'})
|
123
64
|
end
|
124
65
|
|
125
66
|
def page_rich_text(tag, index)
|
126
|
-
default_tag_field(tag, index, :
|
67
|
+
default_tag_field(tag, index, :text_area_tag, :data => {:rich_text => true})
|
127
68
|
end
|
128
69
|
|
129
70
|
def page_file(tag, index)
|
130
|
-
default_tag_field(tag, index, :
|
71
|
+
default_tag_field(tag, index, :file_field_tag)
|
131
72
|
end
|
132
73
|
|
133
74
|
def page_files(tag, index)
|
134
|
-
default_tag_field(tag, index, :
|
75
|
+
default_tag_field(tag, index, :file_field_tag, :multiple => true)
|
76
|
+
end
|
77
|
+
|
78
|
+
def page_markdown(tag, index)
|
79
|
+
default_tag_field(tag, index, :text_area_tag, :data => {:cm_mode => 'text/x-markdown'})
|
135
80
|
end
|
136
81
|
|
137
82
|
def collection(tag, index)
|
@@ -146,7 +91,7 @@ class ComfortableMexicanSofa::FormBuilder < ActionView::Helpers::FormBuilder
|
|
146
91
|
:id => nil
|
147
92
|
)
|
148
93
|
content << @template.hidden_field_tag("page[blocks_attributes][#{index}][identifier]", tag.identifier, :id => nil)
|
149
|
-
|
94
|
+
element(tag.identifier.titleize, content, :class => tag.class.to_s.demodulize.underscore )
|
150
95
|
end
|
151
96
|
|
152
97
|
end
|
@@ -37,7 +37,7 @@ module ComfortableMexicanSofa::Tag
|
|
37
37
|
if match = tag_signature.match(regex_tag_signature)
|
38
38
|
|
39
39
|
params = begin
|
40
|
-
(CSV.parse_line(match[2].to_s,
|
40
|
+
(CSV.parse_line(match[2].to_s, :col_sep => ':') || []).compact
|
41
41
|
rescue
|
42
42
|
[]
|
43
43
|
end.map{|p| p.gsub(/\\|'/) { |c| "\\#{c}" } }
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class ComfortableMexicanSofa::Tag::PageMarkdown
|
2
|
+
include ComfortableMexicanSofa::Tag
|
3
|
+
|
4
|
+
def self.regex_tag_signature(identifier = nil)
|
5
|
+
identifier ||= IDENTIFIER_REGEX
|
6
|
+
/\{\{\s*cms:page:(#{identifier}):markdown\s*\}\}/
|
7
|
+
end
|
8
|
+
|
9
|
+
def content
|
10
|
+
block.content
|
11
|
+
end
|
12
|
+
|
13
|
+
def render
|
14
|
+
md = Redcarpet::Markdown.new(Redcarpet::Render::HTML,
|
15
|
+
:autolink => true,
|
16
|
+
:no_intra_emphasis => true,
|
17
|
+
:fenced_code_blocks => true,
|
18
|
+
:lax_spacing => true
|
19
|
+
)
|
20
|
+
md.render(content.to_s)
|
21
|
+
end
|
22
|
+
end
|