locomotive_cms 2.2.3 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +1 -0
  3. data/README.textile +2 -1
  4. data/app/assets/images/locomotive/icons/flags/bg.png +0 -0
  5. data/app/assets/images/locomotive/icons/flags/cs.png +0 -0
  6. data/app/assets/javascripts/locomotive/models/page.js.coffee +1 -1
  7. data/app/assets/javascripts/locomotive/utils/aloha_settings.js.coffee +2 -2
  8. data/app/assets/javascripts/locomotive/views/application_view.js.coffee +2 -2
  9. data/app/assets/javascripts/locomotive/views/content_assets/picker_view.js.coffee +2 -0
  10. data/app/assets/javascripts/locomotive/views/content_entries/_form_view.js.coffee +8 -0
  11. data/app/assets/javascripts/locomotive/views/editable_elements/text_view.js.coffee +2 -2
  12. data/app/assets/javascripts/locomotive/views/pages/edit_view.js.coffee +2 -0
  13. data/app/assets/javascripts/locomotive/views/shared/fields/belongs_to_view.js.coffee +2 -0
  14. data/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee +7 -5
  15. data/app/assets/javascripts/tinymce/plugins/locomotive_media/editor_plugin.js +7 -3
  16. data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/cs.js +1 -0
  17. data/app/assets/stylesheets/locomotive/backoffice/datepicker.css.scss +66 -0
  18. data/app/assets/stylesheets/locomotive/backoffice/dialog_changes.css.scss +8 -2
  19. data/app/assets/stylesheets/locomotive/backoffice/formtastic_changes.css.scss +8 -0
  20. data/app/assets/stylesheets/locomotive/backoffice/menu/_colors.css.scss +1 -1
  21. data/app/controllers/locomotive/api/base_controller.rb +3 -0
  22. data/app/controllers/locomotive/api/content_entries_controller.rb +4 -4
  23. data/app/controllers/locomotive/api/tokens_controller.rb +4 -0
  24. data/app/controllers/locomotive/base_controller.rb +6 -3
  25. data/app/controllers/locomotive/public/base_controller.rb +3 -0
  26. data/app/controllers/locomotive/public/content_entries_controller.rb +2 -1
  27. data/app/helpers/locomotive/custom_fields_helper.rb +2 -2
  28. data/app/models/locomotive/content_type.rb +7 -0
  29. data/app/models/locomotive/editable_file.rb +1 -0
  30. data/app/models/locomotive/editable_text.rb +4 -1
  31. data/app/models/locomotive/extensions/page/editable_elements.rb +21 -0
  32. data/app/models/locomotive/extensions/page/templatized.rb +2 -2
  33. data/app/models/locomotive/extensions/page/tree.rb +5 -0
  34. data/app/models/locomotive/extensions/site/timezone.rb +7 -10
  35. data/app/models/locomotive/theme_asset.rb +2 -2
  36. data/app/presenters/locomotive/membership_presenter.rb +2 -1
  37. data/app/presenters/locomotive/site_presenter.rb +10 -1
  38. data/app/uploaders/locomotive/theme_asset_uploader.rb +7 -0
  39. data/app/views/locomotive/custom_fields/types/_date_time.html.haml +5 -0
  40. data/app/views/locomotive/notifications/new_content_entry.html.haml +1 -1
  41. data/app/views/locomotive/pages/_page.html.haml +2 -2
  42. data/config/locales/admin_ui.bg.yml +349 -0
  43. data/config/locales/admin_ui.cs.yml +359 -0
  44. data/config/locales/admin_ui.de.yml +25 -9
  45. data/config/locales/admin_ui.en.yml +3 -1
  46. data/config/locales/admin_ui.es.yml +2 -0
  47. data/config/locales/admin_ui.et.yml +3 -1
  48. data/config/locales/admin_ui.fr.yml +2 -0
  49. data/config/locales/admin_ui.it.yml +2 -0
  50. data/config/locales/admin_ui.ja.yml +2 -0
  51. data/config/locales/admin_ui.nb.yml +2 -0
  52. data/config/locales/admin_ui.nl.yml +2 -0
  53. data/config/locales/admin_ui.pl.yml +2 -0
  54. data/config/locales/admin_ui.pt-BR.yml +3 -1
  55. data/config/locales/admin_ui.ru.yml +2 -0
  56. data/config/locales/admin_ui.zh-CN.yml +2 -0
  57. data/config/locales/carrierwave.bg.yml +4 -0
  58. data/config/locales/carrierwave.cs.yml +4 -0
  59. data/config/locales/default.bg.yml +231 -0
  60. data/config/locales/default.cs.yml +249 -0
  61. data/config/locales/default.de.yml +24 -16
  62. data/config/locales/default.en.yml +4 -0
  63. data/config/locales/default.es.yml +1 -1
  64. data/config/locales/default.et.yml +1 -1
  65. data/config/locales/default.fr.yml +1 -1
  66. data/config/locales/default.it.yml +1 -1
  67. data/config/locales/default.ja.yml +4 -0
  68. data/config/locales/default.nb.yml +1 -1
  69. data/config/locales/default.nl.yml +1 -1
  70. data/config/locales/default.pl.yml +1 -1
  71. data/config/locales/default.pt-BR.yml +1 -1
  72. data/config/locales/default.ru.yml +1 -1
  73. data/config/locales/default.zh-CN.yml +1 -1
  74. data/config/locales/devise.bg.yml +64 -0
  75. data/config/locales/devise.cs.yml +64 -0
  76. data/config/locales/flash.bg.yml +115 -0
  77. data/config/locales/flash.cs.yml +115 -0
  78. data/config/locales/formtastic.bg.yml +113 -0
  79. data/config/locales/formtastic.cs.yml +125 -0
  80. data/config/locales/formtastic.de.yml +9 -0
  81. data/features/api/content_entries.feature +2 -0
  82. data/features/api/memberships.feature +26 -0
  83. data/features/backoffice/content_types/many_to_many.feature +3 -3
  84. data/features/backoffice/pages.feature +16 -0
  85. data/features/backoffice/regressions.feature +19 -0
  86. data/features/public/contact_form.feature +9 -0
  87. data/features/step_definitions/api_steps.rb +4 -1
  88. data/features/step_definitions/content_types_steps.rb +5 -0
  89. data/features/step_definitions/more_web_steps.rb +4 -0
  90. data/features/step_definitions/web_steps.rb +4 -0
  91. data/lib/generators/locomotive/install/templates/locomotive.rb +2 -2
  92. data/lib/locomotive.rb +1 -8
  93. data/lib/locomotive/action_controller.rb +1 -0
  94. data/lib/locomotive/action_controller/ssl.rb +11 -2
  95. data/lib/locomotive/action_controller/timezone.rb +13 -0
  96. data/lib/locomotive/configuration.rb +2 -2
  97. data/lib/locomotive/custom_fields.rb +1 -1
  98. data/lib/locomotive/dependencies.rb +2 -0
  99. data/lib/locomotive/engine.rb +10 -0
  100. data/lib/locomotive/httparty/webservice.rb +6 -5
  101. data/lib/locomotive/liquid/drops/base.rb +0 -2
  102. data/lib/locomotive/liquid/drops/content_entry.rb +11 -7
  103. data/lib/locomotive/liquid/drops/content_types.rb +46 -30
  104. data/lib/locomotive/liquid/drops/current_user.rb +3 -3
  105. data/lib/locomotive/liquid/drops/page.rb +15 -15
  106. data/lib/locomotive/liquid/drops/proxy_collection.rb +5 -1
  107. data/lib/locomotive/liquid/drops/site.rb +10 -6
  108. data/lib/locomotive/liquid/drops/uploader.rb +2 -2
  109. data/lib/locomotive/liquid/filters/date.rb +29 -3
  110. data/lib/locomotive/liquid/filters/resize.rb +3 -1
  111. data/lib/locomotive/liquid/filters/text.rb +4 -0
  112. data/lib/locomotive/liquid/tags/editable/control.rb +11 -1
  113. data/lib/locomotive/liquid/tags/link_to.rb +5 -3
  114. data/lib/locomotive/liquid/tags/nav.rb +19 -10
  115. data/lib/locomotive/liquid/tags/with_scope.rb +29 -31
  116. data/lib/locomotive/markdown.rb +23 -0
  117. data/lib/locomotive/render.rb +6 -2
  118. data/lib/locomotive/version.rb +1 -1
  119. data/lib/tasks/locomotive.rake +5 -2
  120. data/mongodb/migrate/20130511121956_generate_checksum_for_theme_assets.rb +5 -1
  121. data/mongodb/migrate/20130903145451_localize_redirect_urls_of_pages.rb +42 -0
  122. data/spec/dummy/config/initializers/locomotive.rb +2 -2
  123. data/spec/dummy/config/mongoid.yml +1 -0
  124. data/spec/lib/locomotive/httparty/webservice_spec.rb +1 -1
  125. data/spec/lib/locomotive/liquid/filters/date_spec.rb +61 -2
  126. data/spec/lib/locomotive/liquid/filters/text_spec.rb +4 -0
  127. data/spec/lib/locomotive/liquid/tags/consume_spec.rb +6 -2
  128. data/spec/lib/locomotive/liquid/tags/nav_spec.rb +1 -1
  129. data/spec/lib/locomotive/liquid/tags/with_scope_spec.rb +33 -27
  130. data/spec/lib/locomotive/render_spec.rb +2 -2
  131. data/spec/lib/locomotive/routing/site_dispatcher_spec.rb +1 -1
  132. data/spec/models/locomotive/content_entry_spec.rb +1 -1
  133. data/spec/models/locomotive/editable_control_spec.rb +9 -0
  134. data/spec/models/locomotive/extensions/page/editable_elements_spec.rb +6 -0
  135. data/spec/models/locomotive/page_spec.rb +13 -0
  136. data/spec/requests/admin_ssl_spec.rb +29 -7
  137. data/spec/support/factories.rb +6 -0
  138. data/vendor/assets/javascripts/locomotive/jquery-ui-timepicker-addon.js +2134 -0
  139. data/vendor/assets/stylesheets/select2/select2.css.scss +3 -3
  140. metadata +54 -94
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 243b2783fdaefcb54415d93da1d0918dd81890f7
4
+ data.tar.gz: 4652d77c5a747fa2fdf429eef59b7ef2f56b3642
5
+ SHA512:
6
+ metadata.gz: 864e756b9dfab5708b8e89ae55229879518a44fb2f91ed207537e19e4f0a3189948d60ad0f93b66d4f757dfa765866b00df1000bacdcd60cdfc9b1c663939d44
7
+ data.tar.gz: 3268fb0c1d076f4084208593ffe762f360c496304ea9d911b5dfc92655ae3cbe794286e502386dfd658e6d1c91b7f229c0b9520b35313b75ba27aa7579cd23ad
data/Gemfile CHANGED
@@ -27,6 +27,7 @@ group :development do
27
27
  # gem 'locomotive-aloha-rails', path: '../gems/aloha-rails' # for Developers
