locomotivecms 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -3
  3. data/README.md +24 -30
  4. data/app/api/locomotive/api/entities/content_type_field_entity.rb +1 -1
  5. data/app/api/locomotive/api/forms/content_type_field_form.rb +1 -1
  6. data/app/api/locomotive/api/resources/content_type_resource.rb +2 -0
  7. data/app/assets/javascripts/locomotive/views/editable_elements/iframe_view.js.coffee +1 -1
  8. data/app/assets/javascripts/locomotive/views/editable_elements/page_view.js.coffee +4 -1
  9. data/app/assets/javascripts/locomotive/views/inputs/array_view.js.coffee +2 -2
  10. data/app/assets/stylesheets/locomotive/account.scss +1 -1
  11. data/app/assets/stylesheets/locomotive/account/_files.scss +2 -1
  12. data/app/assets/stylesheets/locomotive/account/_navigation.scss +2 -1
  13. data/app/assets/stylesheets/locomotive/account/_public.scss +22 -5
  14. data/app/assets/stylesheets/locomotive/account/_type.scss +5 -0
  15. data/app/assets/stylesheets/locomotive/live_editing_iframe.scss +1 -1
  16. data/app/controllers/locomotive/concerns/redirect_to_main_host_controller.rb +1 -1
  17. data/app/helpers/locomotive/custom_fields_helper.rb +5 -1
  18. data/app/inputs/locomotive/file_input.rb +1 -1
  19. data/app/models/locomotive/concerns/asset/checksum.rb +2 -3
  20. data/app/models/locomotive/concerns/page/redirect.rb +1 -1
  21. data/app/models/locomotive/concerns/site/access_points.rb +13 -0
  22. data/app/models/locomotive/editable_file.rb +1 -1
  23. data/app/models/locomotive/editable_model.rb +4 -0
  24. data/app/uploaders/locomotive/editable_file_uploader.rb +3 -1
  25. data/app/uploaders/locomotive/picture_uploader.rb +1 -1
  26. data/app/views/locomotive/editable_elements/_form.html.slim +8 -7
  27. data/app/views/locomotive/errors/404.html.slim +3 -5
  28. data/app/views/locomotive/errors/500.html.slim +3 -5
  29. data/app/views/locomotive/errors/no_site.html.slim +6 -11
  30. data/app/views/locomotive/layouts/account.html.slim +1 -1
  31. data/app/views/locomotive/layouts/error.html.slim +1 -2
  32. data/app/views/locomotive/sessions/new.html.slim +1 -1
  33. data/config/locales/simple_form.en.yml +1 -1
  34. data/config/routes.rb +4 -2
  35. data/lib/generators/locomotive/install/install_generator.rb +1 -1
  36. data/lib/generators/locomotive/install/templates/locomotive.rb +8 -0
  37. data/lib/locomotive/configuration.rb +2 -0
  38. data/lib/locomotive/middlewares/site.rb +1 -1
  39. data/lib/locomotive/mongoid.rb +0 -1
  40. data/lib/locomotive/regexps.rb +3 -3
  41. data/lib/locomotive/simple_form.rb +1 -0
  42. data/lib/locomotive/steam/middlewares/cache.rb +6 -1
  43. data/lib/locomotive/steam/middlewares/page_editing.rb +23 -1
  44. data/lib/locomotive/steam_adaptor.rb +1 -1
  45. data/lib/locomotive/version.rb +1 -1
  46. data/spec/dummy/config/initializers/locomotive.rb +4 -0
  47. data/spec/dummy/config/mongoid.yml +1 -0
  48. data/spec/models/locomotive/concerns/page/redirect_spec.rb +25 -0
  49. data/spec/models/locomotive/concerns/site/access_points_spec.rb +29 -0
  50. data/spec/requests/locomotive/site_spec.rb +11 -1
  51. data/spec/requests/locomotive/steam/cache_spec.rb +3 -2
  52. data/spec/support/capybara.rb +9 -6
  53. data/spec/support/features/session_helpers.rb +1 -0
  54. data/spec/support/features/site_helpers.rb +3 -0
  55. data/spec/support/mongoid.rb +1 -1
  56. metadata +8 -12
  57. data/app/assets/stylesheets/locomotive/components/_error.scss +0 -37
  58. data/app/assets/stylesheets/locomotive/error.scss +0 -12
  59. data/app/assets/stylesheets/locomotive/layouts/_error.scss +0 -33
  60. data/lib/locomotive/mongoid/presenter.rb +0 -76
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb2afe64fab76edbf20e2d79ede530d56718e76f
4
- data.tar.gz: e66377e24345467ba5e893fa1ba996ae60999bc5
3
+ metadata.gz: 3a0a1781f88c6f7d67c51dba24298c5be9880728
4
+ data.tar.gz: 35b36ae8bbc5c7aa6e857dea7f67707c4c6d7e24
5
5
  SHA512:
