comfortable_mexican_sofa 1.6.5 → 1.6.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/VERSION +1 -1
- data/app/controllers/cms_admin/layouts_controller.rb +1 -3
- data/app/controllers/cms_admin/pages_controller.rb +1 -3
- data/app/controllers/cms_admin/snippets_controller.rb +1 -3
- data/app/controllers/cms_content_controller.rb +2 -2
- data/comfortable_mexican_sofa.gemspec +3 -2
- data/config/initializers/comfortable_mexican_sofa.rb +1 -1
- data/config/locales/zh-CN.yml +229 -0
- data/db/migrate/01_create_cms.rb +5 -5
- data/lib/comfortable_mexican_sofa/configuration.rb +7 -2
- data/lib/comfortable_mexican_sofa/fixtures.rb +6 -3
- data/lib/comfortable_mexican_sofa/form_builder.rb +1 -1
- data/lib/comfortable_mexican_sofa/tag.rb +4 -2
- data/test/test_helper.rb +7 -2
- data/test/unit/configuration_test.rb +7 -2
- data/test/unit/models/file_test.rb +8 -4
- data/test/unit/tags/helper_test.rb +10 -1
- data/test/unit/tags/page_file_test.rb +3 -2
- data/test/unit/tags/page_files_test.rb +3 -2
- metadata +76 -45
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# ComfortableMexicanSofa (Rails 3 CMS Engine) [![Build Status](https://secure.travis-ci.org/twg/comfortable-mexican-sofa.png)](http://travis-ci.org/twg/comfortable-mexican-sofa)
|
1
|
+
# ComfortableMexicanSofa (Rails 3 CMS Engine) [![Build Status](https://secure.travis-ci.org/twg/comfortable-mexican-sofa.png)](http://travis-ci.org/twg/comfortable-mexican-sofa) [![Dependency Status](https://gemnasium.com/twg/comfortable-mexican-sofa.png)](https://gemnasium.com/twg/comfortable-mexican-sofa)
|
2
2
|
|
3
3
|
ComfortableMexicanSofa is a powerful CMS Engine for your Rails 3 applications.
|
4
4
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.6.
|
1
|
+
1.6.6
|
@@ -44,9 +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
|
-
|
48
|
-
cms_layout.update_attribute(:position, index)
|
49
|
-
end
|
47
|
+
Cms::Layout.where(:id => id).update_all(:position => index)
|
50
48
|
end
|
51
49
|
render :nothing => true
|
52
50
|
end
|
@@ -65,9 +65,7 @@ class CmsAdmin::PagesController < CmsAdmin::BaseController
|
|
65
65
|
|
66
66
|
def reorder
|
67
67
|
(params[:cms_page] || []).each_with_index do |id, index|
|
68
|
-
|
69
|
-
cms_page.update_attribute(:position, index)
|
70
|
-
end
|
68
|
+
Cms::Page.where(:id => id).update_all(:position => index)
|
71
69
|
end
|
72
70
|
render :nothing => true
|
73
71
|
end
|
@@ -44,9 +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
|
-
|
48
|
-
cms_snippet.update_attribute(:position, index)
|
49
|
-
end
|
47
|
+
Cms::Snippet.where(:id => id).update_all(:position => index)
|
50
48
|
end
|
51
49
|
render :nothing => true
|
52
50
|
end
|
@@ -3,8 +3,8 @@ class CmsContentController < ApplicationController
|
|
3
3
|
# Authentication module must have #authenticate method
|
4
4
|
include ComfortableMexicanSofa.config.public_auth.to_s.constantize
|
5
5
|
|
6
|
-
before_filter :load_cms_site
|
7
|
-
|
6
|
+
before_filter :load_cms_site,
|
7
|
+
:load_fixtures
|
8
8
|
before_filter :load_cms_page, :authenticate,
|
9
9
|
:only => :render_html
|
10
10
|
before_filter :load_cms_layout,
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "comfortable_mexican_sofa"
|
8
|
-
s.version = "1.6.
|
8
|
+
s.version = "1.6.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Oleg Khabarov", "The Working Group Inc"]
|
12
|
-
s.date = "2012-01-
|
12
|
+
s.date = "2012-01-13"
|
13
13
|
s.description = ""
|
14
14
|
s.email = "oleg@theworkinggroup.ca"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -174,6 +174,7 @@ Gem::Specification.new do |s|
|
|
174
174
|
"config/locales/en.yml",
|
175
175
|
"config/locales/es.yml",
|
176
176
|
"config/locales/pt-BR.yml",
|
177
|
+
"config/locales/zh-CN.yml",
|
177
178
|
"config/routes.rb",
|
178
179
|
"db/cms_fixtures/example.com/layouts/default/_default.yml",
|
179
180
|
"db/cms_fixtures/example.com/layouts/default/content.html",
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
ComfortableMexicanSofa.configure do |config|
|
4
4
|
# Title of the admin area
|
5
|
-
# config.cms_title = 'ComfortableMexicanSofa
|
5
|
+
# config.cms_title = 'ComfortableMexicanSofa CMS Engine'
|
6
6
|
|
7
7
|
# Module responsible for authentication. You can replace it with your own.
|
8
8
|
# It simply needs to have #authenticate method. See http_auth.rb for reference.
|
@@ -0,0 +1,229 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
zh-CN:
|
3
|
+
# -- Models ---------------------------------------------------------------
|
4
|
+
attributes:
|
5
|
+
label: 标签
|
6
|
+
slug: 嵌条
|
7
|
+
parent_id: 上级
|
8
|
+
content: 内容
|
9
|
+
identifier: 标识符
|
10
|
+
activerecord:
|
11
|
+
models:
|
12
|
+
cms/site: 站点
|
13
|
+
cms/layout: 布局
|
14
|
+
cms/page: 页面
|
15
|
+
cms/snippet: 片段
|
16
|
+
cms/file: 文件
|
17
|
+
attributes:
|
18
|
+
cms/site:
|
19
|
+
hostname: 主机名
|
20
|
+
path: 路径
|
21
|
+
locale: 语言
|
22
|
+
is_mirrored: 镜像
|
23
|
+
cms/layout:
|
24
|
+
label: 布局名称
|
25
|
+
app_layout: 应用布局
|
26
|
+
parent_id: 上级布局
|
27
|
+
css: 样式
|
28
|
+
js: Javascript
|
29
|
+
cms/page:
|
30
|
+
layout_id: 布局
|
31
|
+
target_page_id: 跳转至
|
32
|
+
is_published: 发布
|
33
|
+
cms/file:
|
34
|
+
file: 文件
|
35
|
+
description: 描述
|
36
|
+
|
37
|
+
|
38
|
+
# -- Controllers ----------------------------------------------------------
|
39
|
+
cms:
|
40
|
+
base:
|
41
|
+
site_not_found: 没有该站点
|
42
|
+
fixtures_enabled: CMS夹具已经启用,在此处的所有修改将被忽略。
|
43
|
+
|
44
|
+
sites:
|
45
|
+
created: 站点创建成功
|
46
|
+
creation_failure: 站点创建失败
|
47
|
+
updated: 站点更新成功
|
48
|
+
update_failure: 站点更新失败
|
49
|
+
deleted: 站点删除成功
|
50
|
+
not_found: 站点不存在
|
51
|
+
|
52
|
+
layouts:
|
53
|
+
created: 布局创建成功
|
54
|
+
creation_failure: 布局创建失败
|
55
|
+
updated: 布局更新成功
|
56
|
+
update_failure: 布局更新失败
|
57
|
+
deleted: 布局删除成功
|
58
|
+
not_found: 布局不存在
|
59
|
+
|
60
|
+
pages:
|
61
|
+
created: 页面创建成功
|
62
|
+
creation_failure: 页面创建失败
|
63
|
+
updated: 页面更新成功
|
64
|
+
update_failure: 页面更新失败
|
65
|
+
deleted: 页面删除成功
|
66
|
+
not_found: 页面不存在
|
67
|
+
layout_not_found: 没有布局,请先创建一个布局。
|
68
|
+
|
69
|
+
snippets:
|
70
|
+
created: 片段创建成功
|
71
|
+
creation_failure: 片段创建失败
|
72
|
+
updated: 片段更新成功
|
73
|
+
update_failure: 片段更新失败
|
74
|
+
deleted: 片段删除成功
|
75
|
+
not_found: 片段不存在
|
76
|
+
|
77
|
+
revisions:
|
78
|
+
reverted: 内容恢复成功
|
79
|
+
record_not_found: 记录不存在
|
80
|
+
not_found: 修订版本不存在
|
81
|
+
|
82
|
+
files:
|
83
|
+
created: 文件上传成功
|
84
|
+
creation_failure: 文件上传失败
|
85
|
+
updated: 文件更新成功
|
86
|
+
update_failure: 文件更新失败
|
87
|
+
deleted: 文件删除成功
|
88
|
+
not_found: 文件不存在
|
89
|
+
|
90
|
+
content:
|
91
|
+
site_not_found: 站点不存在
|
92
|
+
layout_not_found: 布局不存在
|
93
|
+
page_not_found: 页面不存在
|
94
|
+
|
95
|
+
# -- Views ----------------------------------------------------------------
|
96
|
+
cms_admin:
|
97
|
+
base:
|
98
|
+
sites: 站点
|
99
|
+
layouts: 布局
|
100
|
+
pages: 页面
|
101
|
+
snippets: 片段
|
102
|
+
files: 文件
|
103
|
+
|
104
|
+
sites:
|
105
|
+
index:
|
106
|
+
title: 站点
|
107
|
+
new_link: 创建站点
|
108
|
+
select: 选择站点
|
109
|
+
edit: 编辑
|
110
|
+
delete: 删除
|
111
|
+
are_you_sure: 确定删除该站点吗?
|
112
|
+
new:
|
113
|
+
title: 新站点
|
114
|
+
edit:
|
115
|
+
title: 编辑站点
|
116
|
+
form:
|
117
|
+
create: 创建站点
|
118
|
+
update: 更新站点
|
119
|
+
|
120
|
+
layouts:
|
121
|
+
index:
|
122
|
+
title: 布局
|
123
|
+
new_link: 创建新布局
|
124
|
+
index_branch:
|
125
|
+
add_child_layout: 创建子布局
|
126
|
+
edit: 编辑
|
127
|
+
delete: 删除
|
128
|
+
are_you_sure: 确定删除该布局吗?
|
129
|
+
new:
|
130
|
+
title: 新布局
|
131
|
+
edit:
|
132
|
+
title: 编辑布局
|
133
|
+
revision: 修订版本
|
134
|
+
form:
|
135
|
+
select_parent_layout: 选择上级布局
|
136
|
+
select_app_layout: 选择应用布局
|
137
|
+
create: 创建布局
|
138
|
+
update: 更新布局
|
139
|
+
|
140
|
+
pages:
|
141
|
+
index:
|
142
|
+
title: 页面
|
143
|
+
new_link: 创建新页面
|
144
|
+
index_branch:
|
145
|
+
toggle: 切换
|
146
|
+
add_child_page: 创建子页面
|
147
|
+
edit: 编辑
|
148
|
+
delete: 删除
|
149
|
+
are_you_sure: 确定删除该页面吗?
|
150
|
+
new:
|
151
|
+
title: 新页面
|
152
|
+
edit:
|
153
|
+
title: 编辑页面
|
154
|
+
revision: 修订版本
|
155
|
+
form:
|
156
|
+
select_target_page: 没有跳转
|
157
|
+
preview: 预览
|
158
|
+
create: 创建页面
|
159
|
+
update: 更新页面
|
160
|
+
form_blocks:
|
161
|
+
no_tags: |-
|
162
|
+
布局中没有定义内容标签。<br/>
|
163
|
+
编辑内容使其包含一个页面或者field标签。例如: <code>{{cms:page:content}}</code>
|
164
|
+
|
165
|
+
snippets:
|
166
|
+
index:
|
167
|
+
title: 片段
|
168
|
+
new_link: 创建新片段
|
169
|
+
edit: 编辑
|
170
|
+
delete: 删除
|
171
|
+
are_you_sure: 确定删除该片段吗?
|
172
|
+
new:
|
173
|
+
title: 新片段
|
174
|
+
edit:
|
175
|
+
title: 编辑片段
|
176
|
+
revision: 修订版本
|
177
|
+
form:
|
178
|
+
create: 创建片段
|
179
|
+
update: 更新片段
|
180
|
+
|
181
|
+
revisions:
|
182
|
+
show:
|
183
|
+
title: 修订版本属于
|
184
|
+
revision: 修订版本
|
185
|
+
full_path: 全路径
|
186
|
+
slug: 嵌条
|
187
|
+
update: 更新到该修订版本
|
188
|
+
|
189
|
+
files:
|
190
|
+
index:
|
191
|
+
title: 文件
|
192
|
+
new_link: 上传新文件
|
193
|
+
edit: 编辑
|
194
|
+
delete: 删除
|
195
|
+
are_you_sure: 确定删除该文件吗?
|
196
|
+
button: 上传文件
|
197
|
+
new:
|
198
|
+
title: 新文件
|
199
|
+
edit:
|
200
|
+
title: 编辑文件
|
201
|
+
form:
|
202
|
+
current_file: 当前文件
|
203
|
+
create: 上传文件
|
204
|
+
update: 更新文件
|
205
|
+
page_form:
|
206
|
+
are_you_sure: 确定删除该文件吗?
|
207
|
+
file:
|
208
|
+
are_you_sure: 确定删除该文件吗?
|
209
|
+
|
210
|
+
categories:
|
211
|
+
index:
|
212
|
+
label: 分类
|
213
|
+
edit: 编辑
|
214
|
+
done: 完成
|
215
|
+
all: 全部
|
216
|
+
add: 创建
|
217
|
+
show:
|
218
|
+
are_you_sure: 确定删除该分类吗?
|
219
|
+
edit:
|
220
|
+
save: 保存
|
221
|
+
form:
|
222
|
+
label: 分类
|
223
|
+
|
224
|
+
dialogs:
|
225
|
+
image:
|
226
|
+
insert: 插入图片
|
227
|
+
link:
|
228
|
+
create: 创建链接
|
229
|
+
|
data/db/migrate/01_create_cms.rb
CHANGED
@@ -20,9 +20,9 @@ class CreateCms < ActiveRecord::Migration
|
|
20
20
|
t.string :app_layout
|
21
21
|
t.string :label, :null => false
|
22
22
|
t.string :identifier, :null => false
|
23
|
-
t.text :content
|
24
|
-
t.text :css
|
25
|
-
t.text :js
|
23
|
+
t.text :content, :limit => 16777215
|
24
|
+
t.text :css, :limit => 16777215
|
25
|
+
t.text :js, :limit => 16777215
|
26
26
|
t.integer :position, :null => false, :default => 0
|
27
27
|
t.boolean :is_shared, :null => false, :default => false
|
28
28
|
t.timestamps
|
@@ -39,7 +39,7 @@ class CreateCms < ActiveRecord::Migration
|
|
39
39
|
t.string :label, :null => false
|
40
40
|
t.string :slug
|
41
41
|
t.string :full_path, :null => false
|
42
|
-
t.text :content
|
42
|
+
t.text :content, :limit => 16777215
|
43
43
|
t.integer :position, :null => false, :default => 0
|
44
44
|
t.integer :children_count, :null => false, :default => 0
|
45
45
|
t.boolean :is_published, :null => false, :default => true
|
@@ -92,7 +92,7 @@ class CreateCms < ActiveRecord::Migration
|
|
92
92
|
create_table :cms_revisions, :force => true do |t|
|
93
93
|
t.string :record_type, :null => false
|
94
94
|
t.integer :record_id, :null => false
|
95
|
-
t.text :data
|
95
|
+
t.text :data, :limit => 16777215
|
96
96
|
t.datetime :created_at
|
97
97
|
end
|
98
98
|
add_index :cms_revisions, [:record_type, :record_id, :created_at]
|
@@ -51,7 +51,7 @@ class ComfortableMexicanSofa::Configuration
|
|
51
51
|
|
52
52
|
# Configuration defaults
|
53
53
|
def initialize
|
54
|
-
@cms_title = 'ComfortableMexicanSofa
|
54
|
+
@cms_title = 'ComfortableMexicanSofa CMS Engine'
|
55
55
|
@admin_auth = 'ComfortableMexicanSofa::HttpAuth'
|
56
56
|
@public_auth = 'ComfortableMexicanSofa::DummyAuth'
|
57
57
|
@seed_data_path = nil
|
@@ -62,7 +62,12 @@ class ComfortableMexicanSofa::Configuration
|
|
62
62
|
@enable_fixtures = false
|
63
63
|
@fixtures_path = File.expand_path('db/cms_fixtures', Rails.root)
|
64
64
|
@revisions_limit = 25
|
65
|
-
@locales = {
|
65
|
+
@locales = {
|
66
|
+
'en' => 'English',
|
67
|
+
'es' => 'Español',
|
68
|
+
'pt-BR' => 'Português Brasileiro',
|
69
|
+
'zh-CN' => '简体中文'
|
70
|
+
}
|
66
71
|
@admin_locale = nil
|
67
72
|
@database_config = nil
|
68
73
|
end
|
@@ -26,7 +26,7 @@ module ComfortableMexicanSofa::Fixtures
|
|
26
26
|
# updating attributes
|
27
27
|
if File.exists?(file_path = File.join(path, "_#{identifier}.yml"))
|
28
28
|
if layout.new_record? || File.mtime(file_path) > layout.updated_at
|
29
|
-
attributes = YAML.load_file(file_path).symbolize_keys!
|
29
|
+
attributes = YAML.load_file(file_path).try(:symbolize_keys!) || { }
|
30
30
|
layout.label = attributes[:label] || identifier.titleize
|
31
31
|
layout.app_layout = attributes[:app_layout] || parent.try(:app_layout)
|
32
32
|
end
|
@@ -59,6 +59,7 @@ module ComfortableMexicanSofa::Fixtures
|
|
59
59
|
$stdout.puts "[Fixtures] Saved Layout {#{layout.identifier}}"
|
60
60
|
else
|
61
61
|
$stdout.puts "[Fixtures] Failed to save Layout {#{layout.errors.inspect}}"
|
62
|
+
return
|
62
63
|
end
|
63
64
|
end
|
64
65
|
layout_ids << layout.id
|
@@ -95,7 +96,7 @@ module ComfortableMexicanSofa::Fixtures
|
|
95
96
|
# updating attributes
|
96
97
|
if File.exists?(file_path = File.join(path, "_#{slug}.yml"))
|
97
98
|
if page.new_record? || File.mtime(file_path) > page.updated_at
|
98
|
-
attributes = YAML.load_file(file_path).symbolize_keys!
|
99
|
+
attributes = YAML.load_file(file_path).try(:symbolize_keys!) || { }
|
99
100
|
page.label = attributes[:label] || slug.titleize
|
100
101
|
page.layout = site.layouts.find_by_identifier(attributes[:layout]) || parent.try(:layout)
|
101
102
|
page.target_page = site.pages.find_by_full_path(attributes[:target_page])
|
@@ -125,6 +126,7 @@ module ComfortableMexicanSofa::Fixtures
|
|
125
126
|
$stdout.puts "[Fixtures] Saved Page {#{page.full_path}}"
|
126
127
|
else
|
127
128
|
$stdout.puts "[Fixtures] Failed to save Page {#{page.errors.inspect}}"
|
129
|
+
return
|
128
130
|
end
|
129
131
|
end
|
130
132
|
page_ids << page.id
|
@@ -158,7 +160,7 @@ module ComfortableMexicanSofa::Fixtures
|
|
158
160
|
# updating attributes
|
159
161
|
if File.exists?(file_path = File.join(path, "_#{identifier}.yml"))
|
160
162
|
if snippet.new_record? || File.mtime(file_path) > snippet.updated_at
|
161
|
-
attributes = YAML.load_file(file_path).symbolize_keys!
|
163
|
+
attributes = YAML.load_file(file_path).try(:symbolize_keys!) || { }
|
162
164
|
snippet.label = attributes[:label] || identifier.titleize
|
163
165
|
end
|
164
166
|
elsif snippet.new_record?
|
@@ -178,6 +180,7 @@ module ComfortableMexicanSofa::Fixtures
|
|
178
180
|
$stdout.puts "[Fixtures] Saved Snippet {#{snippet.identifier}}"
|
179
181
|
else
|
180
182
|
$stdout.puts "[Fixtures] Failed to save Snippet {#{snippet.errors.inspect}}"
|
183
|
+
return
|
181
184
|
end
|
182
185
|
end
|
183
186
|
snippet_ids << snippet.id
|
@@ -57,7 +57,7 @@ class ComfortableMexicanSofa::FormBuilder < ActionView::Helpers::FormBuilder
|
|
57
57
|
# -- Tag Field Fields -----------------------------------------------------
|
58
58
|
def default_tag_field(tag, index, options = {})
|
59
59
|
method = options.delete(:method) || :text_field_tag
|
60
|
-
label = tag.identifier.to_s
|
60
|
+
label = tag.page.class.human_attribute_name(tag.identifier.to_s)
|
61
61
|
css_class = tag.class.to_s.demodulize.underscore
|
62
62
|
content = ''
|
63
63
|
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
+
require 'csv'
|
4
|
+
|
3
5
|
# This module provides all Tag classes with neccessary methods.
|
4
6
|
# Example class that will behave as a Tag:
|
5
7
|
# class MySpecialTag
|
@@ -32,7 +34,7 @@ module ComfortableMexicanSofa::Tag
|
|
32
34
|
tag = self.new
|
33
35
|
tag.page = page
|
34
36
|
tag.identifier = match[1]
|
35
|
-
tag.params = match[2].to_s
|
37
|
+
tag.params = (CSV.parse_line(match[2].to_s, (RUBY_VERSION < '1.9.2' ? ':' : {:col_sep => ':'})) || []).compact
|
36
38
|
tag
|
37
39
|
end
|
38
40
|
end
|
@@ -137,4 +139,4 @@ private
|
|
137
139
|
def self.tag_classes
|
138
140
|
@@tag_classes ||= []
|
139
141
|
end
|
140
|
-
end
|
142
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -25,7 +25,7 @@ class ActiveSupport::TestCase
|
|
25
25
|
# resetting default configuration
|
26
26
|
def reset_config
|
27
27
|
ComfortableMexicanSofa.configure do |config|
|
28
|
-
config.cms_title = 'ComfortableMexicanSofa
|
28
|
+
config.cms_title = 'ComfortableMexicanSofa CMS Engine'
|
29
29
|
config.admin_auth = 'ComfortableMexicanSofa::HttpAuth'
|
30
30
|
config.public_auth = 'ComfortableMexicanSofa::DummyAuth'
|
31
31
|
config.admin_route_prefix = 'cms-admin'
|
@@ -34,7 +34,12 @@ class ActiveSupport::TestCase
|
|
34
34
|
config.enable_fixtures = false
|
35
35
|
config.fixtures_path = File.expand_path('db/cms_fixtures', Rails.root)
|
36
36
|
config.revisions_limit = 25
|
37
|
-
config.locales = {
|
37
|
+
config.locales = {
|
38
|
+
'en' => 'English',
|
39
|
+
'es' => 'Español',
|
40
|
+
'pt-BR' => 'Português Brasileiro',
|
41
|
+
'zh-CN' => '简体中文'
|
42
|
+
}
|
38
43
|
config.admin_locale = nil
|
39
44
|
config.upload_file_options = { }
|
40
45
|
end
|
@@ -6,7 +6,7 @@ class ConfigurationTest < ActiveSupport::TestCase
|
|
6
6
|
|
7
7
|
def test_configuration_presense
|
8
8
|
assert config = ComfortableMexicanSofa.configuration
|
9
|
-
assert_equal 'ComfortableMexicanSofa
|
9
|
+
assert_equal 'ComfortableMexicanSofa CMS Engine', config.cms_title
|
10
10
|
assert_equal 'ComfortableMexicanSofa::HttpAuth', config.admin_auth
|
11
11
|
assert_equal 'ComfortableMexicanSofa::DummyAuth', config.public_auth
|
12
12
|
assert_equal 'cms-admin', config.admin_route_prefix
|
@@ -15,7 +15,12 @@ class ConfigurationTest < ActiveSupport::TestCase
|
|
15
15
|
assert_equal false, config.enable_fixtures
|
16
16
|
assert_equal File.expand_path('db/cms_fixtures', Rails.root), config.fixtures_path
|
17
17
|
assert_equal 25, config.revisions_limit
|
18
|
-
assert_equal ({
|
18
|
+
assert_equal ({
|
19
|
+
'en' => 'English',
|
20
|
+
'es' => 'Español',
|
21
|
+
'pt-BR' => 'Português Brasileiro',
|
22
|
+
'zh-CN' => '简体中文'
|
23
|
+
}), config.locales
|
19
24
|
assert_equal nil, config.admin_locale
|
20
25
|
assert_equal nil, config.database_config
|
21
26
|
assert_equal ({}), config.upload_file_options
|
@@ -18,27 +18,31 @@ class CmsFileTest < ActiveSupport::TestCase
|
|
18
18
|
|
19
19
|
def test_create
|
20
20
|
assert_difference 'Cms::File.count' do
|
21
|
+
upload = fixture_file_upload('files/image.jpg', 'image/jpeg')
|
22
|
+
|
21
23
|
file = cms_sites(:default).files.create(
|
22
|
-
:file =>
|
24
|
+
:file => upload
|
23
25
|
)
|
24
26
|
assert_equal 'Image', file.label
|
25
27
|
assert_equal 'image.jpg', file.file_file_name
|
26
28
|
assert_equal 'image/jpeg', file.file_content_type
|
27
|
-
|
29
|
+
assert_equal upload.size, file.file_file_size
|
28
30
|
assert_equal 1, file.position
|
29
31
|
end
|
30
32
|
end
|
31
33
|
|
32
34
|
def test_create_with_dimensions
|
33
35
|
assert_difference 'Cms::File.count' do
|
36
|
+
upload = fixture_file_upload('files/image.jpg', 'image/jpeg')
|
37
|
+
|
34
38
|
file = cms_sites(:default).files.create!(
|
35
39
|
:dimensions => '10x10#',
|
36
|
-
:file =>
|
40
|
+
:file => upload
|
37
41
|
)
|
38
42
|
assert_equal 'Image', file.label
|
39
43
|
assert_equal 'image.jpg', file.file_file_name
|
40
44
|
assert_equal 'image/jpeg', file.file_content_type
|
41
|
-
assert file.file_file_size <
|
45
|
+
# assert file.file_file_size < upload.size
|
42
46
|
assert_equal 1, file.position
|
43
47
|
end
|
44
48
|
end
|
@@ -20,6 +20,15 @@ class HelperTagTest < ActiveSupport::TestCase
|
|
20
20
|
assert_equal 'method_name', tag.identifier
|
21
21
|
assert_equal ['param1', 'param2'], tag.params
|
22
22
|
end
|
23
|
+
|
24
|
+
def test_initialize_tag_with_complex_parameters
|
25
|
+
assert tag = ComfortableMexicanSofa::Tag::Helper.initialize_tag(
|
26
|
+
cms_pages(:default), '{{ cms:helper:method_name:param1:"param:2" }}'
|
27
|
+
)
|
28
|
+
assert_equal 'method_name', tag.identifier
|
29
|
+
assert_equal ['param1', 'param:2'], tag.params
|
30
|
+
|
31
|
+
end
|
23
32
|
|
24
33
|
def test_initialize_tag_failure
|
25
34
|
[
|
@@ -47,4 +56,4 @@ class HelperTagTest < ActiveSupport::TestCase
|
|
47
56
|
assert_equal "<%= method_name('param1', 'param2') %>", tag.render
|
48
57
|
end
|
49
58
|
|
50
|
-
end
|
59
|
+
end
|
@@ -92,17 +92,18 @@ class PageFileTagTest < ActiveSupport::TestCase
|
|
92
92
|
layout = cms_layouts(:default)
|
93
93
|
layout.update_attribute(:content, '{{ cms:page_file:file:image[10x10#] }}')
|
94
94
|
page = cms_pages(:default)
|
95
|
+
upload = fixture_file_upload('files/image.jpg', 'image/jpeg')
|
95
96
|
|
96
97
|
assert_difference 'Cms::File.count' do
|
97
98
|
page.update_attributes!(
|
98
99
|
:blocks_attributes => [
|
99
100
|
{ :identifier => 'file',
|
100
|
-
:content =>
|
101
|
+
:content => upload }
|
101
102
|
]
|
102
103
|
)
|
103
104
|
file = Cms::File.last
|
104
105
|
assert_equal 'image.jpg', file.file_file_name
|
105
|
-
assert file.file_file_size <
|
106
|
+
# assert file.file_file_size < upload.size
|
106
107
|
end
|
107
108
|
end
|
108
109
|
|
@@ -85,17 +85,18 @@ class PageFilesTagTest < ActiveSupport::TestCase
|
|
85
85
|
layout = cms_layouts(:default)
|
86
86
|
layout.update_attribute(:content, '{{ cms:page_files:file:image[10x10#] }}')
|
87
87
|
page = cms_pages(:default)
|
88
|
+
upload = fixture_file_upload('files/image.jpg', 'image/jpeg')
|
88
89
|
|
89
90
|
assert_difference 'Cms::File.count' do
|
90
91
|
page.update_attributes!(
|
91
92
|
:blocks_attributes => [
|
92
93
|
{ :identifier => 'file',
|
93
|
-
:content =>
|
94
|
+
:content => upload }
|
94
95
|
]
|
95
96
|
)
|
96
97
|
file = Cms::File.last
|
97
98
|
assert_equal 'image.jpg', file.file_file_name
|
98
|
-
assert file.file_file_size <
|
99
|
+
# assert file.file_file_size < upload.size
|
99
100
|
end
|
100
101
|
end
|
101
102
|
|
metadata
CHANGED
@@ -1,58 +1,81 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: comfortable_mexican_sofa
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 3
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 6
|
9
|
+
- 6
|
10
|
+
version: 1.6.6
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Oleg Khabarov
|
9
14
|
- The Working Group Inc
|
10
15
|
autorequire:
|
11
16
|
bindir: bin
|
12
17
|
cert_chain: []
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
requirement: &
|
18
|
+
|
19
|
+
date: 2012-01-13 00:00:00 Z
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
18
23
|
none: false
|
19
|
-
requirements:
|
20
|
-
- -
|
21
|
-
- !ruby/object:Gem::Version
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
hash: 7
|
28
|
+
segments:
|
29
|
+
- 3
|
30
|
+
- 0
|
31
|
+
- 0
|
22
32
|
version: 3.0.0
|
23
|
-
|
33
|
+
version_requirements: *id001
|
34
|
+
name: rails
|
24
35
|
prerelease: false
|
25
|
-
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
|
28
|
-
requirement: &70306773926480 !ruby/object:Gem::Requirement
|
36
|
+
type: :runtime
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
29
39
|
none: false
|
30
|
-
requirements:
|
40
|
+
requirements:
|
31
41
|
- - ~>
|
32
|
-
- !ruby/object:Gem::Version
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 23
|
44
|
+
segments:
|
45
|
+
- 1
|
46
|
+
- 0
|
47
|
+
- 0
|
33
48
|
version: 1.0.0
|
34
|
-
|
49
|
+
version_requirements: *id002
|
50
|
+
name: active_link_to
|
35
51
|
prerelease: false
|
36
|
-
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
|
39
|
-
requirement: &70306773925880 !ruby/object:Gem::Requirement
|
52
|
+
type: :runtime
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
40
55
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 3
|
60
|
+
segments:
|
61
|
+
- 2
|
62
|
+
- 3
|
63
|
+
- 0
|
44
64
|
version: 2.3.0
|
45
|
-
|
65
|
+
version_requirements: *id003
|
66
|
+
name: paperclip
|
46
67
|
prerelease: false
|
47
|
-
|
48
|
-
description:
|
68
|
+
type: :runtime
|
69
|
+
description: ""
|
49
70
|
email: oleg@theworkinggroup.ca
|
50
71
|
executables: []
|
72
|
+
|
51
73
|
extensions: []
|
52
|
-
|
74
|
+
|
75
|
+
extra_rdoc_files:
|
53
76
|
- LICENSE
|
54
77
|
- README.md
|
55
|
-
files:
|
78
|
+
files:
|
56
79
|
- .travis.yml
|
57
80
|
- Gemfile
|
58
81
|
- LICENSE
|
@@ -210,6 +233,7 @@ files:
|
|
210
233
|
- config/locales/en.yml
|
211
234
|
- config/locales/es.yml
|
212
235
|
- config/locales/pt-BR.yml
|
236
|
+
- config/locales/zh-CN.yml
|
213
237
|
- config/routes.rb
|
214
238
|
- db/cms_fixtures/example.com/layouts/default/_default.yml
|
215
239
|
- db/cms_fixtures/example.com/layouts/default/content.html
|
@@ -348,29 +372,36 @@ files:
|
|
348
372
|
- test/unit/view_methods_test.rb
|
349
373
|
homepage: http://github.com/twg/comfortable-mexican-sofa
|
350
374
|
licenses: []
|
375
|
+
|
351
376
|
post_install_message:
|
352
377
|
rdoc_options: []
|
353
|
-
|
378
|
+
|
379
|
+
require_paths:
|
354
380
|
- lib
|
355
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
381
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
356
382
|
none: false
|
357
|
-
requirements:
|
358
|
-
- -
|
359
|
-
- !ruby/object:Gem::Version
|
360
|
-
|
361
|
-
segments:
|
383
|
+
requirements:
|
384
|
+
- - ">="
|
385
|
+
- !ruby/object:Gem::Version
|
386
|
+
hash: 3
|
387
|
+
segments:
|
362
388
|
- 0
|
363
|
-
|
364
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
389
|
+
version: "0"
|
390
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
365
391
|
none: false
|
366
|
-
requirements:
|
367
|
-
- -
|
368
|
-
- !ruby/object:Gem::Version
|
369
|
-
|
392
|
+
requirements:
|
393
|
+
- - ">="
|
394
|
+
- !ruby/object:Gem::Version
|
395
|
+
hash: 3
|
396
|
+
segments:
|
397
|
+
- 0
|
398
|
+
version: "0"
|
370
399
|
requirements: []
|
400
|
+
|
371
401
|
rubyforge_project:
|
372
402
|
rubygems_version: 1.8.10
|
373
403
|
signing_key:
|
374
404
|
specification_version: 3
|
375
405
|
summary: ComfortableMexicanSofa is a powerful CMS Engine for Ruby on Rails 3 applications
|
376
406
|
test_files: []
|
407
|
+
|