28
28
  # gem 'locomotive-tinymce-rails', path: '../gems/tinymce-rails' # for Developers
29
29
  # gem 'locomotive_liquid', path: '../gems/liquid' # for Developers
30
+ # gem 'locomotivecms_solid', path: '../gems/solid' # for Developers
30
31
 
31
32
  # gem 'carrierwave-mongoid', git: 'git://github.com/locomotivecms/carrierwave-mongoid.git'
32
33
 
@@ -27,7 +27,8 @@ h2. Gems
27
27
 
28
28
  Here is a short list of main gems / technologies used in the application.
29
29
 
30
- * Rails 3.2.13
30
+ * Ruby 2.0
31
+ * Rails 3.2.14 (Rails 4.0 in the next months)
31
32
  * Mongoid 3.1.3 (with MongoDB 2.x)
32
33
  * Liquid
33
34
  * Devise
@@ -19,7 +19,7 @@ class Locomotive.Models.Page extends Backbone.Model
19
19
  _.each ['fullpath', 'localized_fullpaths', 'templatized_from_parent', 'template_changed', 'escaped_raw_template', 'target_klass_name_text', 'content_type_id_text', 'edit_url', 'parent_id_text', 'response_type_text', 'translated_in'], (key) => delete hash[key]
20
20
 
