comfortable_mexican_sofa 1.12.0 → 1.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/app/assets/stylesheets/comfortable_mexican_sofa/base.css.sass +1 -0
- data/app/controllers/comfy/admin/cms/files_controller.rb +3 -4
- data/app/controllers/comfy/cms/assets_controller.rb +13 -2
- data/app/models/comfy/cms/file.rb +2 -1
- data/app/models/comfy/cms/layout.rb +4 -0
- data/comfortable_mexican_sofa.gemspec +4 -2
- data/config/locales/de.yml +109 -110
- data/config/locales/it.yml +48 -48
- data/db/upgrade_migrations/08_upgrade_to_1_12_0.rb +37 -1
- data/lib/comfortable_mexican_sofa/fixture.rb +1 -1
- data/lib/comfortable_mexican_sofa/fixture/file.rb +18 -3
- data/lib/comfortable_mexican_sofa/fixture/layout.rb +2 -2
- data/lib/comfortable_mexican_sofa/fixture/page.rb +2 -2
- data/lib/comfortable_mexican_sofa/fixture/snippet.rb +2 -2
- data/lib/comfortable_mexican_sofa/routes/cms.rb +2 -2
- data/lib/comfortable_mexican_sofa/routes/cms_admin.rb +1 -1
- data/lib/comfortable_mexican_sofa/tags/asset.rb +2 -2
- data/lib/comfortable_mexican_sofa/version.rb +1 -1
- data/test/controllers/comfy/admin/cms/files_controller_test.rb +3 -2
- data/test/controllers/comfy/cms/assets_controller_test.rb +29 -9
- data/test/integration/view_hooks_test.rb +4 -0
- data/test/lib/fixtures/files_test.rb +3 -1
- data/test/lib/tags/asset_test.rb +14 -8
- data/test/models/layout_test.rb +7 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1efe06b72526b07ed7ed92daf8463631749ea30e
|
4
|
+
data.tar.gz: c653f3eef4a9435c89734a0441440fd395cf6497
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f8e198df2b8e878d2ecc8652f11fc06567212ad56beba3fc65d682406359c9c0f2fa28571f05225dc5c0f2a70a77a5c74e2e0b5beb2102480e011608b329287
|
7
|
+
data.tar.gz: 20bd84f9d0b4673c7461299f835d26073911814c1015986fd4a6ecbb30d660ba7f99f51e57c8d7a9ac5398570043e650e49ce5c8b3a2bd5069800207a00d114e
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ ComfortableMexicanSofa is a powerful Rails 4 CMS Engine
|
|
9
9
|
* Build your application in Rails, not in CMS
|
10
10
|
* Powerful page templating capability using [Tags](https://github.com/comfy/comfortable-mexican-sofa/wiki/Tags)
|
11
11
|
* [Multiple Sites](https://github.com/comfy/comfortable-mexican-sofa/wiki/Sites) from a single installation
|
12
|
-
*
|
12
|
+
* Multi-Language Support (i18n) (da, de, en, es, fr, it, ja, nl, pl, pt-BR, ru, sv, zh-CN)
|
13
13
|
* [Fixtures](https://github.com/comfy/comfortable-mexican-sofa/wiki/Working-with-CMS-fixtures) for initial content population
|
14
14
|
* [Revision History](https://github.com/comfy/comfortable-mexican-sofa/wiki/Revisions)
|
15
15
|
* [Great extendable admin interface](https://github.com/comfy/comfortable-mexican-sofa/wiki/Reusing-sofa%27s-admin-area) built with [Bootstrap](http://twitter.github.com/bootstrap/), [CodeMirror](http://codemirror.net/) and [TinyMCE](http://www.tinymce.com/)
|
@@ -19,7 +19,7 @@ ComfortableMexicanSofa is a powerful Rails 4 CMS Engine
|
|
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.12.0'
|
23
23
|
```
|
24
24
|
|
25
25
|
Then from the Rails project's root run:
|
@@ -39,11 +39,10 @@ class Comfy::Admin::Cms::FilesController < Comfy::Admin::Cms::BaseController
|
|
39
39
|
label = (files.size > 1 && file_params[:label].present?) ?
|
40
40
|
"#{file_params[:label]} #{i + 1}" :
|
41
41
|
file_params[:label]
|
42
|
-
@file = @site.files.create!(
|
42
|
+
@file = @site.files.create!(file_params.except(:file, :label).merge(
|
43
43
|
:file => file,
|
44
|
-
:label => label
|
45
|
-
|
46
|
-
)
|
44
|
+
:label => label
|
45
|
+
))
|
47
46
|
@files << @file
|
48
47
|
end
|
49
48
|
|
@@ -1,16 +1,27 @@
|
|
1
1
|
class Comfy::Cms::AssetsController < Comfy::Cms::BaseController
|
2
|
+
|
3
|
+
skip_before_action :verify_authenticity_token
|
4
|
+
|
2
5
|
before_action :load_cms_layout
|
3
|
-
|
6
|
+
|
4
7
|
def render_css
|
5
8
|
render :text => @cms_layout.css, :content_type => 'text/css'
|
9
|
+
cache_control_header
|
6
10
|
end
|
7
11
|
|
8
12
|
def render_js
|
9
|
-
render :text => @cms_layout.js, :content_type => '
|
13
|
+
render :text => @cms_layout.js, :content_type => 'application/javascript'
|
14
|
+
cache_control_header
|
10
15
|
end
|
11
16
|
|
12
17
|
protected
|
13
18
|
|
19
|
+
def cache_control_header
|
20
|
+
if params[:cache_buster].present?
|
21
|
+
response.headers['Cache-Control'] = "public, max-age=#{1.year.to_i}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
14
25
|
def load_cms_layout
|
15
26
|
@cms_layout = @cms_site.layouts.find_by_identifier!(params[:identifier])
|
16
27
|
rescue ActiveRecord::RecordNotFound
|
@@ -27,7 +27,8 @@ class Comfy::Cms::File < ActiveRecord::Base
|
|
27
27
|
validates :site_id,
|
28
28
|
:presence => true
|
29
29
|
validates_attachment_presence :file
|
30
|
-
|
30
|
+
do_not_validate_attachment_file_type :file
|
31
|
+
|
31
32
|
validates :file_file_name,
|
32
33
|
:uniqueness => {:scope => [:site_id, :block_id]}
|
33
34
|
|
@@ -17,11 +17,13 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.platform = Gem::Platform::RUBY
|
18
18
|
s.require_paths = ['lib']
|
19
19
|
|
20
|
-
s.
|
20
|
+
s.required_ruby_version = '>= 1.9.3'
|
21
|
+
|
22
|
+
s.add_dependency 'rails', '>= 4.0.0'
|
21
23
|
s.add_dependency 'rails-i18n', '~> 4.0.0'
|
22
24
|
s.add_dependency 'bootstrap_form', '~> 2.1.1'
|
23
25
|
s.add_dependency 'active_link_to', '>= 1.0.0'
|
24
|
-
s.add_dependency 'paperclip', '>=
|
26
|
+
s.add_dependency 'paperclip', '>= 4.0.0'
|
25
27
|
s.add_dependency 'kramdown', '>= 1.0.0'
|
26
28
|
s.add_dependency 'jquery-rails', '>= 3.0.0'
|
27
29
|
s.add_dependency 'jquery-ui-rails', '>= 4.0.0'
|
data/config/locales/de.yml
CHANGED
@@ -2,138 +2,138 @@
|
|
2
2
|
de:
|
3
3
|
attributes:
|
4
4
|
label: Bezeichnung
|
5
|
-
slug:
|
6
|
-
parent_id:
|
5
|
+
slug: Form
|
6
|
+
parent_id: Vorfahre
|
7
7
|
content: Inhalt
|
8
8
|
identifier: Identifikator
|
9
9
|
activerecord:
|
10
10
|
models:
|
11
|
-
comfy/cms/site: Web
|
11
|
+
comfy/cms/site: Web
|
12
12
|
comfy/cms/layout: Layout
|
13
13
|
comfy/cms/page: Seite
|
14
14
|
comfy/cms/snippet: Schnipsel
|
15
15
|
comfy/cms/file: Datei
|
16
16
|
attributes:
|
17
17
|
comfy/cms/site:
|
18
|
-
identifier:
|
19
|
-
hostname: Hostname
|
20
|
-
path: Pfad
|
21
|
-
locale:
|
22
|
-
is_mirrored:
|
18
|
+
identifier: Kennzeichnung
|
19
|
+
hostname: Server (Hostname)
|
20
|
+
path: Pfad (URL-Suffix)
|
21
|
+
locale: Landessprache
|
22
|
+
is_mirrored: Web gespiegelt
|
23
23
|
comfy/cms/layout:
|
24
|
-
identifier:
|
25
|
-
label:
|
26
|
-
app_layout:
|
27
|
-
parent_id:
|
28
|
-
css:
|
29
|
-
js:
|
24
|
+
identifier: Kennzeichnung
|
25
|
+
label: Name
|
26
|
+
app_layout: Grundlegendes Layout
|
27
|
+
parent_id: Übergeordnetes Layout
|
28
|
+
css: Stilvorlage (CSS)
|
29
|
+
js: Skript (JavaScript)
|
30
30
|
comfy/cms/page:
|
31
31
|
label: Bezeichnung
|
32
32
|
layout_id: Layout
|
33
|
-
slug:
|
34
|
-
target_page_id:
|
33
|
+
slug: Form
|
34
|
+
target_page_id: Weiterleitung zu Seite
|
35
35
|
is_published: Veröffentlicht
|
36
36
|
comfy/cms/file:
|
37
37
|
file: Datei
|
38
38
|
description: Beschreibung
|
39
39
|
comfy/cms/snippet:
|
40
|
-
identifier:
|
41
|
-
|
40
|
+
identifier: Kennzeichnung
|
41
|
+
|
42
42
|
comfy:
|
43
43
|
cms:
|
44
44
|
content:
|
45
|
-
site_not_found: Web
|
45
|
+
site_not_found: Web nicht gefunden
|
46
46
|
layout_not_found: Layout nicht gefunden
|
47
47
|
page_not_found: Seite nicht gefunden
|
48
|
-
|
49
|
-
admin:
|
48
|
+
|
49
|
+
admin:
|
50
50
|
cms:
|
51
51
|
base:
|
52
|
-
site_not_found:
|
53
|
-
fixtures_enabled:
|
54
|
-
|
55
|
-
sites:
|
52
|
+
site_not_found: Fehler
|
53
|
+
fixtures_enabled: Fixtures sind aktiviert - alle Änderungen werden verworfen!
|
54
|
+
|
55
|
+
sites: Webs
|
56
56
|
layouts: Layouts
|
57
57
|
pages: Seiten
|
58
58
|
snippets: Schnipsel
|
59
|
-
files:
|
59
|
+
files: Dateien
|
60
60
|
|
61
61
|
sites:
|
62
|
-
created: Web
|
63
|
-
creation_failure: Fehler beim
|
64
|
-
updated: Web
|
65
|
-
update_failure: Fehler beim
|
66
|
-
deleted: Web
|
67
|
-
not_found: Web
|
68
|
-
|
62
|
+
created: Web erstellt
|
63
|
+
creation_failure: Fehler beim Erstellen des Webs!
|
64
|
+
updated: Web aktualisiert
|
65
|
+
update_failure: Fehler beim Aktualisieren des Webs!
|
66
|
+
deleted: Web gelöscht
|
67
|
+
not_found: Web existiert nicht
|
68
|
+
|
69
69
|
index:
|
70
|
-
title:
|
71
|
-
new_link:
|
72
|
-
select:
|
70
|
+
title: Webs
|
71
|
+
new_link: Neues Web erstellen
|
72
|
+
select: Auswählen
|
73
73
|
edit: Bearbeiten
|
74
74
|
delete: Löschen
|
75
|
-
are_you_sure:
|
75
|
+
are_you_sure: Sicher, dass Sie dieses Web löschen möchten?
|
76
76
|
new:
|
77
|
-
title:
|
77
|
+
title: Web erstellen
|
78
78
|
edit:
|
79
|
-
title: Web
|
79
|
+
title: Web bearbeiten
|
80
80
|
form:
|
81
|
-
create:
|
82
|
-
update: Web
|
81
|
+
create: Web erstellen
|
82
|
+
update: Web speichern
|
83
83
|
is_mirrored: Gespiegelt
|
84
84
|
|
85
85
|
layouts:
|
86
86
|
created: Layout erstellt
|
87
|
-
creation_failure: Fehler beim
|
87
|
+
creation_failure: Fehler beim Erstellen des Layouts!
|
88
88
|
updated: Layout aktualisiert
|
89
|
-
update_failure: Fehler beim
|
89
|
+
update_failure: Fehler beim Aktualisieren des Layouts!
|
90
90
|
deleted: Layout gelöscht
|
91
|
-
not_found: Layout nicht
|
92
|
-
|
91
|
+
not_found: Layout nicht angelegt
|
92
|
+
|
93
93
|
index:
|
94
94
|
title: Layouts
|
95
|
-
new_link:
|
95
|
+
new_link: Neues Layout erstellen
|
96
96
|
index_branch:
|
97
|
-
add_child_layout:
|
98
|
-
edit:
|
99
|
-
delete:
|
100
|
-
are_you_sure: Sind Sie sicher?
|
97
|
+
add_child_layout: Neues, untergeordnetes Layout erstellen
|
98
|
+
edit: Layout bearbeiten
|
99
|
+
delete: Layout löschen
|
100
|
+
are_you_sure: Sind Sie sicher, dass Sie dieses Layout löschen möchten?
|
101
101
|
new:
|
102
102
|
title: Neues Layout
|
103
103
|
edit:
|
104
104
|
title: Layout bearbeiten
|
105
105
|
revision: &revision
|
106
|
-
zero:
|
107
|
-
one: '%{count}
|
108
|
-
few: '%{count}
|
109
|
-
many: '%{count}
|
110
|
-
other: '%{count}
|
106
|
+
zero: Keine Versionen
|
107
|
+
one: '%{count} Version'
|
108
|
+
few: '%{count} Versionen'
|
109
|
+
many: '%{count} Versionen'
|
110
|
+
other: '%{count} Versionen'
|
111
111
|
form:
|
112
|
-
select_parent_layout:
|
113
|
-
select_app_layout:
|
114
|
-
create:
|
112
|
+
select_parent_layout: Übergeordnetes Layout auswählen
|
113
|
+
select_app_layout: Grundlegendes Layout auswählen
|
114
|
+
create: Layout erstellen
|
115
115
|
update: Layout speichern
|
116
116
|
|
117
117
|
pages:
|
118
118
|
created: Seite erstellt
|
119
|
-
creation_failure: Fehler beim
|
119
|
+
creation_failure: Fehler beim Erstellen der Seite!
|
120
120
|
updated: Seite aktualisiert
|
121
|
-
update_failure: Fehler beim
|
121
|
+
update_failure: Fehler beim Aktualisieren der Seite!
|
122
122
|
deleted: Seite gelöscht
|
123
123
|
not_found: Seite nicht gefunden
|
124
|
-
layout_not_found:
|
125
|
-
|
124
|
+
layout_not_found: Bisher wurde kein Layout angelegt!
|
125
|
+
|
126
126
|
index:
|
127
127
|
title: Seiten
|
128
|
-
new_link:
|
128
|
+
new_link: Neue Seite erstellen
|
129
129
|
index_branch:
|
130
|
-
toggle:
|
131
|
-
add_child_page:
|
130
|
+
toggle: Schalter
|
131
|
+
add_child_page: Neue, untergeordnete Seite erstellen
|
132
132
|
edit: Bearbeiten
|
133
133
|
delete: Löschen
|
134
|
-
are_you_sure: Sind Sie sicher?
|
134
|
+
are_you_sure: Sind Sie sicher, dass Sie diese Seite löschen möchten?
|
135
135
|
new:
|
136
|
-
title:
|
136
|
+
title: Seite erstellen
|
137
137
|
edit:
|
138
138
|
title: Seite bearbeiten
|
139
139
|
revision:
|
@@ -141,83 +141,82 @@ de:
|
|
141
141
|
form:
|
142
142
|
select_target_page: Keine Weiterleitung
|
143
143
|
preview: Vorschau
|
144
|
-
create:
|
144
|
+
create: Seite erstellen
|
145
145
|
update: Seite speichern
|
146
146
|
is_published: Veröffentlicht
|
147
147
|
form_blocks:
|
148
148
|
no_tags: |-
|
149
|
-
Layout
|
150
|
-
|
151
|
-
|
149
|
+
Das gewählte Layout hat kein Comfy-Tag deklariert, daher kann diese Seite nicht bearbeitet werden.<br/>
|
150
|
+
Beispiel: <code>{{ cms:page:content }}</code>
|
152
151
|
|
153
152
|
snippets:
|
154
153
|
created: Schnipsel erstellt
|
155
|
-
creation_failure: Fehler beim
|
154
|
+
creation_failure: Fehler beim Erstellen des Schnipsels!
|
156
155
|
updated: Schnipsel aktualisiert
|
157
|
-
update_failure: Fehler beim
|
156
|
+
update_failure: Fehler beim Aktualisieren des Schnipsels!
|
158
157
|
deleted: Schnipsel gelöscht
|
159
|
-
not_found: Schnipsel nicht
|
160
|
-
|
158
|
+
not_found: Schnipsel nicht angelegt
|
159
|
+
|
161
160
|
index:
|
162
|
-
title:
|
163
|
-
new_link:
|
164
|
-
edit:
|
165
|
-
delete:
|
166
|
-
are_you_sure: Sind Sie sicher?
|
161
|
+
title: Schnipsel
|
162
|
+
new_link: Neuen Schnipsel erstellen
|
163
|
+
edit: Schnipsel bearbeiten
|
164
|
+
delete: Schnipsel löschen
|
165
|
+
are_you_sure: Sind Sie sicher, dass Sie diesen Schnipsel löschen möchten?
|
167
166
|
new:
|
168
|
-
title:
|
167
|
+
title: Schnipsel erstellen
|
169
168
|
edit:
|
170
169
|
title: Schnipsel bearbeiten
|
171
170
|
revision:
|
172
171
|
<<: *revision
|
173
172
|
form:
|
174
|
-
create:
|
173
|
+
create: Schnipsel erstellen
|
175
174
|
update: Schnipsel speichern
|
176
175
|
|
177
176
|
revisions:
|
178
|
-
reverted: Inhalt wiederhergestellt
|
179
|
-
record_not_found: Eintrag nicht gefunden
|
180
|
-
not_found:
|
181
|
-
|
177
|
+
reverted: Inhalt wurde aus gewählter Version wiederhergestellt
|
178
|
+
record_not_found: Eintrag in gewählter Version nicht gefunden
|
179
|
+
not_found: Version nicht gefunden
|
180
|
+
|
182
181
|
show:
|
183
|
-
title:
|
184
|
-
revision:
|
185
|
-
full_path:
|
186
|
-
slug:
|
187
|
-
update: Zurücksetzen auf
|
188
|
-
content:
|
189
|
-
changes:
|
190
|
-
previous:
|
182
|
+
title: Versionen von
|
183
|
+
revision: Version
|
184
|
+
full_path: Vollständiger Pfad
|
185
|
+
slug: Form
|
186
|
+
update: Zurücksetzen auf gewählte Version
|
187
|
+
content: Inhalt
|
188
|
+
changes: Änderungen
|
189
|
+
previous: Vorherige Version
|
191
190
|
current: Aktuell
|
192
191
|
|
193
192
|
files:
|
194
|
-
created: Datei
|
195
|
-
creation_failure: Fehler beim
|
196
|
-
updated: Datei
|
197
|
-
update_failure: Fehler beim
|
193
|
+
created: Datei aufgespielt
|
194
|
+
creation_failure: Fehler beim Aufspielen der Datei!
|
195
|
+
updated: Datei aufgespielt
|
196
|
+
update_failure: Fehler beim Aktualisieren der Datei!
|
198
197
|
deleted: Datei gelöscht
|
199
198
|
not_found: Datei nicht gefunden
|
200
|
-
|
199
|
+
|
201
200
|
index:
|
202
201
|
title: Datei
|
203
|
-
new_link: Neue Datei
|
204
|
-
edit:
|
205
|
-
delete:
|
206
|
-
are_you_sure: Sind Sie sicher?
|
207
|
-
button: Datei
|
202
|
+
new_link: Neue Datei aufspielen
|
203
|
+
edit: Datei bearbeiten
|
204
|
+
delete: Datei löschen
|
205
|
+
are_you_sure: Sind Sie sicher, dass Sie diese Datei löschen möchten?
|
206
|
+
button: Datei aufspielen
|
208
207
|
new:
|
209
|
-
title:
|
208
|
+
title: Datei anlegen
|
210
209
|
edit:
|
211
210
|
title: Datei bearbeiten
|
212
211
|
form:
|
213
212
|
current_file: Aktuelle Datei
|
214
|
-
create:
|
213
|
+
create: Datei aufspielen
|
215
214
|
update: Datei speichern
|
216
215
|
page_form:
|
217
216
|
are_you_sure: Sind Sie sicher?
|
218
217
|
file:
|
219
218
|
are_you_sure: Sind Sie sicher?
|
220
|
-
|
219
|
+
|
221
220
|
categories:
|
222
221
|
index:
|
223
222
|
label: Kategorien
|
@@ -225,10 +224,10 @@ de:
|
|
225
224
|
done: Erledigt
|
226
225
|
all: Alle
|
227
226
|
add: Hinzuzufügen
|
228
|
-
add_placeholder: Kategorie
|
227
|
+
add_placeholder: Kategorie hinzuzufügen
|
229
228
|
show:
|
230
|
-
are_you_sure: Sind Sie sicher?
|
229
|
+
are_you_sure: Sind Sie sicher, dass Sie diese Kategorie löschen möchten?
|
231
230
|
edit:
|
232
|
-
save:
|
231
|
+
save: Kategorie speichern
|
233
232
|
form:
|
234
233
|
label: Kategorien
|
data/config/locales/it.yml
CHANGED
@@ -11,7 +11,7 @@ it:
|
|
11
11
|
comfy/cms/site: Sito
|
12
12
|
comfy/cms/layout: Layout
|
13
13
|
comfy/cms/page: Pagina
|
14
|
-
comfy/cms/snippet:
|
14
|
+
comfy/cms/snippet: Snippet
|
15
15
|
comfy/cms/file: File
|
16
16
|
attributes:
|
17
17
|
comfy/cms/site:
|
@@ -24,7 +24,7 @@ it:
|
|
24
24
|
identifier: Identificatore
|
25
25
|
label: Nome Layout
|
26
26
|
app_layout: Layout Applicazione
|
27
|
-
parent_id: Layout
|
27
|
+
parent_id: Layout Padre
|
28
28
|
css: Foglio di stile
|
29
29
|
js: Javascript
|
30
30
|
comfy/cms/page:
|
@@ -42,20 +42,20 @@ it:
|
|
42
42
|
comfy:
|
43
43
|
cms:
|
44
44
|
content:
|
45
|
-
site_not_found:
|
45
|
+
site_not_found: Sito non trovato
|
46
46
|
layout_not_found: Layout non trovato
|
47
47
|
page_not_found: Pagina non trovata
|
48
|
-
|
48
|
+
|
49
49
|
admin:
|
50
50
|
cms:
|
51
51
|
base:
|
52
52
|
site_not_found: Sito non trovato
|
53
53
|
fixtures_enabled: Le Fixtures CMS sono abilitate. Tutti i cambiamenti fatti qui saranno scartati.
|
54
|
-
|
54
|
+
|
55
55
|
sites: Siti
|
56
|
-
layouts:
|
56
|
+
layouts: Layout
|
57
57
|
pages: Pagine
|
58
|
-
snippets:
|
58
|
+
snippets: Snippet
|
59
59
|
files: Files
|
60
60
|
|
61
61
|
sites:
|
@@ -65,7 +65,7 @@ it:
|
|
65
65
|
update_failure: Impossibile modificare il sito
|
66
66
|
deleted: Sito eliminato
|
67
67
|
not_found: Sito non trovato
|
68
|
-
|
68
|
+
|
69
69
|
index:
|
70
70
|
title: Siti
|
71
71
|
new_link: Crea nuovo sito
|
@@ -89,15 +89,15 @@ it:
|
|
89
89
|
update_failure: Impossibile modificare il layout
|
90
90
|
deleted: Layout eliminato
|
91
91
|
not_found: Layout non trovato
|
92
|
-
|
92
|
+
|
93
93
|
index:
|
94
|
-
title:
|
94
|
+
title: Layout
|
95
95
|
new_link: Crea nuovo layout
|
96
96
|
index_branch:
|
97
|
-
add_child_layout: Aggiungi Layout
|
97
|
+
add_child_layout: Aggiungi Layout figlio
|
98
98
|
edit: Modifica
|
99
99
|
delete: Elimina
|
100
|
-
are_you_sure: Sei sicuro?
|
100
|
+
are_you_sure: Sei sicuro di voler eliminare questo Layout?
|
101
101
|
new:
|
102
102
|
title: Nuovo Layout
|
103
103
|
edit:
|
@@ -109,8 +109,8 @@ it:
|
|
109
109
|
many: '%{count} Revisioni'
|
110
110
|
other: '%{count} Revisioni'
|
111
111
|
form:
|
112
|
-
select_parent_layout: Seleziona Layout
|
113
|
-
select_app_layout: Seleziona Layout
|
112
|
+
select_parent_layout: Seleziona Layout padre
|
113
|
+
select_app_layout: Seleziona Layout applicazione
|
114
114
|
create: Crea Layout
|
115
115
|
update: Modifica Layout
|
116
116
|
|
@@ -122,16 +122,16 @@ it:
|
|
122
122
|
deleted: Pagina eliminata
|
123
123
|
not_found: Pagina non trovata
|
124
124
|
layout_not_found: Nessun layout trovato. Creane uno per favore.
|
125
|
-
|
125
|
+
|
126
126
|
index:
|
127
127
|
title: Pagine
|
128
128
|
new_link: Crea nuova pagina
|
129
129
|
index_branch:
|
130
130
|
toggle: Alterna
|
131
|
-
add_child_page: Aggiungi Pagina
|
131
|
+
add_child_page: Aggiungi Pagina figlio
|
132
132
|
edit: Modifica
|
133
133
|
delete: Elimina
|
134
|
-
are_you_sure: Sei sicuro?
|
134
|
+
are_you_sure: Sei sicuro di voler eliminare questa pagina?
|
135
135
|
new:
|
136
136
|
title: Nuova Pagina
|
137
137
|
edit:
|
@@ -139,84 +139,84 @@ it:
|
|
139
139
|
revision:
|
140
140
|
<<: *revision
|
141
141
|
form:
|
142
|
-
select_target_page:
|
142
|
+
select_target_page: Nessun reindirizzamento
|
143
143
|
preview: Anteprima
|
144
144
|
create: Crea Pagina
|
145
145
|
update: Modifica Pagina
|
146
|
-
is_published:
|
146
|
+
is_published: Pubblicata
|
147
147
|
form_blocks:
|
148
148
|
no_tags: |-
|
149
|
-
Il Layout non ha
|
149
|
+
Il Layout non ha tag di contenuto definiti.<br/>
|
150
150
|
Modifica il contenuto per includere una pagina o un campo. Per esempio: <code>{{cms:page:content}}</code>
|
151
151
|
|
152
152
|
snippets:
|
153
|
-
created:
|
154
|
-
creation_failure: Impossibile creare
|
155
|
-
updated:
|
156
|
-
update_failure: Impossibile modificare
|
157
|
-
deleted:
|
158
|
-
not_found:
|
159
|
-
|
153
|
+
created: Snippet creato
|
154
|
+
creation_failure: Impossibile creare lo snippet
|
155
|
+
updated: Snippet modificato
|
156
|
+
update_failure: Impossibile modificare lo snippet
|
157
|
+
deleted: Snippet eliminato
|
158
|
+
not_found: Snippet non trovato
|
159
|
+
|
160
160
|
index:
|
161
|
-
title:
|
162
|
-
new_link: Crea
|
161
|
+
title: Snippet
|
162
|
+
new_link: Crea nuovo Snippet
|
163
163
|
edit: Modifica
|
164
164
|
delete: Elimina
|
165
|
-
are_you_sure: Sei sicuro?
|
165
|
+
are_you_sure: Sei sicuro di voler eliminare questo snippet?
|
166
166
|
new:
|
167
|
-
title: Nuovo
|
167
|
+
title: Nuovo Snippet
|
168
168
|
edit:
|
169
|
-
title: Modifica
|
169
|
+
title: Modifica Snippet
|
170
170
|
revision:
|
171
171
|
<<: *revision
|
172
172
|
form:
|
173
|
-
create: Crea
|
174
|
-
update: Modifica
|
173
|
+
create: Crea Snippet
|
174
|
+
update: Modifica Snippet
|
175
175
|
|
176
176
|
revisions:
|
177
|
-
reverted: Contenuto ripristinato
|
177
|
+
reverted: Contenuto ripristinato con successo
|
178
178
|
record_not_found: Record non trovato
|
179
179
|
not_found: Revisione non trovata
|
180
|
-
|
180
|
+
|
181
181
|
show:
|
182
182
|
title: Revisioni per
|
183
183
|
revision: Revisione
|
184
184
|
full_path: Percorso intero
|
185
185
|
slug: Slug
|
186
|
-
update: Aggiorna a questa
|
187
|
-
content:
|
188
|
-
changes:
|
189
|
-
previous:
|
186
|
+
update: Aggiorna a questa revisione
|
187
|
+
content: Contenuto
|
188
|
+
changes: Cambiamenti
|
189
|
+
previous: Precedente
|
190
190
|
current: Attuale
|
191
191
|
|
192
192
|
files:
|
193
|
-
created:
|
194
|
-
creation_failure: Impossibile caricare i
|
193
|
+
created: File caricati
|
194
|
+
creation_failure: Impossibile caricare i file
|
195
195
|
updated: File aggiornato
|
196
196
|
update_failure: Impossibile aggiornare il file
|
197
197
|
deleted: File eliminato
|
198
198
|
not_found: File non trovato
|
199
|
-
|
199
|
+
|
200
200
|
index:
|
201
201
|
title: Files
|
202
202
|
new_link: Carica nuovo file
|
203
203
|
edit: Modifica
|
204
204
|
delete: Elimina
|
205
|
-
are_you_sure: Sei sicuro?
|
206
|
-
button: Carica
|
205
|
+
are_you_sure: Sei sicuro di voler eliminare questo file?
|
206
|
+
button: Carica File
|
207
207
|
new:
|
208
208
|
title: Nuovo File
|
209
209
|
edit:
|
210
210
|
title: Modifica File
|
211
211
|
form:
|
212
|
-
current_file: File
|
212
|
+
current_file: File attuale
|
213
213
|
create: Carica File
|
214
214
|
update: Modifica File
|
215
215
|
page_form:
|
216
216
|
are_you_sure: Sei sicuro?
|
217
217
|
file:
|
218
218
|
are_you_sure: Sei sicuro?
|
219
|
-
|
219
|
+
|
220
220
|
categories:
|
221
221
|
index:
|
222
222
|
label: Categorie
|
@@ -224,7 +224,7 @@ it:
|
|
224
224
|
done: Fatto
|
225
225
|
all: Tutte
|
226
226
|
add: Aggiungi
|
227
|
-
add_placeholder:
|
227
|
+
add_placeholder: Aggiungi categoria
|
228
228
|
show:
|
229
229
|
are_you_sure: Sei sicuro?
|
230
230
|
edit:
|
@@ -1,4 +1,7 @@
|
|
1
1
|
class UpgradeTo1120 < ActiveRecord::Migration
|
2
|
+
|
3
|
+
COMFY_CLASSES = %w(Block Category Categorization File Layout Page Revision Site Snippet)
|
4
|
+
|
2
5
|
def self.up
|
3
6
|
add_column :cms_blocks, :blockable_type, :string
|
4
7
|
add_index :cms_blocks, :blockable_type
|
@@ -14,15 +17,48 @@ class UpgradeTo1120 < ActiveRecord::Migration
|
|
14
17
|
rename_table :cms_blocks, :comfy_cms_blocks
|
15
18
|
rename_table :cms_snippets, :comfy_cms_snippets
|
16
19
|
rename_table :cms_files, :comfy_cms_files
|
20
|
+
rename_index :cms_revisions,
|
21
|
+
'index_cms_revisions_on_record_type_and_record_id_and_created_at',
|
22
|
+
'index_cms_revisions_on_record_type_id_created'
|
17
23
|
rename_table :cms_revisions, :comfy_cms_revisions
|
18
24
|
rename_index :cms_categories,
|
19
25
|
'index_cms_categories_on_site_id_and_categorized_type_and_label',
|
20
26
|
'index_cms_categories_on_site_id_and_cat_type_and_label'
|
21
27
|
rename_table :cms_categories, :comfy_cms_categories
|
22
28
|
rename_table :cms_categorizations, :comfy_cms_categorizations
|
29
|
+
|
30
|
+
COMFY_CLASSES.each do |klass|
|
31
|
+
execute("
|
32
|
+
UPDATE comfy_cms_categories SET categorized_type = 'Comfy::Cms::#{klass}'
|
33
|
+
WHERE categorized_type = 'Cms::#{klass}'
|
34
|
+
")
|
35
|
+
execute("
|
36
|
+
UPDATE comfy_cms_categorizations SET categorized_type = 'Comfy::Cms::#{klass}'
|
37
|
+
WHERE categorized_type = 'Cms::#{klass}'
|
38
|
+
")
|
39
|
+
execute("
|
40
|
+
UPDATE comfy_cms_revisions SET record_type = 'Comfy::Cms::#{klass}'
|
41
|
+
WHERE record_type = 'Cms::#{klass}'
|
42
|
+
")
|
43
|
+
end
|
23
44
|
end
|
24
45
|
|
25
46
|
def self.down
|
47
|
+
COMFY_CLASSES.each do |klass|
|
48
|
+
execute("
|
49
|
+
UPDATE comfy_cms_revisions SET record_type = 'Cms::#{klass}'
|
50
|
+
WHERE record_type = 'Comfy::Cms::#{klass}'
|
51
|
+
")
|
52
|
+
execute("
|
53
|
+
UPDATE comfy_cms_categorizations SET categorized_type = 'Cms::#{klass}'
|
54
|
+
WHERE categorized_type = 'Comfy::Cms::#{klass}'
|
55
|
+
")
|
56
|
+
execute("
|
57
|
+
UPDATE comfy_cms_categories SET categorized_type = 'Cms::#{klass}'
|
58
|
+
WHERE categorized_type = 'Comfy::Cms::#{c}'
|
59
|
+
")
|
60
|
+
end
|
61
|
+
|
26
62
|
rename_table :comfy_cms_sites, :cms_sites
|
27
63
|
rename_table :comfy_cms_layouts, :cms_layouts
|
28
64
|
rename_table :comfy_cms_pages, :cms_pages
|
@@ -38,4 +74,4 @@ class UpgradeTo1120 < ActiveRecord::Migration
|
|
38
74
|
rename_column :cms_blocks, :blockable_id, :page_id
|
39
75
|
rename_column :cms_pages, :content_cache, :content
|
40
76
|
end
|
41
|
-
end
|
77
|
+
end
|
@@ -42,10 +42,10 @@ module ComfortableMexicanSofa::Fixture
|
|
42
42
|
|
43
43
|
def import!
|
44
44
|
ComfortableMexicanSofa::Fixture::Category::Importer.new(from, to, force_import).import!
|
45
|
-
ComfortableMexicanSofa::Fixture::File::Importer.new( from, to, force_import).import!
|
46
45
|
ComfortableMexicanSofa::Fixture::Layout::Importer.new( from, to, force_import).import!
|
47
46
|
ComfortableMexicanSofa::Fixture::Page::Importer.new( from, to, force_import).import!
|
48
47
|
ComfortableMexicanSofa::Fixture::Snippet::Importer.new( from, to, force_import).import!
|
48
|
+
ComfortableMexicanSofa::Fixture::File::Importer.new( from, to, force_import).import!
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -10,9 +10,15 @@ module ComfortableMexicanSofa::Fixture::File
|
|
10
10
|
if File.exists?(attrs_path = File.join(self.path, "_#{filename}.yml"))
|
11
11
|
if fresh_fixture?(file, attrs_path)
|
12
12
|
attrs = get_attributes(attrs_path)
|
13
|
+
|
14
|
+
block = if (attrs['page'] && attrs['block']) && (page = self.site.pages.find_by_slug(attrs['page']))
|
15
|
+
page.blocks.find_by_identifier(attrs['block'])
|
16
|
+
end
|
17
|
+
|
13
18
|
file.label = attrs['label']
|
14
19
|
file.description = attrs['description']
|
15
20
|
categories = attrs['categories']
|
21
|
+
file.block = block
|
16
22
|
end
|
17
23
|
end
|
18
24
|
|
@@ -24,7 +30,7 @@ module ComfortableMexicanSofa::Fixture::File
|
|
24
30
|
if file.changed? || self.force_import
|
25
31
|
if file.save
|
26
32
|
save_categorizations!(file, categories)
|
27
|
-
ComfortableMexicanSofa.logger.
|
33
|
+
ComfortableMexicanSofa.logger.info("[FIXTURES] Imported File \t #{file.file_file_name}")
|
28
34
|
else
|
29
35
|
ComfortableMexicanSofa.logger.warn("[FIXTURES] Failed to import File \n#{file.errors.inspect}")
|
30
36
|
end
|
@@ -44,13 +50,17 @@ module ComfortableMexicanSofa::Fixture::File
|
|
44
50
|
|
45
51
|
self.site.files.each do |file|
|
46
52
|
file_path = File.join(self.path, file.file_file_name)
|
53
|
+
block = file.block
|
54
|
+
page = block.present?? block.page : nil
|
47
55
|
|
48
56
|
# writing attributes
|
49
57
|
open(::File.join(self.path, "_#{file.file_file_name}.yml"), 'w') do |f|
|
50
58
|
f.write({
|
51
59
|
'label' => file.label,
|
52
60
|
'description' => file.description,
|
53
|
-
'categories' => file.categories.map{|c| c.label}
|
61
|
+
'categories' => file.categories.map{|c| c.label},
|
62
|
+
'page' => page.present? ? page.slug : nil,
|
63
|
+
'block' => block.present? ? block.identifier : nil
|
54
64
|
}.to_yaml)
|
55
65
|
end
|
56
66
|
|
@@ -58,12 +68,17 @@ module ComfortableMexicanSofa::Fixture::File
|
|
58
68
|
data_path = file.file.options[:storage] == :filesystem ?
|
59
69
|
file.file.path :
|
60
70
|
file.file.url
|
71
|
+
|
72
|
+
unless ::File.exists?(data_path)
|
73
|
+
ComfortableMexicanSofa.logger.warn("[FIXTURES] No physical File \t #{file.file_file_name}")
|
74
|
+
next
|
75
|
+
end
|
61
76
|
|
62
77
|
open(::File.join(self.path, ::File.basename(file_path)), 'wb') do |f|
|
63
78
|
open(data_path) { |src| f.write(src.read) }
|
64
79
|
end
|
65
80
|
|
66
|
-
ComfortableMexicanSofa.logger.
|
81
|
+
ComfortableMexicanSofa.logger.info("[FIXTURES] Exported File \t #{file.file_file_name}")
|
67
82
|
end
|
68
83
|
end
|
69
84
|
end
|
@@ -43,7 +43,7 @@ module ComfortableMexicanSofa::Fixture::Layout
|
|
43
43
|
# saving
|
44
44
|
if layout.changed? || self.force_import
|
45
45
|
if layout.save
|
46
|
-
ComfortableMexicanSofa.logger.
|
46
|
+
ComfortableMexicanSofa.logger.info("[FIXTURES] Imported Layout \t #{layout.identifier}")
|
47
47
|
else
|
48
48
|
ComfortableMexicanSofa.logger.warn("[FIXTURES] Failed to import Layout \n#{layout.errors.inspect}")
|
49
49
|
end
|
@@ -88,7 +88,7 @@ module ComfortableMexicanSofa::Fixture::Layout
|
|
88
88
|
f.write(layout.js)
|
89
89
|
end
|
90
90
|
|
91
|
-
ComfortableMexicanSofa.logger.
|
91
|
+
ComfortableMexicanSofa.logger.info("[FIXTURES] Exported Layout \t #{layout.identifier}")
|
92
92
|
end
|
93
93
|
end
|
94
94
|
end
|
@@ -66,7 +66,7 @@ module ComfortableMexicanSofa::Fixture::Page
|
|
66
66
|
if page.changed? || page.blocks_attributes_changed || self.force_import
|
67
67
|
if page.save
|
68
68
|
save_categorizations!(page, categories)
|
69
|
-
ComfortableMexicanSofa.logger.
|
69
|
+
ComfortableMexicanSofa.logger.info("[FIXTURES] Imported Page \t #{page.full_path}")
|
70
70
|
else
|
71
71
|
ComfortableMexicanSofa.logger.warn("[FIXTURES] Failed to import Page \n#{page.errors.inspect}")
|
72
72
|
end
|
@@ -121,7 +121,7 @@ module ComfortableMexicanSofa::Fixture::Page
|
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
|
-
ComfortableMexicanSofa.logger.
|
124
|
+
ComfortableMexicanSofa.logger.info("[FIXTURES] Exported Page \t #{page.full_path}")
|
125
125
|
end
|
126
126
|
end
|
127
127
|
end
|
@@ -32,7 +32,7 @@ module ComfortableMexicanSofa::Fixture::Snippet
|
|
32
32
|
if snippet.changed? || self.force_import
|
33
33
|
if snippet.save
|
34
34
|
save_categorizations!(snippet, categories)
|
35
|
-
ComfortableMexicanSofa.logger.
|
35
|
+
ComfortableMexicanSofa.logger.info("[FIXTURES] Imported Snippet \t #{snippet.identifier}")
|
36
36
|
else
|
37
37
|
ComfortableMexicanSofa.logger.warn("[FIXTURES] Failed to import Snippet \n#{snippet.errors.inspect}")
|
38
38
|
end
|
@@ -68,7 +68,7 @@ module ComfortableMexicanSofa::Fixture::Snippet
|
|
68
68
|
f.write(snippet.content)
|
69
69
|
end
|
70
70
|
|
71
|
-
ComfortableMexicanSofa.logger.
|
71
|
+
ComfortableMexicanSofa.logger.info("[FIXTURES] Exported Snippet \t #{snippet.identifier}")
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
@@ -3,8 +3,8 @@ class ActionDispatch::Routing::Mapper
|
|
3
3
|
def comfy_route_cms(options = {})
|
4
4
|
scope :module => :comfy, :as => :comfy do
|
5
5
|
namespace :cms, :path => options[:path] do
|
6
|
-
get 'cms-css/:site_id/:identifier' => 'assets#render_css', :as => 'render_css'
|
7
|
-
get 'cms-js/:site_id/:identifier' => 'assets#render_js', :as => 'render_js'
|
6
|
+
get 'cms-css/:site_id/:identifier(/:cache_buster)' => 'assets#render_css', :as => 'render_css'
|
7
|
+
get 'cms-js/:site_id/:identifier(/:cache_buster)' => 'assets#render_js', :as => 'render_js'
|
8
8
|
|
9
9
|
if options[:sitemap]
|
10
10
|
get '(:cms_path)/sitemap' => 'content#render_sitemap',
|
@@ -13,11 +13,11 @@ class ComfortableMexicanSofa::Tag::Asset
|
|
13
13
|
|
14
14
|
case type
|
15
15
|
when 'css'
|
16
|
-
out = "/cms-css/#{blockable.site.id}/#{identifier}.css"
|
16
|
+
out = "/cms-css/#{blockable.site.id}/#{identifier}/#{layout.cache_buster}.css"
|
17
17
|
out = "<link href='#{out}' media='screen' rel='stylesheet' type='text/css' />" if format == 'html_tag'
|
18
18
|
out
|
19
19
|
when 'js'
|
20
|
-
out = "/cms-js/#{blockable.site.id}/#{identifier}.js"
|
20
|
+
out = "/cms-js/#{blockable.site.id}/#{identifier}/#{layout.cache_buster}.js"
|
21
21
|
out = "<script src='#{out}' type='text/javascript'></script>" if format == 'html_tag'
|
22
22
|
out
|
23
23
|
end
|
@@ -89,11 +89,12 @@ class Comfy::Admin::Cms::FilesControllerTest < ActionController::TestCase
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def test_create
|
92
|
-
assert_difference 'Comfy::Cms::File.count' do
|
92
|
+
assert_difference ['Comfy::Cms::File.count', 'Comfy::Cms::Categorization.count'] do
|
93
93
|
post :create, :site_id => comfy_cms_sites(:default), :file => {
|
94
94
|
:label => 'Test File',
|
95
95
|
:description => 'Test Description',
|
96
|
-
:file => [fixture_file_upload('files/image.jpg', 'image/jpeg')]
|
96
|
+
:file => [fixture_file_upload('files/image.jpg', 'image/jpeg')],
|
97
|
+
:category_ids => {comfy_cms_categories(:default).id => '1'}
|
97
98
|
}
|
98
99
|
assert_response :redirect
|
99
100
|
file = Comfy::Cms::File.last
|
@@ -2,19 +2,29 @@ require_relative '../../../test_helper'
|
|
2
2
|
|
3
3
|
class Comfy::Cms::AssetsControllerTest < ActionController::TestCase
|
4
4
|
|
5
|
-
def
|
5
|
+
def test_render_css_with_site_with_path
|
6
|
+
site = comfy_cms_sites(:default)
|
7
|
+
site.update_column(:path, 'some/path')
|
8
|
+
get :render_css, :site_id => site, :identifier => comfy_cms_layouts(:default).identifier
|
9
|
+
assert_response :success
|
10
|
+
assert_match 'text/css', response.content_type
|
11
|
+
assert_equal comfy_cms_layouts(:default).css, response.body
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_render_css_without_cache_buster
|
6
15
|
get :render_css, :site_id => comfy_cms_sites(:default), :identifier => comfy_cms_layouts(:default).identifier
|
7
16
|
assert_response :success
|
8
17
|
assert_match 'text/css', response.content_type
|
18
|
+
assert_nil response.headers['Cache-Control']
|
9
19
|
assert_equal comfy_cms_layouts(:default).css, response.body
|
10
20
|
end
|
11
|
-
|
12
|
-
def
|
13
|
-
|
14
|
-
|
15
|
-
get :render_css, :site_id => site, :identifier => comfy_cms_layouts(:default).identifier
|
21
|
+
|
22
|
+
def test_render_css_with_cache_buster
|
23
|
+
layout = comfy_cms_layouts(:default)
|
24
|
+
get :render_css, :site_id => comfy_cms_sites(:default), :identifier => layout.identifier, :cache_buster => layout.cache_buster
|
16
25
|
assert_response :success
|
17
26
|
assert_match 'text/css', response.content_type
|
27
|
+
assert_equal 'public, max-age=31557600', response.headers['Cache-Control']
|
18
28
|
assert_equal comfy_cms_layouts(:default).css, response.body
|
19
29
|
end
|
20
30
|
|
@@ -23,10 +33,20 @@ class Comfy::Cms::AssetsControllerTest < ActionController::TestCase
|
|
23
33
|
assert_response 404
|
24
34
|
end
|
25
35
|
|
26
|
-
def
|
36
|
+
def test_render_js_without_cache_buster
|
27
37
|
xhr :get, :render_js, :site_id => comfy_cms_sites(:default).id, :identifier => comfy_cms_layouts(:default).identifier
|
28
38
|
assert_response :success
|
29
|
-
assert_equal '
|
39
|
+
assert_equal 'application/javascript', response.content_type
|
40
|
+
assert_nil response.headers['Cache-Control']
|
41
|
+
assert_equal comfy_cms_layouts(:default).js, response.body
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_render_js_with_cache_buster
|
45
|
+
layout = comfy_cms_layouts(:default)
|
46
|
+
xhr :get, :render_js, :site_id => comfy_cms_sites(:default).id, :identifier => layout.identifier, :cache_buster => layout.cache_buster
|
47
|
+
assert_response :success
|
48
|
+
assert_equal 'application/javascript', response.content_type
|
49
|
+
assert_equal 'public, max-age=31557600', response.headers['Cache-Control']
|
30
50
|
assert_equal comfy_cms_layouts(:default).js, response.body
|
31
51
|
end
|
32
52
|
|
@@ -35,4 +55,4 @@ class Comfy::Cms::AssetsControllerTest < ActionController::TestCase
|
|
35
55
|
assert_response 404
|
36
56
|
end
|
37
57
|
|
38
|
-
end
|
58
|
+
end
|
@@ -2,6 +2,10 @@ require_relative '../test_helper'
|
|
2
2
|
|
3
3
|
class ViewHooksIntegrationTest < ActionDispatch::IntegrationTest
|
4
4
|
|
5
|
+
def teardown
|
6
|
+
ComfortableMexicanSofa::ViewHooks.remove(:navigation)
|
7
|
+
end
|
8
|
+
|
5
9
|
def test_hooks_rendering
|
6
10
|
Comfy::Admin::Cms::SitesController.append_view_path(File.expand_path('../fixtures/views', File.dirname(__FILE__)))
|
7
11
|
ComfortableMexicanSofa::ViewHooks.add(:navigation, '/nav_hook')
|
@@ -91,7 +91,9 @@ class FixtureFilesTest < ActiveSupport::TestCase
|
|
91
91
|
assert_equal ({
|
92
92
|
'label' => 'Default File',
|
93
93
|
'description' => 'Default Description',
|
94
|
-
'categories' => ['Default']
|
94
|
+
'categories' => ['Default'],
|
95
|
+
'page' => nil,
|
96
|
+
'block' => nil
|
95
97
|
}), YAML.load_file(attr_path)
|
96
98
|
|
97
99
|
FileUtils.rm_rf(host_path)
|
data/test/lib/tags/asset_test.rb
CHANGED
@@ -30,27 +30,33 @@ class AssetTagTest < ActiveSupport::TestCase
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def test_render_for_css
|
33
|
+
site = comfy_cms_sites(:default)
|
34
|
+
layout = site.layouts.last
|
35
|
+
|
33
36
|
tag = ComfortableMexicanSofa::Tag::Asset.initialize_tag(
|
34
|
-
comfy_cms_pages(:default),
|
37
|
+
comfy_cms_pages(:default), "{{ cms:asset:#{layout.identifier}:css }}"
|
35
38
|
)
|
36
|
-
assert_equal "/cms-css/#{
|
39
|
+
assert_equal "/cms-css/#{site.id}/#{layout.identifier}/#{layout.cache_buster}.css", tag.render
|
37
40
|
|
38
41
|
tag = ComfortableMexicanSofa::Tag::Asset.initialize_tag(
|
39
|
-
comfy_cms_pages(:default),
|
42
|
+
comfy_cms_pages(:default), "{{ cms:asset:#{layout.identifier}:css:html_tag }}"
|
40
43
|
)
|
41
|
-
assert_equal "<link href='/cms-css/#{
|
44
|
+
assert_equal "<link href='/cms-css/#{site.id}/#{layout.identifier}/#{layout.cache_buster}.css' media='screen' rel='stylesheet' type='text/css' />", tag.render
|
42
45
|
end
|
43
46
|
|
44
47
|
def test_render_for_js
|
48
|
+
site = comfy_cms_sites(:default)
|
49
|
+
layout = site.layouts.last
|
50
|
+
|
45
51
|
tag = ComfortableMexicanSofa::Tag::Asset.initialize_tag(
|
46
|
-
comfy_cms_pages(:default),
|
52
|
+
comfy_cms_pages(:default), "{{ cms:asset:#{layout.identifier}:js }}"
|
47
53
|
)
|
48
|
-
assert_equal "/cms-js/#{
|
54
|
+
assert_equal "/cms-js/#{site.id}/#{layout.identifier}/#{layout.cache_buster}.js", tag.render
|
49
55
|
|
50
56
|
tag = ComfortableMexicanSofa::Tag::Asset.initialize_tag(
|
51
|
-
comfy_cms_pages(:default),
|
57
|
+
comfy_cms_pages(:default), "{{ cms:asset:#{layout.identifier}:js:html_tag }}"
|
52
58
|
)
|
53
|
-
assert_equal "<script src='/cms-js/#{
|
59
|
+
assert_equal "<script src='/cms-js/#{site.id}/#{layout.identifier}/#{layout.cache_buster}.js' type='text/javascript'></script>", tag.render
|
54
60
|
end
|
55
61
|
|
56
62
|
end
|
data/test/models/layout_test.rb
CHANGED
@@ -121,5 +121,11 @@ class CmsLayoutTest < ActiveSupport::TestCase
|
|
121
121
|
assert_equal "Updated content_content", page_1.content_cache
|
122
122
|
assert_equal "Updated left_column_content\nleft_column_content", page_2.content_cache
|
123
123
|
end
|
124
|
-
|
124
|
+
|
125
|
+
def test_cache_buster
|
126
|
+
timestamp = Time.current
|
127
|
+
layout = comfy_cms_sites(:default).layouts.create(updated_at: timestamp)
|
128
|
+
|
129
|
+
assert_equal timestamp.to_i, layout.cache_buster
|
130
|
+
end
|
125
131
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comfortable_mexican_sofa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.12.
|
4
|
+
version: 1.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleg Khabarov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 4.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 4.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rails-i18n
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 4.0.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 4.0.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: kramdown
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -587,7 +587,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
587
587
|
requirements:
|
588
588
|
- - '>='
|
589
589
|
- !ruby/object:Gem::Version
|
590
|
-
version:
|
590
|
+
version: 1.9.3
|
591
591
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
592
592
|
requirements:
|
593
593
|
- - '>='
|