locomotive_cms 2.5.5 → 2.5.6.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -2
  3. data/README.textile +3 -3
  4. data/app/assets/images/locomotive/icons/flags/pt.png +0 -0
  5. data/app/assets/javascripts/locomotive/utils/aloha_settings.js.coffee +1 -1
  6. data/app/assets/javascripts/locomotive/views/current_site/edit_view.js.coffee +5 -0
  7. data/app/assets/stylesheets/locomotive/backoffice/menu/main.css.scss +1 -1
  8. data/app/controllers/locomotive/api/theme_assets_controller.rb +1 -1
  9. data/app/controllers/locomotive/public/content_entries_controller.rb +6 -11
  10. data/app/controllers/locomotive/public/pages_controller.rb +1 -1
  11. data/app/controllers/locomotive/public/sitemaps_controller.rb +1 -1
  12. data/app/models/locomotive/extensions/content_type/sync.rb +16 -5
  13. data/app/models/locomotive/extensions/page/tree.rb +7 -3
  14. data/app/models/locomotive/extensions/site/locales.rb +12 -9
  15. data/app/models/locomotive/site.rb +10 -0
  16. data/app/views/locomotive/current_site/_form.html.haml +1 -0
  17. data/config/locales/admin_ui.cs.yml +2 -0
  18. data/config/locales/admin_ui.de.yml +3 -2
  19. data/config/locales/admin_ui.en.yml +1 -0
  20. data/config/locales/admin_ui.es.yml +2 -1
  21. data/config/locales/admin_ui.et.yml +1 -0
  22. data/config/locales/admin_ui.fr.yml +2 -1
  23. data/config/locales/admin_ui.it.yml +23 -0
  24. data/config/locales/admin_ui.ja.yml +1 -0
  25. data/config/locales/admin_ui.nb.yml +1 -0
  26. data/config/locales/admin_ui.nl.yml +4 -0
  27. data/config/locales/admin_ui.pl.yml +1 -0
  28. data/config/locales/admin_ui.pt-BR.yml +6 -5
  29. data/config/locales/admin_ui.pt.yml +320 -0
  30. data/config/locales/admin_ui.ru.yml +1 -0
  31. data/config/locales/admin_ui.sk.yml +2 -0
  32. data/config/locales/admin_ui.sr.yml +1 -0
  33. data/config/locales/admin_ui.zh-CN.yml +1 -0
  34. data/config/locales/carrierwave.pt.yml +4 -0
  35. data/config/locales/default.pt.yml +212 -0
  36. data/config/locales/devise.pt.yml +62 -0
  37. data/config/locales/flash.pt.yml +106 -0
  38. data/config/locales/formtastic.pt.yml +70 -0
  39. data/config/routes.rb +5 -6
  40. data/features/api/authorization/theme_assets.feature +4 -4
  41. data/features/public/contact_form.feature +1 -1
  42. data/features/public/new_contact_form.feature +95 -0
  43. data/features/public/pages.feature +2 -2
  44. data/features/step_definitions/relationships_steps.rb +37 -34
  45. data/lib/generators/locomotive/install/install_generator.rb +2 -0
  46. data/lib/generators/locomotive/install/templates/README +3 -2
  47. data/lib/generators/locomotive/install/templates/devise.rb +175 -0
  48. data/lib/generators/locomotive/install/templates/dragonfly.rb +1 -1
  49. data/lib/generators/locomotive/install/templates/locomotive.rb +2 -2
  50. data/lib/locomotive.rb +9 -0
  51. data/lib/locomotive/action_controller/public_responder.rb +45 -28
  52. data/lib/locomotive/configuration.rb +2 -2
  53. data/lib/locomotive/liquid/drops/content_entry.rb +6 -8
  54. data/lib/locomotive/liquid/drops/site.rb +1 -5
  55. data/lib/locomotive/liquid/filters/translate.rb +1 -1
  56. data/lib/locomotive/liquid/tags/fetch_page.rb +14 -6
  57. data/lib/locomotive/liquid/tags/model_form.rb +75 -0
  58. data/lib/locomotive/middlewares.rb +5 -1
  59. data/lib/locomotive/middlewares/base.rb +45 -0
  60. data/lib/locomotive/middlewares/locale.rb +32 -0
  61. data/lib/locomotive/middlewares/locale_redirection.rb +46 -0
  62. data/lib/locomotive/middlewares/seo_trailing_slash.rb +7 -28
  63. data/lib/locomotive/middlewares/site.rb +26 -0
  64. data/lib/locomotive/regexps.rb +1 -1
  65. data/lib/locomotive/render.rb +22 -2
  66. data/lib/locomotive/routing.rb +1 -0
  67. data/lib/locomotive/routing/post_content_entry_constraint.rb +11 -0
  68. data/lib/locomotive/routing/site_dispatcher.rb +1 -12
  69. data/lib/locomotive/version.rb +1 -1
  70. data/spec/dummy/config/boot.rb +1 -1
  71. data/spec/dummy/config/initializers/dragonfly.rb +1 -1
  72. data/spec/dummy/config/initializers/locomotive.rb +2 -2
  73. data/spec/lib/locomotive/liquid/drops/content_entry_spec.rb +23 -18
  74. data/spec/lib/locomotive/liquid/drops/site_spec.rb +25 -15
  75. data/spec/lib/locomotive/liquid/tags/model_form_spec.rb +46 -0
  76. data/spec/lib/locomotive/routing/site_dispatcher_spec.rb +0 -41
  77. data/spec/models/locomotive/site_spec.rb +1 -1
  78. data/spec/requests/locale_redirection_spec.rb +109 -0
  79. data/spec/requests/locale_spec.rb +85 -0
  80. data/spec/requests/seo_trailing_slash_spec.rb +1 -1
  81. data/spec/requests/site_spec.rb +27 -0
  82. data/spec/support/factories.rb +6 -0
  83. data/spec/support/middlewares.rb +3 -0
  84. metadata +48 -10