21
21
  delete hash['editable_elements']
22
- hash.editable_elements = @get('editable_elements').toJSONForSave() if @get('editable_elements')? && @get('editable_elements').length > 0
22
+ hash.editable_elements_attributes = @get('editable_elements').toJSONForSave() if @get('editable_elements')? && @get('editable_elements').length > 0
23
23
 
24
24
  delete hash['target_klass_name']
25
25
  hash.target_klass_name = @get('target_klass_name') if @get('templatized') == true
@@ -39,7 +39,7 @@ window.Aloha.settings =
39
39
  crop: false
40
40
 
41
41
  i18n:
42
- available: ['en', 'fr', 'pl', 'pt-BR', 'es', 'de', 'no', 'ru', 'nl', 'ja']
42
+ available: ['en', 'fr', 'pl', 'pt-BR', 'es', 'de', 'no', 'ru', 'nl', 'ja', 'cs', 'bg']
43
43
 
44
44
  sidebar:
45
45
  disabled: true
@@ -62,4 +62,4 @@ window.Aloha.settings =
62
62
  ]
63
63
  ]
64
64
  }
65
- ]
65
+ ]
@@ -99,5 +99,5 @@ class Locomotive.Views.ApplicationView extends Backbone.View
99
99
  # Each modal window should have a different zIndex, otherwise there will be conflicts between them.
