locomotive_cms 2.3.0 → 2.3.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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/locomotive/models/editable_element.js.coffee +11 -0
- data/app/assets/javascripts/locomotive/views/pages/_form_view.js.coffee +1 -2
- data/app/assets/javascripts/locomotive/views/pages/edit_view.js.coffee +6 -0
- data/app/controllers/locomotive/api/base_controller.rb +1 -1
- data/app/controllers/locomotive/base_controller.rb +1 -1
- data/app/helpers/locomotive/pages_helper.rb +3 -5
- data/app/models/locomotive/extensions/page/tree.rb +2 -6
- data/app/models/locomotive/membership.rb +4 -4
- data/app/views/locomotive/pages/_form.html.haml +4 -2
- data/config/routes.rb +4 -0
- data/lib/locomotive/carrierwave.rb +4 -1
- data/lib/locomotive/liquid/tags/link_to.rb +10 -16
- data/lib/locomotive/render.rb +1 -1
- data/lib/locomotive/version.rb +1 -1
- data/lib/tasks/development.rake +1 -0
- data/spec/fixtures/assets/5k@2x.png +0 -0
- data/spec/models/locomotive/theme_asset_spec.rb +6 -0
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b5296380d468cf4e5522e01268698e14df1be493
|
|
4
|
+
data.tar.gz: f55fa2c7671c33d05b6d93c12cd6a33034b69b61
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3c1bfd20751c88557fe805ba6b3e2292c4c9f03c71e8034f5cb6cd3ad5f2120b830b9fedcdb03eda475b34c97b6fc752d93cefd9f5c4f09286d9a392b33bc295
|
|
7
|
+
data.tar.gz: 7db9d6cb249af95f012abb14833df09945373194d487515c84a879611ed3605707992069a4011ab8bf3a3a13bfb173c3a24c90c3485c735ca5a629ea06e0a585
|
|
@@ -23,5 +23,16 @@ class Locomotive.Models.EditableElementsCollection extends Backbone.Collection
|
|
|
23
23
|
by_block: (name) ->
|
|
24
24
|
@filter (editable) -> editable.get('block_name') == name
|
|
25
25
|
|
|
26
|
+
find_similar: (editable) ->
|
|
27
|
+
@find (_editable) ->
|
|
28
|
+
editable.get('block') == _editable.get('block') &&
|
|
29
|
+
editable.get('slug') == _editable.get('slug') &&
|
|
30
|
+
editable.get('type') == _editable.get('type')
|
|
31
|
+
|
|
32
|
+
update_content_from: (collection) ->
|
|
33
|
+
collection.each (element) =>
|
|
34
|
+
_element = @find_similar(element)
|
|
35
|
+
_element.set('content', element.get('content')) if _element
|
|
36
|
+
|
|
26
37
|
toJSONForSave: ->
|
|
27
38
|
@map (model) => model.toJSONForSave()
|
|
@@ -159,5 +159,4 @@ class Locomotive.Views.Pages.FormView extends Locomotive.Views.Shared.FormView
|
|
|
159
159
|
@$('li#page_redirect_url_input, li#page_redirect_type_input').hide()
|
|
160
160
|
|
|
161
161
|
enable_other_checkboxes: ->
|
|
162
|
-
|
|
163
|
-
@$('li#page_' + exp + '_input input[type=checkbox]').checkToggle()
|
|
162
|
+
@$('li.toggle input[type=checkbox].simple-toggle').checkToggle()
|
|
@@ -11,6 +11,11 @@ class Locomotive.Views.Pages.EditView extends Locomotive.Views.Pages.FormView
|
|
|
11
11
|
|
|
12
12
|
@clear_errors()
|
|
13
13
|
|
|
14
|
+
# store the previous editable elements in case we
|
|
15
|
+
# need to use the content of these elements for
|
|
16
|
+
# the new ones (same block and slug).
|
|
17
|
+
editable_elements = _.clone @model.get('editable_elements')
|
|
18
|
+
|
|
14
19
|
@model.save {},
|
|
15
20
|
success: (model, response) =>
|
|
16
21
|
form.trigger('ajax:complete')
|
|
@@ -18,6 +23,7 @@ class Locomotive.Views.Pages.EditView extends Locomotive.Views.Pages.FormView
|
|
|
18
23
|
model._normalize()
|
|
19
24
|
|
|
20
25
|
if model.get('template_changed') == true
|
|
26
|
+
model.get('editable_elements').update_content_from(editable_elements)
|
|
21
27
|
@reset_editable_elements()
|
|
22
28
|
else
|
|
23
29
|
@refresh_editable_elements()
|
|
@@ -19,12 +19,10 @@ module Locomotive
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def parent_pages_options
|
|
22
|
-
roots = current_site.pages.roots.where(:slug.ne => '404').and(:_id.ne => @page.id)
|
|
23
|
-
|
|
24
22
|
[].tap do |list|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
root = Locomotive::Page.quick_tree(current_site).first
|
|
24
|
+
|
|
25
|
+
add_children_to_options(root, list)
|
|
28
26
|
end
|
|
29
27
|
end
|
|
30
28
|
|
|
@@ -20,6 +20,7 @@ module Locomotive
|
|
|
20
20
|
## indexes ##
|
|
21
21
|
index position: 1
|
|
22
22
|
index depth: 1, position: 1
|
|
23
|
+
index site_id: 1, depth: 1, position: 1
|
|
23
24
|
|
|
24
25
|
alias_method_chain :rearrange, :identity_map
|
|
25
26
|
alias_method_chain :rearrange_children, :identity_map
|
|
@@ -83,12 +84,7 @@ module Locomotive
|
|
|
83
84
|
end
|
|
84
85
|
end
|
|
85
86
|
|
|
86
|
-
current_page.
|
|
87
|
-
def children=(list); @children = list; end
|
|
88
|
-
def children; @children || []; end
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
current_page.children = children
|
|
87
|
+
current_page.instance_variable_set(:@children, children || [])
|
|
92
88
|
|
|
93
89
|
current_page
|
|
94
90
|
end
|
|
@@ -19,7 +19,7 @@ module Locomotive
|
|
|
19
19
|
|
|
20
20
|
## methods ##
|
|
21
21
|
|
|
22
|
-
Ability::ROLES.each do |_role|
|
|
22
|
+
Locomotive::Ability::ROLES.each do |_role|
|
|
23
23
|
define_method("#{_role}?") do
|
|
24
24
|
self.role == _role
|
|
25
25
|
end
|
|
@@ -48,13 +48,13 @@ module Locomotive
|
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
def ability
|
|
51
|
-
@ability ||= Ability.new(self.account, self.site)
|
|
51
|
+
@ability ||= Locomotive::Ability.new(self.account, self.site)
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
protected
|
|
55
55
|
|
|
56
56
|
def define_role
|
|
57
|
-
self.role = Ability::ROLES.include?(role.downcase) ? role.downcase : Ability::ROLES.first
|
|
57
|
+
self.role = Locomotive::Ability::ROLES.include?(role.downcase) ? role.downcase : Locomotive::Ability::ROLES.first
|
|
58
58
|
end
|
|
59
59
|
|
|
60
60
|
# Users should not be able to set the role of another user to be higher than
|
|
@@ -67,7 +67,7 @@ module Locomotive
|
|
|
67
67
|
if current_membership.present?
|
|
68
68
|
# The role cannot be set higher than the current one (we use the index in
|
|
69
69
|
# the roles array to check role presidence)
|
|
70
|
-
errors.add(:role, :invalid) if Ability::ROLES.index(role) < Ability::ROLES.index(current_membership.role)
|
|
70
|
+
errors.add(:role, :invalid) if Locomotive::Ability::ROLES.index(role) < Locomotive::Ability::ROLES.index(current_membership.role)
|
|
71
71
|
end
|
|
72
72
|
end
|
|
73
73
|
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
|
|
36
36
|
= f.input :target_klass_name, as: :select, collection: options_for_target_klass_name, include_blank: false, wrapper_html: { style: "#{'display: none' if !@page.templatized? || @page.templatized_from_parent?}" }
|
|
37
37
|
|
|
38
|
-
= f.input :published, as: :'Locomotive::Toggle'
|
|
38
|
+
= f.input :published, as: :'Locomotive::Toggle', input_html: { class: 'simple-toggle' }
|
|
39
39
|
|
|
40
|
-
= f.input :listed, as: :'Locomotive::Toggle'
|
|
40
|
+
= f.input :listed, as: :'Locomotive::Toggle', input_html: { class: 'simple-toggle' }
|
|
41
41
|
|
|
42
42
|
= f.input :redirect, as: :'Locomotive::Toggle', wrapper_html: { style: "#{'display: none' if @page.templatized? || !@page.default_response_type?}" }
|
|
43
43
|
|
|
@@ -45,6 +45,8 @@
|
|
|
45
45
|
|
|
46
46
|
= f.input :redirect_type, as: :select, collection: options_for_page_redirect_type, include_blank: false, wrapper_html: { style: "#{'display: none' unless @page.redirect?}" }
|
|
47
47
|
|
|
48
|
+
= render_cell 'locomotive/partials', :display, :page_form, g: f
|
|
49
|
+
|
|
48
50
|
- if can?(:customize, @page)
|
|
49
51
|
|
|
50
52
|
= f.input :cache_strategy, as: :select, collection: options_for_page_cache_strategy, include_blank: false, wrapper_html: { style: "#{'display: none' if @page.redirect?}" }
|
data/config/routes.rb
CHANGED
|
@@ -8,6 +8,10 @@ Locomotive::Engine.routes.draw do
|
|
|
8
8
|
failure_app: 'Locomotive::Devise::FailureApp',
|
|
9
9
|
controllers: { sessions: 'locomotive/sessions', passwords: 'locomotive/passwords' }
|
|
10
10
|
|
|
11
|
+
authenticated :locomotive_account do
|
|
12
|
+
root to: 'pages#index'
|
|
13
|
+
end
|
|
14
|
+
|
|
11
15
|
devise_scope :locomotive_account do
|
|
12
16
|
match '/' => 'sessions#new'
|
|
13
17
|
delete 'signout' => 'sessions#destroy', as: :destroy_locomotive_session
|
|
@@ -7,4 +7,7 @@ require 'locomotive/carrierwave/patches'
|
|
|
7
7
|
# register missing mime types
|
|
8
8
|
EXTENSIONS[:eot] = 'application/vnd.ms-fontobject'
|
|
9
9
|
EXTENSIONS[:woff] = 'application/x-woff'
|
|
10
|
-
EXTENSIONS[:otf] = 'application/octet-stream'
|
|
10
|
+
EXTENSIONS[:otf] = 'application/octet-stream'
|
|
11
|
+
|
|
12
|
+
# Allow retina images
|
|
13
|
+
CarrierWave::SanitizedFile.sanitize_regexp = /[^a-zA-Z0-9\.\-\+_\@]/
|
|
@@ -42,23 +42,17 @@ module Locomotive
|
|
|
42
42
|
protected
|
|
43
43
|
|
|
44
44
|
def retrieve_page_from_handle(site, context)
|
|
45
|
-
context
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
nil
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
return page unless page.nil?
|
|
45
|
+
handle = context[@handle] || @handle
|
|
46
|
+
|
|
47
|
+
case handle
|
|
48
|
+
when Locomotive::Page then handle
|
|
49
|
+
when Locomotive::Liquid::Drops::Page then handle.instance_variable_get(:@_source)
|
|
50
|
+
when String then fetch_page(site, handle)
|
|
51
|
+
when Locomotive::ContentEntry then fetch_page(site, handle, true)
|
|
52
|
+
when Locomotive::Liquid::Drops::ContentEntry then fetch_page(site, handle.instance_variable_get(:@_source), true)
|
|
53
|
+
else
|
|
54
|
+
nil
|
|
59
55
|
end
|
|
60
|
-
|
|
61
|
-
nil
|
|
62
56
|
end
|
|
63
57
|
|
|
64
58
|
def fetch_page(site, handle, templatized = false)
|
data/lib/locomotive/render.rb
CHANGED
|
@@ -96,7 +96,7 @@ module Locomotive
|
|
|
96
96
|
|
|
97
97
|
# Get the Locomotive page matching the request and scoped by the current Locomotive site
|
|
98
98
|
#
|
|
99
|
-
# @param [ String ] path An optional path overriding the default
|
|
99
|
+
# @param [ String ] path An optional path overriding the default behaviour to get a page
|
|
100
100
|
#
|
|
101
101
|
# @return [ Object ] The Locomotive::Page
|
|
102
102
|
#
|
data/lib/locomotive/version.rb
CHANGED
data/lib/tasks/development.rake
CHANGED
|
Binary file
|
|
@@ -55,6 +55,12 @@ describe Locomotive::ThemeAsset do
|
|
|
55
55
|
asset.local_path.should == 'images/a_la_poubelle/5k.png'
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
+
it 'should keep the original name for a retina image' do
|
|
59
|
+
asset.source = FixturedAsset.open('5k@2x.png')
|
|
60
|
+
asset.save
|
|
61
|
+
asset.local_path.should == 'images/5k@2x.png'
|
|
62
|
+
end
|
|
63
|
+
|
|
58
64
|
end
|
|
59
65
|
|
|
60
66
|
describe '#validation' do
|
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.3.
|
|
4
|
+
version: 2.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Didier Lafforgue
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-10
|
|
11
|
+
date: 2013-11-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|
|
@@ -1269,6 +1269,7 @@ files:
|
|
|
1269
1269
|
- spec/cells/locomotive/main_menu_cell_spec.rb
|
|
1270
1270
|
- spec/cells/locomotive/settings_menu_cell_spec.rb
|
|
1271
1271
|
- spec/fixtures/assets/5k.png
|
|
1272
|
+
- spec/fixtures/assets/5k@2x.png
|
|
1272
1273
|
- spec/fixtures/assets/5k_2.png
|
|
1273
1274
|
- spec/fixtures/assets/application.js
|
|
1274
1275
|
- spec/fixtures/assets/main.css
|
|
@@ -1483,6 +1484,7 @@ test_files:
|
|
|
1483
1484
|
- spec/cells/locomotive/main_menu_cell_spec.rb
|
|
1484
1485
|
- spec/cells/locomotive/settings_menu_cell_spec.rb
|
|
1485
1486
|
- spec/fixtures/assets/5k.png
|
|
1487
|
+
- spec/fixtures/assets/5k@2x.png
|
|
1486
1488
|
- spec/fixtures/assets/5k_2.png
|
|
1487
1489
|
- spec/fixtures/assets/application.js
|
|
1488
1490
|
- spec/fixtures/assets/main.css
|