comfortable_mexican_sofa 1.9.3 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -6
- data/README.md +2 -2
- data/Rakefile +23 -2
- data/app/assets/javascripts/comfortable_mexican_sofa/application.js.coffee +7 -1
- data/app/assets/stylesheets/comfortable_mexican_sofa/application.css.sass +1 -1
- data/app/assets/stylesheets/comfortable_mexican_sofa/base.css.sass +7 -4
- data/app/controllers/{cms_admin → admin/cms}/base_controller.rb +6 -6
- data/app/controllers/{cms_admin → admin/cms}/categories_controller.rb +1 -1
- data/app/controllers/{cms_admin → admin/cms}/files_controller.rb +4 -4
- data/app/controllers/{cms_admin → admin/cms}/layouts_controller.rb +3 -3
- data/app/controllers/{cms_admin → admin/cms}/pages_controller.rb +3 -3
- data/app/controllers/{cms_admin → admin/cms}/revisions_controller.rb +8 -8
- data/app/controllers/{cms_admin → admin/cms}/sites_controller.rb +7 -7
- data/app/controllers/{cms_admin → admin/cms}/snippets_controller.rb +2 -2
- data/app/controllers/cms/base_controller.rb +30 -0
- data/app/controllers/{cms_content_controller.rb → cms/content_controller.rb} +2 -22
- data/app/models/cms/file.rb +1 -3
- data/app/models/cms/layout.rb +1 -1
- data/app/models/cms/snippet.rb +1 -3
- data/app/views/{cms_admin → admin/cms}/categories/_categories.html.haml +0 -0
- data/app/views/{cms_admin → admin/cms}/categories/_edit.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/categories/_form.html.haml +0 -0
- data/app/views/{cms_admin → admin/cms}/categories/_index.html.haml +3 -3
- data/app/views/{cms_admin → admin/cms}/categories/_show.html.haml +2 -2
- data/app/views/{cms_admin → admin/cms}/categories/create.js.erb +0 -0
- data/app/views/{cms_admin → admin/cms}/categories/destroy.js.erb +0 -0
- data/app/views/{cms_admin → admin/cms}/categories/edit.js.erb +0 -0
- data/app/views/{cms_admin → admin/cms}/categories/update.js.erb +0 -0
- data/app/views/{cms_admin → admin/cms}/files/_file.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/files/_form.html.haml +3 -3
- data/app/views/{cms_admin → admin/cms}/files/_index.html.haml +2 -2
- data/app/views/{cms_admin → admin/cms}/files/_page_form.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/files/destroy.js.coffee +0 -0
- data/app/views/{cms_admin → admin/cms}/files/edit.html.haml +0 -0
- data/app/views/{cms_admin → admin/cms}/files/index.html.haml +8 -8
- data/app/views/{cms_admin → admin/cms}/files/new.html.haml +0 -0
- data/app/views/{cms_admin → admin/cms}/layouts/_form.html.haml +3 -3
- data/app/views/{cms_admin → admin/cms}/layouts/_index_branch.html.haml +4 -4
- data/app/views/{cms_admin → admin/cms}/layouts/edit.html.haml +2 -2
- data/app/views/admin/cms/layouts/index.html.haml +13 -0
- data/app/views/{cms_admin → admin/cms}/layouts/new.html.haml +0 -0
- data/app/views/{cms_admin → admin/cms}/pages/_form.html.haml +10 -10
- data/app/views/{cms_admin → admin/cms}/pages/_form_blocks.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/pages/_index_branch.html.haml +6 -6
- data/app/views/{cms_admin → admin/cms}/pages/edit.html.haml +2 -2
- data/app/views/{cms_admin → admin/cms}/pages/form_blocks.js.erb +0 -0
- data/app/views/admin/cms/pages/index.html.haml +15 -0
- data/app/views/{cms_admin → admin/cms}/pages/new.html.haml +0 -0
- data/app/views/{cms_admin → admin/cms}/pages/toggle_branch.js.erb +0 -0
- data/app/views/{cms_admin → admin/cms}/partials/_body_before.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/partials/_file_form_after.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/partials/_file_form_before.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/partials/_files_after.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/partials/_files_before.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/partials/_html_footer.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/partials/_html_head.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/partials/_layout_form_after.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/partials/_layout_form_before.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/partials/_layouts_after.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/partials/_layouts_before.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/partials/_navigation_after.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/partials/_navigation_before.html.haml +1 -1
- data/app/views/admin/cms/partials/_navigation_inner.html.haml +3 -0
- data/app/views/{cms_admin → admin/cms}/partials/_page_form_after.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/partials/_page_form_before.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/partials/_page_form_inner.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/partials/_pages_after.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/partials/_pages_before.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/partials/_right_column_after.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/partials/_right_column_before.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/partials/_site_form_after.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/partials/_site_form_before.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/partials/_sites_after.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/partials/_sites_before.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/partials/_snippet_form_after.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/partials/_snippet_form_before.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/partials/_snippets_after.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/partials/_snippets_before.html.haml +1 -1
- data/app/views/{cms_admin → admin/cms}/revisions/show.html.haml +6 -4
- data/app/views/{cms_admin → admin/cms}/sites/_form.html.haml +2 -2
- data/app/views/admin/cms/sites/_mirrors.html.haml +18 -0
- data/app/views/{cms_admin → admin/cms}/sites/edit.html.haml +0 -0
- data/app/views/{cms_admin → admin/cms}/sites/index.html.haml +7 -7
- data/app/views/{cms_admin → admin/cms}/sites/new.html.haml +0 -0
- data/app/views/{cms_admin → admin/cms}/snippets/_form.html.haml +4 -4
- data/app/views/{cms_admin → admin/cms}/snippets/edit.html.haml +2 -2
- data/app/views/{cms_admin → admin/cms}/snippets/index.html.haml +9 -9
- data/app/views/{cms_admin → admin/cms}/snippets/new.html.haml +0 -0
- data/app/views/{cms_content → cms/content}/render_sitemap.xml.builder +1 -1
- data/app/views/kaminari/_first_page.html.haml +2 -0
- data/app/views/kaminari/_gap.html.haml +2 -0
- data/app/views/kaminari/_last_page.html.haml +2 -0
- data/app/views/kaminari/_next_page.html.haml +2 -0
- data/app/views/kaminari/_page.html.haml +2 -0
- data/app/views/kaminari/_paginator.html.haml +12 -0
- data/app/views/kaminari/_prev_page.html.haml +2 -0
- data/app/views/layouts/admin/cms.html.haml +4 -0
- data/app/views/layouts/admin/cms/_body.html.haml +17 -0
- data/app/views/layouts/{cms_admin → admin/cms}/_center.html.haml +0 -0
- data/app/views/layouts/{cms_admin → admin/cms}/_footer.html.haml +0 -0
- data/app/views/layouts/{cms_admin → admin/cms}/_footer_js.html.haml +2 -2
- data/app/views/layouts/{cms_admin → admin/cms}/_head.html.haml +1 -1
- data/app/views/layouts/admin/cms/_left.html.haml +16 -0
- data/app/views/layouts/admin/cms/_right.html.haml +5 -0
- data/comfortable_mexican_sofa.gemspec +12 -10
- data/config/database.yml +1 -1
- data/config/locales/de.yml +137 -136
- data/config/locales/en.yml +136 -135
- data/config/locales/es.yml +129 -128
- data/config/locales/fr.yml +129 -128
- data/config/locales/ja.yml +129 -128
- data/config/locales/pl.yml +129 -128
- data/config/locales/pt-BR.yml +129 -128
- data/config/locales/ru.yml +137 -136
- data/config/locales/sv.yml +129 -128
- data/config/locales/zh-CN.yml +138 -137
- data/lib/comfortable_mexican_sofa/engine.rb +2 -1
- data/lib/comfortable_mexican_sofa/fixture.rb +7 -0
- data/lib/comfortable_mexican_sofa/fixture/layout.rb +1 -1
- data/lib/comfortable_mexican_sofa/fixture/page.rb +2 -2
- data/lib/comfortable_mexican_sofa/fixture/snippet.rb +1 -1
- data/lib/comfortable_mexican_sofa/form_builder.rb +1 -1
- data/lib/comfortable_mexican_sofa/routing.rb +32 -30
- data/lib/comfortable_mexican_sofa/version.rb +1 -1
- data/lib/generators/comfy/cms/README +1 -1
- data/lib/generators/comfy/cms/cms_generator.rb +6 -6
- data/lib/generators/comfy/scaffold/scaffold_generator.rb +69 -0
- data/lib/generators/comfy/scaffold/templates/controller.rb +62 -0
- data/lib/generators/comfy/scaffold/templates/migration.rb +12 -0
- data/lib/generators/comfy/scaffold/templates/model.rb +21 -0
- data/lib/generators/comfy/scaffold/templates/tests/controller.rb +102 -0
- data/lib/generators/comfy/scaffold/templates/tests/fixture.yml +4 -0
- data/lib/generators/comfy/scaffold/templates/tests/model.rb +27 -0
- data/lib/generators/comfy/scaffold/templates/views/_form.haml +6 -0
- data/lib/generators/comfy/scaffold/templates/views/edit.haml +5 -0
- data/lib/generators/comfy/scaffold/templates/views/index.haml +23 -0
- data/lib/generators/comfy/scaffold/templates/views/new.haml +5 -0
- data/lib/generators/comfy/scaffold/templates/views/show.haml +4 -0
- data/test/controllers/{cms_admin → admin/cms}/base_controller_test.rb +3 -3
- data/test/controllers/{cms_admin → admin/cms}/categories_controller_test.rb +2 -2
- data/test/controllers/{cms_admin → admin/cms}/files_controller_test.rb +4 -4
- data/test/controllers/{cms_admin → admin/cms}/layouts_controller_test.rb +5 -5
- data/test/controllers/{cms_admin → admin/cms}/pages_controller_test.rb +9 -9
- data/test/controllers/{cms_admin → admin/cms}/revisions_controller_test.rb +9 -9
- data/test/controllers/{cms_admin → admin/cms}/sites_controller_test.rb +5 -5
- data/test/controllers/{cms_admin → admin/cms}/snippets_controller_test.rb +5 -5
- data/test/controllers/{cms_content_controller_test.rb → cms/content_controller_test.rb} +8 -9
- data/test/fixtures/generators/cms/routes.rb +8 -0
- data/test/fixtures/generators/scaffold/controller.rb +62 -0
- data/test/fixtures/generators/scaffold/migration.rb +10 -0
- data/test/fixtures/generators/scaffold/model.rb +21 -0
- data/test/fixtures/generators/scaffold/routes.rb +7 -0
- data/test/fixtures/generators/scaffold/tests/controller.rb +98 -0
- data/test/fixtures/generators/scaffold/tests/fixture +2 -0
- data/test/fixtures/generators/scaffold/tests/model.rb +25 -0
- data/test/fixtures/generators/scaffold/views/_form.haml +4 -0
- data/test/fixtures/generators/scaffold/views/edit.haml +5 -0
- data/test/fixtures/generators/scaffold/views/index.haml +19 -0
- data/test/fixtures/generators/scaffold/views/new.haml +5 -0
- data/test/fixtures/generators/scaffold/views/show.haml +4 -0
- data/test/gemfiles/Gemfile.rails.4.0 +2 -0
- data/test/generators/cms_generator_test.rb +23 -0
- data/test/generators/scaffold_generator_test.rb +31 -0
- data/test/integration/authentication_test.rb +6 -6
- data/test/integration/fixtures_test.rb +1 -1
- data/test/integration/mirrors_test.rb +12 -12
- data/test/integration/sites_test.rb +8 -8
- data/test/integration/view_hooks_test.rb +7 -7
- data/test/{models → lib}/configuration_test.rb +0 -0
- data/test/{models → lib}/fixtures/categories_test.rb +0 -0
- data/test/{models → lib}/fixtures/files_test.rb +0 -0
- data/test/{models → lib}/fixtures/layouts_test.rb +0 -0
- data/test/{models → lib}/fixtures/pages_test.rb +0 -0
- data/test/{models → lib}/fixtures/snippets_test.rb +0 -0
- data/test/{models → lib}/fixtures_test.rb +0 -0
- data/test/{models → lib}/mirrors_test.rb +0 -0
- data/test/{models → lib}/revisions_test.rb +0 -0
- data/test/{models → lib}/tag_test.rb +0 -0
- data/test/{models → lib}/tags/asset_test.rb +0 -0
- data/test/{models → lib}/tags/collection_test.rb +0 -0
- data/test/{models → lib}/tags/field_datetime_test.rb +0 -0
- data/test/{models → lib}/tags/field_integer_test.rb +0 -0
- data/test/{models → lib}/tags/field_rich_text_test.rb +0 -0
- data/test/{models → lib}/tags/field_string_test.rb +0 -0
- data/test/{models → lib}/tags/field_text_test.rb +0 -0
- data/test/{models → lib}/tags/file_test.rb +0 -0
- data/test/{models → lib}/tags/helper_test.rb +0 -0
- data/test/{models → lib}/tags/page_datetime_test.rb +0 -0
- data/test/{models → lib}/tags/page_file_test.rb +0 -0
- data/test/{models → lib}/tags/page_files_test.rb +0 -0
- data/test/{models → lib}/tags/page_integer_test.rb +0 -0
- data/test/{models → lib}/tags/page_markdown_test.rb +0 -0
- data/test/{models → lib}/tags/page_rich_text_test.rb +0 -0
- data/test/{models → lib}/tags/page_string_test.rb +0 -0
- data/test/{models → lib}/tags/page_text_test.rb +0 -0
- data/test/{models → lib}/tags/partial_test.rb +0 -0
- data/test/{models → lib}/tags/snippet_test.rb +0 -0
- data/test/{models → lib}/tags/template_test.rb +0 -0
- data/test/{models → lib}/view_methods_test.rb +0 -0
- data/test/models/{cms/block_test.rb → block_test.rb} +1 -1
- data/test/models/{cms/categorization_test.rb → categorization_test.rb} +1 -1
- data/test/models/{cms/category_test.rb → category_test.rb} +1 -1
- data/test/models/{cms/file_test.rb → file_test.rb} +2 -2
- data/test/models/{cms/layout_test.rb → layout_test.rb} +4 -4
- data/test/models/{cms/page_test.rb → page_test.rb} +1 -1
- data/test/models/{cms/site_test.rb → site_test.rb} +1 -1
- data/test/models/{cms/snippet_test.rb → snippet_test.rb} +1 -1
- data/test/test_helper.rb +30 -1
- metadata +204 -139
- data/app/assets/javascripts/comfortable_mexican_sofa/lib/codemirror.js +0 -10
- data/app/assets/stylesheets/comfortable_mexican_sofa/lib/codemirror.css +0 -240
- data/app/views/cms_admin/layouts/index.html.haml +0 -13
- data/app/views/cms_admin/pages/index.html.haml +0 -15
- data/app/views/cms_admin/partials/_navigation_inner.html.haml +0 -3
- data/app/views/cms_admin/sites/_mirrors.html.haml +0 -18
- data/app/views/layouts/cms_admin.html.haml +0 -4
- data/app/views/layouts/cms_admin/_body.html.haml +0 -17
- data/app/views/layouts/cms_admin/_left.html.haml +0 -16
- data/app/views/layouts/cms_admin/_right.html.haml +0 -5
data/.travis.yml
CHANGED
@@ -1,18 +1,14 @@
|
|
1
1
|
language: ruby
|
2
|
-
before_install:
|
3
|
-
- gem update --system
|
4
|
-
- gem --version
|
5
2
|
before_script:
|
6
3
|
- rake db:migrate
|
4
|
+
script:
|
5
|
+
- rake test:all
|
7
6
|
rvm:
|
8
7
|
- 1.9.3
|
9
8
|
- 2.0.0
|
10
9
|
- jruby-19mode
|
11
10
|
gemfile:
|
12
11
|
- test/gemfiles/Gemfile.rails.4.0
|
13
|
-
notifications:
|
14
|
-
recipients:
|
15
|
-
- oleg@khabarov.ca
|
16
12
|
branches:
|
17
13
|
only:
|
18
14
|
- master
|
data/README.md
CHANGED
@@ -19,7 +19,7 @@ Installation
|
|
19
19
|
Add gem definition to your Gemfile:
|
20
20
|
|
21
21
|
```ruby
|
22
|
-
gem 'comfortable_mexican_sofa', '~> 1.
|
22
|
+
gem 'comfortable_mexican_sofa', '~> 1.10.0'
|
23
23
|
```
|
24
24
|
|
25
25
|
Then from the Rails project's root run:
|
@@ -31,7 +31,7 @@ Then from the Rails project's root run:
|
|
31
31
|
Now take a look inside your `config/routes.rb` file. You'll see where routes attach for the admin area and content serving. Make sure that content serving route appears as a very last item.
|
32
32
|
|
33
33
|
```ruby
|
34
|
-
ComfortableMexicanSofa::Routing.admin :path => '/
|
34
|
+
ComfortableMexicanSofa::Routing.admin :path => '/admin'
|
35
35
|
ComfortableMexicanSofa::Routing.content :path => '/', :sitemap => false
|
36
36
|
```
|
37
37
|
|
data/Rakefile
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
-
|
1
|
+
require_relative 'config/application'
|
2
2
|
|
3
|
-
ComfortableMexicanSofa::Application.load_tasks
|
3
|
+
ComfortableMexicanSofa::Application.load_tasks
|
4
|
+
|
5
|
+
namespace :test do
|
6
|
+
|
7
|
+
Rake::TestTask.new(:lib) do |t|
|
8
|
+
t.libs << 'test'
|
9
|
+
t.pattern = 'test/lib/**/*_test.rb'
|
10
|
+
t.verbose = true
|
11
|
+
end
|
12
|
+
|
13
|
+
Rake::TestTask.new(:generators) do |t|
|
14
|
+
t.libs << 'test'
|
15
|
+
t.pattern = 'test/generators/**/*_test.rb'
|
16
|
+
t.verbose = true
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
Rake::Task[:test].enhance do
|
22
|
+
Rake::Task['test:lib'].invoke
|
23
|
+
Rake::Task['test:generators'].invoke
|
24
|
+
end
|
@@ -1,8 +1,14 @@
|
|
1
1
|
#= require jquery
|
2
2
|
#= require jquery_ujs
|
3
3
|
#= require jquery.ui.all
|
4
|
+
#= require codemirror
|
5
|
+
#= require codemirror/modes/css
|
6
|
+
#= require codemirror/modes/htmlmixed
|
7
|
+
#= require codemirror/modes/javascript
|
8
|
+
#= require codemirror/modes/markdown
|
9
|
+
#= require codemirror/modes/xml
|
10
|
+
#= require codemirror/addons/edit/closetag
|
4
11
|
#= require comfortable_mexican_sofa/lib/bootstrap
|
5
|
-
#= require comfortable_mexican_sofa/lib/codemirror
|
6
12
|
#= require comfortable_mexican_sofa/lib/wysihtml5
|
7
13
|
#= require comfortable_mexican_sofa/lib/bootstrap-wysihtml5
|
8
14
|
#= require comfortable_mexican_sofa/lib/bootstrap-datetimepicker
|
@@ -1,6 +1,6 @@
|
|
1
1
|
//= require jquery.ui.all
|
2
|
+
//= require codemirror
|
2
3
|
//= require comfortable_mexican_sofa/lib/bootstrap
|
3
|
-
//= require comfortable_mexican_sofa/lib/codemirror
|
4
4
|
//= require comfortable_mexican_sofa/lib/bootstrap-wysihtml5
|
5
5
|
//= require comfortable_mexican_sofa/lib/bootstrap-datetimepicker
|
6
6
|
//= require comfortable_mexican_sofa/bootstrap_overrides
|
@@ -170,11 +170,14 @@ body#comfy
|
|
170
170
|
|
171
171
|
.cms-partial
|
172
172
|
background-color: #252525
|
173
|
-
color: #
|
174
|
-
outline: 1px dotted #
|
173
|
+
color: #fff
|
174
|
+
outline: 1px dotted #444
|
175
175
|
font-size: 9px
|
176
|
-
|
177
|
-
|
176
|
+
line-height: 11px
|
177
|
+
padding: 5px
|
178
|
+
margin: 3px
|
179
|
+
background-image: linear-gradient(-45deg, rgba(255, 255, 255, .05) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .05) 50%, rgba(255, 255, 255, .05) 75%, transparent 75%, transparent)
|
180
|
+
background-size: 50px 50px
|
178
181
|
|
179
182
|
// -- Sofa Version --------------------------------------------------------
|
180
183
|
.center-column .body-footer
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class Admin::Cms::BaseController < ComfortableMexicanSofa.config.base_controller.to_s.constantize
|
2
2
|
|
3
3
|
protect_from_forgery
|
4
4
|
|
@@ -11,7 +11,7 @@ class CmsAdmin::BaseController < ComfortableMexicanSofa.config.base_controller.t
|
|
11
11
|
:load_fixtures,
|
12
12
|
:except => :jump
|
13
13
|
|
14
|
-
layout '
|
14
|
+
layout 'admin/cms'
|
15
15
|
|
16
16
|
if ComfortableMexicanSofa.config.admin_cache_sweeper.present?
|
17
17
|
cache_sweeper *ComfortableMexicanSofa.config.admin_cache_sweeper
|
@@ -21,18 +21,18 @@ class CmsAdmin::BaseController < ComfortableMexicanSofa.config.base_controller.t
|
|
21
21
|
path = ComfortableMexicanSofa.config.admin_route_redirect
|
22
22
|
return redirect_to(path) unless path.blank?
|
23
23
|
load_admin_site
|
24
|
-
redirect_to
|
24
|
+
redirect_to admin_cms_site_pages_path(@site) if @site
|
25
25
|
end
|
26
26
|
|
27
27
|
protected
|
28
28
|
|
29
29
|
def load_admin_site
|
30
|
-
if @site = Cms::Site.find_by_id(params[:site_id] || session[:site_id]) || Cms::Site.first
|
30
|
+
if @site = ::Cms::Site.find_by_id(params[:site_id] || session[:site_id]) || ::Cms::Site.first
|
31
31
|
session[:site_id] = @site.id
|
32
32
|
else
|
33
33
|
I18n.locale = ComfortableMexicanSofa.config.admin_locale || I18n.default_locale
|
34
34
|
flash[:error] = I18n.t('cms.base.site_not_found')
|
35
|
-
return redirect_to(
|
35
|
+
return redirect_to(new_admin_cms_site_path)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -43,7 +43,7 @@ protected
|
|
43
43
|
|
44
44
|
def load_fixtures
|
45
45
|
return unless ComfortableMexicanSofa.config.enable_fixtures
|
46
|
-
if %w(
|
46
|
+
if %w(admin/cms/layouts admin/cms/pages admin/cms/snippets).member?(params[:controller])
|
47
47
|
ComfortableMexicanSofa::Fixture::Importer.new(@site.identifier).import!
|
48
48
|
flash.now[:error] = I18n.t('cms.base.fixtures_enabled')
|
49
49
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class Admin::Cms::FilesController < Admin::Cms::BaseController
|
2
2
|
|
3
3
|
skip_before_action :load_fixtures
|
4
4
|
|
@@ -48,7 +48,7 @@ class CmsAdmin::FilesController < CmsAdmin::BaseController
|
|
48
48
|
end
|
49
49
|
|
50
50
|
if params[:ajax]
|
51
|
-
view = render_to_string(:partial => '
|
51
|
+
view = render_to_string(:partial => 'admin/cms/files/file', :collection => @files, :layout => false)
|
52
52
|
render :json => {:filelink => @file.file.url, :filename => @file.file_file_name, :view => view.gsub("\n", '')}
|
53
53
|
else
|
54
54
|
flash[:success] = I18n.t('cms.files.created')
|
@@ -88,8 +88,8 @@ class CmsAdmin::FilesController < CmsAdmin::BaseController
|
|
88
88
|
|
89
89
|
def reorder
|
90
90
|
(params[:cms_file] || []).each_with_index do |id, index|
|
91
|
-
if (cms_file = Cms::File.find_by_id(id))
|
92
|
-
cms_file.
|
91
|
+
if (cms_file = ::Cms::File.find_by_id(id))
|
92
|
+
cms_file.update_column(:position, index)
|
93
93
|
end
|
94
94
|
end
|
95
95
|
render :nothing => true
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class Admin::Cms::LayoutsController < Admin::Cms::BaseController
|
2
2
|
|
3
3
|
before_action :build_layout, :only => [:new, :create]
|
4
4
|
before_action :load_layout, :only => [:edit, :update, :destroy]
|
@@ -44,7 +44,7 @@ class CmsAdmin::LayoutsController < CmsAdmin::BaseController
|
|
44
44
|
|
45
45
|
def reorder
|
46
46
|
(params[:cms_layout] || []).each_with_index do |id, index|
|
47
|
-
Cms::Layout.where(:id => id).update_all(:position => index)
|
47
|
+
::Cms::Layout.where(:id => id).update_all(:position => index)
|
48
48
|
end
|
49
49
|
render :nothing => true
|
50
50
|
end
|
@@ -53,7 +53,7 @@ protected
|
|
53
53
|
|
54
54
|
def build_layout
|
55
55
|
@layout = @site.layouts.new(layout_params)
|
56
|
-
@layout.parent ||= Cms::Layout.find_by_id(params[:parent_id])
|
56
|
+
@layout.parent ||= ::Cms::Layout.find_by_id(params[:parent_id])
|
57
57
|
@layout.app_layout ||= @layout.parent.try(:app_layout)
|
58
58
|
@layout.content ||= '{{ cms:page:content:text }}'
|
59
59
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class Admin::Cms::PagesController < Admin::Cms::BaseController
|
2
2
|
|
3
3
|
before_action :check_for_layouts, :only => [:new, :edit]
|
4
4
|
before_action :build_cms_page, :only => [:new, :create]
|
@@ -67,7 +67,7 @@ class CmsAdmin::PagesController < CmsAdmin::BaseController
|
|
67
67
|
|
68
68
|
def reorder
|
69
69
|
(params[:cms_page] || []).each_with_index do |id, index|
|
70
|
-
Cms::Page.where(:id => id).update_all(:position => index)
|
70
|
+
::Cms::Page.where(:id => id).update_all(:position => index)
|
71
71
|
end
|
72
72
|
render :nothing => true
|
73
73
|
end
|
@@ -77,7 +77,7 @@ protected
|
|
77
77
|
def check_for_layouts
|
78
78
|
if @site.layouts.count == 0
|
79
79
|
flash[:error] = I18n.t('cms.pages.layout_not_found')
|
80
|
-
redirect_to
|
80
|
+
redirect_to new_admin_cms_site_layout_path(@site)
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class Admin::Cms::RevisionsController < Admin::Cms::BaseController
|
2
2
|
|
3
3
|
before_action :load_record
|
4
4
|
before_action :load_revision, :except => :index
|
@@ -28,15 +28,15 @@ protected
|
|
28
28
|
|
29
29
|
def load_record
|
30
30
|
@record = if params[:layout_id]
|
31
|
-
Cms::Layout.find(params[:layout_id])
|
31
|
+
::Cms::Layout.find(params[:layout_id])
|
32
32
|
elsif params[:page_id]
|
33
|
-
Cms::Page.find(params[:page_id])
|
33
|
+
::Cms::Page.find(params[:page_id])
|
34
34
|
elsif params[:snippet_id]
|
35
|
-
Cms::Snippet.find(params[:snippet_id])
|
35
|
+
::Cms::Snippet.find(params[:snippet_id])
|
36
36
|
end
|
37
37
|
rescue ActiveRecord::RecordNotFound
|
38
38
|
flash[:error] = I18n.t('cms.revisions.record_not_found')
|
39
|
-
redirect_to
|
39
|
+
redirect_to admin_cms_path
|
40
40
|
end
|
41
41
|
|
42
42
|
def load_revision
|
@@ -48,9 +48,9 @@ protected
|
|
48
48
|
|
49
49
|
def redirect_to_record
|
50
50
|
redirect_to case @record
|
51
|
-
when Cms::Layout then
|
52
|
-
when Cms::Page then
|
53
|
-
when Cms::Snippet then
|
51
|
+
when ::Cms::Layout then edit_admin_cms_site_layout_path(@site, @record)
|
52
|
+
when ::Cms::Page then edit_admin_cms_site_page_path(@site, @record)
|
53
|
+
when ::Cms::Snippet then edit_admin_cms_site_snippet_path(@site, @record)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class Admin::Cms::SitesController < Admin::Cms::BaseController
|
2
2
|
|
3
3
|
skip_before_action :load_admin_site,
|
4
4
|
:load_fixtures
|
@@ -7,9 +7,9 @@ class CmsAdmin::SitesController < CmsAdmin::BaseController
|
|
7
7
|
before_action :load_site, :only => [:edit, :update, :destroy]
|
8
8
|
|
9
9
|
def index
|
10
|
-
return redirect_to :action => :new if Cms::Site.count == 0
|
11
|
-
@site = Cms::Site.find_by_id(session[:site_id])
|
12
|
-
@sites ||= Cms::Site.all
|
10
|
+
return redirect_to :action => :new if ::Cms::Site.count == 0
|
11
|
+
@site = ::Cms::Site.find_by_id(session[:site_id])
|
12
|
+
@sites ||= ::Cms::Site.all
|
13
13
|
end
|
14
14
|
|
15
15
|
def new
|
@@ -23,7 +23,7 @@ class CmsAdmin::SitesController < CmsAdmin::BaseController
|
|
23
23
|
def create
|
24
24
|
@site.save!
|
25
25
|
flash[:success] = I18n.t('cms.sites.created')
|
26
|
-
redirect_to
|
26
|
+
redirect_to admin_cms_site_layouts_path(@site)
|
27
27
|
rescue ActiveRecord::RecordInvalid
|
28
28
|
logger.detailed_error($!)
|
29
29
|
flash.now[:error] = I18n.t('cms.sites.creation_failure')
|
@@ -49,12 +49,12 @@ class CmsAdmin::SitesController < CmsAdmin::BaseController
|
|
49
49
|
protected
|
50
50
|
|
51
51
|
def build_site
|
52
|
-
@site = Cms::Site.new(site_params)
|
52
|
+
@site = ::Cms::Site.new(site_params)
|
53
53
|
@site.hostname ||= request.host.downcase
|
54
54
|
end
|
55
55
|
|
56
56
|
def load_site
|
57
|
-
@site = Cms::Site.find(params[:id])
|
57
|
+
@site = ::Cms::Site.find(params[:id])
|
58
58
|
I18n.locale = ComfortableMexicanSofa.config.admin_locale || @site.locale
|
59
59
|
rescue ActiveRecord::RecordNotFound
|
60
60
|
flash[:error] = I18n.t('cms.sites.not_found')
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class Admin::Cms::SnippetsController < Admin::Cms::BaseController
|
2
2
|
|
3
3
|
before_action :build_snippet, :only => [:new, :create]
|
4
4
|
before_action :load_snippet, :only => [:edit, :update, :destroy]
|
@@ -44,7 +44,7 @@ class CmsAdmin::SnippetsController < CmsAdmin::BaseController
|
|
44
44
|
|
45
45
|
def reorder
|
46
46
|
(params[:cms_snippet] || []).each_with_index do |id, index|
|
47
|
-
Cms::Snippet.where(:id => id).update_all(:position => index)
|
47
|
+
::Cms::Snippet.where(:id => id).update_all(:position => index)
|
48
48
|
end
|
49
49
|
render :nothing => true
|
50
50
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class Cms::BaseController < ApplicationController
|
2
|
+
|
3
|
+
before_action :load_cms_site
|
4
|
+
|
5
|
+
protected
|
6
|
+
|
7
|
+
def load_cms_site
|
8
|
+
@cms_site ||= if params[:site_id]
|
9
|
+
::Cms::Site.find_by_id(params[:site_id])
|
10
|
+
else
|
11
|
+
::Cms::Site.find_site(request.host_with_port.downcase, request.fullpath)
|
12
|
+
end
|
13
|
+
|
14
|
+
if @cms_site
|
15
|
+
if @cms_site.path.present?
|
16
|
+
if params[:cms_path] && params[:cms_path].match(/\A#{@cms_site.path}/)
|
17
|
+
params[:cms_path].gsub!(/\A#{@cms_site.path}/, '')
|
18
|
+
params[:cms_path] && params[:cms_path].gsub!(/\A\//, '')
|
19
|
+
else
|
20
|
+
raise ActionController::RoutingError.new('Site Not Found')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
I18n.locale = @cms_site.locale
|
24
|
+
else
|
25
|
+
I18n.locale = I18n.default_locale
|
26
|
+
raise ActionController::RoutingError.new('Site Not Found')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -1,10 +1,9 @@
|
|
1
|
-
class
|
1
|
+
class Cms::ContentController < Cms::BaseController
|
2
2
|
|
3
3
|
# Authentication module must have #authenticate method
|
4
4
|
include ComfortableMexicanSofa.config.public_auth.to_s.constantize
|
5
5
|
|
6
|
-
before_action :
|
7
|
-
:load_fixtures
|
6
|
+
before_action :load_fixtures
|
8
7
|
before_action :load_cms_page,
|
9
8
|
:authenticate,
|
10
9
|
:only => :render_html
|
@@ -39,25 +38,6 @@ protected
|
|
39
38
|
ComfortableMexicanSofa::Fixture::Importer.new(@cms_site.identifier).import!
|
40
39
|
end
|
41
40
|
|
42
|
-
def load_cms_site
|
43
|
-
@cms_site ||= if params[:site_id]
|
44
|
-
Cms::Site.find_by_id(params[:site_id])
|
45
|
-
else
|
46
|
-
Cms::Site.find_site(request.host_with_port.downcase, request.fullpath)
|
47
|
-
end
|
48
|
-
|
49
|
-
if @cms_site
|
50
|
-
if params[:cms_path].present?
|
51
|
-
params[:cms_path].gsub!(/^#{@cms_site.path}/, '')
|
52
|
-
params[:cms_path].to_s.gsub!(/^\//, '')
|
53
|
-
end
|
54
|
-
I18n.locale = @cms_site.locale
|
55
|
-
else
|
56
|
-
I18n.locale = I18n.default_locale
|
57
|
-
raise ActionController::RoutingError.new('Site Not Found')
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
41
|
def load_cms_page
|
62
42
|
@cms_page = @cms_site.pages.published.find_by_full_path!("/#{params[:cms_path]}")
|
63
43
|
return redirect_to(@cms_page.target_page.url) if @cms_page.target_page
|
data/app/models/cms/file.rb
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
class Cms::File < ActiveRecord::Base
|
2
2
|
include Cms::Base
|
3
3
|
|
4
|
-
IMAGE_MIMETYPES = %w(gif jpeg pjpeg png
|
4
|
+
IMAGE_MIMETYPES = %w(gif jpeg pjpeg png tiff).collect{|subtype| "image/#{subtype}"}
|
5
5
|
|
6
6
|
cms_is_categorized
|
7
7
|
|
8
8
|
attr_accessor :dimensions
|
9
9
|
|
10
|
-
# -- AR Extensions --------------------------------------------------------
|
11
10
|
has_attached_file :file, ComfortableMexicanSofa.config.upload_file_options.merge(
|
12
11
|
# dimensions accessor needs to be set before file assignment for this to work
|
13
12
|
:styles => lambda { |f|
|
@@ -57,7 +56,6 @@ protected
|
|
57
56
|
self.position = max ? max + 1 : 0
|
58
57
|
end
|
59
58
|
|
60
|
-
# FIX: Terrible, but no way of creating cached page content overwise
|
61
59
|
def reload_page_cache
|
62
60
|
return unless self.block
|
63
61
|
p = self.block.page
|
data/app/models/cms/layout.rb
CHANGED
@@ -81,7 +81,7 @@ protected
|
|
81
81
|
|
82
82
|
# Forcing page content reload
|
83
83
|
def clear_cached_page_content
|
84
|
-
self.pages.
|
84
|
+
Cms::Page.where(:id => self.pages.pluck(:id)).update_all(:content => nil)
|
85
85
|
self.children.each{ |child_layout| child_layout.clear_cached_page_content }
|
86
86
|
end
|
87
87
|
|
data/app/models/cms/snippet.rb
CHANGED