100
100
  window.Locomotive.jQueryModals ||= 0
101
101
 
102
- 998 + window.Locomotive.jQueryModals++
103
-
102
+ # 998 + window.Locomotive.jQueryModals++
103
+ 300000 + window.Locomotive.jQueryModals++
@@ -20,6 +20,8 @@ class Locomotive.Views.ContentAssets.PickerView extends Locomotive.Views.Shared.
20
20
  build_uploader: (el, link) ->
21
21
  link.bind 'click', (event) ->
22
22
  event.stopPropagation() & event.preventDefault()
23
+ console.log(el)
24
+ window.foo = el
23
25
  el.click()
24
26
 
25
27
  el.bind 'change', (event) =>
@@ -37,6 +37,8 @@ class Locomotive.Views.ContentEntries.FormView extends Locomotive.Views.Shared.F
37
37
 
38
38
  @enable_datepickers()
39
39
 
40
+ @enable_datetimepickers()
41
+
40
42
  @enable_richtexteditor()
41
43
 
42
44
  @enable_select_fields()
@@ -62,6 +64,11 @@ class Locomotive.Views.ContentEntries.FormView extends Locomotive.Views.Shared.F
62
64
  enable_datepickers: ->
63
65
  @$('li.input.date input[type=text]').datepicker()
64
66
 
67
+ enable_datetimepickers: ->
68
+ @$('li.input.date-time input[type=text]').datetimepicker
69
+ controlType: 'select'
70
+ showTime: false
71
+
65
72
  enable_richtexteditor: ->
66
73
  _.each @$('li.input.rte textarea.html'), (textarea) =>
67
74
  settings = _.extend {}, @tinyMCE_settings(),
@@ -162,6 +169,7 @@ class Locomotive.Views.ContentEntries.FormView extends Locomotive.Views.Shared.F
162
169
 
163
170
  remove: ->
164
171
  @$('li.input.date input[type=text]').datepicker('destroy')
172
+ @$('li.input.date_time input[type=text]').datetimepicker('destroy')
165
173
  @_select_field_view.remove()
166
174
  _.each @_file_field_views, (view) => view.remove()
167
175
  _.each @_has_many_field_views, (view) => view.remove()
@@ -31,11 +31,11 @@ class Locomotive.Views.EditableElements.TextView extends Backbone.View
31
31
  height: @model.get('rows') * @default_line_height
