comfortable_mexican_sofa 1.6.3 → 1.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/app/controllers/cms_admin/base_controller.rb +1 -1
- data/app/models/cms/site.rb +6 -1
- data/app/views/cms_admin/pages/_form.html.erb +1 -1
- data/comfortable_mexican_sofa.gemspec +2 -2
- data/config/locales/pt-BR.yml +35 -35
- data/lib/comfortable_mexican_sofa/fixtures.rb +18 -9
- data/lib/comfortable_mexican_sofa/form_builder.rb +1 -1
- data/test/unit/fixtures_test.rb +14 -0
- data/test/unit/models/site_test.rb +6 -0
- metadata +9 -9
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.6.
|
|
1
|
+
1.6.4
|
|
@@ -32,8 +32,8 @@ protected
|
|
|
32
32
|
|
|
33
33
|
def load_fixtures
|
|
34
34
|
return unless ComfortableMexicanSofa.config.enable_fixtures
|
|
35
|
-
ComfortableMexicanSofa::Fixtures.import_all(@site.hostname)
|
|
36
35
|
if %w(cms_admin/layouts cms_admin/pages cms_admin/snippets).member?(params[:controller])
|
|
36
|
+
ComfortableMexicanSofa::Fixtures.import_all(@site.hostname)
|
|
37
37
|
flash.now[:error] = I18n.t('cms.base.fixtures_enabled')
|
|
38
38
|
end
|
|
39
39
|
end
|
data/app/models/cms/site.rb
CHANGED
|
@@ -12,7 +12,8 @@ class Cms::Site < ActiveRecord::Base
|
|
|
12
12
|
has_many :categories, :dependent => :destroy
|
|
13
13
|
|
|
14
14
|
# -- Callbacks ------------------------------------------------------------
|
|
15
|
-
before_validation :
|
|
15
|
+
before_validation :assign_identifier,
|
|
16
|
+
:assign_label
|
|
16
17
|
before_save :clean_path
|
|
17
18
|
|
|
18
19
|
# -- Validations ----------------------------------------------------------
|
|
@@ -47,6 +48,10 @@ class Cms::Site < ActiveRecord::Base
|
|
|
47
48
|
end
|
|
48
49
|
|
|
49
50
|
protected
|
|
51
|
+
|
|
52
|
+
def assign_identifier
|
|
53
|
+
self.identifier = self.identifier.blank?? self.hostname.try(:idify) : self.identifier
|
|
54
|
+
end
|
|
50
55
|
|
|
51
56
|
def assign_label
|
|
52
57
|
self.label = self.label.blank?? self.identifier.try(:titleize) : self.label
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
<%= form.text_field :slug, :id => 'slug' %>
|
|
17
17
|
<% end %>
|
|
18
18
|
<% if (options = Cms::Layout.options_for_select(@site)).present? %>
|
|
19
|
-
<%= form.select :layout_id, options, {}, 'data-url' => form_blocks_cms_admin_site_page_path(@site, @page.id.to_i)
|
|
19
|
+
<%= form.select :layout_id, options, {}, 'data-url' => form_blocks_cms_admin_site_page_path(@site, @page.id.to_i) %>
|
|
20
20
|
<% end %>
|
|
21
21
|
<% if (options = Cms::Page.options_for_select(@site, @page)).present? %>
|
|
22
22
|
<%= form.select :parent_id, options %>
|
|
@@ -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.4"
|
|
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 = "
|
|
12
|
+
s.date = "2012-01-03"
|
|
13
13
|
s.description = ""
|
|
14
14
|
s.email = "oleg@theworkinggroup.ca"
|
|
15
15
|
s.extra_rdoc_files = [
|
data/config/locales/pt-BR.yml
CHANGED
|
@@ -44,50 +44,50 @@ pt-BR:
|
|
|
44
44
|
fixtures_enabled: Os Fixtures do CMS estão ativados. Todas as mudanças feitas aqui serão descartadas.
|
|
45
45
|
|
|
46
46
|
sites:
|
|
47
|
-
created: Site criado
|
|
48
|
-
creation_failure: Não foi possível criar site
|
|
49
|
-
updated: Site atualizado
|
|
50
|
-
update_failure: Não foi possível atualizar site
|
|
51
|
-
deleted: Site excluído
|
|
52
|
-
not_found: Site não encontrado
|
|
47
|
+
created: Site criado com sucesso.
|
|
48
|
+
creation_failure: Não foi possível criar site.
|
|
49
|
+
updated: Site atualizado com sucesso.
|
|
50
|
+
update_failure: Não foi possível atualizar site.
|
|
51
|
+
deleted: Site excluído com sucesso.
|
|
52
|
+
not_found: Site não encontrado.
|
|
53
53
|
|
|
54
54
|
layouts:
|
|
55
|
-
created: Leiaute criado
|
|
56
|
-
creation_failure: Não foi possível criar leiaute
|
|
57
|
-
updated: Leiaute atualizado
|
|
58
|
-
update_failure: Não foi possível atualizar leiaute
|
|
59
|
-
deleted: Leiaute excluído
|
|
60
|
-
not_found: Leiaute não encontrado
|
|
55
|
+
created: Leiaute criado com sucesso.
|
|
56
|
+
creation_failure: Não foi possível criar leiaute.
|
|
57
|
+
updated: Leiaute atualizado com sucesso.
|
|
58
|
+
update_failure: Não foi possível atualizar leiaute.
|
|
59
|
+
deleted: Leiaute excluído com sucesso.
|
|
60
|
+
not_found: Leiaute não encontrado.
|
|
61
61
|
|
|
62
62
|
pages:
|
|
63
|
-
created: Página criada
|
|
64
|
-
creation_failure: Não foi possível criar página
|
|
65
|
-
updated: Página atualizada
|
|
66
|
-
update_failure: Não foi possível atualizar página
|
|
67
|
-
deleted: Página excluída
|
|
68
|
-
not_found: Página não encontrada
|
|
69
|
-
layout_not_found: "Nenhum leiaute encontrado. Por favor, crie um."
|
|
63
|
+
created: Página criada com sucesso.
|
|
64
|
+
creation_failure: Não foi possível criar página.
|
|
65
|
+
updated: Página atualizada com sucesso.
|
|
66
|
+
update_failure: Não foi possível atualizar página.
|
|
67
|
+
deleted: Página excluída com sucesso.
|
|
68
|
+
not_found: Página não encontrada.
|
|
69
|
+
layout_not_found: "Nenhum leiaute foi encontrado. Por favor, crie um."
|
|
70
70
|
|
|
71
71
|
snippets:
|
|
72
|
-
created: Fragmento criado
|
|
73
|
-
creation_failure: Não foi possível criar fragmento
|
|
74
|
-
updated: Fragmento atualizado
|
|
75
|
-
update_failure: Não foi possível atualizar fragmento
|
|
76
|
-
deleted: Fragmento excluído
|
|
77
|
-
not_found: Fragmento não encontrado
|
|
72
|
+
created: Fragmento criado com sucesso.
|
|
73
|
+
creation_failure: Não foi possível criar fragmento.
|
|
74
|
+
updated: Fragmento atualizado com sucesso.
|
|
75
|
+
update_failure: Não foi possível atualizar fragmento.
|
|
76
|
+
deleted: Fragmento excluído com sucesso.
|
|
77
|
+
not_found: Fragmento não encontrado.
|
|
78
78
|
|
|
79
79
|
revisions:
|
|
80
|
-
reverted: Conteúdo
|
|
81
|
-
record_not_found: Registro
|
|
82
|
-
not_found: Revisão
|
|
80
|
+
reverted: Conteúdo revertido com sucesso.
|
|
81
|
+
record_not_found: Registro não encontrado.
|
|
82
|
+
not_found: Revisão não encontrada.
|
|
83
83
|
|
|
84
84
|
files:
|
|
85
|
-
created: Arquivo enviado
|
|
86
|
-
creation_failure: Não foi possível enviar arquivo
|
|
87
|
-
updated: Arquivo atualizado
|
|
88
|
-
update_failure: Não foi possível atualizar arquivo
|
|
89
|
-
deleted: Arquivo excluído
|
|
90
|
-
not_found: Arquivo não encontrado
|
|
85
|
+
created: Arquivo enviado com sucesso.
|
|
86
|
+
creation_failure: Não foi possível enviar arquivo.
|
|
87
|
+
updated: Arquivo atualizado com sucesso.
|
|
88
|
+
update_failure: Não foi possível atualizar arquivo.
|
|
89
|
+
deleted: Arquivo excluído com sucesso.
|
|
90
|
+
not_found: Arquivo não encontrado.
|
|
91
91
|
|
|
92
92
|
content:
|
|
93
93
|
site_not_found: Site Não Encontrado
|
|
@@ -155,7 +155,7 @@ pt-BR:
|
|
|
155
155
|
title: Editando Página
|
|
156
156
|
revision: Revisão
|
|
157
157
|
form:
|
|
158
|
-
select_target_page:
|
|
158
|
+
select_target_page: Não Redirecionar
|
|
159
159
|
preview: Pré-visualização
|
|
160
160
|
create: Criar Página
|
|
161
161
|
update: Atualizar Página
|
|
@@ -15,7 +15,7 @@ module ComfortableMexicanSofa::Fixtures
|
|
|
15
15
|
def self.import_layouts(to_hostname, from_hostname = nil, path = nil, root = true, parent = nil, layout_ids = [])
|
|
16
16
|
site = Cms::Site.find_or_create_by_hostname(to_hostname)
|
|
17
17
|
unless path ||= find_fixtures_path((from_hostname || to_hostname), 'layouts')
|
|
18
|
-
$
|
|
18
|
+
$stdout.puts 'Cannot find Layout fixtures'
|
|
19
19
|
return
|
|
20
20
|
end
|
|
21
21
|
|
|
@@ -55,8 +55,11 @@ module ComfortableMexicanSofa::Fixtures
|
|
|
55
55
|
# saving
|
|
56
56
|
layout.parent = parent
|
|
57
57
|
if layout.changed?
|
|
58
|
-
layout.save
|
|
59
|
-
|
|
58
|
+
if layout.save
|
|
59
|
+
$stdout.puts "[Fixtures] Saved Layout {#{layout.identifier}}"
|
|
60
|
+
else
|
|
61
|
+
$stdout.puts "[Fixtures] Failed to save Layout {#{layout.errors.inspect}}"
|
|
62
|
+
end
|
|
60
63
|
end
|
|
61
64
|
layout_ids << layout.id
|
|
62
65
|
|
|
@@ -77,7 +80,7 @@ module ComfortableMexicanSofa::Fixtures
|
|
|
77
80
|
def self.import_pages(to_hostname, from_hostname = nil, path = nil, root = true, parent = nil, page_ids = [])
|
|
78
81
|
site = Cms::Site.find_or_create_by_hostname(to_hostname)
|
|
79
82
|
unless path ||= find_fixtures_path((from_hostname || to_hostname), 'pages')
|
|
80
|
-
$
|
|
83
|
+
$stdout.puts 'Cannot find Page fixtures'
|
|
81
84
|
return
|
|
82
85
|
end
|
|
83
86
|
|
|
@@ -118,8 +121,11 @@ module ComfortableMexicanSofa::Fixtures
|
|
|
118
121
|
# saving
|
|
119
122
|
page.blocks_attributes = blocks_attributes if blocks_attributes.present?
|
|
120
123
|
if page.changed? || blocks_attributes.present?
|
|
121
|
-
page.save
|
|
122
|
-
|
|
124
|
+
if page.save
|
|
125
|
+
$stdout.puts "[Fixtures] Saved Page {#{page.full_path}}"
|
|
126
|
+
else
|
|
127
|
+
$stdout.puts "[Fixtures] Failed to save Page {#{page.errors.inspect}}"
|
|
128
|
+
end
|
|
123
129
|
end
|
|
124
130
|
page_ids << page.id
|
|
125
131
|
|
|
@@ -140,7 +146,7 @@ module ComfortableMexicanSofa::Fixtures
|
|
|
140
146
|
def self.import_snippets(to_hostname, from_hostname = nil)
|
|
141
147
|
site = Cms::Site.find_or_create_by_hostname(to_hostname)
|
|
142
148
|
unless path = find_fixtures_path((from_hostname || to_hostname), 'snippets')
|
|
143
|
-
$stdout.puts 'Cannot find fixtures'
|
|
149
|
+
$stdout.puts 'Cannot find Snippet fixtures'
|
|
144
150
|
return
|
|
145
151
|
end
|
|
146
152
|
|
|
@@ -168,8 +174,11 @@ module ComfortableMexicanSofa::Fixtures
|
|
|
168
174
|
|
|
169
175
|
# saving
|
|
170
176
|
if snippet.changed?
|
|
171
|
-
snippet.save
|
|
172
|
-
|
|
177
|
+
if snippet.save
|
|
178
|
+
$stdout.puts "[Fixtures] Saved Snippet {#{snippet.identifier}}"
|
|
179
|
+
else
|
|
180
|
+
$stdout.puts "[Fixtures] Failed to save Snippet {#{snippet.errors.inspect}}"
|
|
181
|
+
end
|
|
173
182
|
end
|
|
174
183
|
snippet_ids << snippet.id
|
|
175
184
|
end
|
|
@@ -43,7 +43,7 @@ class ComfortableMexicanSofa::FormBuilder < ActionView::Helpers::FormBuilder
|
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
def label_for(field, options={})
|
|
46
|
-
label = options.delete(:label) || object.class.human_attribute_name(field).
|
|
46
|
+
label = options.delete(:label) || object.class.human_attribute_name(field).capitalize
|
|
47
47
|
for_value = options[:id] || "#{object_name}_#{field}"
|
|
48
48
|
%Q{<label for="#{for_value}">#{label}</label>}.html_safe
|
|
49
49
|
end
|
data/test/unit/fixtures_test.rb
CHANGED
|
@@ -208,6 +208,20 @@ class FixturesTest < ActiveSupport::TestCase
|
|
|
208
208
|
end
|
|
209
209
|
end
|
|
210
210
|
|
|
211
|
+
def test_import_all_with_no_site
|
|
212
|
+
cms_sites(:default).destroy
|
|
213
|
+
|
|
214
|
+
assert_difference 'Cms::Site.count', 1 do
|
|
215
|
+
assert_difference 'Cms::Layout.count', 2 do
|
|
216
|
+
assert_difference 'Cms::Page.count', 2 do
|
|
217
|
+
assert_difference 'Cms::Snippet.count', 1 do
|
|
218
|
+
ComfortableMexicanSofa::Fixtures.import_all('test.host', 'example.com')
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
end
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
|
|
211
225
|
def test_export_layouts
|
|
212
226
|
host_path = File.join(ComfortableMexicanSofa.config.fixtures_path, 'test.test')
|
|
213
227
|
layout_1_attr_path = File.join(host_path, 'layouts/nested/_nested.yml')
|
|
@@ -43,6 +43,12 @@ class CmsSiteTest < ActiveSupport::TestCase
|
|
|
43
43
|
assert s2.valid?
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
+
def test_identifier_assignment
|
|
47
|
+
site = Cms::Site.new(:hostname => 'my-site.host')
|
|
48
|
+
assert site.valid?
|
|
49
|
+
assert_equal 'my_site_host', site.identifier
|
|
50
|
+
end
|
|
51
|
+
|
|
46
52
|
def test_label_assignment
|
|
47
53
|
site = Cms::Site.new(:identifier => 'test', :hostname => 'my-site.host')
|
|
48
54
|
assert site.valid?
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: comfortable_mexican_sofa
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.6.
|
|
4
|
+
version: 1.6.4
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -10,11 +10,11 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date:
|
|
13
|
+
date: 2012-01-03 00:00:00.000000000Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: rails
|
|
17
|
-
requirement: &
|
|
17
|
+
requirement: &70105868102320 !ruby/object:Gem::Requirement
|
|
18
18
|
none: false
|
|
19
19
|
requirements:
|
|
20
20
|
- - ! '>='
|
|
@@ -22,10 +22,10 @@ dependencies:
|
|
|
22
22
|
version: 3.0.0
|
|
23
23
|
type: :runtime
|
|
24
24
|
prerelease: false
|
|
25
|
-
version_requirements: *
|
|
25
|
+
version_requirements: *70105868102320
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: active_link_to
|
|
28
|
-
requirement: &
|
|
28
|
+
requirement: &70105868101600 !ruby/object:Gem::Requirement
|
|
29
29
|
none: false
|
|
30
30
|
requirements:
|
|
31
31
|
- - ~>
|
|
@@ -33,10 +33,10 @@ dependencies:
|
|
|
33
33
|
version: 1.0.0
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
|
-
version_requirements: *
|
|
36
|
+
version_requirements: *70105868101600
|
|
37
37
|
- !ruby/object:Gem::Dependency
|
|
38
38
|
name: paperclip
|
|
39
|
-
requirement: &
|
|
39
|
+
requirement: &70105868100660 !ruby/object:Gem::Requirement
|
|
40
40
|
none: false
|
|
41
41
|
requirements:
|
|
42
42
|
- - ! '>='
|
|
@@ -44,7 +44,7 @@ dependencies:
|
|
|
44
44
|
version: 2.3.0
|
|
45
45
|
type: :runtime
|
|
46
46
|
prerelease: false
|
|
47
|
-
version_requirements: *
|
|
47
|
+
version_requirements: *70105868100660
|
|
48
48
|
description: ''
|
|
49
49
|
email: oleg@theworkinggroup.ca
|
|
50
50
|
executables: []
|
|
@@ -360,7 +360,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
360
360
|
version: '0'
|
|
361
361
|
segments:
|
|
362
362
|
- 0
|
|
363
|
-
hash:
|
|
363
|
+
hash: 3884986161663546839
|
|
364
364
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
365
365
|
none: false
|
|
366
366
|
requirements:
|