comfortable_mexican_sofa 1.12.7 → 1.12.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/app/assets/javascripts/comfy/admin/cms/application.js.coffee +1 -1
  4. data/app/assets/javascripts/comfy/admin/cms/base.js.coffee +4 -2
  5. data/app/assets/javascripts/comfy/admin/cms/lib/redactor.js +309 -218
  6. data/app/assets/javascripts/comfy/admin/cms/lib/redactor/definedlinks.js +53 -0
  7. data/app/controllers/comfy/admin/cms/pages_controller.rb +21 -0
  8. data/app/helpers/comfy/cms_helper.rb +1 -1
  9. data/app/models/comfy/cms/site.rb +1 -1
  10. data/app/views/comfy/admin/cms/pages/_form.html.haml +2 -4
  11. data/app/views/layouts/comfy/admin/cms/_head.html.haml +1 -0
  12. data/config/environments/test.rb +4 -0
  13. data/config/locales/cs.yml +28 -23
  14. data/config/locales/da.yml +36 -31
  15. data/config/locales/de.yml +32 -27
  16. data/config/locales/en.yml +10 -7
  17. data/config/locales/es.yml +21 -16
  18. data/config/locales/fr.yml +28 -23
  19. data/config/locales/it.yml +12 -7
  20. data/config/locales/ja.yml +28 -23
  21. data/config/locales/nb.yml +12 -7
  22. data/config/locales/nl.yml +21 -16
  23. data/config/locales/pl.yml +28 -23
  24. data/config/locales/pt-BR.yml +27 -22
  25. data/config/locales/ru.yml +19 -16
  26. data/config/locales/sv.yml +28 -23
  27. data/config/locales/uk.yml +10 -7
  28. data/config/locales/zh-CN.yml +22 -17
  29. data/config/locales/zh-TW.yml +22 -17
  30. data/lib/comfortable_mexican_sofa/render_methods.rb +1 -1
  31. data/lib/comfortable_mexican_sofa/version.rb +1 -1
  32. data/test/controllers/comfy/admin/cms/pages_controller_test.rb +59 -46
  33. data/test/gemfiles/Gemfile.rails.4.0 +2 -2
  34. data/test/gemfiles/Gemfile.rails.4.1 +1 -1
  35. data/test/gemfiles/Gemfile.rails.4.2 +1 -1
  36. data/test/gemfiles/Gemfile.rails.master +1 -1
  37. data/test/integration/i18n_test.rb +37 -0
  38. data/test/integration/js_variables_test.rb +1 -0
  39. data/test/lib/mirrors_test.rb +35 -35
  40. metadata +4 -2
@@ -0,0 +1,53 @@
1
+ if (!RedactorPlugins) var RedactorPlugins = {};
2
+
3
+ (function($)
4
+ {
5
+ RedactorPlugins.definedlinks = function()
6
+ {
7
+ return {
8
+ init: function()
9
+ {
10
+ if (!this.opts.definedLinks) return;
11
+
12
+ this.modal.addCallback('link', $.proxy(this.definedlinks.load, this));
13
+
14
+ },
15
+ load: function()
16
+ {
17
+ var $select = $('<select id="redactor-defined-links" />');
18
+ $('#redactor-modal-link-insert').prepend($select);
19
+
20
+ this.definedlinks.storage = {};
21
+
22
+ $.getJSON(this.opts.definedLinks, $.proxy(function(data)
23
+ {
24
+ $.each(data, $.proxy(function(key, val)
25
+ {
26
+ this.definedlinks.storage[key] = val;
27
+ $select.append($('<option>').val(key).html(val.name));
28
+
29
+ }, this));
30
+
31
+ $select.on('change', $.proxy(this.definedlinks.select, this));
32
+
33
+ }, this));
34
+
35
+ },
36
+ select: function(e)
37
+ {
38
+ var key = $(e.target).val();
39
+ var name = '', url = '';
40
+ if (key !== 0)
41
+ {
42
+ name = this.definedlinks.storage[key].name;
43
+ url = this.definedlinks.storage[key].url;
44
+ }
45
+
46
+ $('#redactor-link-url').val(url);
47
+
48
+ var $el = $('#redactor-link-url-text');
49
+ if ($el.val() === '') $el.val(name);
50
+ }
51
+ };
52
+ };
53
+ })(jQuery);
@@ -9,6 +9,8 @@ class Comfy::Admin::Cms::PagesController < Comfy::Admin::Cms::BaseController
9
9
  def index