32
32
  oninit: ((editor) =>
33
33
  $.cmd 'S', (() =>
34
- @model.set(content: editor.getBody().innerHTML)
34
+ @model.set(content: editor.getContent())
35
35
  $(@el).parents('form').trigger('submit')
36
36
  ), [], ignoreCase: true, document: editor.dom.doc),
37
37
  onchange_callback: (editor) =>
38
- @model.set(content: editor.getBody().innerHTML)
38
+ @model.set(content: editor.getContent())
39
39
 
40
40
  refresh: ->
41
41
  # do nothing
@@ -5,6 +5,8 @@ class Locomotive.Views.Pages.EditView extends Locomotive.Views.Pages.FormView
5
5
  save: (event) ->
6
6
  event.stopPropagation() & event.preventDefault()
7
7
 
8
+ @trigger_change_event_on_focused_inputs()
9
+
8
10
  form = $(event.target).trigger('ajax:beforeSend')
9
11
 
10
12
  @clear_errors()
@@ -15,6 +15,8 @@ class Locomotive.Views.Shared.Fields.BelongsToView extends Backbone.View
15
15
  width: '50%'
16
16
  minimumInputLength: 1
17
17
  quietMillis: 100
18
+ allowClear: true
19
+ placeholder: ' '
18
20
  ajax:
19
21
  url: options.url
20
22
  data: (term, page) ->
@@ -29,6 +29,8 @@ class Locomotive.Views.Shared.FormView extends Backbone.View
29
29
  save_in_ajax: (event, options) ->
30
30
  event.stopPropagation() & event.preventDefault()
31
31
 
32
+ @trigger_change_event_on_focused_inputs()
33
+
32
34
  form = $(event.target).trigger('ajax:beforeSend')
33
35
 
34
36
  @clear_errors()
@@ -85,16 +87,16 @@ class Locomotive.Views.Shared.FormView extends Backbone.View
85
87
  else
86
88
  content.slideUp 100, -> parent.addClass('folded')
87
89
 
90
+ trigger_change_event_on_focused_inputs: ->
91
+ # make sure that the current text field gets saved too
92
+ input = @$('form input[type=text]:focus, form input[type=password]:focus, form textarea:focus')
93
+ input.trigger('change') if input.size() > 0
94
+
88
95
  enable_save_with_keys_combination: ->
89
96
  $.cmd 'S', (() =>
90
- # make sure that the current text field gets saved too
91
- input = @$('form input[type=text]:focus, form input[type=password]:focus, form textarea:focus')
92
- input.trigger('change') if input.size() > 0
93
-
94
97
  @$('form input[type=submit]').trigger('click')
95
98
  ), [], ignoreCase: true
96
99
 
97
-
98
100
  enable_form_notifications: ->
99
101
  @$('form').formSubmitNotification()
100
102
 
@@ -21,14 +21,18 @@
21
21
  el = ed.selection.getNode();
22
22
 
23
23
  if (el && (el.nodeName == 'IMG' || el.nodeName == 'A')) {
24
- ed.dom.setAttribs(el, args);
24
+ ed.dom.setAttribs(el, args);
25
25
  } else {
26
26
  if (asset.get('image')) {
27
27
  ed.execCommand('mceInsertContent', false, '<img id="__mce_tmp" />', { skip_undo: 1 });
28
28
  } else {
29
29
  var html = ed.selection.getContent();
30
- if (html == '') html = asset.get('filename');
31
- ed.execCommand('mceInsertContent', false, '<a id="__mce_tmp" >' + html + '</a>', { skip_undo: 1 });
30
+ if (html == '') {
31
+ html = asset.get('filename');
32
+ ed.execCommand('mceInsertContent', false, '<a id="__mce_tmp" href="#">' + html + '</a>', { skip_undo: 1 });
33
+ } else {
34
+ ed.execCommand('mceReplaceContent', false, ' <a id="__mce_tmp" href="#">' + html + '</a>', { skip_undo: 1 });
35
+ }
32
36
  }
33
37
 
34
38
  ed.dom.setAttribs('__mce_tmp', args);
@@ -0,0 +1 @@
1
+ tinyMCE.addI18n('cs.locomotive_media',{"image_desc": "Vložit obrázek"});
@@ -2,10 +2,13 @@
2
2
  @import "compass/css3/border-radius";
3
3
  @import "compass/css3/images";
4
4
  @import "compass/css3/text-shadow";
5
+ @import "compass/css3/box-shadow";
5
6
 
6
7
  // Note: http://www.west-wind.com/weblog/posts/2009/Sep/12/jQuery-UI-Datepicker-and-zIndex
7
8
  #ui-datepicker-div {
8
9
  z-index: 9999999 !important;
10
+
11
+ @include box-shadow(rgba(0, 0, 0, 0.2) 4px 4px 10px 2px);
9
12
  }
