locomotive_cms 2.5.6 → 2.5.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +7 -3
- data/app/assets/javascripts/locomotive/utils/tinymce_settings.js.coffee +4 -3
- data/app/assets/javascripts/locomotive/views/pages/_form_view.js.coffee +2 -2
- data/app/assets/stylesheets/locomotive/backoffice/application.css.scss +34 -1
- data/app/controllers/locomotive/api/base_controller.rb +8 -0
- data/app/controllers/locomotive/api/content_entries_controller.rb +15 -2
- data/app/controllers/locomotive/api/my_account_controller.rb +15 -0
- data/app/controllers/locomotive/api/version_controller.rb +17 -0
- data/app/controllers/locomotive/base_controller.rb +1 -1
- data/app/controllers/locomotive/content_entries_controller.rb +9 -10
- data/app/helpers/locomotive/content_types_helper.rb +16 -1
- data/app/helpers/locomotive/pages_helper.rb +13 -1
- data/app/models/locomotive/content_type.rb +15 -8
- data/app/models/locomotive/extensions/page/layout.rb +42 -0
- data/app/models/locomotive/extensions/page/templatized.rb +1 -1
- data/app/models/locomotive/page.rb +1 -0
- data/app/presenters/locomotive/content_entry_presenter.rb +5 -1
- data/app/presenters/locomotive/page_presenter.rb +1 -1
- data/app/services/locomotive/content_entry_service.rb +81 -0
- data/app/uploaders/locomotive/theme_asset_uploader.rb +1 -1
- data/app/views/locomotive/content_entries/index.html.haml +8 -0
- data/app/views/locomotive/content_types/_form.html.haml +2 -0
- data/app/views/locomotive/notifications/new_content_entry.html.haml +2 -2
- data/app/views/locomotive/pages/_form.html.haml +8 -1
- data/config/locales/admin_ui.en.yml +2 -0
- data/config/locales/admin_ui.fr.yml +1 -0
- data/config/locales/formtastic.en.yml +3 -0
- data/config/routes.rb +6 -2
- data/features/api/content_entries.feature +22 -9
- data/features/backoffice/site.feature +1 -1
- data/features/public/content_entries.feature +20 -5
- data/features/step_definitions/content_types_steps.rb +6 -0
- data/lib/generators/locomotive/install/templates/devise.rb +0 -2
- data/lib/locomotive/action_controller/responder.rb +1 -1
- data/lib/locomotive/carrierwave.rb +1 -0
- data/lib/locomotive/carrierwave/asset.rb +1 -1
- data/lib/locomotive/httparty/webservice.rb +17 -11
- data/lib/locomotive/liquid/drops/content_types.rb +7 -1
- data/lib/locomotive/liquid/drops/page.rb +51 -3
- data/lib/locomotive/liquid/tags/consume.rb +15 -10
- data/lib/locomotive/liquid/tags/editable/base.rb +1 -1
- data/lib/locomotive/liquid/tags/with_scope.rb +6 -1
- data/lib/locomotive/presentable.rb +1 -1
- data/lib/locomotive/regexps.rb +1 -1
- data/lib/locomotive/version.rb +1 -1
- data/lib/tasks/locomotive.rake +1 -1
- data/spec/dummy/config/application.rb +1 -1
- data/spec/dummy/config/mongoid.yml +2 -2
- data/spec/lib/locomotive/httparty/webservice_spec.rb +8 -3
- data/spec/lib/locomotive/liquid/drops/page_spec.rb +20 -5
- data/spec/lib/locomotive/liquid/tags/consume_spec.rb +66 -48
- data/spec/lib/locomotive/liquid/tags/with_scope_spec.rb +6 -0
- data/spec/mailers/locomotive/notifications_spec.rb +15 -8
- data/spec/models/locomotive/content_entry_spec.rb +1 -1
- data/spec/models/locomotive/editable_control_spec.rb +2 -2
- data/spec/models/locomotive/extensions/page/layout_spec.rb +50 -0
- data/spec/models/locomotive/site_spec.rb +1 -1
- metadata +26 -7
@@ -23,6 +23,12 @@ describe Locomotive::Liquid::Tags::WithScope do
|
|
23
23
|
options[:category].should == 'posts'
|
24
24
|
end
|
25
25
|
|
26
|
+
it 'decodes a regexp stored in a context variable' do
|
27
|
+
scope = Locomotive::Liquid::Tags::WithScope.new('with_scope', 'title: my_regexp', ["{% endwith_scope %}"], {})
|
28
|
+
options = decode_options(scope, { 'my_regexp' => '/^Hello World/' })
|
29
|
+
options[:title].should == /^Hello World/
|
30
|
+
end
|
31
|
+
|
26
32
|
it 'allows order_by option' do
|
27
33
|
scope = Locomotive::Liquid::Tags::WithScope.new('with_scope', 'order_by:\'name DESC\'', ["{% endwith_scope %}"], {})
|
28
34
|
options = decode_options(scope)
|
@@ -4,15 +4,13 @@ describe Locomotive::Notifications do
|
|
4
4
|
|
5
5
|
describe 'new_content_entry' do
|
6
6
|
|
7
|
-
let(:
|
8
|
-
|
9
|
-
let(:account)
|
10
|
-
|
11
|
-
let(:content_type) { FactoryGirl.build(:content_type, site: site) }
|
12
|
-
|
7
|
+
let(:now) { Time.parse('Sep 16 1982 9:00pm') }
|
8
|
+
let(:site) { FactoryGirl.build(:site, domains: %w{www.acme.com}, timezone_name: 'CET') }
|
9
|
+
let(:account) { FactoryGirl.build(:account) }
|
10
|
+
let(:content_type) { FactoryGirl.build(:content_type, site: site) }
|
13
11
|
let(:content_entry) { FactoryGirl.build(:content_entry, content_type: content_type, site: site) }
|
14
12
|
|
15
|
-
let(:mail) { Locomotive::Notifications.new_content_entry(account, content_entry) }
|
13
|
+
let(:mail) { set_timezone { Locomotive::Notifications.new_content_entry(account, content_entry) } }
|
16
14
|
|
17
15
|
it 'renders the subject' do
|
18
16
|
mail.subject.should == '[www.acme.com][My project] new entry'
|
@@ -26,6 +24,11 @@ describe Locomotive::Notifications do
|
|
26
24
|
mail.from.should == ['support@dummy.com']
|
27
25
|
end
|
28
26
|
|
27
|
+
it 'outputs the current time in the correct time zone' do
|
28
|
+
Time.stubs(:now).returns(now)
|
29
|
+
mail.body.encoded.should match('a new instance has been created on 09/16/1982 21:00')
|
30
|
+
end
|
31
|
+
|
29
32
|
it 'outputs the domain in the email body' do
|
30
33
|
mail.body.encoded.should match('<b>www.acme.com</b>')
|
31
34
|
end
|
@@ -54,4 +57,8 @@ describe Locomotive::Notifications do
|
|
54
57
|
|
55
58
|
end
|
56
59
|
|
57
|
-
|
60
|
+
def set_timezone(&block)
|
61
|
+
Time.use_zone(site.try(:timezone) || 'UTC', &block)
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
@@ -176,7 +176,7 @@ describe Locomotive::ContentEntry do
|
|
176
176
|
@content_type.update_attribute :order_by, '_position'
|
177
177
|
|
178
178
|
%w(first second third).each_with_index do |item, index|
|
179
|
-
content = build_content_entry(title: item.to_s, _position: index, published_at: (index +
|
179
|
+
content = build_content_entry(title: item.to_s, _position: index, published_at: (index + 2).days.ago, visible: true)
|
180
180
|
content.save!
|
181
181
|
instance_variable_set "@#{item}", content
|
182
182
|
end
|
@@ -10,7 +10,7 @@ describe Locomotive::EditableControl do
|
|
10
10
|
describe '#simple' do
|
11
11
|
|
12
12
|
before(:each) do
|
13
|
-
@home.update_attributes raw_template:
|
13
|
+
@home.update_attributes raw_template: %({% block body %}{% editable_control 'menu', options: "true=Yes,false=No" %}false{% endeditable_control %}{% endblock %}%)
|
14
14
|
|
15
15
|
@sub_page_1 = FactoryGirl.create(:page, slug: 'sub_page_1', parent: @home, raw_template: "{% extends 'parent' %}")
|
16
16
|
end
|
@@ -76,4 +76,4 @@ describe Locomotive::EditableControl do
|
|
76
76
|
|
77
77
|
end
|
78
78
|
|
79
|
-
end
|
79
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Locomotive::Extensions::Page::Layout do
|
4
|
+
|
5
|
+
let(:site) { FactoryGirl.build(:site) }
|
6
|
+
let(:allow_layout) { true }
|
7
|
+
let(:layout) { Locomotive::Page.new(is_layout: true, fullpath: 'awesome-layout') }
|
8
|
+
let(:page) { Locomotive::Page.new(layout: layout, allow_layout: allow_layout, site: site) }
|
9
|
+
|
10
|
+
describe 'allow_layout default value' do
|
11
|
+
|
12
|
+
let(:page) { Locomotive::Page.new }
|
13
|
+
|
14
|
+
subject { page.allow_layout }
|
15
|
+
|
16
|
+
describe 'true for a new page' do
|
17
|
+
|
18
|
+
it { should eq true }
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
describe 'false for an existing page without the allow_layout attribute' do
|
23
|
+
|
24
|
+
let(:page) { p = Locomotive::Page.new; p.save(validate: false); p.unset(:allow_layout); Locomotive::Page.find(p._id) }
|
25
|
+
|
26
|
+
it { should eq false }
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
describe 'use a layout' do
|
33
|
+
|
34
|
+
before { page.valid? }
|
35
|
+
|
36
|
+
subject { page.raw_template }
|
37
|
+
|
38
|
+
it { should eq '{% extends "awesome-layout" %}' }
|
39
|
+
|
40
|
+
describe 'but changing the layout is not allowed' do
|
41
|
+
|
42
|
+
let(:allow_layout) { false }
|
43
|
+
|
44
|
+
it { should eq "{% extends 'parent' %}" }
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
@@ -59,7 +59,7 @@ describe Locomotive::Site do
|
|
59
59
|
end
|
60
60
|
|
61
61
|
it 'should validate format of domains' do
|
62
|
-
site = FactoryGirl.build(:site, domains: ['barformat.a', '-foo.net', 'goodformat.superlong', 'local.lb-service'])
|
62
|
+
site = FactoryGirl.build(:site, domains: ['www.9troisquarts.com', 'barformat.a', '-foo.net', 'goodformat.superlong', 'local.lb-service'])
|
63
63
|
site.should_not be_valid
|
64
64
|
site.errors[:domains].should == ['barformat.a is invalid', '-foo.net is invalid']
|
65
65
|
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.
|
4
|
+
version: 2.5.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Didier Lafforgue
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-06-15 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.
|
33
|
+
version: 3.2.21
|
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.
|
40
|
+
version: 3.2.21
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: devise
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,20 +80,34 @@ dependencies:
|
|
80
80
|
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 1.6.7
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: moped
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.5.3
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.5.3
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: mongoid
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version: 3.1.
|
103
|
+
version: 3.1.7
|
90
104
|
type: :runtime
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version: 3.1.
|
110
|
+
version: 3.1.7
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: mongoid-tree
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -767,6 +781,7 @@ files:
|
|
767
781
|
- app/controllers/locomotive/api/theme_assets_controller.rb
|
768
782
|
- app/controllers/locomotive/api/tokens_controller.rb
|
769
783
|
- app/controllers/locomotive/api/translations_controller.rb
|
784
|
+
- app/controllers/locomotive/api/version_controller.rb
|
770
785
|
- app/controllers/locomotive/base_controller.rb
|
771
786
|
- app/controllers/locomotive/content_assets_controller.rb
|
772
787
|
- app/controllers/locomotive/content_entries_controller.rb
|
@@ -829,6 +844,7 @@ files:
|
|
829
844
|
- app/models/locomotive/extensions/content_type/item_template.rb
|
830
845
|
- app/models/locomotive/extensions/content_type/sync.rb
|
831
846
|
- app/models/locomotive/extensions/page/editable_elements.rb
|
847
|
+
- app/models/locomotive/extensions/page/layout.rb
|
832
848
|
- app/models/locomotive/extensions/page/listed.rb
|
833
849
|
- app/models/locomotive/extensions/page/parse.rb
|
834
850
|
- app/models/locomotive/extensions/page/redirect.rb
|
@@ -863,6 +879,7 @@ files:
|
|
863
879
|
- app/presenters/locomotive/snippet_presenter.rb
|
864
880
|
- app/presenters/locomotive/theme_asset_presenter.rb
|
865
881
|
- app/presenters/locomotive/translation_presenter.rb
|
882
|
+
- app/services/locomotive/content_entry_service.rb
|
866
883
|
- app/uploaders/locomotive/content_asset_uploader.rb
|
867
884
|
- app/uploaders/locomotive/editable_file_uploader.rb
|
868
885
|
- app/uploaders/locomotive/theme_asset_uploader.rb
|
@@ -1370,6 +1387,7 @@ files:
|
|
1370
1387
|
- spec/models/locomotive/editable_text_spec.rb
|
1371
1388
|
- spec/models/locomotive/extensions/content_entry/csv_spec.rb
|
1372
1389
|
- spec/models/locomotive/extensions/page/editable_elements_spec.rb
|
1390
|
+
- spec/models/locomotive/extensions/page/layout_spec.rb
|
1373
1391
|
- spec/models/locomotive/extensions/page/redirect_spec.rb
|
1374
1392
|
- spec/models/locomotive/extensions/page/render_spec.rb
|
1375
1393
|
- spec/models/locomotive/extensions/site/locales_spec.rb
|
@@ -1462,7 +1480,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1462
1480
|
version: '0'
|
1463
1481
|
requirements: []
|
1464
1482
|
rubyforge_project:
|
1465
|
-
rubygems_version: 2.2.
|
1483
|
+
rubygems_version: 2.2.0
|
1466
1484
|
signing_key:
|
1467
1485
|
specification_version: 4
|
1468
1486
|
summary: A Next Generation Sexy CMS for Rails 3
|
@@ -1611,6 +1629,7 @@ test_files:
|
|
1611
1629
|
- spec/models/locomotive/editable_text_spec.rb
|
1612
1630
|
- spec/models/locomotive/extensions/content_entry/csv_spec.rb
|
1613
1631
|
- spec/models/locomotive/extensions/page/editable_elements_spec.rb
|
1632
|
+
- spec/models/locomotive/extensions/page/layout_spec.rb
|
1614
1633
|
- spec/models/locomotive/extensions/page/redirect_spec.rb
|
1615
1634
|
- spec/models/locomotive/extensions/page/render_spec.rb
|
1616
1635
|
- spec/models/locomotive/extensions/site/locales_spec.rb
|