comfortable_mexican_sofa 1.11.1 → 1.11.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -4
  3. data/LICENSE +2 -2
  4. data/README.md +2 -6
  5. data/app/assets/javascripts/comfortable_mexican_sofa/application.js.coffee +2 -1
  6. data/app/controllers/cms/content_controller.rb +2 -1
  7. data/app/models/cms/file.rb +2 -1
  8. data/app/views/admin/cms/layouts/edit.html.haml +1 -1
  9. data/app/views/admin/cms/pages/_form_blocks.html.haml +4 -1
  10. data/app/views/admin/cms/pages/edit.html.haml +1 -1
  11. data/app/views/admin/cms/pages/form_blocks.js.erb +0 -1
  12. data/app/views/admin/cms/snippets/edit.html.haml +1 -1
  13. data/comfortable_mexican_sofa.gemspec +3 -2
  14. data/config/locales/de.yml +10 -3
  15. data/config/locales/en.yml +10 -3
  16. data/config/locales/es.yml +10 -3
  17. data/config/locales/fr.yml +10 -3
  18. data/config/locales/it.yml +244 -0
  19. data/config/locales/ja.yml +10 -3
  20. data/config/locales/nl.yml +10 -3
  21. data/config/locales/pl.yml +10 -3
  22. data/config/locales/pt-BR.yml +10 -3
  23. data/config/locales/ru.yml +10 -3
  24. data/config/locales/sv.yml +10 -3
  25. data/config/locales/zh-CN.yml +10 -3
  26. data/lib/comfortable_mexican_sofa/configuration.rb +2 -1
  27. data/lib/comfortable_mexican_sofa/engine.rb +1 -0
  28. data/lib/comfortable_mexican_sofa/fixture/file.rb +2 -2
  29. data/lib/comfortable_mexican_sofa/form_builder.rb +31 -24
  30. data/lib/comfortable_mexican_sofa/tags/field_boolean.rb +17 -0
  31. data/lib/comfortable_mexican_sofa/version.rb +1 -1
  32. data/test/controllers/admin/cms/files_controller_test.rb +2 -1
  33. data/test/controllers/admin/cms/pages_controller_test.rb +14 -0
  34. data/test/controllers/cms/content_controller_test.rb +6 -0
  35. data/test/lib/tags/field_boolean_test.rb +49 -0
  36. data/test/models/file_test.rb +5 -0
  37. metadata +20 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 41489044868c7bb042cdbade3f93d9c3243a3616
4
- data.tar.gz: 96b5f18e7166c5f45a546e216036854b584131d6
3
+ metadata.gz: 0a35ba0c1902bd02fd420650d31f0640f2c7c261
4
+ data.tar.gz: 6bdef6661eaf0b3b66cb8daa1df5181d52c72ee7
5
5
  SHA512:
6
- metadata.gz: f5df44ea25b94cba839ce686bf513f9f02c50b27285c4b2b5a389e124d985fc7e74e9450b3cb1d0081aa6ebec29a1779227322e0aa7a6425978bf2654e3ffd9e
7
- data.tar.gz: 83261b21be5c24846cd75568739ddda9d89955fc31b8fba4877f0a3a7e44816d51da1066030d03b9002a50184950483550d45f547bd85f16d37b2d673af1f3a7
6
+ metadata.gz: 3559118792688dc5c6605727f1d19b4e01b0b85530eaeb2f16d98aafd1a9915604f542fb4e9f66b6a90060a0dcaebd95e94c5696025242a5e741bcb1d04baa36
7
+ data.tar.gz: 53b453415bc65a90a0083bead5d6a30341e81b6cdcf1dec8a179b0d43c329915a8ab3af163761048935b0194492b0439c10bfb24a09e4ec7f9bc4c8f8e7acc42
@@ -6,13 +6,10 @@ script:
6
6
  rvm:
7
7
  - 1.9.3
8
8
  - 2.0.0
9
- - jruby-19mode
9
+ - 2.1.0
10
10
  gemfile:
11
11
  - test/gemfiles/Gemfile.rails.4.0
12
12
  - test/gemfiles/Gemfile.rails.4.1
13
13
  branches:
14
14
  only:
15
15
  - master
16
- matrix:
17
- allow_failures:
18
- - rvm: jruby-19mode
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010-2013 Oleg Khabarov, The Working Group Inc
1
+ Copyright (c) 2010-2014 Oleg Khabarov
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
17
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
18
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
19
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -51,7 +51,7 @@ After finishing installation you should be able to navigate to http://yoursite/a
51
51
 