10
13
 
11
14
  .ui-datepicker {
@@ -181,3 +184,66 @@
181
184
  }
182
185
  }
183
186
 
187
+ .ui-timepicker-div {
188
+
189
+ border-top: 1px solid #bcbfc2;
190
+
191
+ .ui-widget-header {
192
+ margin-bottom: 8px;
193
+ }
194
+
195
+ dl {
196
+ margin: 0px;
197
+ }
198
+
199
+ // dl { text-align: left; }
200
+ // dl dt { height: 25px; margin-bottom: -25px; }
201
+ // dl dd { margin: 0 10px 10px 65px; }
202
+ // td { font-size: 90%; }
203
+
204
+ .ui_tpicker_hour_label {
205
+ display: none;
206
+ }
207
+
208
+ .ui_tpicker_minute_label {
209
+ display: none;
210
+ }
211
+
212
+ .ui_tpicker_hour, .ui_tpicker_minute {
213
+ display: inline-block;
214
+ width: 50%;
215
+ text-align: right;
216
+ margin: 4px 0px 6px 0px;
217
+
218
+ select {
219
+ margin: 0 3px;
220
+ font-size: 11px;
221
+ font-family: Verdana, Arial, sans-serif;
222
+ }
223
+
224
+ &.ui_tpicker_minute {
225
+ text-align: left;
226
+ .ui_tpicker_minute_slider {
227
+ &:before { font-size: 14px; font-weight: bold; content: ':'; }
228
+ }
229
+ }
230
+ }
231
+ }
232
+
233
+ .ui-tpicker-grid-label {
234
+ background: none;
235
+ border: none;
236
+ margin: 0;
237
+ padding: 0;
238
+ }
239
+
240
+ .ui-timepicker-rtl {
241
+ direction: rtl;
242
+
243
+ dl { text-align: right; }
244
+ dl dd { margin: 0 65px 10px 10px; }
245
+ }
246
+
247
+ .ui-datepicker-buttonpane {
248
+ display: none;
249
+ }
@@ -60,7 +60,7 @@
60
60
 
61
61
  .ui-dialog-content {
62
62
  position: relative;
63
- z-index: 1200;
63
+ // z-index: 1200;
64
64
 
65
65
  text-align: left;
66
66
 
@@ -90,6 +90,12 @@
90
90
  width: 90px;
91
91
  }
92
92
  } // li.string
93
+
94
+ li.tags {
95
+ ul.tagit {
96
+ width: 530px;
97
+ }
98
+ }
93
99
  }
94
100
  }
95
101
  } // .form.formtastic
@@ -131,7 +137,7 @@
131
137
  }
132
138
 
133
139
  input[type=file] {
134
- z-index: 1203;
140
+ z-index: 400000; // thanks to tinymce modal z-index
135
141
  }
136
142
 
137
143
  } // .button-wrapper
@@ -435,6 +435,14 @@ form.formtastic {
435
435
 
436
436
  } // li.date
437
437
 