6
- metadata.gz: 864c8c0c17575926f0d2fa10ceaafa2606827ed05ed1562ff300160835448b220ca07515313b6977c424be25554d365c5c4b2f851d0f8ebe1969f793312b7fdf
7
- data.tar.gz: 3a20c0edb014b7a2b1d29bc147751a411b0ac7fdc2191725bda3208702a961fd7c55b5e4ff4683390a5726145d196287a1b575c3516e04986de4fe4496041e57
6
+ metadata.gz: e55ecd3fa077eb76429b00b147fad3ad12d8ab13a3d3f816183d3168042324455b145751b2eb06c2a148a44f3bb1a9024f1ec00750abfddeb064b31ade9c2426
7
+ data.tar.gz: d783f608c5e0b57a2c2fee907a18de0435534a815f99f4b00ac69d6cceba3a99f9118eda36db206c81f0cb0909d6385f064289f215f8aebc574796b48b7d40c1
data/Gemfile CHANGED
@@ -19,10 +19,10 @@ end
19
19
  group :development do
20
20
  # gem 'custom_fields', path: '../custom_fields'
21
21
  # gem 'custom_fields', path: '../gems/custom_fields' # for Developers
22
- # gem 'custom_fields', github: 'locomotivecms/custom_fields', ref: '279c6744eb6b7dd'
22
+ # gem 'custom_fields', github: 'locomotivecms/custom_fields', ref: '131b6a6'
23
23
 
24
24
  # gem 'locomotivecms_steam', path: '../gems/steam', require: false
25
- # gem 'locomotivecms_steam', github: 'locomotivecms/steam', ref: '939f6f6', require: false
25
+ # gem 'locomotivecms_steam', github: 'locomotivecms/steam', ref: '0cdb255dafd13', require: false
26
26
 
27
27
  # gem 'locomotive_liquid', path: '../gems/liquid' # for Developers
28
28
  # gem 'locomotivecms_solid', path: '../gems/solid' # for Developers
@@ -56,7 +56,7 @@ group :test do
56
56
  gem 'simplecov'
57
57
 
58
58
  gem 'capybara', '~> 2.5.0'
59
- gem 'poltergeist', '~> 1.8.1'
59
+ gem 'capybara-webkit', '~> 1.8.0'
60
60
 
61
61
  gem 'grape-entity-matchers'
62
62
  gem 'shoulda-matchers', '2.7.0'