10
10
  return redirect_to :action => :new if site_has_no_pages?
11
11
 
12
+ return index_for_redactor if params[:source] == 'redactor'
13
+
12
14
  @pages_by_parent = pages_grouped_by_parent
13
15
 
14
16
  if params[:category].present?
@@ -74,6 +76,25 @@ class Comfy::Admin::Cms::PagesController < Comfy::Admin::Cms::BaseController
74
76
 
75
77
  protected
76
78
 
79
+ def index_for_redactor
80
+ tree_walker = ->(page, list, offset) do
81
+ return unless page.present?
82
+ label = "#{'. . ' * offset}#{page.label}"
83
+ list << {:name => label, :url => page.url(:relative)}
84
+ page.children.each do |child_page|
85
+ tree_walker.(child_page, list, offset + 1)
86
+ end
87
+ list
88
+ end
89
+
90
+ page_select_options = [{
91
+ :name => I18n.t('comfy.admin.cms.pages.form.choose_link'),
92
+ :url => false
93
+ }] + tree_walker.(@site.pages.root, [ ], 0)
94
+
95
+ render :json => page_select_options
96
+ end
97
+
77
98
  def site_has_no_pages?
78
99
  @site.pages.count == 0
79
100
  end
@@ -19,7 +19,7 @@ module Comfy::CmsHelper
19
19
  # <% end %>
20
20
  def cms_snippet_content(identifier, cms_site = @cms_site, &block)
21
21
  unless cms_site
22
- host, path = request.host.downcase, request.fullpath if respond_to?(:request) && request
22
+ host, path = request.host_with_port.downcase, request.fullpath if respond_to?(:request) && request
23
23
  cms_site = Comfy::Cms::Site.find_site(host, path)
24
24
  end
25
25
  return '' unless cms_site
@@ -57,7 +57,7 @@ class Comfy::Cms::Site < ActiveRecord::Base
57
57
  # When removing entire site, let's not destroy content from other sites
58
58
  # Since before_destroy doesn't really work, this does the trick
59
59
  def destroy
60
- self.class.where(:id => self.id).update_all(:is_mirrored => false) if self.is_mirrored?
60
+ self.update_attributes(:is_mirrored => false) if self.is_mirrored?
61
61
  super
62
62
  end
63
63
 
@@ -9,10 +9,8 @@
9
9
 
10
10
  = form.text_field :label, :data => {:slugify => @page.new_record?}
11
11
 
12
- - unless @site.pages.count == 0 || @site.pages.root == @page
13
- = form.text_field :slug, :data => {:slug => true}
14
- - unless @page.new_record?
15
- = form.text_field :full_path, :id => 'full-path', :disabled => true
12
+ - if @page.parent.present?
13
+ = form.text_field :slug, :data => {:slug => true}, :prepend => @page.parent.full_path
16
14
 
17
15
  - if (options = ::Comfy::Cms::Layout.options_for_select(@site)).present?
18
16
  = form.select :layout_id, options, {}, 'data-url' => form_blocks_comfy_admin_cms_site_page_path(@site, @page.id.to_i)
@@ -9,6 +9,7 @@
9
9
  - if @site && @site.persisted?
10
10
  :javascript
11
11
  CMS.file_upload_path = '#{comfy_admin_cms_site_files_path(@site)}';
12
+ CMS.pages_path = '#{comfy_admin_cms_site_pages_path(@site)}';
12
13
  CMS.locale = '#{I18n.locale}';
13
14
 
14
15
  = yield :head
@@ -35,4 +35,8 @@ defined?(ComfortableMexicanSofa::Application) && ComfortableMexicanSofa::Applica
35
35
  config.active_support.deprecation = :stderr
36
36
 
37
37
  config.active_support.test_order = :random
38
+
39
+ if Rails.version >= '4.2'
40
+ config.active_record.raise_in_transactional_callbacks = true
41
+ end
38
42
  end
@@ -1,12 +1,5 @@
1
1
  # encoding: utf-8
2
2
  cs:
3
- attributes:
4
- label: Popis
5
- slug: Slug
6
- parent_id: Rodič
7
- content: Obsah
8
- identifier: Identifikátor
9
- full_path: Full path
10
3
  activerecord:
11
4
  models:
12
5
  comfy/cms/site: Web