@@ -0,0 +1,85 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Locomotive::Middlewares::Locale' do
4
+
5
+ let(:locales) { ['en'] }
6
+ let(:site) { FactoryGirl.create('existing site', locales: locales) }
7
+ let(:url) { 'http://models.example.com' }
8
+ let(:app) { ->(env) { [200, env, "app"] } }
9
+ let(:middleware) { Locomotive::Middlewares::Locale.new(app) }
10
+
11
+ subject { code, env = middleware.call(env_for(url, 'locomotive.site' => site)); env['locomotive.locale'] }
12
+
13
+ describe 'not localized' do
14
+
15
+ it { should be_nil }
16
+
17
+ end
18
+
19
+ describe 'localized site' do
20
+
21
+ let(:locales) { ['en', 'fr', 'de'] }
22
+
23
+ describe 'without locale in URL' do
24
+
25
+ it { should be_nil }
26
+
27
+ end
28
+
29
+ describe 'the locale happens to be in the path' do
30
+
31
+ let(:url) { 'http://models.example.com/english' }
32
+ it { should be_nil }
33
+
34
+ end
35
+
36
+ describe 'with locale in URL' do
37
+
38
+ let(:url) { 'http://models.example.com/en' }
39
+ it { should eq 'en' }
40
+
41
+ end
42
+
43
+ describe 'with locale in URL (ending slash)' do
44
+
45
+ let(:url) { 'http://models.example.com/fr/' }
46
+ it { should eq 'fr' }
47
+
48
+ end
49
+
50
+ describe 'with locale in URL (long path)' do
51
+
52
+ let(:url) { 'http://models.example.com/de/guten_morgen' }
53
+ it { should eq 'de' }
54
+
55
+ end
56
+
57
+ describe 'extracting path with localization' do
58
+
59
+ subject { code, env = middleware.call(env_for(url, 'locomotive.site' => site)); env['locomotive.path'] }
60
+
61
+ describe 'without locale in URL' do
62
+
63
+ it { should be_nil }
64
+
65
+ end
66
+
67
+ describe 'with locale in URL (ending slash)' do
68
+
69
+ let(:url) { 'http://models.example.com/fr/' }
70
+ it { should eq '/' }
71
+
72
+ end
73
+
74
+ describe 'with locale in URL (long path)' do
75
+
76
+ let(:url) { 'http://models.example.com/de/guten_morgen' }
77
+ it { should eq '/guten_morgen' }
78
+
79
+ end
80
+
81
+ end
82
+
83
+ end
84
+
85
+ end
@@ -25,7 +25,7 @@ describe 'Locomotive::Middlewares::SeoTrailingSlash' do
25
25
  it 'removes the trailing slash but preserves the query' do
26
26
  get '/hello_world/?test=name'
27
27
  response.status.should be(301)
28
- response.location.should == '/hello_world?test=name'
28
+ response.location.should == 'http://www.example.com/hello_world?test=name'
29
29
  end