52
52
  Default username and password is 'username' and 'password'. You probably want to change it right away. Admin credentials (among other things) can be found and changed in the cms initializer: [/config/initializers/comfortable\_mexican\_sofa.rb](https://github.com/comfy/comfortable-mexican-sofa/blob/master/config/initializers/comfortable_mexican_sofa.rb)
53
53
 
54
- Before creating pages and populating them with content we need to create a Site. Site defines a hostname, content path and it's language.
54
+ Before creating pages and populating them with content we need to create a Site. Site defines a hostname, content path and its language.
55
55
 
56
56
  After creating a Site, you need to make a Layout. Layout is the template of your pages; it defines some reusable content (like header and footer, for example) and places where the content goes. A very simple layout can look like this:
57
57
 
@@ -80,8 +80,4 @@ Twitter: [@GroceryBagHead](http://twitter.com/#!/GroceryBagHead)
80
80
 
81
81
  ComfortableMexicanSofa is released under the [MIT license](https://github.com/comfy/comfortable-mexican-sofa/raw/master/LICENSE)
82
82
 
83
- Copyright 2009-2013 Oleg Khabarov, [The Working Group Inc](http://www.twg.ca)
84
-
85
-
86
- [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/comfy/comfortable-mexican-sofa/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
87
-
83
+ Copyright 2009-2014 Oleg Khabarov
@@ -100,7 +100,8 @@ window.CMS.page_blocks = ->
100
100
  complete: ->
101
101
  CMS.wysiwyg()
102
102
  CMS.timepicker()
103
-
103
+ CMS.codemirror()
104
+ CMS.reinitialize_page_blocks() if CMS.reinitialize_page_blocks?
104
105
 
105
106
  window.CMS.mirrors = ->
106
107
  $('#mirrors select').change ->
@@ -1,6 +1,7 @@
1
1
  class Cms::ContentController < Cms::BaseController
2
2
 
3
- respond_to :json, :html
3
+ # Respond with HTML by default so that requests with 'Accept: */*' get a web page (e.g. Facebook)
4
+ respond_to :html, :json
4
5
 
5
6
  # Authentication module must have #authenticate method
6
7
  include ComfortableMexicanSofa.config.public_auth.to_s.constantize
@@ -13,7 +13,7 @@ class Cms::File < ActiveRecord::Base
13
13
  if f.respond_to?(:instance) && f.instance.respond_to?(:dimensions)
14
14
  (f.instance.dimensions.blank?? { } : { :original => f.instance.dimensions }).merge(
15
15
  :cms_thumb => '80x60#'
16
- )
16
+ ).merge(ComfortableMexicanSofa.config.upload_file_options[:styles] || {})
17
17
  end
18
18
  }
19
19
  )
@@ -27,6 +27,7 @@ class Cms::File < ActiveRecord::Base
27
27
  validates :site_id,
28
28
  :presence => true
29
29
  validates_attachment_presence :file
30
+ validates_attachment_content_type :file, :content_type => /.*/
30
31
  validates :file_file_name,
31
32
  :uniqueness => {:scope => :site_id}
32
33
 
@@ -1,5 +1,5 @@
1
1
  .page-header
2
- = link_to pluralize(@layout.revisions.count, t('.revision')), admin_cms_site_layout_revisions_path(@site, @layout), :class => 'btn pull-right'
2
+ = link_to t('.revision', :count => @layout.revisions.count), admin_cms_site_layout_revisions_path(@site, @layout), :class => 'btn pull-right'
3
3
  %h2= t('.title')
4
4
 
5
5
  - content_for :right_column do
@@ -24,5 +24,8 @@
24
24
  - namespace.each_with_index do |(name, tags), index|
25
25
  .tab-pane{:id => "ns-#{name}", :class => index == 0 ? 'active' : nil}
26
26
  - tags.each do |tag|
27
- = cms_blocks.send(tag.class.to_s.demodulize.underscore, tag, block_index) rescue nil
27
+ - begin
28
+ = cms_blocks.send(tag.class.to_s.demodulize.underscore, tag, block_index)
29
+ - rescue
30
+ - Rails.env.production?? nil : raise
28
31
  - block_index += 1
@@ -1,5 +1,5 @@
1
1
  .page-header
2
- = link_to pluralize(@page.revisions.count, t('.revision')), admin_cms_site_page_revisions_path(@site, @page), :class => 'btn pull-right'
2
+ = link_to t('.revision', :count => @page.revisions.count), admin_cms_site_page_revisions_path(@site, @page), :class => 'btn pull-right'
3
3
  %h2= t('.title')
4
4
 
5
5
  - content_for :right_column do
@@ -1,2 +1 @@
1
1
  $('#form-blocks').replaceWith('<%= escape_javascript(render(:partial => "form_blocks")) %>');
2
- CMS.codemirror();
@@ -1,5 +1,5 @@
1
1
  .page-header
2
- = link_to pluralize(@snippet.revisions.count, t('.revision')), admin_cms_site_snippet_revisions_path(@site, @snippet), :class => 'btn pull-right'
2
+ = link_to t('.revision', :count => @snippet.revisions.count), admin_cms_site_snippet_revisions_path(@site, @snippet), :class => 'btn pull-right'
3
3
  %h2= t('.title')
4
4
 
5
5
  - content_for :right_column do
@@ -6,11 +6,11 @@ require 'comfortable_mexican_sofa/version'
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "comfortable_mexican_sofa"
8
8
  s.version = ComfortableMexicanSofa::VERSION
9
- s.authors = ["Oleg Khabarov", "The Working Group Inc"]
9
+ s.authors = ["Oleg Khabarov"]
10
10
  s.email = ["oleg@khabarov.ca"]
11
11
  s.homepage = "http://github.com/comfy/comfortable-mexican-sofa"
12
12
  s.summary = "CMS Engine for Rails 4 apps"
13
- s.description = "ComfortableMexicanSofa is a powerful CMS Engine for Ruby on Rails applications"
13
+ s.description = "ComfortableMexicanSofa is a powerful CMS Engine for Rails 4 applications"
14
14
  s.license = 'MIT'
15
15
 
16
16
  s.files = `git ls-files`.split("\n")
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.require_paths = ['lib']
19
19
 
20
20
  s.add_dependency 'rails', '~> 4.0'
21
+ s.add_dependency 'rails-i18n', '~> 4.0.0'
21
22
  s.add_dependency 'formatted_form', '>= 2.1.0'
22
23
  s.add_dependency 'active_link_to', '>= 1.0.0'
23
24
  s.add_dependency 'paperclip', '>= 3.4.0'
@@ -137,7 +137,12 @@ de:
137
137
  title: Neues Layout
138
138
  edit:
139
139
  title: Layout bearbeiten
140
- revision: Revision
140
+ revision: &revision
141
+ zero: No Revisions
142
+ one: '%{count} Revision'
143
+ few: '%{count} Revisions'
144
+ many: '%{count} Revisions'
145
+ other: '%{count} Revisions'
141
146
  form:
142
147
  select_parent_layout: Select Parent Layout
143
148
  select_app_layout: Select Application Layout
@@ -158,7 +163,8 @@ de:
158
163
  title: Neue Seite
159
164
  edit:
160
165
  title: Seite bearbeiten
161
- revision: Revision
166
+ revision:
167
+ <<: *revision
162
168
  form:
163
169
  select_target_page: Keine Weiterleitung
164
170
  preview: Vorschau
@@ -181,7 +187,8 @@ de:
181
187
  title: Neuer Schnipsel
182
188
  edit:
183
189
  title: Schnipsel bearbeiten
184
- revision: Revision
190
+ revision:
191
+ <<: *revision
185
192
  form:
186
193
  create: Erstelle Schnipsel
187
194
  update: Schnipsel speichern
@@ -137,7 +137,12 @@ en:
137
137
  title: New Layout
138
138
  edit:
139
139
  title: Editing Layout
140
- revision: Revision
140
+ revision: &revision
141
+ zero: No Revisions
142
+ one: '%{count} Revision'
143
+ few: '%{count} Revisions'
144
+ many: '%{count} Revisions'
145
+ other: '%{count} Revisions'
141
146
  form:
142
147
  select_parent_layout: Select Parent Layout
143
148
  select_app_layout: Select Application Layout
@@ -158,7 +163,8 @@ en:
158
163
  title: New Page
159
164
  edit:
160
165
  title: Editing Page
161
- revision: Revision
166
+ revision:
167
+ <<: *revision
162
168
  form:
163
169
  select_target_page: No Redirect
164
170
  preview: Preview
@@ -181,7 +187,8 @@ en:
181
187
  title: New Snippet
182
188
  edit:
183
189
  title: Editing Snippet
184
- revision: Revision
190
+ revision:
191
+ <<: *revision
185
192
  form:
186
193
  create: Create Snippet
187
194
  update: Update Snippet
@@ -137,7 +137,12 @@ es:
137
137
  title: Nuevo Diseño
138
138
  edit:
139
139
  title: Editando Diseño
140
- revision: Revisión
140
+ revision: &revision
141
+ zero: No Revisions
142
+ one: '%{count} Revision'
143
+ few: '%{count} Revisions'
144
+ many: '%{count} Revisions'
145
+ other: '%{count} Revisions'
141
146
  form:
142
147
  select_parent_layout: Seleccionar diseño padre
143
148
  select_app_layout: Seleccionar diseño (App)
@@ -158,7 +163,8 @@ es:
158
163
  title: Nueva Página
159
164
  edit:
160
165
  title: Editando Página
161
- revision: Revision
166
+ revision:
167
+ <<: *revision
162
168
  form:
163
169
  select_target_page: No Redirigir
164
170
  preview: Vista Previa
@@ -181,7 +187,8 @@ es:
181
187
  title: Nuevo Fragmento
182
188
  edit:
183
189
  title: Editando Fragmento
184
- revision: Revisión
190
+ revision:
191
+ <<: *revision
185
192
  form:
186
193
  create: Crear Fragmento
187
194
  update: Actualizar Fragmento
@@ -137,7 +137,12 @@ fr:
137
137
  title: Nouvelle mise en page
138
138
  edit:
139
139
  title: Modification de la mise en page
140
- revision: révision
140
+ revision: &revision
141
+ zero: No Revisions
142
+ one: '%{count} Revision'
143
+ few: '%{count} Revisions'
144
+ many: '%{count} Revisions'
145
+ other: '%{count} Revisions'
141
146
  form:
142
147
  select_parent_layout: Sélectionner une mise en page parent
143
148
  select_app_layout: Sélectionner une mise en page de l'application
@@ -158,7 +163,8 @@ fr:
158
163
  title: Nouvelle page
159
164
  edit:
160
165
  title: Modification de la page
161
- revision: révision
166
+ revision:
167
+ <<: *revision
162
168
  form:
163
169
  select_target_page: Pas de redirection
164
170
  preview: Prévisualiser
@@ -181,7 +187,8 @@ fr:
181
187
  title: Nouveau fragment
182
188
  edit:
183
189
  title: Modification du fragment
184
- revision: révision
190
+ revision:
191
+ <<: *revision
185
192
  form:
186
193
  create: Créer le fragment
187
194
  update: Modifier le fragment
@@ -0,0 +1,244 @@
1
+ # encoding: utf-8
2
+ it:
3
+ # -- Models ---------------------------------------------------------------
4
+ attributes:
5
+ label: Etichetta
6
+ slug: Slug
7
+ parent_id: Padre
8
+ content: Contenuto
9
+ identifier: Identificatore
10
+ activerecord:
11
+ models:
12
+ cms/site: Sito
13
+ cms/layout: Layout
14
+ cms/page: Pagina
15
+ cms/snippet: Frammento
16
+ cms/file: File
17
+ attributes:
18
+ cms/site:
19
+ identifier: Identificatore
20
+ hostname: Indirizzo Host
21
+ path: Percorso
22
+ locale: Lingua
23
+ is_mirrored: Mirrored
24
+ cms/layout:
25
+ identifier: Identificatore
26
+ label: Nome Layout
27
+ app_layout: Layout Applicazione
28
+ parent_id: Layout Padres
29
+ css: Foglio di stile
30
+ js: Javascript
31
+ cms/page:
32
+ label: Etichetta
33
+ layout_id: Layout
34
+ slug: Slug
35
+ target_page_id: Reindirizza a Pagina
36
+ is_published: Pubblicato
37
+ cms/file:
38
+ file: File
39
+ description: Descrizione
40
+ cms/snippet:
41
+ identifier: Identificatore
42
+
43
+ # -- Controllers ----------------------------------------------------------
44
+ cms:
45
+ base:
46
+ site_not_found: Sito non trovato
47
+ fixtures_enabled: Le Fixtures CMS sono abilitate. Tutti i cambiamenti fatti qui saranno scartati.
48
+
49
+ sites:
50
+ created: Sito creato
51
+ creation_failure: Impossibile creare il sito
52
+ updated: Sito aggiornato
53
+ update_failure: Impossibile modificare il sito
54
+ deleted: Sito eliminato
55
+ not_found: Sito non trovato
56
+
57
+ layouts:
58
+ created: Layout creato
59
+ creation_failure: Impossibile creare il layout
60
+ updated: Layout modificato
61
+ update_failure: Impossibile modificare il layout
62
+ deleted: Layout eliminato
63
+ not_found: Layout non trovato
64
+
65
+ pages:
66
+ created: Pagina creata
67
+ creation_failure: Impossibile creare la pagina
68
+ updated: Pagina modificata
69
+ update_failure: Impossibile modificare la pagina
70
+ deleted: Pagina eliminata
71
+ not_found: Pagina non trovata
72
+ layout_not_found: Nessun layout trovato. Creane uno per favore.
73
+
74
+ snippets:
75
+ created: Frammento creato
76
+ creation_failure: Impossibile creare il frammento
77
+ updated: Frammento modificato
78
+ update_failure: Impossibile modificare il frammento
79
+ deleted: Frammento eliminato
80
+ not_found: Frammento non trovato
81
+
82
+ revisions:
83
+ reverted: Contenuto ripristinato
84
+ record_not_found: Record non trovato
85
+ not_found: Revisione non trovata
86
+
87
+ files:
88
+ created: Files caricati
89
+ creation_failure: Impossibile caricare i files
90
+ updated: File aggiornato
91
+ update_failure: Impossibile aggiornare il file
92
+ deleted: File eliminato
93
+ not_found: File non trovato
94
+
95
+ content:
96
+ site_not_found: Site non trovato
97
+ layout_not_found: Layout non trovato
98
+ page_not_found: Pagina non trovata
99
+
100
+ # -- Views ----------------------------------------------------------------
101
+ admin:
102
+ cms:
103
+ base:
104
+ sites: Siti
105
+ layouts: Layouts
106
+ pages: Pagine
107
+ snippets: Frammenti
108
+ files: Files
109
+
110
+ sites:
111
+ index:
112
+ title: Siti
113
+ new_link: Crea nuovo sito
114
+ select: Seleziona sito
115
+ edit: Modifica
116
+ delete: Elimina
117
+ are_you_sure: Sei sicuro di voler eliminare questo sito?
118
+ new:
119
+ title: Nuovo sito
120
+ edit:
121
+ title: Modifica sito
122
+ form:
123
+ create: Crea sito
124
+ update: Modifica sito
125
+ is_mirrored: Mirrored
126
+
127
+ layouts:
128
+ index:
129
+ title: Layouts
130
+ new_link: Crea nuovo layout
131
+ index_branch:
132
+ add_child_layout: Aggiungi Layout Figlio
133
+ edit: Modifica
134
+ delete: Elimina
135
+ are_you_sure: Sei sicuro?
136
+ new:
137
+ title: Nuovo Layout
138
+ edit:
139
+ title: Modifica Layout
140
+ revision: &revision
141
+ zero: '%{count} Revisione'
142
+ one: '%{count} Revisione'
143
+ few: '%{count} Revisione'
144
+ many: '%{count} Revisione'
145
+ other: '%{count} Revisione'
146
+ form:
147
+ select_parent_layout: Seleziona Layout Padre
148
+ select_app_layout: Seleziona Layout di applicazione
149
+ create: Crea Layout
150
+ update: Modifica Layout
151
+
152
+ pages:
153
+ index:
154
+ title: Pagine
155
+ new_link: Crea nuova pagina
156
+ index_branch:
157
+ toggle: Alterna
158
+ add_child_page: Aggiungi Pagina Figlio
159
+ edit: Modifica
160
+ delete: Elimina
161
+ are_you_sure: Sei sicuro?
162
+ new:
163
+ title: Nuova Pagina
164
+ edit:
165
+ title: Modifica Pagina
166
+ revision:
167
+ <<: *revision
168
+ form:
169
+ select_target_page: Nessuna reindirezione
170
+ preview: Anteprima
171
+ create: Crea Pagina
172
+ update: Modifica Pagina
173
+ is_published: Pubblicato
174
+ form_blocks:
175
+ no_tags: |-
176
+ Il Layout non ha tags di contenuto definiti.<br/>
177
+ Modifica il contenuto per includere una pagina o un campo. Per esempio: <code>{{cms:page:content}}</code>
178
+
179
+ snippets:
180
+ index:
181
+ title: Frammenti
182
+ new_link: Crea Nuovo Frammento
183
+ edit: Modifica
184
+ delete: Elimina
185
+ are_you_sure: Sei sicuro?
186
+ new:
187
+ title: Nuovo Frammento
188
+ edit:
189
+ title: Modifica Frammento
190
+ revision:
191
+ <<: *revision
192
+ form:
193
+ create: Crea Frammento
194
+ update: Modifica Frammento
195
+
196
+ revisions:
197
+ show:
198
+ title: Revisioni per
199
+ revision: Revisione
200
+ full_path: Percorso intero
201
+ slug: Slug
202
+ update: Aggiorna a questa Revisione
203
+ current: Attuale
204
+
205
+ files:
206
+ index:
207
+ title: Files
208
+ new_link: Carica nuovo file
209
+ edit: Modifica
210
+ delete: Elimina
211
+ are_you_sure: Sei sicuro?
212
+ button: Carica Files
213
+ new:
214
+ title: Nuovo File
215
+ edit:
216
+ title: Modifica File
217
+ form:
218
+ current_file: File Attuale
219
+ create: Carica File
220
+ update: Modifica File
221
+ page_form:
222
+ are_you_sure: Sei sicuro?
223
+ file:
224
+ are_you_sure: Sei sicuro?
225
+
226
+ categories:
227
+ index:
228
+ label: Categorie
229
+ edit: Modifica
230
+ done: Fatto
231
+ all: Tutte
232
+ add: Aggiungi
233
+ show:
234
+ are_you_sure: Sei sicuro?
235
+ edit:
236
+ save: Salva
237
+ form:
238
+ label: Categorie
239
+
240
+ dialogs:
241
+ image:
242
+ insert: Inserisci Immagine
243
+ link:
244
+ create: Modifica Link
@@ -137,7 +137,12 @@ ja:
137
137
  title: 新規レイアウト
138
138
  edit:
139
139
  title: レイアウトを編集
140
- revision: リビジョン
140
+ revision: &revision
141
+ zero: リビジョン
142
+ one: '%{count} リビジョン'
143
+ few: '%{count} リビジョン'
144
+ many: '%{count} リビジョン'
145
+ other: '%{count} リビジョン'
141
146
  form:
142
147
  select_parent_layout: 親レイアウトを選択
143
148
  select_app_layout: アプリケーションレイアウトを選択
@@ -158,7 +163,8 @@ ja:
158
163
  title: 新規ページ
159
164
  edit:
160
165
  title: ページを編集
161
- revision: リビジョン
166
+ revision:
167
+ <<: *revision
162
168
  form:
163
169
  select_target_page: リダイレクトなし
164
170
  preview: プレビュー
@@ -181,7 +187,8 @@ ja:
181
187
  title: 新規スニペット
182
188
  edit:
183
189
  title: スニペットを編集
184
- revision: リビジョン
190
+ revision:
191
+ <<: *revision
185
192
  form:
186
193
  create: スニペットを作成
187
194
  update: スニペットを更新
@@ -137,7 +137,12 @@ nl:
137
137
  title: Nieuwe Lay-out
138
138
  edit:
139
139
  title: Lay-out Bewerken
140
- revision: Revisie
140
+ revision: &revision
141
+ zero: '%{count} Revisie'
142
+ one: '%{count} Revisie'
143
+ few: '%{count} Revisie'
144
+ many: '%{count} Revisie'
145
+ other: '%{count} Revisie'
141
146
  form:
142
147
  select_parent_layout: Selecteer Ouder Lay-out
143
148
  select_app_layout: Selecteer Applicatie Lay-out
@@ -158,7 +163,8 @@ nl:
158
163
  title: Nieuwe Pagina
159
164
  edit:
160
165
  title: Pagina Bewerken
161
- revision: Revisie
166
+ revision:
167
+ <<: *revision
162
168
  form:
163
169
  select_target_page: Geen Omleiding
164
170
  preview: Preview
@@ -181,7 +187,8 @@ nl:
181
187
  title: Nieuw Snippet
182
188
  edit:
183
189
  title: Snippet Bewerken
184
- revision: Revisie
190
+ revision:
191
+ <<: *revision
185
192
  form:
186
193
  create: Snippet Aanmaken
187
194
  update: Snippet Bijwerken
@@ -137,7 +137,12 @@ pl:
137
137
  title: Nowy szablon
138
138
  edit:
139
139
  title: Edytuj szablon
140
- revision: Wersje
140
+ revision: &revision
141
+ zero: '%{count} Wersje'
142
+ one: '%{count} Wersje'
143
+ few: '%{count} Wersje'
144
+ many: '%{count} Wersje'
145
+ other: '%{count} Wersje'
141
146
  form:
142
147
  select_parent_layout: Wybierz szablon rodzic
143
148
  select_app_layout: Wybierz szablon aplikacji
@@ -158,7 +163,8 @@ pl:
158
163
  title: Nowa strona
159
164
  edit:
160
165
  title: Edytuj stronę
161
- revision: Wersje
166
+ revision:
167
+ <<: *revision
162
168
  form:
163
169
  select_target_page: Bez przekierowania
164
170
  preview: Podgląd
@@ -181,7 +187,8 @@ pl:
181
187
  title: Nowy snippet
182
188
  edit:
183
189
  title: Edytuj snippet
184
- revision: Wersje
190
+ revision:
191
+ <<: *revision
185
192
  form:
186
193
  create: Utwórz snippet
187
194
  update: Uaktualnij snippet
@@ -137,7 +137,12 @@ pt-BR:
137
137
  title: Novo Leiaute
138
138
  edit:
139
139
  title: Editando Leiaute
140
- revision: Revisão
140
+ revision: &revision
141
+ zero: '%{count} Revisão'
142
+ one: '%{count} Revisão'
143
+ few: '%{count} Revisão'
144
+ many: '%{count} Revisão'
145
+ other: '%{count} Revisão'
141
146
  form:
142
147
  select_parent_layout: Selecione o Leiaute Pai
143
148
  select_app_layout: Selecione o Leiaute da Aplicação
@@ -158,7 +163,8 @@ pt-BR:
158
163
  title: Nova Página
159
164
  edit:
160
165
  title: Editando Página
161
- revision: Revisão
166
+ revision:
167
+ <<: *revision
162
168
  form:
163
169
  select_target_page: Não Redirecionar
164
170
  preview: Pré-visualização
@@ -181,7 +187,8 @@ pt-BR:
181
187
  title: Novo Fragmento
182
188
  edit:
183
189
  title: Editando Fragmento
184
- revision: Revisão
190
+ revision:
191
+ <<: *revision
185
192
  form:
186
193
  create: Criar Fragmento
187
194
  update: Atualizar Fragmento
@@ -137,7 +137,12 @@ ru:
137
137
  title: Новый шаблон
138
138
  edit:
139
139
  title: Редактирование шаблона
140
- revision: Ревизия
140
+ revision: &revision
141
+ zero: 'Нет Ревизий'
142
+ one: '%{count} Ревизия'
143
+ few: '%{count} Ревизии'
144
+ many: '%{count} Ревизий'
145
+ other: '%{count} Ревизии'
141
146
  form:
142
147
  select_parent_layout: Выбрать родительский шаблон
143
148
  select_app_layout: Выбрать шаблон приложения
@@ -158,7 +163,8 @@ ru:
158
163
  title: Новая страница
159
164
  edit:
160
165
  title: Редактирование страницы
161
- revision: Ревизия
166
+ revision:
167
+ <<: *revision
162
168
  form:
163
169
  select_target_page: Без редиректа
164
170
  preview: Предпросмотр
@@ -181,7 +187,8 @@ ru:
181
187
  title: Новый сниппет
182
188
  edit:
183
189
  title: Редактирование сниппета
184
- revision: Ревизия
190
+ revision:
191
+ <<: *revision
185
192
  form:
186
193
  create: Создать сниппет
187
194
  update: Обновить сниппет
@@ -137,7 +137,12 @@ sv:
137
137
  title: Ny layout
138
138
  edit:
139
139
  title: Ändra layout
140
- revision: Revision
140
+ revision: &revision
141
+ zero: No Revisions
142
+ one: '%{count} Revision'
143
+ few: '%{count} Revisions'
144
+ many: '%{count} Revisions'
145
+ other: '%{count} Revisions'
141
146
  form:
142
147
  select_parent_layout: Välj överordnad layout
143
148
  select_app_layout: Väl Applikationslayout
@@ -158,7 +163,8 @@ sv:
158
163
  title: Ny sida
159
164
  edit:
160
165
  title: Ändra sida
161
- revision: Revision
166
+ revision:
167
+ <<: *revision
162
168
  form:
163
169
  select_target_page: Ingen vidarebefodring
164
170
  preview: Förhandsgranska
@@ -181,7 +187,8 @@ sv:
181
187
  title: Ny Snippet
182
188
  edit:
183
189
  title: Ändra Snippet
184
- revision: Revision
190
+ revision:
191
+ <<: *revision
185
192
  form:
186
193
  create: Skapa Snippet
187
194
  update: Uppdatera Snippet
@@ -137,7 +137,12 @@ zh-CN:
137
137
  title: 新布局
138
138
  edit:
139
139
  title: 编辑布局
140
- revision: 修订版本
140
+ revision: &revision
141
+ zero: '%{count} 修订版本'
142
+ one: '%{count} 修订版本'
143
+ few: '%{count} 修订版本'
144
+ many: '%{count} 修订版本'
145
+ other: '%{count} 修订版本'
141
146
  form:
142
147
  select_parent_layout: 选择上级布局
143
148
  select_app_layout: 选择应用布局
@@ -158,7 +163,8 @@ zh-CN:
158
163
  title: 新页面
159
164
  edit:
160
165
  title: 编辑页面
161
- revision: 修订版本
166
+ revision:
167
+ <<: *revision
162
168
  form:
163
169
  select_target_page: 没有跳转
164
170
  preview: 预览
@@ -181,7 +187,8 @@ zh-CN:
181
187
  title: 新片段
182
188
  edit:
183
189
  title: 编辑片段
184
- revision: 修订版本
190
+ revision:
191
+ <<: *revision
185
192
  form:
186
193
  create: 创建片段
187
194
  update: 更新片段
@@ -99,7 +99,8 @@ class ComfortableMexicanSofa::Configuration
99
99
  'ru' => 'Русский',
100
100
  'pl' => 'Polski',
101
101
  'de' => 'Deutsch',
102
- 'nl' => 'Nederlands'
102
+ 'nl' => 'Nederlands',
103
+ 'it' => 'Italiano'
103
104
  }
104
105
  @admin_locale = nil
105
106
  @database_config = nil
@@ -1,6 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'comfortable_mexican_sofa'
3
3
  require 'rails'
4
+ require 'rails-i18n'
4
5
  require 'formatted_form'
5
6
  require 'active_link_to'
6
7
  require 'paperclip'
@@ -59,7 +59,7 @@ module ComfortableMexicanSofa::Fixture::File
59
59
  file.file.path :
60
60
  file.file.url
61
61
 
62
- open(::File.join(self.path, ::File.basename(file_path)), 'w') do |f|
62
+ open(::File.join(self.path, ::File.basename(file_path)), 'wb') do |f|
63
63
  open(data_path) { |src| f.write(src.read) }
64
64
  end
65
65
 
@@ -67,4 +67,4 @@ module ComfortableMexicanSofa::Fixture::File
67
67
  end
68
68
  end
69
69
  end
70
- end
70
+ end
@@ -1,90 +1,97 @@
1
1
  class ComfortableMexicanSofa::FormBuilder < FormattedForm::FormBuilder
2
-
2
+
3
3
  # -- Tag Field Fields -----------------------------------------------------
4
4
  def default_tag_field(tag, index, method = :text_field_tag, options = {})
5
-
5
+
6
6
  label = tag.page.class.human_attribute_name(tag.identifier.to_s)
7
7
  css_class = tag.class.to_s.demodulize.underscore
8
8
  content = ''
9
-
9
+
10
10
  case method
11
11
  when :file_field_tag
12
12
  input_params = {:id => nil}
13
13
  name = "page[blocks_attributes][#{index}][content]"
14
-
14
+
15
15
  if options.delete(:multiple)
16
16
  input_params.merge!(:multiple => true)
17
17
  name << '[]'
18
18
  end
19
-
19
+
20
20
  content << @template.send(method, name, input_params)
21
21
  content << @template.render(:partial => 'admin/cms/files/page_form', :object => tag.block)
22
22
  else
23
23
  content << @template.send(method, "page[blocks_attributes][#{index}][content]", tag.content, options)
24
24
  end
25
25
  content << @template.hidden_field_tag("page[blocks_attributes][#{index}][identifier]", tag.identifier, :id => nil)
26
-
26
+
27
27
  element(label, content.html_safe)
28
28
  end
29
-
29
+
30
30
  def field_date_time(tag, index)
31
31
  default_tag_field(tag, index, :text_field_tag, :data => {'cms-datetime' => true})
32
32
  end
33
-
33
+
34
34
  def field_integer(tag, index)
35
35
  default_tag_field(tag, index, :number_field_tag)
36
36
  end
37
-
37
+
38
38
  def field_string(tag, index)
39
39
  default_tag_field(tag, index)
40
40
  end
41
-
41
+
42
42
  def field_text(tag, index)
43
43
  default_tag_field(tag, index, :text_area_tag, :data => {'cms-cm-mode' => 'text/html'})
44
44
  end
45
-
45
+
46
46
  def field_rich_text(tag, index)
47
47
  default_tag_field(tag, index, :text_area_tag, :data => {'cms-rich-text' => true})
48
48
  end
49
-
49
+
50
+ def field_boolean(tag, index)
51
+ content = @template.hidden_field_tag("page[blocks_attributes][#{index}][content]", '', :id => nil)
52
+ content << @template.check_box_tag("page[blocks_attributes][#{index}][content]", '1', tag.content.present?, :id => nil)
53
+ content << @template.hidden_field_tag("page[blocks_attributes][#{index}][identifier]", tag.identifier, :id => nil)
54
+ element(tag.identifier.titleize + "?", content)
55
+ end
56
+
50
57
  def page_date_time(tag, index)
51
58
  default_tag_field(tag, index, :text_field_tag, :data => {'cms-datetime' => true})
52
59
  end
53
-
60
+
54
61
  def page_integer(tag, index)
55
62
  default_tag_field(tag, index, :number_field_tag)
56
63
  end
57
-
64
+
58
65
  def page_string(tag, index)
59
66
  default_tag_field(tag, index)
60
67
  end
61
-
68
+
62
69
  def page_text(tag, index)
63
70
  default_tag_field(tag, index, :text_area_tag, :data => {'cms-cm-mode' => 'text/html'})
64
71
  end
65
-
72
+
66
73
  def page_rich_text(tag, index)
67
74
  default_tag_field(tag, index, :text_area_tag, :data => {'cms-rich-text' => true})
68
75
  end
69
-
76
+
70
77
  def page_file(tag, index)
71
78
  default_tag_field(tag, index, :file_field_tag)
72
79
  end
73
-
80
+
74
81
  def page_files(tag, index)
75
82
  default_tag_field(tag, index, :file_field_tag, :multiple => true)
76
83
  end
77
-
84
+
78
85
  def page_markdown(tag, index)
79
86
  default_tag_field(tag, index, :text_area_tag, :data => {'cms-cm-mode' => 'text/x-markdown'})
80
87
  end
81
-
88
+
82
89
  def collection(tag, index)
83
- options = [["---- Select #{tag.collection_class.titleize} ----", nil]] +
84
- tag.collection_objects.collect do |m|
90
+ options = [["---- Select #{tag.collection_class.titleize} ----", nil]] +
91
+ tag.collection_objects.collect do |m|
85
92
  [m.send(tag.collection_title), m.send(tag.collection_identifier)]
86
93
  end
87
-
94
+
88
95
  content = @template.select_tag(
89
96
  "page[blocks_attributes][#{index}][content]",
90
97
  @template.options_for_select(options, :selected => tag.content),
@@ -93,5 +100,5 @@ class ComfortableMexicanSofa::FormBuilder < FormattedForm::FormBuilder
93
100
  content << @template.hidden_field_tag("page[blocks_attributes][#{index}][identifier]", tag.identifier, :id => nil)
94
101
  element(tag.identifier.titleize, content, :class => tag.class.to_s.demodulize.underscore )
95
102
  end
96
-
103
+
97
104
  end
@@ -0,0 +1,17 @@
1
+ class ComfortableMexicanSofa::Tag::FieldBoolean
2
+ include ComfortableMexicanSofa::Tag
3
+
4
+ def self.regex_tag_signature(identifier = nil)
5
+ identifier ||= IDENTIFIER_REGEX
6
+ /\{\{\s*cms:field:(#{identifier}):boolean\s*\}\}/
7
+ end
8
+
9
+ def content
10
+ block.content
11
+ end
12
+
13
+ def render
14
+ ''
15
+ end
16
+
17
+ end
@@ -1,3 +1,3 @@
1
1
  module ComfortableMexicanSofa
2
- VERSION = "1.11.1"
2
+ VERSION = "1.11.2"
3
3
  end
@@ -172,7 +172,8 @@ class Admin::Cms::FilesControllerTest < ActionController::TestCase
172
172
  file = cms_files(:default)
173
173
  put :update, :site_id => file.site, :id => file, :file => {
174
174
  :label => 'New File',
175
- :description => 'New Description'
175
+ :description => 'New Description',
176
+ :file => fixture_file_upload('files/image.jpg', 'image/jpeg')
176
177
  }
177
178
  assert_response :redirect
178
179
  assert_redirected_to :action => :edit, :site_id => file.site, :id => file
@@ -176,6 +176,15 @@ class Admin::Cms::PagesControllerTest < ActionController::TestCase
176
176
  assert_select "input[type='hidden'][name='page[blocks_attributes][0][identifier]'][value='test_label']"
177
177
  end
178
178
 
179
+ def test_get_new_with_boolean_field
180
+ cms_layouts(:default).update_columns(:content => '{{cms:field:test_label:boolean}}')
181
+ get :new, :site_id => cms_sites(:default)
182
+ assert_response :success
183
+ assert_select "input[type='hidden'][name='page[blocks_attributes][0][identifier]'][value='test_label']"
184
+ assert_select "input[type='hidden'][name='page[blocks_attributes][0][content]'][value='']"
185
+ assert_select "input[type='checkbox'][name='page[blocks_attributes][0][content]'][value='1']"
186
+ end
187
+
179
188
  def test_get_new_with_several_tag_fields
180
189
  cms_layouts(:default).update_columns(:content => '{{cms:page:label_a}}{{cms:page:label_b}}')
181
190
  get :new, :site_id => cms_sites(:default)
@@ -188,6 +197,11 @@ class Admin::Cms::PagesControllerTest < ActionController::TestCase
188
197
 
189
198
  def test_get_new_with_crashy_tag
190
199
  cms_layouts(:default).update_columns(:content => '{{cms:collection:label:invalid}}')
200
+ assert_exception_raised do
201
+ get :new, :site_id => cms_sites(:default)
202
+ end
203
+
204
+ Rails.stubs(:env => ActiveSupport::StringInquirer.new('production'))
191
205
  get :new, :site_id => cms_sites(:default)
192
206
  assert_response :success
193
207
  end
@@ -21,6 +21,12 @@ class Cms::ContentControllerTest < ActionController::TestCase
21
21
  ), response.body
22
22
  assert_equal 'text/html', response.content_type
23
23
  end
24
+
25
+ def test_show_default_html
26
+ @request.headers["Accept"] = "*/*"
27
+ get :show, :cms_path => ''
28
+ assert_equal 'text/html', response.content_type
29
+ end
24
30
 
25
31
  def test_show_as_json
26
32
  get :show, :cms_path => '', :format => 'json'
@@ -0,0 +1,49 @@
1
+ require_relative '../../test_helper'
2
+
3
+ class FieldBooleanTagTest < ActiveSupport::TestCase
4
+
5
+ def test_initialize_tag
6
+ assert tag = ComfortableMexicanSofa::Tag::FieldBoolean.initialize_tag(
7
+ cms_pages(:default), '{{ cms:field:content:boolean }}'
8
+ )
9
+ assert_equal 'content', tag.identifier
10
+ assert_nil tag.namespace
11
+ assert tag = ComfortableMexicanSofa::Tag::FieldBoolean.initialize_tag(
12
+ cms_pages(:default), '{{cms:field:content:boolean}}'
13
+ )
14
+ assert_equal 'content', tag.identifier
15
+ assert tag = ComfortableMexicanSofa::Tag::FieldBoolean.initialize_tag(
16
+ cms_pages(:default), '{{cms:field:dash-content:boolean}}'
17
+ )
18
+ assert_equal 'dash-content', tag.identifier
19
+ assert tag = ComfortableMexicanSofa::Tag::FieldBoolean.initialize_tag(
20
+ cms_pages(:default), '{{cms:field:namespace.content:boolean}}'
21
+ )
22
+ assert_equal 'namespace.content', tag.identifier
23
+ assert_equal 'namespace', tag.namespace
24
+ end
25
+
26
+ def test_initialize_tag_failure
27
+ [
28
+ '{{cms:field:content:not_boolean}}',
29
+ '{{cms:field:content}}',
30
+ '{{cms:not_field:content}}',
31
+ '{not_a_tag}'
32
+ ].each do |tag_signature|
33
+ assert_nil ComfortableMexicanSofa::Tag::FieldBoolean.initialize_tag(
34
+ cms_pages(:default), tag_signature
35
+ )
36
+ end
37
+ end
38
+
39
+ def test_content_and_render
40
+ tag = ComfortableMexicanSofa::Tag::FieldBoolean.initialize_tag(
41
+ cms_pages(:default), '{{cms:field:content:boolean}}'
42
+ )
43
+ assert tag.block.content.blank?
44
+ tag.block.content = 'TRUE'
45
+ assert_equal 'TRUE', tag.content
46
+ assert_equal '', tag.render
47
+ end
48
+
49
+ end
@@ -3,6 +3,11 @@ require_relative '../test_helper'
3
3
  class CmsFileTest < ActiveSupport::TestCase
4
4
 
5
5
  def test_fixtures_validity
6
+ # stubbing out Paperclip 4.0 mimetype validation
7
+ if defined? Paperclip::Validators::MediaTypeSpoofDetectionValidator
8
+ Paperclip::Validators::MediaTypeSpoofDetectionValidator.any_instance.stubs(:validate_each).returns(true)
9
+ end
10
+
6
11
  Cms::File.all.each do |file|
7
12
  assert file.valid?, file.errors.full_messages.to_s
8
13
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comfortable_mexican_sofa
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.1
4
+ version: 1.11.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Khabarov
8
- - The Working Group Inc
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-12-20 00:00:00.000000000 Z
11
+ date: 2014-02-03 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rails
@@ -25,6 +24,20 @@ dependencies:
25
24
  - - ~>
26
25
  - !ruby/object:Gem::Version
27
26
  version: '4.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails-i18n
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 4.0.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 4.0.0
28
41
  - !ruby/object:Gem::Dependency
29
42
  name: formatted_form
30
43
  requirement: !ruby/object:Gem::Requirement
@@ -179,7 +192,7 @@ dependencies:
179
192
  - - '>='
180
193
  - !ruby/object:Gem::Version
181
194
  version: 0.14.0
182
- description: ComfortableMexicanSofa is a powerful CMS Engine for Ruby on Rails applications
195
+ description: ComfortableMexicanSofa is a powerful CMS Engine for Rails 4 applications
183
196
  email:
184
197
  - oleg@khabarov.ca
185
198
  executables: []
@@ -342,6 +355,7 @@ files:
342
355
  - config/locales/en.yml
343
356
  - config/locales/es.yml
344
357
  - config/locales/fr.yml
358
+ - config/locales/it.yml
345
359
  - config/locales/ja.yml
346
360
  - config/locales/nl.yml
347
361
  - config/locales/pl.yml
@@ -404,6 +418,7 @@ files:
404
418
  - lib/comfortable_mexican_sofa/tag.rb
405
419
  - lib/comfortable_mexican_sofa/tags/asset.rb
406
420
  - lib/comfortable_mexican_sofa/tags/collection.rb
421
+ - lib/comfortable_mexican_sofa/tags/field_boolean.rb
407
422
  - lib/comfortable_mexican_sofa/tags/field_datetime.rb
408
423
  - lib/comfortable_mexican_sofa/tags/field_integer.rb
409
424
  - lib/comfortable_mexican_sofa/tags/field_rich_text.rb
@@ -504,6 +519,7 @@ files:
504
519
  - test/lib/tag_test.rb
505
520
  - test/lib/tags/asset_test.rb
506
521
  - test/lib/tags/collection_test.rb
522
+ - test/lib/tags/field_boolean_test.rb
507
523
  - test/lib/tags/field_datetime_test.rb
508
524
  - test/lib/tags/field_integer_test.rb
509
525
  - test/lib/tags/field_rich_text_test.rb