@@ -14,9 +7,11 @@ cs:
14
7
  comfy/cms/page: Stránka
15
8
  comfy/cms/snippet: Úryvek
16
9
  comfy/cms/file: Soubor
10
+
17
11
  attributes:
18
12
  comfy/cms/site:
19
13
  identifier: Identifikátor
14
+ label: Popis
20
15
  hostname: Doména
21
16
  path: Cesta
22
17
  locale: Jazyk
@@ -26,39 +21,46 @@ cs:
26
21
  label: Název rozložení
27
22
  app_layout: Rozložení aplikace
28
23
  parent_id: Rodičovské rozložení
24
+ content: Obsah
29
25
  css: Styl
30
26
  js: Javascript
31
27
  comfy/cms/page:
32
28
  label: Popis
33
29
  layout_id: Rozložení
34
30
  slug: Slug
31
+ full_path: Full path
32
+ parent_id: Rodič
35
33
  target_page_id: Přesměrovat na stránku
34
+ content: Obsah
36
35
  is_published: Publikovaný
37
36
  comfy/cms/file:
37
+ label: Popis
38
38
  file: Soubor
39
39
  description: Popis
40
40
  comfy/cms/snippet:
41
41
  identifier: Identifikátor
42
-
42
+ label: Popis
43
+ content: Obsah
44
+
43
45
  comfy:
44
46
  cms:
45
47
  content:
46
48
  site_not_found: Web nenalezen
47
49
  layout_not_found: Rozložení nenalezeno
48
50
  page_not_found: Stránka nenalezena
49
-
51
+
50
52
  admin:
51
53
  cms:
52
54
  base:
53
55
  site_not_found: Web nenalezen
54
56
  fixtures_enabled: Je povolen pevně definovaný obsah CMS. Všechny zde provedené změny budou ztraceny.
55
-
57
+
56
58
  sites: Weby
57
59
  layouts: Rozložení
58
60
  pages: Stránky
59
61
  snippets: Úryvky
60
62
  files: Soubory
61
-
63
+
62
64
  sites:
63
65
  created: Web vytvořen
64
66
  creation_failure: Nepodařilo se vytvořit web
@@ -66,7 +68,7 @@ cs:
66
68
  update_failure: Nepodařilo se upravit web
67
69
  deleted: Web odstraněn
68
70
  not_found: Web nenalezen
69
-
71
+
70
72
  index:
71
73
  title: Weby
72
74
  new_link: Vytvořit web
@@ -83,7 +85,7 @@ cs:
83
85
  cancel: Zrušit
84
86
  update: Upravit web
85
87
  is_mirrored: Zrcadlený
86
-
88
+
87
89
  layouts:
88
90
  created: Rozložení vytvořeno
89
91
  creation_failure: Nepodařilo se vytvořit rozložení
@@ -91,7 +93,7 @@ cs:
91
93
  update_failure: Nepodařilo se upravit rozložení
92
94
  deleted: Rozložení odstraněno
93
95
  not_found: Rozložení nenalezeno
94
-
96
+
95
97
  index:
96
98
  title: Rozložení
97
99
  new_link: Vytvořit nové rozložení
@@ -116,7 +118,7 @@ cs:
116
118
  create: Vytvořit rozložení
117
119
  cancel: Zrušit
118
120
  update: Upravit rozložení
119
-
121
+
120
122
  pages:
121
123
  created: Stránka vytvořena
122
124
  creation_failure: Nepodařilo se vytvořit stránku
@@ -125,7 +127,7 @@ cs:
125
127
  deleted: Stránka odstraněna
126
128
  not_found: Stránka nenalezena
127
129
  layout_not_found: "Nebyla nalezena žádná rozložení, vytvořte je prosím."
128
-
130
+
129
131
  index:
130
132
  title: Stránky
131
133
  new_link: Vytvořit novou stránku
@@ -148,11 +150,12 @@ cs:
148
150
  cancel: Zrušit
149
151
  update: Upravit stránku
150
152
  is_published: Publikovaná
153
+ choose_link: Select page...
151
154
  form_blocks:
152
155
  no_tags: |-
153
156
  Rozložení nedefinuje žádné obsahové značky.<br/>
154
157
  Upravte jeho obsah tak, aby zahrnovalo obsahové značky. Například: <code>{{cms:page:content}}</code>
155
-
158
+
156
159
  snippets:
157
160
  created: Úryvek vytvořen