30
30
 
31
31
  end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Locomotive::Middlewares::Site' do
4
+
5
+ let(:site) { FactoryGirl.create('existing site') }
6
+ let(:url) { 'http://models.example.com' }
7
+ let(:app) { ->(env) { [200, env, "app"] } }
8
+ let(:middleware) { Locomotive::Middlewares::Site.new(app) }
9
+
10
+ subject { code, env = middleware.call(env_for(url)); env['locomotive.site'] }
11
+
12
+ describe 'no site' do
13
+
14
+ it { should be_nil }
15
+
16
+ end
17
+
18
+ describe 'existing site' do
19
+
20
+ before { site }
21
+
22
+ its(:name) { should eq 'Locomotive site with existing models' }
23
+ its(:subdomain) { should eq 'models' }
24
+
25
+ end
26
+
27
+ end
@@ -61,6 +61,12 @@ FactoryGirl.define do
61
61
  locale 'fr'
62
62
  end
63
63
 
64
+ factory 'portuguese user' do
65
+ name 'Tiago Fernandes'
66
+ email 'tjg.fernandes@gmail.com'
67
+ locale 'pt'
68
+ end
69
+
64
70
  factory 'brazillian user' do
65
71
  name 'Jose Carlos'
66
72
  email 'jose@carlos.com.br'
@@ -0,0 +1,3 @@
1
+ def env_for(url, opts={})
2
+ Rack::MockRequest.env_for(url, opts)
3
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: locomotive_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.5
4
+ version: 2.5.6.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Didier Lafforgue
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-11 00:00:00.000000000 Z
11
+ date: 2014-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 3.2.17
33
+ version: 3.2.19
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 3.2.17
40
+ version: 3.2.19
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: devise
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 2.3.1
159
+ version: 2.3.2
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 2.3.1
166
+ version: 2.3.2
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: kaminari
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -276,6 +276,20 @@ dependencies:
276
276
  - - "~>"
277
277
  - !ruby/object:Gem::Version
278
278
  version: 1.1.1
279
+ - !ruby/object:Gem::Dependency
280
+ name: compass-rails
281
+ requirement: !ruby/object:Gem::Requirement
282
+ requirements:
283
+ - - "~>"
284
+ - !ruby/object:Gem::Version
285
+ version: 2.0.0
286
+ type: :runtime
287
+ prerelease: false
288
+ version_requirements: !ruby/object:Gem::Requirement
289
+ requirements:
290
+ - - "~>"
291
+ - !ruby/object:Gem::Version
292
+ version: 2.0.0
279
293
  - !ruby/object:Gem::Dependency
280
294
  name: locomotivecms_solid
281
295
  requirement: !ruby/object:Gem::Requirement
@@ -436,14 +450,14 @@ dependencies:
436
450
  requirements:
437
451
  - - "~>"
438
452
  - !ruby/object:Gem::Version
439
- version: 1.0.4
453
+ version: 1.0.7
440
454
  type: :runtime
441
455
  prerelease: false
442
456
  version_requirements: !ruby/object:Gem::Requirement
443
457
  requirements:
444
458
  - - "~>"
445
459
  - !ruby/object:Gem::Version
446
- version: 1.0.4
460
+ version: 1.0.7
447
461
  - !ruby/object:Gem::Dependency
448
462
  name: rack-cache
449
463
  requirement: !ruby/object:Gem::Requirement
@@ -560,6 +574,7 @@ files:
560
574
  - app/assets/images/locomotive/icons/flags/nl.png
561
575
  - app/assets/images/locomotive/icons/flags/pl.png
562
576
  - app/assets/images/locomotive/icons/flags/pt-BR.png
577
+ - app/assets/images/locomotive/icons/flags/pt.png
563
578
  - app/assets/images/locomotive/icons/flags/ru.png
564
579
  - app/assets/images/locomotive/icons/flags/sk.png
565
580
  - app/assets/images/locomotive/icons/flags/sr.png
@@ -962,6 +977,7 @@ files:
962
977
  - config/locales/admin_ui.nl.yml
963
978
  - config/locales/admin_ui.pl.yml
964
979
  - config/locales/admin_ui.pt-BR.yml
980
+ - config/locales/admin_ui.pt.yml
965
981
  - config/locales/admin_ui.ru.yml
966
982
  - config/locales/admin_ui.sk.yml
967
983
  - config/locales/admin_ui.sr.yml