438
+ &.date-time {
439
+
440
+ input[type=text] {
441
+ width: 120px;
442
+ }
443
+
444
+ } // li.date-time
445
+
438
446
  &.file {
439
447
  span.file {
440
448
  a:first-child {
@@ -14,7 +14,7 @@
14
14
 
15
15
  span, i {
16
16
  color: #fff;
17
- @include single-text-shadow(transparent, 0px, 0px, 0px);
17
+ @include single-text-shadow(rgba(0, 0, 0, 0.2), 0px, 1px, 0px);
18
18
  }
19
19
  }
20
20
 
@@ -3,10 +3,13 @@ module Locomotive
3
3
  class BaseController < ApplicationController
4
4
 
5
5
  include Locomotive::Routing::SiteDispatcher
6
+ include Locomotive::ActionController::Timezone
6
7
  include Locomotive::ActionController::LocaleHelpers
7
8
 
8
9
  skip_before_filter :verify_authenticity_token
9
10
 
11
+ around_filter :set_timezone
12
+
10
13
  before_filter :require_account
11
14
 
12
15
  before_filter :require_site
@@ -4,13 +4,13 @@ module Locomotive
4
4
 
5
5
  load_and_authorize_resource({
6
6
  class: Locomotive::ContentEntry,
7
- through: :content_type,
7
+ through: :get_content_type,
8
8
  through_association: :entries,
9
9
  find_by: :find_by_id_or_permalink
10
10
  })
11
11
 
12
12
  def index
13
- @content_entries = @content_entries.order_by([content_type.order_by_definition])
13
+ @content_entries = @content_entries.order_by([get_content_type.order_by_definition])
14
14
  respond_with @content_entries
15
15
  end
16
16
 
@@ -37,10 +37,10 @@ module Locomotive
37
37
 
38
38
  protected
39
39
 
40
- def content_type
40
+ def get_content_type
41
41
  @content_type ||= current_site.content_types.where(slug: params[:slug]).first
42
42
  end
43
43
 
44
44
  end
45
45
  end
46
- end
46
+ end
@@ -24,6 +24,10 @@ module Locomotive
24
24
 
25
25
  protected
26
26
 
27
+ def set_locale
28
+ I18n.locale = Locomotive.config.locales.first
29
+ end
30
+
27
31
  def self.description
28
32
  {
29
33
  overall: %{Manage a session token which will be passed to all the other REST calls},
@@ -6,6 +6,7 @@ module Locomotive
6
6
  include Locomotive::ActionController::SectionHelpers
7
7
  include Locomotive::ActionController::UrlHelpers
8
8
  include Locomotive::ActionController::Ssl
9
+ include Locomotive::ActionController::Timezone
9
10
 
10
11
  layout '/locomotive/layouts/application'
11
12
 
@@ -15,13 +16,15 @@ module Locomotive
15
16
 
16
17
  before_filter :require_site
17
18
 
19
+ before_filter :set_back_office_locale
20
+
21
+ before_filter :set_current_content_locale
22
+
18
23
  before_filter :validate_site_membership
19
24
 
20
25
  load_and_authorize_resource
21
26
 
22
- before_filter :set_back_office_locale
23
-
24
- before_filter :set_current_content_locale
27
+ around_filter :set_timezone
25
28
 
26
29
  before_filter :set_current_thread_variables
27
30
 
@@ -6,9 +6,12 @@ module Locomotive
6
6
  include Locomotive::ActionController::LocaleHelpers
7
7
  include Locomotive::ActionController::SectionHelpers
8
8
  include Locomotive::ActionController::UrlHelpers
9
+ include Locomotive::ActionController::Timezone
9
10
 
10
11
  skip_load_and_authorize_resource
11
12
 
13
+ around_filter :set_timezone
14
+
12
15
  before_filter :require_site
13
16
 
14
17
  protected
@@ -13,7 +13,7 @@ module Locomotive
13
13
  respond_to :html, :json
14
14
 
15
15
  def create
16
- @entry = @content_type.entries.create(params[:entry] || params[:content])
16
+ @entry = @content_type.entries.safe_create(params[:entry] || params[:content])
17
17
 
18
18
  respond_with @entry, {
19
19
  location: self.callback_url,
@@ -25,6 +25,7 @@ module Locomotive
25
25
 
26
26
  def set_locale
27
27
  ::I18n.locale = params[:locale] || current_site.default_locale
28
+ ::Mongoid::Fields::I18n.locale = ::I18n.locale
28
29
  end
29
30
 
30
31
  def set_content_type