158
161
  creation_failure: Nepodařilo se vytvořit úryvek
@@ -160,7 +163,7 @@ cs:
160
163
  update_failure: Nepodařilo se upravit úryvek
161
164
  deleted: Úryvek odstraněn
162
165
  not_found: Úryvek nenalezen
163
-
166
+
164
167
  index:
165
168
  title: Úryvky
166
169
  new_link: Vytvořit úryvek
@@ -177,12 +180,12 @@ cs:
177
180
  create: Vytvořit úryvek
178
181
  cancel: Zrušit
179
182
  update: Upravit úryvek
180
-
183
+
181
184
  revisions:
182
185
  reverted: Obsah byl obnoven
183
186
  record_not_found: Záznam nenalezen
184
187
  not_found: Revize nenalezena
185
-
188
+
186
189
  show:
187
190
  title: Revize pro
188
191
  revision: Revize
@@ -193,7 +196,7 @@ cs:
193
196
  changes: Změny
194
197
  previous: Předchozí
195
198
  current: Aktuální
196
-
199
+
197
200
  files:
198
201
  created: Soubory nahrány
199
202
  creation_failure: Nepodařilo se nahrát soubory
@@ -201,7 +204,7 @@ cs:
201
204
  update_failure: Nepodařilo se upravit soubor
202
205
  deleted: Soubor odstraněn
203
206
  not_found: Soubor nenalezen
204
-
207
+
205
208
  index:
206
209
  title: Soubory
207
210
  new_link: Nahrát nový soubor
@@ -218,11 +221,13 @@ cs:
218
221
  create: Nahrát soubor
219
222
  cancel: Zrušit
220
223
  update: Upravit soubor
224
+ delete: Smazat
225
+ are_you_sure: Určitě?
221
226
  page_form:
222
227
  are_you_sure: Určitě?
223
228
  file:
224
229
  are_you_sure: Určitě?
225
-
230
+
226
231
  categories:
227
232
  index:
228
233
  label: Kategorie
@@ -1,12 +1,5 @@
1
1
  # encoding: utf-8
2
2
  da:
3
- attributes:
4
- label: Etiket
5
- slug: Slug
6
- parent_id: Overordnet
7
- content: Indhold
8
- identifier: Nøgleord
9
- full_path: Full path
10
3
  activerecord:
11
4
  models:
12
5
  comfy/cms/site: Websted
@@ -14,9 +7,11 @@ da:
14
7
  comfy/cms/page: Side
15
8
  comfy/cms/snippet: Snippet
16
9
  comfy/cms/file: Fil
10
+
17
11
  attributes:
18
12
  comfy/cms/site:
19
13
  identifier: Nøgleord
14
+ label: Etiket
20
15
  hostname: Værtsnavn
21
16
  path: Sti
22
17
  locale: Sprog
@@ -26,19 +21,26 @@ da:
26
21
  label: Layout Navn
27
22
  app_layout: App Layout
28
23
  parent_id: Overordnet Layout
24
+ content: Indhold
29
25
  css: Stylesheet
30
26
  js: Javascript
31
27
  comfy/cms/page:
32
28
  label: Etiket
33
29
  layout_id: Layout
34
30
  slug: Slug
31
+ full_path: Full path
32
+ parent_id: Overordnet
35
33
  target_page_id: Viderestil til Side
34
+ content: Indhold
36
35
  is_published: Udgivet
37
36
  comfy/cms/file:
37
+ label: Etiket
38
38
  file: Fil
39
39
  description: Beskrivelse
40
40
  comfy/cms/snippet:
41
41
  identifier: Nøgleord
42
+ label: Etiket
43
+ content: Indhold
42
44
 
43
45
  comfy:
44
46
  cms:
@@ -46,19 +48,19 @@ da:
46
48
  site_not_found: Websted findes ikke
47
49
  layout_not_found: Layout findes ikke
48
50
  page_not_found: Side findes ikke
49
-
51
+
50
52
  admin:
51
- cms:
52
- base:
53
- site_not_found: Webstedet findes ikke
54
- fixtures_enabled: CMS Fixtures er slået til. Alle ændringer til blive ignoreret.
55
-
56
- sites: Websteder
57
- layouts: Layouts
58
- pages: Sider
59
- snippets: Snippets
60
- files: Filer
61
-
53
+ cms:
54
+ base:
55
+ site_not_found: Webstedet findes ikke
56
+ fixtures_enabled: CMS Fixtures er slået til. Alle ændringer til blive ignoreret.
57
+
58
+ sites: Websteder
59
+ layouts: Layouts
60
+ pages: Sider
61
+ snippets: Snippets
62
+ files: Filer
63
+
62
64
  sites:
63
65
  created: Websted oprettet
64
66
  creation_failure: Oprettelse af websted mislykkedes
@@ -66,7 +68,7 @@ da:
66
68
  update_failure: Opdatering af websted mislykkedes
67
69
  deleted: Websted slettet
68
70
  not_found: Websted findes ikke
69
-
71
+
70
72
  index:
71
73
  title: Websteder
72
74
  new_link: Opret nyt websted
@@ -83,7 +85,7 @@ da:
83
85
  cancel: Annuller
84
86
  update: Opdater websted
85
87
  is_mirrored: Kopieret websted
86
-
88
+
87
89
  layouts:
88
90
  created: Layout oprettet
89
91
  creation_failure: Oprettelse af layout mislykkedes
@@ -91,7 +93,7 @@ da:
91
93
  update_failure: Opdatering af layout mislykkedes
92
94
  deleted: Layout slettet
93
95
  not_found: Layout findes ikke
94
-
96
+
95
97
  index:
96
98
  title: Layouts
97
99
  new_link: Opret nyt layout
@@ -116,7 +118,7 @@ da:
116
118
  create: Opret layout
117
119
  cancel: Annuller
118
120
  update: Opdater layout
119
-
121
+
120
122
  pages:
121
123
  created: Side oprettet
122
124
  creation_failure: Oprettelse af side mislykkedes
@@ -125,7 +127,7 @@ da:
125
127
  deleted: Side slettet
126
128
  not_found: Side findes ikke
127
129
  layout_not_found: Ingen layouts findes. Opret venligst et layout.
128
-
130
+
129
131
  index:
130
132
  title: Sider
131
133
  new_link: Opret ny side
@@ -148,11 +150,12 @@ da:
148
150
  cancel: Annuller
149
151
  update: Opdater side
150
152
  is_published: Udgivet
153
+ choose_link: Select page...
151
154
  form_blocks:
152
155
  no_tags: |-
153
156
  Layout har ingen indholdtags defineret.<br/>
154
157
  Rediger indholdet for at inkluderere et side- eller felttag. Eksempelvis: <code>{{cms:page:content}}</code>
155
-
158
+
156
159
  snippets:
157
160
  created: Snippet oprettet
158
161
  creation_failure: Oprettelse af snippet mislykkedes
@@ -160,7 +163,7 @@ da:
160
163
  update_failure: Opdatering af snippet mislykkedes
161
164
  deleted: Snippet slettet
162
165
  not_found: Snippet findes ikke
163
-
166
+
164
167
  index:
165
168
  title: Snippets
166
169
  new_link: Opret ny snippet
@@ -177,12 +180,12 @@ da:
177
180
  create: Opret snippet
178
181
  cancel: Annuller
179
182
  update: Opdater snippet
180
-
183
+
181
184
  revisions:
182
185
  reverted: Indhold gendannet
183
186
  record_not_found: Indhold findes ikke
184
187
  not_found: Revision findes ikke
185
-
188
+
186
189
  show:
187
190
  title: Revisioner for
188
191
  revision: Revision
@@ -193,7 +196,7 @@ da:
193
196
  changes: Ændringer
194
197
  previous: Forrige
195
198
  current: Nuværende
196
-
199
+
197
200
  files:
198
201
  created: Filer sendt
199
202
  creation_failure: Sending af filer mislykkedes
@@ -201,7 +204,7 @@ da:
201
204
  update_failure: Opdatering af fil mislykkedes
202
205
  deleted: Fil slettet
203
206
  not_found: Fil findes ikke
204
-
207
+
205
208
  index:
206
209
  title: Filer
207
210
  new_link: Send ny fil
@@ -218,11 +221,13 @@ da:
218
221
  create: Send fil
219
222
  cancel: Annuller
220
223
  update: Opdater fil
224
+ delete: Slet
225
+ are_you_sure: Er du sikker?
221
226
  page_form:
222
227
  are_you_sure: Er du sikker?
223
228
  file:
224
229
  are_you_sure: Er du sikker?
225
-
230
+
226
231
  categories:
227
232
  index:
228
233
  label: Kategorier