comfortable_mexican_sofa 1.5.11 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -2
- data/Gemfile +1 -1
- data/VERSION +1 -1
- data/app/assets/images/comfortable_mexican_sofa/checkerboard.gif +0 -0
- 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/x.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/application.js +28 -3
- data/app/assets/javascripts/comfortable_mexican_sofa/codemirror/codemirror.js +1 -1
- data/app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.codemirror.js +35 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.js +267 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.sofa_image.js +61 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/elrte/elrte.sofa_link.js +58 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/jquery.js +4 -18
- data/app/assets/stylesheets/comfortable_mexican_sofa/application.css +3 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/codemirror.css +6 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/content.css +0 -65
- data/app/assets/stylesheets/comfortable_mexican_sofa/dialogs.css +45 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/elrte.css +173 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/files.css +82 -0
- data/app/assets/stylesheets/comfortable_mexican_sofa/form.css +2 -2
- data/app/assets/stylesheets/comfortable_mexican_sofa/structure.css +1 -1
- data/app/assets/stylesheets/comfortable_mexican_sofa/widgets.css +14 -56
- data/app/controllers/cms_admin/categories_controller.rb +2 -2
- data/app/controllers/cms_admin/dialogs_controller.rb +13 -0
- data/app/controllers/cms_admin/files_controller.rb +4 -1
- data/app/controllers/cms_admin/revisions_controller.rb +2 -2
- data/app/controllers/cms_content_controller.rb +1 -1
- data/app/models/cms/block.rb +2 -2
- data/app/models/cms/category.rb +3 -0
- data/app/models/cms/file.rb +9 -1
- data/app/models/cms/layout.rb +2 -2
- data/app/models/cms/page.rb +7 -5
- data/app/models/cms/site.rb +10 -5
- data/app/models/cms/snippet.rb +5 -3
- data/app/views/cms_admin/categories/_form.html.erb +1 -1
- data/app/views/cms_admin/categories/_index.html.erb +2 -2
- data/app/views/cms_admin/dialogs/image.html.erb +7 -0
- data/app/views/cms_admin/dialogs/link.html.erb +5 -0
- data/app/views/cms_admin/files/_file.html.erb +17 -9
- data/app/views/cms_admin/files/_index.html.erb +8 -18
- data/app/views/cms_admin/files/create.js.erb +1 -1
- data/app/views/cms_admin/layouts/_form.html.erb +1 -1
- data/app/views/cms_admin/layouts/_index_branch.html.erb +1 -1
- data/app/views/cms_admin/pages/_form_blocks.html.erb +1 -1
- data/app/views/cms_admin/revisions/show.html.erb +1 -1
- data/app/views/cms_admin/sites/_form.html.erb +2 -1
- data/app/views/cms_admin/snippets/_form.html.erb +1 -1
- data/app/views/cms_admin/snippets/index.html.erb +1 -1
- data/app/views/layouts/cms_admin/_head.html.erb +7 -6
- data/comfortable_mexican_sofa.gemspec +46 -47
- data/config/initializers/paperclip.rb +0 -25
- data/config/locales/en.yml +6 -0
- data/config/locales/es.yml +6 -0
- data/config/routes.rb +3 -2
- data/db/migrate/01_create_cms.rb +37 -35
- data/db/migrate/upgrades/07_upgrade_to_1_6_0.rb +25 -0
- data/lib/comfortable_mexican_sofa/error.rb +4 -4
- data/lib/comfortable_mexican_sofa/extensions/is_categorized.rb +3 -1
- data/lib/comfortable_mexican_sofa/extensions/is_mirrored.rb +8 -8
- data/lib/comfortable_mexican_sofa/fixtures.rb +19 -19
- data/lib/comfortable_mexican_sofa/form_builder.rb +4 -4
- data/lib/comfortable_mexican_sofa/render_methods.rb +8 -8
- data/lib/comfortable_mexican_sofa/tag.rb +14 -13
- data/lib/comfortable_mexican_sofa/tags/asset.rb +6 -6
- data/lib/comfortable_mexican_sofa/tags/collection.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/field_datetime.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/field_integer.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/field_string.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/field_text.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/file.rb +5 -5
- data/lib/comfortable_mexican_sofa/tags/helper.rb +4 -4
- data/lib/comfortable_mexican_sofa/tags/page_datetime.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/page_file.rb +8 -6
- data/lib/comfortable_mexican_sofa/tags/page_files.rb +6 -4
- data/lib/comfortable_mexican_sofa/tags/page_integer.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/page_rich_text.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/page_string.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/page_text.rb +3 -3
- data/lib/comfortable_mexican_sofa/tags/partial.rb +4 -4
- data/lib/comfortable_mexican_sofa/tags/snippet.rb +5 -4
- data/lib/comfortable_mexican_sofa/view_methods.rb +6 -6
- data/test/fixtures/cms/blocks.yml +2 -2
- data/test/fixtures/cms/categories.yml +1 -0
- data/test/fixtures/cms/layouts.yml +3 -3
- data/test/fixtures/cms/revisions.yml +4 -4
- data/test/fixtures/cms/sites.yml +1 -0
- data/test/fixtures/cms/snippets.yml +1 -1
- data/test/fixtures/files/data.zip +0 -0
- data/test/functional/cms_admin/dialogs_controller_test.rb +24 -0
- data/test/functional/cms_admin/files_controller_test.rb +1 -1
- data/test/functional/cms_admin/layouts_controller_test.rb +7 -7
- data/test/functional/cms_admin/pages_controller_test.rb +34 -35
- data/test/functional/cms_admin/revisions_controller_test.rb +2 -2
- data/test/functional/cms_admin/sites_controller_test.rb +3 -2
- data/test/functional/cms_admin/snippets_controller_test.rb +8 -8
- data/test/functional/cms_content_controller_test.rb +10 -11
- data/test/gemfiles/{Gemfile.rails-3.0.10 → Gemfile.rails-3.0} +1 -1
- data/test/gemfiles/{Gemfile.rails-3.1.1 → Gemfile.rails-3.1} +1 -1
- data/test/integration/fixtures_test.rb +4 -4
- data/test/integration/mirrors_test.rb +1 -1
- data/test/integration/render_cms_test.rb +10 -10
- data/test/integration/sites_test.rb +3 -3
- data/test/test_helper.rb +3 -0
- data/test/unit/fixtures_test.rb +11 -11
- data/test/unit/mirrors_test.rb +25 -25
- data/test/unit/models/block_test.rb +29 -29
- data/test/unit/models/categorization_test.rb +1 -1
- data/test/unit/models/category_test.rb +2 -2
- data/test/unit/models/file_test.rb +18 -0
- data/test/unit/models/layout_test.rb +21 -18
- data/test/unit/models/page_test.rb +3 -3
- data/test/unit/models/site_test.rb +26 -17
- data/test/unit/models/snippet_test.rb +6 -6
- data/test/unit/revisions_test.rb +13 -13
- data/test/unit/tag_test.rb +39 -45
- data/test/unit/tags/asset_test.rb +1 -1
- data/test/unit/tags/collection_test.rb +12 -10
- data/test/unit/tags/field_datetime_test.rb +3 -3
- data/test/unit/tags/field_integer_test.rb +3 -3
- data/test/unit/tags/field_string_test.rb +4 -4
- data/test/unit/tags/field_text_test.rb +3 -3
- data/test/unit/tags/file_test.rb +1 -1
- data/test/unit/tags/helper_test.rb +3 -3
- data/test/unit/tags/page_datetime_test.rb +3 -3
- data/test/unit/tags/page_file_test.rb +7 -4
- data/test/unit/tags/page_files_test.rb +7 -4
- data/test/unit/tags/page_integer_test.rb +3 -3
- data/test/unit/tags/page_rich_text_test.rb +3 -3
- data/test/unit/tags/page_string_test.rb +3 -3
- data/test/unit/tags/page_text_test.rb +4 -4
- data/test/unit/tags/partial_test.rb +4 -4
- data/test/unit/tags/snippet_test.rb +3 -3
- metadata +51 -52
- data/app/assets/images/comfortable_mexican_sofa/wym_icons.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-blockquote.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-h1.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-h2.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-h3.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-h4.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-h5.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-h6.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-p.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/lbl-pre.png +0 -0
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/wymiframe.css +0 -52
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/iframe/default/wymiframe.html +0 -26
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/jquery.wymeditor.cms.js +0 -342
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/jquery.wymeditor.embed.js +0 -19
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/jquery.wymeditor.pack.js +0 -1
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/bg.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/ca.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/cs.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/cy.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/de.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/en.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/es.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/fa.js +0 -46
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/fi.js +0 -44
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/fr.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/gl.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/he.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/hr.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/hu.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/it.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/nb.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/nl.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/nn.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/pl.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/pt-br.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/pt.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/ru.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/sv.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/tr.js +0 -45
- data/app/assets/javascripts/comfortable_mexican_sofa/wymeditor/lang/zh_cn.js +0 -47
@@ -7,7 +7,7 @@
|
|
7
7
|
width: 117px;
|
8
8
|
float: left;
|
9
9
|
text-align: right;
|
10
|
-
font: 13px/19px 'Lucida Grande', 'Tahoma', serif;
|
10
|
+
font: 13px/19px 'Lucida Grande', 'Tahoma', sans-serif;
|
11
11
|
text-shadow: #fff 1px 1px;
|
12
12
|
padding: 0px 10px;
|
13
13
|
background-color: #f1f1f1;
|
@@ -169,7 +169,7 @@
|
|
169
169
|
padding: 3px 5px;
|
170
170
|
background-color: #484848;
|
171
171
|
border-radius: 3px;
|
172
|
-
font: 9px/14px 'Arial', serif;
|
172
|
+
font: 9px/14px 'Arial', sans-serif;
|
173
173
|
text-transform: uppercase;
|
174
174
|
color: #fff;
|
175
175
|
margin-bottom: 3px;
|
@@ -8,64 +8,22 @@
|
|
8
8
|
.ui-timepicker-div dl dd{ margin: -25px 10px 10px 65px; }
|
9
9
|
.ui-timepicker-div td { font-size: 90%; }
|
10
10
|
|
11
|
-
/* --
|
12
|
-
.
|
13
|
-
background: #f1f1f1;
|
14
|
-
border-radius: 3px;
|
15
|
-
padding: 3px;
|
16
|
-
}
|
17
|
-
.wym_box .wym_toolbar {
|
18
|
-
overflow: hidden;
|
19
|
-
margin-bottom: 2px;
|
20
|
-
}
|
21
|
-
.wym_box .wym_toolbar .wym_toolbar_section li:last-child a {
|
22
|
-
margin-right: 10px;
|
23
|
-
}
|
24
|
-
.wym_box .wym_toolbar a {
|
25
|
-
display: block;
|
26
|
-
float: left;
|
27
|
-
margin-right: 2px;
|
28
|
-
height: 20px;
|
29
|
-
width: 20px;
|
30
|
-
background: #fff url(/assets/comfortable_mexican_sofa/wym_icons.png) no-repeat;
|
31
|
-
border: 1px solid #fff;
|
32
|
-
border-radius: 3px;
|
33
|
-
text-indent: -9999px;
|
34
|
-
}
|
35
|
-
.wym_box .wym_toolbar a:hover {
|
36
|
-
border: 1px solid #d8d8d8;
|
37
|
-
}
|
38
|
-
.wym_box .wym_toolbar li.wym_containers_h2 a { background-position: -20px 0px }
|
39
|
-
.wym_box .wym_toolbar li.wym_containers_h3 a { background-position: -40px 0px }
|
40
|
-
.wym_box .wym_toolbar li.wym_containers_p a { background-position: -60px 0px }
|
41
|
-
.wym_box .wym_toolbar li.wym_containers_pre a { background-position: -80px 0px }
|
42
|
-
|
43
|
-
.wym_box .wym_toolbar li.wym_tools_strong a { background-position: -100px 0px }
|
44
|
-
.wym_box .wym_toolbar li.wym_tools_emphasis a { background-position: -120px 0px }
|
45
|
-
.wym_box .wym_toolbar li.wym_tools_ordered_list a { background-position: -140px 0px }
|
46
|
-
.wym_box .wym_toolbar li.wym_tools_unordered_list a { background-position: -160px 0px }
|
47
|
-
.wym_box .wym_toolbar li.wym_tools_table a { background-position: -180px 0px }
|
48
|
-
.wym_box .wym_toolbar li.wym_tools_link a { background-position: -200px 0px }
|
49
|
-
.wym_box .wym_toolbar li.wym_tools_unlink a { background-position: -220px 0px }
|
50
|
-
.wym_box .wym_toolbar li.wym_tools_image a { background-position: -240px 0px }
|
51
|
-
.wym_box .wym_toolbar li.wym_tools_paste a { background-position: -260px 0px }
|
52
|
-
.wym_box .wym_toolbar li.wym_tools_html a { background-position: -280px 0px }
|
53
|
-
|
54
|
-
.wym_box .wym_toolbar li.wym_classes_align_left a { background-position: -300px 0px }
|
55
|
-
.wym_box .wym_toolbar li.wym_classes_align_center a { background-position: -320px 0px }
|
56
|
-
.wym_box .wym_toolbar li.wym_classes_align_right a { background-position: -340px 0px }
|
57
|
-
|
58
|
-
.wym_box .wym_html,
|
59
|
-
.wym_box .wym_iframe {
|
11
|
+
/* -- elrte -------------------------------------------------------------- */
|
12
|
+
.el-dialogform-content iframe {
|
60
13
|
background: #fff;
|
61
|
-
border: 1px solid #d8d8d8;
|
62
14
|
}
|
63
|
-
.
|
64
|
-
|
15
|
+
.el-rte .toolbar ul li.sofa_image {
|
16
|
+
background-position: -384px -2px
|
17
|
+
}
|
18
|
+
.el-rte .toolbar ul li.sofa_link {
|
19
|
+
background-position:-244px -29px
|
65
20
|
}
|
66
|
-
.
|
67
|
-
|
68
|
-
|
69
|
-
width: 100%;
|
21
|
+
#cms_body .el-rte .toolbar ul li.formatblock h1,
|
22
|
+
#cms_body .el-rte .toolbar ul li.formatblock h2 {
|
23
|
+
font: normal 11px 'Trebuchet MS', Verdana, Geneva, sans-serif;
|
70
24
|
border: 0px;
|
25
|
+
padding: 0px;
|
26
|
+
margin: 0px;
|
27
|
+
letter-spacing: normal;
|
28
|
+
text-shadow: none;
|
71
29
|
}
|
@@ -7,7 +7,7 @@ class CmsAdmin::CategoriesController < CmsAdmin::BaseController
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def create
|
10
|
-
@category =
|
10
|
+
@category = @site.categories.create!(params[:category])
|
11
11
|
rescue ActiveRecord::RecordInvalid
|
12
12
|
logger.detailed_error($!)
|
13
13
|
render :nothing => true
|
@@ -27,7 +27,7 @@ class CmsAdmin::CategoriesController < CmsAdmin::BaseController
|
|
27
27
|
protected
|
28
28
|
|
29
29
|
def load_category
|
30
|
-
@category =
|
30
|
+
@category = @site.categories.find(params[:id])
|
31
31
|
rescue ActiveRecord::RecordNotFound
|
32
32
|
render :nothing => true
|
33
33
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CmsAdmin::DialogsController < CmsAdmin::BaseController
|
2
|
+
|
3
|
+
TEMPLATES = %w(image link)
|
4
|
+
|
5
|
+
def show
|
6
|
+
if template = TEMPLATES.include?(params[:type])? params[:type] : nil
|
7
|
+
render :template => "cms_admin/dialogs/#{template}", :layout => false
|
8
|
+
else
|
9
|
+
render :nothing => true
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
@@ -32,7 +32,10 @@ class CmsAdmin::FilesController < CmsAdmin::BaseController
|
|
32
32
|
redirect_to :action => :edit, :id => @file
|
33
33
|
end
|
34
34
|
format.js do
|
35
|
-
|
35
|
+
# FIX: No idea why this cannot be simulated in the test
|
36
|
+
io = Rails.env.test??
|
37
|
+
request.env['RAW_POST_DATA'].clone :
|
38
|
+
request.env['rack.input'].clone
|
36
39
|
io.class.class_eval { attr_accessor :original_filename, :content_type }
|
37
40
|
io.original_filename = request.env['HTTP_X_FILE_NAME']
|
38
41
|
io.content_type = request.env['CONTENT_TYPE']
|
@@ -10,8 +10,8 @@ class CmsAdmin::RevisionsController < CmsAdmin::BaseController
|
|
10
10
|
def show
|
11
11
|
case @record
|
12
12
|
when Cms::Page
|
13
|
-
@current_content = @record.blocks.inject({}){|c, b| c[b.
|
14
|
-
@versioned_content = @record.blocks.inject({}){|c, b| c[b.
|
13
|
+
@current_content = @record.blocks.inject({}){|c, b| c[b.identifier] = b.content; c }
|
14
|
+
@versioned_content = @record.blocks.inject({}){|c, b| c[b.identifier] = @revision.data['blocks_attributes'].detect{|r| r[:identifier] == b.identifier}.try(:[], :content); c }
|
15
15
|
else
|
16
16
|
@current_content = @record.revision_fields.inject({}){|c, f| c[f] = @record.send(f); c }
|
17
17
|
@versioned_content = @record.revision_fields.inject({}){|c, f| c[f] = @revision.data[f]; c }
|
@@ -65,7 +65,7 @@ protected
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def load_cms_layout
|
68
|
-
@cms_layout = @cms_site.layouts.
|
68
|
+
@cms_layout = @cms_site.layouts.find_by_identifier!(params[:identifier])
|
69
69
|
rescue ActiveRecord::RecordNotFound
|
70
70
|
render :nothing => true, :status => 404
|
71
71
|
end
|
data/app/models/cms/block.rb
CHANGED
@@ -14,14 +14,14 @@ class Cms::Block < ActiveRecord::Base
|
|
14
14
|
before_save :prepare_files
|
15
15
|
|
16
16
|
# -- Validations ----------------------------------------------------------
|
17
|
-
validates :
|
17
|
+
validates :identifier,
|
18
18
|
:presence => true,
|
19
19
|
:uniqueness => { :scope => :page_id }
|
20
20
|
|
21
21
|
# -- Instance Methods -----------------------------------------------------
|
22
22
|
# Tag object that is using this block
|
23
23
|
def tag
|
24
|
-
@tag ||= page.tags(true).detect{|t| t.is_cms_block? && t.
|
24
|
+
@tag ||= page.tags(true).detect{|t| t.is_cms_block? && t.identifier == identifier}
|
25
25
|
end
|
26
26
|
|
27
27
|
protected
|
data/app/models/cms/category.rb
CHANGED
@@ -5,10 +5,13 @@ class Cms::Category < ActiveRecord::Base
|
|
5
5
|
set_table_name :cms_categories
|
6
6
|
|
7
7
|
# -- Relationships --------------------------------------------------------
|
8
|
+
belongs_to :site
|
8
9
|
has_many :categorizations,
|
9
10
|
:dependent => :destroy
|
10
11
|
|
11
12
|
# -- Validations ----------------------------------------------------------
|
13
|
+
validates :site_id,
|
14
|
+
:presence => true
|
12
15
|
validates :label,
|
13
16
|
:presence => true,
|
14
17
|
:uniqueness => { :scope => :categorized_type }
|
data/app/models/cms/file.rb
CHANGED
@@ -14,9 +14,12 @@ class Cms::File < ActiveRecord::Base
|
|
14
14
|
has_attached_file :file, ComfortableMexicanSofa.config.upload_file_options.merge(
|
15
15
|
# dimensions accessor needs to be set before file assignment for this to work
|
16
16
|
:styles => lambda { |f|
|
17
|
-
f.instance.dimensions.blank?? { } : { :original => f.instance.dimensions }
|
17
|
+
(f.instance.dimensions.blank?? { } : { :original => f.instance.dimensions }).merge(
|
18
|
+
:cms_thumb => '80x60#'
|
19
|
+
)
|
18
20
|
}
|
19
21
|
)
|
22
|
+
before_post_process :is_image?
|
20
23
|
|
21
24
|
# -- Relationships --------------------------------------------------------
|
22
25
|
belongs_to :site
|
@@ -36,6 +39,11 @@ class Cms::File < ActiveRecord::Base
|
|
36
39
|
scope :images, where(:file_content_type => IMAGE_MIMETYPES)
|
37
40
|
scope :not_images, where('file_content_type NOT IN (?)', IMAGE_MIMETYPES)
|
38
41
|
|
42
|
+
# -- Instance Methods -----------------------------------------------------
|
43
|
+
def is_image?
|
44
|
+
IMAGE_MIMETYPES.include?(file_content_type)
|
45
|
+
end
|
46
|
+
|
39
47
|
protected
|
40
48
|
|
41
49
|
def assign_label
|
data/app/models/cms/layout.rb
CHANGED
@@ -23,7 +23,7 @@ class Cms::Layout < ActiveRecord::Base
|
|
23
23
|
:presence => true
|
24
24
|
validates :label,
|
25
25
|
:presence => true
|
26
|
-
validates :
|
26
|
+
validates :identifier,
|
27
27
|
:presence => true,
|
28
28
|
:uniqueness => { :scope => :site_id },
|
29
29
|
:format => { :with => /^\w[a-z0-9_-]*$/i }
|
@@ -73,7 +73,7 @@ class Cms::Layout < ActiveRecord::Base
|
|
73
73
|
protected
|
74
74
|
|
75
75
|
def assign_label
|
76
|
-
self.label = self.label.blank?? self.
|
76
|
+
self.label = self.label.blank?? self.identifier.try(:titleize) : self.label
|
77
77
|
end
|
78
78
|
|
79
79
|
def assign_position
|
data/app/models/cms/page.rb
CHANGED
@@ -70,22 +70,24 @@ class Cms::Page < ActiveRecord::Base
|
|
70
70
|
def blocks_attributes(was = false)
|
71
71
|
self.blocks.collect do |block|
|
72
72
|
block_attr = {}
|
73
|
-
block_attr[:
|
74
|
-
block_attr[:content]
|
73
|
+
block_attr[:identifier] = block.identifier
|
74
|
+
block_attr[:content] = was ? block.content_was : block.content
|
75
75
|
block_attr
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
79
|
# Array of block hashes in the following format:
|
80
80
|
# [
|
81
|
-
# { :
|
82
|
-
# { :
|
81
|
+
# { :identifier => 'block_1', :content => 'block content' },
|
82
|
+
# { :identifier => 'block_2', :content => 'block content' }
|
83
83
|
# ]
|
84
84
|
def blocks_attributes=(block_hashes = [])
|
85
85
|
block_hashes = block_hashes.values if block_hashes.is_a?(Hash)
|
86
86
|
block_hashes.each do |block_hash|
|
87
87
|
block_hash.symbolize_keys! unless block_hash.is_a?(HashWithIndifferentAccess)
|
88
|
-
block =
|
88
|
+
block =
|
89
|
+
self.blocks.detect{|b| b.identifier == block_hash[:identifier]} ||
|
90
|
+
self.blocks.build(:identifier => block_hash[:identifier])
|
89
91
|
block.content = block_hash[:content]
|
90
92
|
self.blocks_attributes_changed = self.blocks_attributes_changed || block.content_changed?
|
91
93
|
end
|
data/app/models/cms/site.rb
CHANGED
@@ -5,16 +5,21 @@ class Cms::Site < ActiveRecord::Base
|
|
5
5
|
set_table_name :cms_sites
|
6
6
|
|
7
7
|
# -- Relationships --------------------------------------------------------
|
8
|
-
has_many :layouts,
|
9
|
-
has_many :pages,
|
10
|
-
has_many :snippets,
|
11
|
-
has_many :files,
|
8
|
+
has_many :layouts, :dependent => :destroy
|
9
|
+
has_many :pages, :dependent => :destroy
|
10
|
+
has_many :snippets, :dependent => :destroy
|
11
|
+
has_many :files, :dependent => :destroy
|
12
|
+
has_many :categories, :dependent => :destroy
|
12
13
|
|
13
14
|
# -- Callbacks ------------------------------------------------------------
|
14
15
|
before_validation :assign_label
|
15
16
|
before_save :clean_path
|
16
17
|
|
17
18
|
# -- Validations ----------------------------------------------------------
|
19
|
+
validates :identifier,
|
20
|
+
:presence => true,
|
21
|
+
:uniqueness => true,
|
22
|
+
:format => { :with => /^\w[a-z0-9_-]*$/i }
|
18
23
|
validates :label,
|
19
24
|
:presence => true
|
20
25
|
validates :hostname,
|
@@ -44,7 +49,7 @@ class Cms::Site < ActiveRecord::Base
|
|
44
49
|
protected
|
45
50
|
|
46
51
|
def assign_label
|
47
|
-
self.label = self.label.blank?? self.
|
52
|
+
self.label = self.label.blank?? self.identifier.try(:titleize) : self.label
|
48
53
|
end
|
49
54
|
|
50
55
|
def clean_path
|
data/app/models/cms/snippet.rb
CHANGED
@@ -22,7 +22,7 @@ class Cms::Snippet < ActiveRecord::Base
|
|
22
22
|
:presence => true
|
23
23
|
validates :label,
|
24
24
|
:presence => true
|
25
|
-
validates :
|
25
|
+
validates :identifier,
|
26
26
|
:presence => true,
|
27
27
|
:uniqueness => { :scope => :site_id },
|
28
28
|
:format => { :with => /^\w[a-z0-9_-]*$/i }
|
@@ -33,14 +33,16 @@ class Cms::Snippet < ActiveRecord::Base
|
|
33
33
|
protected
|
34
34
|
|
35
35
|
def assign_label
|
36
|
-
self.label = self.label.blank?? self.
|
36
|
+
self.label = self.label.blank?? self.identifier.try(:titleize) : self.label
|
37
37
|
end
|
38
38
|
|
39
39
|
# Note: This might be slow. We have no idea where the snippet is used, so
|
40
40
|
# gotta reload every single page. Kinda sucks, but might be ok unless there
|
41
41
|
# are hundreds of pages.
|
42
42
|
def clear_cached_page_content
|
43
|
-
site.pages.all.each
|
43
|
+
site.pages.all.each do |p|
|
44
|
+
Cms::Page.where(:id => p.id).update_all(:content => p.content(true))
|
45
|
+
end
|
44
46
|
end
|
45
47
|
|
46
48
|
def assign_position
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<% object = form.object %>
|
2
|
-
<% if (categories =
|
2
|
+
<% if (categories = @site.categories.of_type(object.class.to_s)).present? %>
|
3
3
|
<%= form.simple_field t('.label'), nil, :class => 'categories' do %>
|
4
4
|
<% categories.each do |category| %>
|
5
5
|
<%= hidden_field_tag "#{object.class.to_s.demodulize.downcase}[category_ids][#{category.id}]", 0, :id => nil %>
|
@@ -11,13 +11,13 @@
|
|
11
11
|
<div class='category all <%= (params[:category].blank?? 'active' : nil ) %>'>
|
12
12
|
<%= link_to t('.all'), :category => nil %>
|
13
13
|
</div>
|
14
|
-
<%
|
14
|
+
<% @site.categories.of_type(type).each do |category| %>
|
15
15
|
<%= render :partial => 'cms_admin/categories/show', :object => category, :locals => { :read => true } %>
|
16
16
|
<% end %>
|
17
17
|
</div>
|
18
18
|
|
19
19
|
<div class='categories editable' style='display:none'>
|
20
|
-
<%
|
20
|
+
<% @site.categories.of_type(type).each do |category| %>
|
21
21
|
<%= render :partial => 'cms_admin/categories/show', :object => category %>
|
22
22
|
<% end %>
|
23
23
|
<div class='category new'>
|
@@ -1,10 +1,18 @@
|
|
1
|
-
<div class='file <%= dom_id(file) %>'>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
<div class='file <%= dom_id(file) %> <%= file.is_image?? 'image' : nil %>'>
|
2
|
+
|
3
|
+
<div class='file_name'>
|
4
|
+
<%= link_to file.file_file_name, file.file.url, :target => '_blank', :class => 'filename' %>
|
5
|
+
<%= link_to span_tag('x'), cms_admin_site_file_path(@site, file), :method => :delete, :remote => true, :confirm => t('.are_you_sure'), :class => 'delete' %>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<div class='file_info' data-url='<%= file.file.url %>'>
|
9
|
+
<div class='thumb'>
|
10
|
+
<%= image_tag file.file.url(:cms_thumb) if file.is_image? %>
|
11
|
+
</div>
|
12
|
+
<div class='details'>
|
13
|
+
<input type='text' value='<%= file.file.url %>'/>
|
14
|
+
<div class='file_type'><%= file.file_content_type %></div>
|
15
|
+
<div class='file_size'><%= number_to_human_size(file.file_file_size) %></div>
|
16
|
+
</div>
|
17
|
+
</div>
|
10
18
|
</div>
|
@@ -1,26 +1,16 @@
|
|
1
|
-
|
1
|
+
<% type ||= nil %>
|
2
|
+
<% files_scope = (type == 'image') ? @site.files.images : @site.files %>
|
3
|
+
|
4
|
+
<div class='box file_uploads'>
|
2
5
|
|
3
6
|
<%= form_for :file, :url => cms_admin_site_files_path(@site), :html => {:multipart => true} do |form| %>
|
4
7
|
<a id='uploader_button' href='#' class='big button'><%= t('.button') %></a>
|
5
|
-
<%= form.file_field :file, :multiple => true %>
|
8
|
+
<%= form.file_field :file, :multiple => true, :id => false %>
|
6
9
|
<% end %>
|
7
10
|
|
8
|
-
<div
|
9
|
-
<%
|
10
|
-
|
11
|
-
<h3>Images</h3>
|
12
|
-
<% images.each do |file| %>
|
13
|
-
<%= render :partial => 'cms_admin/files/file', :object => file %>
|
14
|
-
<% end %>
|
15
|
-
</div>
|
16
|
-
<% end %>
|
17
|
-
<% if (images = Cms::File.not_images.order(:label)).present? %>
|
18
|
-
<div class='section other'>
|
19
|
-
<h3>Files</h3>
|
20
|
-
<% images.each do |file| %>
|
21
|
-
<%= render :partial => 'cms_admin/files/file', :object => file %>
|
22
|
-
<% end %>
|
23
|
-
</div>
|
11
|
+
<div class='uploaded_files'>
|
12
|
+
<% files_scope.order(:label).each do |file| %>
|
13
|
+
<%= render :partial => 'cms_admin/files/file', :object => file %>
|
24
14
|
<% end %>
|
25
15
|
</div>
|
26
16
|
</div>
|