@@ -979,6 +995,7 @@ files:
979
995
  - config/locales/carrierwave.nl.yml
980
996
  - config/locales/carrierwave.pl.yml
981
997
  - config/locales/carrierwave.pt-BR.yml
998
+ - config/locales/carrierwave.pt.yml
982
999
  - config/locales/carrierwave.ru.yml
983
1000
  - config/locales/carrierwave.sk.yml
984
1001
  - config/locales/carrierwave.sr.yml
@@ -996,6 +1013,7 @@ files:
996
1013
  - config/locales/default.nl.yml
997
1014
  - config/locales/default.pl.yml
998
1015
  - config/locales/default.pt-BR.yml
1016
+ - config/locales/default.pt.yml
999
1017
  - config/locales/default.ru.yml
1000
1018
  - config/locales/default.sk.yml
1001
1019
  - config/locales/default.sr.yml
@@ -1013,6 +1031,7 @@ files:
1013
1031
  - config/locales/devise.nl.yml
1014
1032
  - config/locales/devise.pl.yml
1015
1033
  - config/locales/devise.pt-BR.yml
1034
+ - config/locales/devise.pt.yml
1016
1035
  - config/locales/devise.ru.yml
1017
1036
  - config/locales/devise.sk.yml
1018
1037
  - config/locales/devise.sr.yml
@@ -1030,6 +1049,7 @@ files:
1030
1049
  - config/locales/flash.nl.yml
1031
1050
  - config/locales/flash.pl.yml
1032
1051
  - config/locales/flash.pt-BR.yml
1052
+ - config/locales/flash.pt.yml
1033
1053
  - config/locales/flash.ru.yml
1034
1054
  - config/locales/flash.sk.yml
1035
1055
  - config/locales/flash.sr.yml
@@ -1047,6 +1067,7 @@ files:
1047
1067
  - config/locales/formtastic.nl.yml
1048
1068
  - config/locales/formtastic.pl.yml
1049
1069
  - config/locales/formtastic.pt-BR.yml
1070
+ - config/locales/formtastic.pt.yml
1050
1071
  - config/locales/formtastic.ru.yml
1051
1072
  - config/locales/formtastic.sk.yml
1052
1073
  - config/locales/formtastic.sr.yml
@@ -1105,6 +1126,7 @@ files:
1105
1126
  - features/public/inheritance.feature
1106
1127
  - features/public/inline_front_end_editing.feature
1107
1128
  - features/public/many_to_many.feature
1129
+ - features/public/new_contact_form.feature
1108
1130
  - features/public/pages.feature
1109
1131
  - features/public/pagination.feature
1110
1132
  - features/public/robots.feature
@@ -1143,6 +1165,7 @@ files:
1143
1165
  - lib/generators/locomotive/install/install_generator.rb
1144
1166
  - lib/generators/locomotive/install/templates/README
1145
1167
  - lib/generators/locomotive/install/templates/carrierwave.rb
1168
+ - lib/generators/locomotive/install/templates/devise.rb
1146
1169
  - lib/generators/locomotive/install/templates/dragonfly.rb
1147
1170
  - lib/generators/locomotive/install/templates/locomotive.rb
1148
1171
  - lib/generators/locomotive/install/templates/mongoid.yml
@@ -1209,6 +1232,7 @@ files:
1209
1232
  - lib/locomotive/liquid/tags/javascript.rb
1210
1233
  - lib/locomotive/liquid/tags/link_to.rb
1211
1234
  - lib/locomotive/liquid/tags/locale_switcher.rb
1235
+ - lib/locomotive/liquid/tags/model_form.rb
1212
1236
  - lib/locomotive/liquid/tags/nav.rb
1213
1237
  - lib/locomotive/liquid/tags/paginate.rb
1214
1238
  - lib/locomotive/liquid/tags/path_helper.rb
@@ -1220,9 +1244,13 @@ files:
1220
1244
  - lib/locomotive/logger.rb
1221
1245
  - lib/locomotive/markdown.rb
1222
1246
  - lib/locomotive/middlewares.rb
1247
+ - lib/locomotive/middlewares/base.rb
1223
1248
  - lib/locomotive/middlewares/inline_editor.rb
1249
+ - lib/locomotive/middlewares/locale.rb
1250
+ - lib/locomotive/middlewares/locale_redirection.rb
1224
1251
  - lib/locomotive/middlewares/permalink.rb