data/README.md CHANGED
@@ -2,32 +2,20 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/locomotivecms/engine.svg?branch=master)](https://travis-ci.org/locomotivecms/engine) [![Code Climate](https://codeclimate.com/github/locomotivecms/engine/badges/gpa.svg)](https://codeclimate.com/github/locomotivecms/engine) [![Dependency Status](https://gemnasium.com/locomotivecms/engine.svg)](https://gemnasium.com/locomotivecms/engine) [![Coverage Status](https://img.shields.io/coveralls/locomotivecms/engine.svg)](https://coveralls.io/r/locomotivecms/engine?branch=master) [![Join the chat at https://gitter.im/locomotivecms/engine](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/locomotivecms/engine?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4
4
 
5
- ![Locomotive Screenshot](https://wagonapp.s3.amazonaws.com/doc/v3_backoffice.png)
5
+ Locomotive is an open source platform to create, publish and edit sites (CMS). It is designed to save time and help you focus on what matters: front-end technology, standard development process and a very low learning curve for your clients.
6
6
 
7
- Locomotive is an open source platform to create, publish and edit sites. It is designed to save your time and help you focus on what matters: front-end technology, standard development process and no learning time for your client.
7
+ Locomotive relies on a **very original workflow**:
8
8
 
9
- Locomotive relies on a **very original workflow**.
10
-
11
- - Sites are coded locally using our open source tool: [Wagon](https://github.com/locomotivecms/wagon). A desktop version (not open source) is also available [here](http://www.wagonapp.com).
9
+ - Sites are coded locally using our open source tool: [Wagon](https://github.com/locomotivecms/wagon). A desktop version (not open source and not tested in v3) is also available [here](http://www.wagonapp.com).
12
10
  - Sites are deployed to the platform (engine) thanks to our internal API.
13
11
  - A back-office for the end-users is automatically generated based on the custom models and editable regions described by the developers.
14
12
 
15
- Visit the Locomotive official website [here](http://www.locomotivecms.com) for more information.
16
-
17
- ## Development Status ##
18
-
19
- As you can see from the commit logs, we are intensively working on the new V3 version. We kept all the features from our stable [v2 version](https://github.com/locomotivecms/engine/tree/v2.5.x), we just replace the UI, upgrade the gems and refactor our code.
20
-
21
- **[UPDATES]** Finally, we've been doing much more than we planned at first. We extracted the rendering functionality from the Engine and make it a gem named [Steam](https://github.com/locomotivecms/steam). This gem is also now used by [Wagon](https://github.com/locomotivecms/wagon) (version 2.0 in progress) which makes sure you get the same result between Wagon and Engine when you preview a page.
22
- And last but not least, we added a Ruby API client for Locomotive that we called [Coal](https://github.com/locomotivecms/coal). That client consumes the API from Engine which embeds now GrapeAPI. [Nic Boie](https://github.com/boie0025) is in charge of it. Kudos to him!
13
+ ![Locomotive](https://dl.dropboxusercontent.com/u/20823269/locomotive-engine.png)
23
14
 
24
- **TRELLO** [here](https://trello.com/b/kRiy1dZu/locomotive-v3)
15
+ Visit the Locomotive official website [here](http://
16
+ locomotive.works) for more information.
25
17
 
26
- ## Getting Started ##
27
-
28
- If you can not wait for playing with our new version, you still can use the current one (v2.5.x). Check out our [installation guide](http://doc.locomotivecms.com/get-started).
29
-
30
- ## Features ##
18
+ ## Features
31
19
 
32
20
  - Multi-sites natively supported
33
21
  - Uses Liquid, a simple and clean templating language
@@ -36,9 +24,19 @@ If you can not wait for playing with our new version, you still can use the curr
36
24
  - Can fully localize all the content and pages
37
25
  - Embed a Restful API to manage every site
38
26
  - Develop and preview sites locally with your favorite tools **(Wagon)**
39
- - Support for SASS, LESS, HAML and Coffee Script **(Wagon)**
27
+ - Support for SASS, HAML and Coffee Script **(Wagon)**
40
28
 
41
- ## Technologies ##
29
+ ## Instructions and help
30
+
31
+ - [Documentation](https://locomotive-v3.readme.io/)
32
+ - Get help with Locomotive or discuss technical issues on [Gitter](https://gitter.im/locomotivecms/engine?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) or [here](https://locomotive-v3.readme.io/discuss).
33
+ - [Follow us on twitter](http://twitter.com/locomotivecms)
34
+
35
+ ## Contribute
36
+
37
+ V3 has launched! Which means a lot of stuff changed and we got bunch of new features shipped in. However, Locomotive will be updated frequently with more awesome features. Have a look at our [Trello](https://trello.com/b/kRiy1dZu/locomotive-v3) board to see what's next or see where you can help out.
38
+
39
+ ### Technologies
42
40
 
43
41
  Here is a list of the main gems used to power the Locomotive platform:
44
42
 
@@ -49,19 +47,15 @@ Here is a list of the main gems used to power the Locomotive platform:
49
47
  - Carrierwave - *Upload*
50
48
  - Pundit - *Permissions*
51
49
 
52
- ## Community ##
53
-
54
- - [Gitter](https://gitter.im/locomotivecms/engine?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) for technical discussions.
55
- - Get help or discuss Locomotive at the [Locomotive Google group](https://groups.google.com/forum/?fromgroups#!forum/locomotivecms)
56
- - [Follow us on twitter](http://twitter.com/locomotivecms)
50
+ ### Translating the back-office
57
51
 
58
- ## Translating the back-office ##
52
+ By default, the Locomotive back-office is fully translated in English, Dutch and Greek.
59
53
 
60
- By default, the Locomotive back-office is fully translated in English. But adding a new language is pretty straightforward since we now manage all our I18n translation keys in [Transifex](https://www.transifex.com), a platform dedicated to this kind of task.
54
+ Adding a new language is pretty straightforward since we now manage all our I18n translation keys in [Transifex](https://www.transifex.com), a platform dedicated to this kind of task.
61
55
 
62
56
  Here is our Transifex portal page: [https://www.transifex.com/locomotive/locomotive-engine](https://www.transifex.com/locomotive/locomotive-engine). Feel free to sign up and translate!
63
57
 
64
- ## Contributing to Locomotive ##
58
+ ### How to contribute
65
59
 
66
60
  Locomotive is an open source project, we encourage contributions. If you have found a bug and want to contribute a fix, or have a new feature you would like to add, follow the steps below to get your patch into the project:
67
61
 
@@ -76,7 +70,7 @@ Locomotive is an open source project, we encourage contributions. If you have fo
76
70
 
77
71
  For new features (especially large ones) it is best to create a topic on the [Google group](https://groups.google.com/forum/?fromgroups#!forum/locomotivecms) first to make sure it fits into the goals of the project.
78
72
 
79
- ## Contact ##
73
+ ### Contact
80
74
 
81
75
  Feel free to contact me at did at locomotivecms dot com.
82
76
 
@@ -4,7 +4,7 @@ module Locomotive
4
4
 
5
5
  class ContentTypeFieldEntity < BaseEntity
6
6
 
7
- expose :name, :type, :label, :hint, :required, :localized, :unique, :position
7
+ expose :name, :type, :label, :hint, :required, :localized, :unique, :default, :position
8
8
 
9
9
  # text type field
10
10
  expose :text_formatting, if: ->(field, _) { field.type.to_s == 'text' }
@@ -10,7 +10,7 @@ module Locomotive
10
10
  :required, :localized, :unique, :position,
11
11
  :text_formatting, :select_options_attributes,
12
12
  :target, :inverse_of, :order_by, :ui_enabled,
13
- :class_name, :_destroy
13
+ :default, :class_name, :_destroy
14
14
 
15
15
  def initialize(content_type_service, existing_field, attributes)
16
16
  self.content_type_service = content_type_service
@@ -46,6 +46,7 @@ module Locomotive
46
46
  optional :required
47
47
  optional :localized
48
48
  optional :unique
49
+ optional :default
49
50
  optional :position
50
51
  optional :text_formatting
51
52
  optional :select_options
@@ -90,6 +91,7 @@ module Locomotive
90
91
  optional :required
91
92
  optional :localized
92
93
  optional :unique
94
+ optional :default
93
95
  optional :position
94
96
  optional :text_formatting
95
97
  optional :select_options
@@ -44,7 +44,7 @@ class Locomotive.Views.EditableElements.IframeView extends Backbone.View
44
44
  build_and_render_page_view: ->
45
45
  @page_view.remove() if @page_view?
46
46
  @page_view = new Locomotive.Views.EditableElements.PageView
47
- el: $(@window.document.body)
47
+ el: $(@window.document)
48
48
  parent_view: @
49
49
  button_labels:
50
50
  edit: $(@el).data('edit-label')
@@ -15,8 +15,11 @@ class Locomotive.Views.EditableElements.PageView extends Backbone.View
15
15
  PubSub.subscribe 'pages.sorted', @refresh_all
16
16
  ]
17
17
 
18
+ # used to prefix links to inner pages with mounted_on
19
+ @mounted_on = @$('meta[name=locomotive-mounted-on]').attr('content')
20
+
18
21
  # create the highlighter view
19
- @views = [new Locomotive.Views.EditableElements.TextHighLighterView(el: @el, button_labels: @options.button_labels)]
22
+ @views = [new Locomotive.Views.EditableElements.TextHighLighterView(el: @$('body'), button_labels: @options.button_labels)]
20
23
 
21
24
  render: ->
22
25
  # render the highlighter view
@@ -46,8 +46,8 @@ class Locomotive.Views.Inputs.ArrayView extends Backbone.View
46
46
 
47
47
  make_simple_selectable: ->
48
48
  @$new_input.select2
49
- templateResult: @format_select_result
50
- templateSelection: @format_select_result
49
+ templateResult: @format_select_result
50
+ templateSelection: @format_select_result
51
51
 
52
52
  format_select_result: (state) ->
53
53
  return state.text unless state.id?
@@ -2,7 +2,7 @@
2
2
  // Account
3
3
  // =============================================================================
4
4
 
5
- // Stylesheet for all un-authorized pages like register, sign in, ...
5
+ // Stylesheet for all account related pages like register, my account, ...
6
6
 
7
7
  // Core variables and mixins
8
8
 
@@ -97,7 +97,8 @@
97
97
  user-select: none;
98
98
  .file-name {
99
99
  display: inline-block;
100
- width: 210px;
100
+ width: 100%;
101
+ max-width: 210px;
101
102
  overflow: hidden;
102
103
  text-overflow: ellipsis;
103
104
  white-space: nowrap;
@@ -7,10 +7,11 @@
7
7
  // Navigation wrapper.
8
8
 
9
9
  .navigation {
10
- position: fixed;
10
+ position: absolute;
11
11
  top: 0;
12
12
  right: 0;
13
13
  left: 0;
14
+ display: block;
14
15
  padding: 25px 40px;
15
16
  text-align: left;
16
17
  .brand-logo {
@@ -35,7 +35,7 @@
35
35
  .public-wrapper {
36
36
  display: inline-block;
37
37
  width: 460px;
38
- margin: 25px 0;
38
+ padding: 56px 0;
39
39
  vertical-align: middle;
40
40
  }
41
41
 
@@ -59,6 +59,9 @@
59
59
  &.without-padding {
60
60
  padding: 0;
61
61
  }
62
+ > p {
63
+ margin: 0;
64
+ }
62
65
  }
63
66
 
64
67
  // Styles intro title and text above the public form.
@@ -69,10 +72,17 @@
69
72
  text-align: center;
70
73
  h3 {
71
74
  margin-bottom: 15px;
75
+ i {
76
+ display: block;
77
+ margin-bottom: 15px;
78
+ font-size: 30px;
79
+ color: $gray-lighter;
80
+ text-align: center;
81
+ }
72
82
  }
73
83
  p {
74
84
  margin-bottom: 30px;
75
- color: $gray-light;
85
+ color: $gray;
76
86
  }
77
87
  &.with-padding {
78
88
  padding: 50px 50px 0;
@@ -105,6 +115,7 @@
105
115
  display: block;
106
116
  max-height: 500px;
107
117
  overflow: auto;
118
+ border-top: 1px solid $border-color-base;
108
119
  }
109
120
 
110
121
  // Public entries, used in the sites overview.
@@ -115,13 +126,14 @@
115
126
  padding: 15px 25px;
116
127
  text-align: left;
117
128
  background: transparent;
118
- border-top: 1px solid $border-color-base;
129
+ border-bottom: 1px solid $border-color-base;
119
130
  transition: background $base-transition-speed linear;
120
131
  img {
121
132
  display: inline-block;
122
133
  width: 60px;
123
134
  margin-right: 25px;
124
135
  vertical-align: middle;
136
+ background: $gray-lightest;
125
137
  border-radius: 50%;
126
138
  }
127
139
  .fa-arrow-right {
@@ -133,9 +145,13 @@
133
145
  line-height: 1;
134
146
  color: $gray-lighter;
135
147
  }
148
+ &:last-child {
149
+ border-bottom: 0;
150
+ }
136
151
  &.is-add {
137
152
  padding: 25px;
138
153
  text-align: center;
154
+ border-top: 1px solid $border-color-base;
139
155
  border-radius: 0 0 $border-radius-base $border-radius-base;
140
156
  .fa {
141
157
  margin-right: 10px;
@@ -159,10 +175,12 @@
159
175
  display: inline-block;
160
176
  vertical-align: middle;
161
177
  h5 {
178
+ font-family: $font-family-sans-serif;
162
179
  color: $gray-darker;
163
180
  }
164
181
  p {
165
182
  margin: 5px 0 0;
183
+ font-weight: 300;
166
184
  color: $gray-light;
167
185
  }
168
186
  }
@@ -174,8 +192,7 @@
174
192
  .public-wrapper {
175
193
  left: 0;
176
194
  width: 99%;
177
- padding: 20px 10px;
178
- margin-left: 0;
195
+ padding: 56px 10px;
179
196
  }
180
197
  .public-box {
181
198
  padding: 50px 20px;
@@ -12,3 +12,8 @@ h5,
12
12
  h6 {
13
13
  margin: 0;
14
14
  }
15
+
16
+ code {
17
+ display: block;
18
+ overflow: auto;
19
+ }
@@ -48,7 +48,7 @@ $fa-version: '4_4_0';
48
48
  font-family: 'Noto Sans', sans-serif;
49
49
  font-size: 12px;
50
50
  font-weight: normal;
51
- height: 30px;
51
+ max-height: 30px;
52
52
  line-height: 18px;
53
53
  margin: 0 10px 0 0px;
54
54
  padding: 5px 10px;
@@ -19,7 +19,7 @@ module Locomotive
19
19
  options = { host: Locomotive.config.host }
20
20
  options[:port] = request.port if request.port != 80
21
21
 
22
- redirect_to options
22
+ redirect_to root_url(options)
23
23
  end
24
24
  end
25
25
 
@@ -10,7 +10,11 @@ module Locomotive
10
10
  #
11
11
  def render_custom_fields(content_type, form)
12
12
  html = content_type.ordered_entries_custom_fields.map do |field|
13
- render_custom_field(field, form)
13
+ if field.ui_enabled? || field.name == content_type.label_field_name
14
+ render_custom_field(field, form)
15
+ else
16
+ ''
17
+ end
14
18
  end
15
19
 
16
20
  html.join("\n").html_safe
@@ -57,7 +57,7 @@ module Locomotive
57
57
  def filename_or_image
58
58
  if persisted_file?
59
59
  css = "current-file #{persisted_file.image? ? 'image' : ''}"
60
- template.content_tag :span, image_html + filename_html, class: css
60
+ template.content_tag :span, (image_html + filename_html).html_safe, class: css
61
61
  else
62
62
  ''
63
63
  end
@@ -18,9 +18,7 @@ module Locomotive
18
18
 
19
19
  def calculate_checksum
20
20
  begin
21
- if self.checksum.blank?
22
- self.checksum = Digest::MD5.hexdigest(self.source.read)
23
- end
21
+ self.checksum = Digest::MD5.hexdigest(self.source.read)
24
22
  rescue Errno::ENOENT => e
25
23
  # no file
26
24
  end
@@ -31,3 +29,4 @@ module Locomotive
31
29
  end
32
30
  end
33
31
  end
32
+
@@ -15,7 +15,7 @@ module Locomotive
15
15
  ## validations ##
16
16
  validates_presence_of :redirect_type, if: :redirect?
17
17
  validates_presence_of :redirect_url, if: :redirect?
18
- validates_format_of :redirect_url, with: Locomotive::Regexps::URL, allow_blank: true
18
+ validates_format_of :redirect_url, with: Locomotive::Regexps::URL_AND_MAILTO, allow_blank: true
19
19
 
20
20
  end
21
21
 
@@ -22,6 +22,7 @@ module Locomotive
22
22
  validates_format_of :handle, with: Locomotive::Regexps::HANDLE, allow_blank: true,
23
23
  multiline: true
24
24
  validate :domains_must_be_valid_and_unique
25
+ validate :domains_must_not_be_reserved
25
26
 
26
27
  ## callbacks ##
27
28
  before_validation :prepare_domain_sync
@@ -74,6 +75,18 @@ module Locomotive
74
75
  end
75
76
  end
76
77
 
78
+ def domains_must_not_be_reserved
79
+ return if self.domains.empty? || Locomotive.config.reserved_domains.blank?
80
+
81
+ self.domains.each do |domain|
82
+ any = Locomotive.config.reserved_domains.any? do |matcher|
83
+ matcher.is_a?(Regexp) ? domain =~ matcher : matcher == domain
84
+ end
85
+
86
+ self.errors.add(:domains, :domain_taken, value: domain) if any
87
+ end
88
+ end
89
+
77
90
  def emit_domain_sync_event
78
91
  return if @added_domains.blank? && @removed_domains.blank?
79
92
 
@@ -37,7 +37,7 @@ module Locomotive
37
37
 
38
38
  def init_localized_source
39
39
  # FIXME: the source of the element is not correctly set for the first time (certainly because the source is localized)
40
- attributes[:source] = {} unless self.persisted?
40
+ attributes['source'] = {} unless self.persisted?
41
41
  end
42
42
 
43
43
  end