1225
1252
  - lib/locomotive/middlewares/seo_trailing_slash.rb
1253
+ - lib/locomotive/middlewares/site.rb
1226
1254
  - lib/locomotive/misc/api_documentation.rb
1227
1255
  - lib/locomotive/misc/api_documentation/bootstrap.html.haml
1228
1256
  - lib/locomotive/mongoid.rb
@@ -1237,6 +1265,7 @@ files:
1237
1265
  - lib/locomotive/render.rb
1238
1266
  - lib/locomotive/routing.rb
1239
1267
  - lib/locomotive/routing/default_constraint.rb
1268
+ - lib/locomotive/routing/post_content_entry_constraint.rb
1240
1269
  - lib/locomotive/routing/site_dispatcher.rb
1241
1270
  - lib/locomotive/version.rb
1242
1271
  - lib/locomotive_cms.rb
@@ -1321,6 +1350,7 @@ files:
1321
1350
  - spec/lib/locomotive/liquid/tags/javascript_spec.rb
1322
1351
  - spec/lib/locomotive/liquid/tags/link_to_spec.rb
1323
1352
  - spec/lib/locomotive/liquid/tags/locale_switcher_spec.rb
1353
+ - spec/lib/locomotive/liquid/tags/model_form_spec.rb
1324
1354
  - spec/lib/locomotive/liquid/tags/nav_spec.rb
1325
1355
  - spec/lib/locomotive/liquid/tags/paginate_spec.rb
1326
1356
  - spec/lib/locomotive/liquid/tags/path_to_spec.rb
@@ -1350,7 +1380,10 @@ files:
1350
1380
  - spec/models/locomotive/snippet_spec.rb
1351
1381
  - spec/models/locomotive/theme_asset_spec.rb
1352
1382
  - spec/requests/admin_ssl_spec.rb
1383
+ - spec/requests/locale_redirection_spec.rb
1384
+ - spec/requests/locale_spec.rb
1353
1385
  - spec/requests/seo_trailing_slash_spec.rb
1386
+ - spec/requests/site_spec.rb
1354
1387
  - spec/support/asset_host_stubs.rb
1355
1388
  - spec/support/carrierwave.rb
1356
1389
  - spec/support/cells.rb
@@ -1424,9 +1457,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
1424
1457
  version: '0'
1425
1458
  required_rubygems_version: !ruby/object:Gem::Requirement
1426
1459
  requirements:
1427
- - - ">="
1460
+ - - ">"
1428
1461
  - !ruby/object:Gem::Version
1429
- version: '0'
1462
+ version: 1.3.1
1430
1463
  requirements: []
1431
1464
  rubyforge_project:
1432
1465
  rubygems_version: 2.2.2
@@ -1487,6 +1520,7 @@ test_files:
1487
1520
  - features/public/inheritance.feature
1488
1521
  - features/public/inline_front_end_editing.feature
1489
1522
  - features/public/many_to_many.feature
1523
+ - features/public/new_contact_form.feature
1490
1524
  - features/public/pages.feature
1491
1525
  - features/public/pagination.feature
1492
1526
  - features/public/robots.feature
@@ -1557,6 +1591,7 @@ test_files:
1557
1591
  - spec/lib/locomotive/liquid/tags/javascript_spec.rb
1558
1592
  - spec/lib/locomotive/liquid/tags/link_to_spec.rb
1559
1593
  - spec/lib/locomotive/liquid/tags/locale_switcher_spec.rb
1594
+ - spec/lib/locomotive/liquid/tags/model_form_spec.rb
1560
1595
  - spec/lib/locomotive/liquid/tags/nav_spec.rb
1561
1596
  - spec/lib/locomotive/liquid/tags/paginate_spec.rb
1562
1597
  - spec/lib/locomotive/liquid/tags/path_to_spec.rb
@@ -1586,7 +1621,10 @@ test_files:
1586
1621
  - spec/models/locomotive/snippet_spec.rb
1587
1622
  - spec/models/locomotive/theme_asset_spec.rb
1588
1623
  - spec/requests/admin_ssl_spec.rb
1624
+ - spec/requests/locale_redirection_spec.rb
1625
+ - spec/requests/locale_spec.rb
1589
1626
  - spec/requests/seo_trailing_slash_spec.rb
1627
+ - spec/requests/site_spec.rb
1590
1628
  - spec/support/asset_host_stubs.rb
1591
1629
  - spec/support/carrierwave.rb
1592
1630
  - spec/support/cells.rb