locomotive_cms 2.1.4 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -5
- data/app/assets/images/locomotive/icons/flags/zh-CN.png +0 -0
- data/app/assets/javascripts/aloha/plugins/custom/inputcontrol/css/inputcontrol.css +3 -0
- data/app/assets/javascripts/aloha/plugins/custom/inputcontrol/lib/inputcontrol-plugin.js +94 -0
- data/app/assets/javascripts/aloha/plugins/custom/inputcontrol/package.json +1 -0
- data/app/assets/javascripts/locomotive.js +2 -1
- data/app/assets/javascripts/locomotive/models/content_type.js.coffee +6 -2
- data/app/assets/javascripts/locomotive/models/page.js.coffee +1 -1
- data/app/assets/javascripts/locomotive/models/site.js.coffee +1 -1
- data/app/assets/javascripts/locomotive/utils/aloha_settings.js.coffee +17 -7
- data/app/assets/javascripts/locomotive/utils/tinymce_settings.js.coffee +6 -0
- data/app/assets/javascripts/locomotive/views/application_view.js.coffee +13 -2
- data/app/assets/javascripts/locomotive/views/content_entries/_form_view.js.coffee +19 -2
- data/app/assets/javascripts/locomotive/views/content_entries/_popup_form_view.js.coffee +1 -1
- data/app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee +2 -2
- data/app/assets/javascripts/locomotive/views/content_types/_form_view.js.coffee +2 -1
- data/app/assets/javascripts/locomotive/views/content_types/custom_field_entry_view.js.coffee +3 -0
- data/app/assets/javascripts/locomotive/views/current_site/edit_view.js.coffee +2 -1
- data/app/assets/javascripts/locomotive/views/editable_elements/edit_all_view.js.coffee +3 -6
- data/app/assets/javascripts/locomotive/views/editable_elements/text_view.js.coffee +47 -0
- data/app/assets/javascripts/locomotive/views/inline_editor/toolbar_view.js.coffee +1 -1
- data/app/assets/javascripts/locomotive/views/pages/_form_view.js.coffee +2 -1
- data/app/assets/javascripts/locomotive/views/pages/list_view.js.coffee +2 -2
- data/app/assets/javascripts/locomotive/views/shared/fields/belongs_to_view.js.coffee +32 -0
- data/app/assets/javascripts/locomotive/views/shared/fields/has_many_view.js.coffee +2 -2
- data/app/assets/javascripts/locomotive/views/shared/fields/many_to_many_view.js.coffee +2 -2
- data/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee +2 -0
- data/app/assets/javascripts/locomotive/views/snippets/_form_view.js.coffee +2 -1
- data/app/assets/javascripts/locomotive/views/theme_assets/_form_view.js.coffee +2 -1
- data/app/assets/javascripts/locomotive/views/theme_assets/index_view.js.coffee +0 -1
- data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/es.js +1 -0
- data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/et.js +1 -0
- data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/it.js +1 -0
- data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/ja.js +1 -0
- data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/nb.js +1 -0
- data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/nl.js +1 -0
- data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/no.js +1 -0
- data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/pl.js +1 -0
- data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/pt.js +1 -0
- data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/zh-cn.js +1 -0
- data/app/assets/stylesheets/locomotive.css +1 -0
- data/app/assets/stylesheets/locomotive/backoffice/codemirror_changes.css.scss +2 -0
- data/app/assets/stylesheets/locomotive/backoffice/formtastic_changes.css.scss +17 -3
- data/app/controllers/locomotive/content_entries_controller.rb +6 -2
- data/app/controllers/locomotive/public/content_entries_controller.rb +6 -0
- data/app/helpers/locomotive/base_helper.rb +8 -0
- data/app/helpers/locomotive/sites_helper.rb +6 -0
- data/app/models/locomotive/content_entry.rb +35 -5
- data/app/models/locomotive/content_type.rb +26 -8
- data/app/models/locomotive/editable_element.rb +15 -1
- data/app/models/locomotive/editable_file.rb +0 -2
- data/app/models/locomotive/editable_long_text.rb +3 -3
- data/app/models/locomotive/editable_short_text.rb +3 -64
- data/app/models/locomotive/editable_text.rb +84 -0
- data/app/models/locomotive/extensions/content_entry/csv.rb +7 -3
- data/app/models/locomotive/extensions/page/editable_elements.rb +3 -5
- data/app/models/locomotive/extensions/site/locales.rb +20 -0
- data/app/models/locomotive/extensions/site/timezone.rb +35 -0
- data/app/models/locomotive/site.rb +20 -16
- data/app/models/locomotive/theme_asset.rb +1 -1
- data/app/presenters/locomotive/content_entry_presenter.rb +1 -1
- data/app/presenters/locomotive/{editable_short_text_presenter.rb → editable_text_presenter.rb} +14 -2
- data/app/views/locomotive/current_site/_form.html.haml +1 -0
- data/app/views/locomotive/custom_fields/types/_belongs_to.html.haml +6 -5
- data/app/views/locomotive/pages/_editable_elements.html.haml +1 -1
- data/app/views/locomotive/shared/_head.html.haml +2 -0
- data/app/views/locomotive/shared/_main_app_head_before_backbone.html.haml +1 -0
- data/config/locales/admin_ui.de.yml +1 -0
- data/config/locales/admin_ui.en.yml +1 -0
- data/config/locales/admin_ui.et.yml +1 -0
- data/config/locales/admin_ui.fr.yml +1 -0
- data/config/locales/admin_ui.ja.yml +1 -0
- data/config/locales/admin_ui.nb.yml +2 -0
- data/config/locales/admin_ui.pl.yml +1 -0
- data/config/locales/admin_ui.pt-BR.yml +2 -1
- data/config/locales/admin_ui.ru.yml +24 -4
- data/config/locales/admin_ui.zh-CN.yml +347 -0
- data/config/locales/carrierwave.zh-CN.yml +4 -0
- data/config/locales/default.zh-CN.yml +116 -0
- data/config/locales/devise.nb.yml +1 -0
- data/config/locales/devise.zh-CN.yml +64 -0
- data/config/locales/flash.zh-CN.yml +115 -0
- data/config/locales/formtastic.en.yml +1 -0
- data/config/locales/formtastic.ru.yml +4 -1
- data/config/locales/formtastic.zh-CN.yml +112 -0
- data/features/backoffice/content_types/localized.feature +63 -0
- data/features/backoffice/pages.feature +3 -1
- data/features/backoffice/site.feature +7 -0
- data/features/public/contact_form.feature +11 -0
- data/features/public/content_entries.feature +13 -0
- data/features/public/pages.feature +24 -0
- data/features/step_definitions/page_steps.rb +6 -0
- data/features/step_definitions/web_steps.rb +24 -7
- data/lib/generators/locomotive/install/templates/locomotive.rb +2 -2
- data/lib/generators/locomotive/install/templates/mongoid.yml +23 -29
- data/lib/locomotive.rb +1 -4
- data/lib/locomotive/configuration.rb +3 -3
- data/lib/locomotive/dependencies.rb +1 -0
- data/lib/locomotive/engine.rb +2 -1
- data/lib/locomotive/liquid/drops/page.rb +1 -1
- data/lib/locomotive/liquid/filters/date.rb +3 -1
- data/lib/locomotive/liquid/filters/misc.rb +4 -0
- data/lib/locomotive/liquid/filters/text.rb +4 -0
- data/lib/locomotive/liquid/tags/editable.rb +1 -2
- data/lib/locomotive/liquid/tags/editable/text.rb +79 -0
- data/lib/locomotive/liquid/tags/inline_editor.rb +1 -1
- data/lib/locomotive/liquid/tags/link_to.rb +72 -13
- data/lib/locomotive/liquid/tags/with_scope.rb +3 -3
- data/lib/locomotive/middlewares.rb +0 -1
- data/lib/locomotive/mongoid/patches.rb +0 -16
- data/lib/locomotive/render.rb +1 -1
- data/lib/locomotive/version.rb +1 -1
- data/lib/tasks/locomotive.rake +15 -9
- data/mongodb/migrate/20130326201349_rename_entry_to_content_entry.rb +1 -1
- data/mongodb/migrate/20130621135025_create_editable_texts.rb +42 -0
- data/mongodb/migrate/20130627101548_localize_slugs_of_content_entries.rb +43 -0
- data/spec/dummy/config/initializers/locomotive.rb +1 -1
- data/spec/dummy/config/initializers/session_store.rb +1 -1
- data/spec/lib/locomotive/liquid/drops/page_spec.rb +1 -1
- data/spec/lib/locomotive/liquid/filters/misc_spec.rb +26 -0
- data/spec/lib/locomotive/liquid/tags/editable/text_spec.rb +85 -0
- data/spec/lib/locomotive/liquid/tags/link_to_spec.rb +111 -0
- data/spec/lib/locomotive/liquid/tags/with_scope_spec.rb +6 -0
- data/spec/models/locomotive/content_entry_spec.rb +27 -7
- data/spec/models/locomotive/{editable_short_text_spec.rb → editable_text_spec.rb} +53 -8
- data/spec/models/locomotive/extensions/page/editable_elements_spec.rb +6 -6
- data/spec/models/locomotive/site_spec.rb +52 -32
- data/vendor/assets/images/select2-spinner.gif +0 -0
- data/vendor/assets/images/select2.png +0 -0
- data/vendor/assets/images/select2x2.png +0 -0
- data/vendor/assets/javascripts/locomotive/liquid_mode.js +1 -1
- data/vendor/assets/javascripts/select2/select2.js +3054 -0
- data/vendor/assets/stylesheets/select2/select2.css.scss +652 -0
- metadata +77 -33
- data/app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee +0 -36
- data/app/assets/javascripts/locomotive/views/editable_elements/short_text_view.js.coffee +0 -22
- data/app/presenters/locomotive/editable_long_text_presenter.rb +0 -5
- data/lib/locomotive/liquid/tags/editable/long_text.rb +0 -33
- data/lib/locomotive/liquid/tags/editable/short_text.rb +0 -41
- data/lib/locomotive/middlewares/fonts.rb +0 -42
- data/lib/locomotive/session_store.rb +0 -64
- data/spec/lib/locomotive/liquid/tags/editable/short_text_spec.rb +0 -46
- data/spec/models/locomotive/editable_long_text_spec.rb +0 -50
@@ -0,0 +1,63 @@
|
|
1
|
+
Feature: Localized Content Entries
|
2
|
+
As an editor
|
3
|
+
In order to manage translations of custom content entries
|
4
|
+
I want to edit localized fields of custom contents of my site
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I have the site: "test site" set up with name: "test site"
|
8
|
+
And the site "test site" has locales "en, de"
|
9
|
+
And I have a custom model named "Proverbs" with
|
10
|
+
| label | type | required | localized |
|
11
|
+
| Proverb | string | true | true |
|
12
|
+
| Author | string | false | false |
|
13
|
+
And I have entries for "Proverbs" with
|
14
|
+
| proverb | author |
|
15
|
+
| Jump on the bandwagon | John |
|
16
|
+
And I am an authenticated user
|
17
|
+
|
18
|
+
Scenario: See original entry in list
|
19
|
+
When I go to the list of "Proverbs"
|
20
|
+
Then I should see "Jump on the bandwagon"
|
21
|
+
And I should not see "untranslated"
|
22
|
+
|
23
|
+
@javascript
|
24
|
+
Scenario: See untranslated entry in list
|
25
|
+
When I switch the locale to "de"
|
26
|
+
And I go to the list of "Proverbs"
|
27
|
+
Then I should see "Jump on the bandwagon"
|
28
|
+
And I should see "untranslated"
|
29
|
+
|
30
|
+
Scenario: See original entry details
|
31
|
+
When I go to the list of "Proverbs"
|
32
|
+
And I follow "Jump on the bandwagon" within the main content
|
33
|
+
Then the "Proverb" field should contain "Jump on the bandwagon"
|
34
|
+
And the "Author" field should contain "John"
|
35
|
+
|
36
|
+
@javascript
|
37
|
+
Scenario: See untranslated entry details
|
38
|
+
When I switch the locale to "de"
|
39
|
+
And I go to the list of "Proverbs"
|
40
|
+
And I follow "Jump on the bandwagon" within the main content
|
41
|
+
Then the "Proverb" field should contain "Jump on the bandwagon"
|
42
|
+
And the "Author" field should contain "John"
|
43
|
+
|
44
|
+
@javascript
|
45
|
+
Scenario: Translate entry
|
46
|
+
When I switch the locale to "de"
|
47
|
+
And I go to the list of "Proverbs"
|
48
|
+
And I follow "Jump on the bandwagon" within the main content
|
49
|
+
|
50
|
+
When I fill in "Proverb" with "Auf einen fahrenden Zug aufspringen"
|
51
|
+
And I press "Save" within the main form
|
52
|
+
Then I should see "Entry was successfully updated."
|
53
|
+
|
54
|
+
When I go to the list of "Proverbs"
|
55
|
+
Then I should see "Auf einen fahrenden Zug aufspringen"
|
56
|
+
And I should not see "Jump on the bandwagon"
|
57
|
+
And I should not see "untranslated"
|
58
|
+
|
59
|
+
When I switch the locale to "en"
|
60
|
+
And I go to the list of "Proverbs"
|
61
|
+
Then I should not see "Auf einen fahrenden Zug aufspringen"
|
62
|
+
And I should see "Jump on the bandwagon"
|
63
|
+
And I should not see "untranslated"
|
@@ -4,7 +4,7 @@ Feature: Manage Pages
|
|
4
4
|
I want to add/edit/delete pages of my site
|
5
5
|
|
6
6
|
Background:
|
7
|
-
Given I have the site: "test site" set up with name: "test site"
|
7
|
+
Given I have the site: "test site" set up with name: "test site", timezone_name: "Paris"
|
8
8
|
And I am an authenticated user
|
9
9
|
|
10
10
|
Scenario: Pages list is not accessible for non authenticated accounts
|
@@ -32,6 +32,8 @@ Scenario: Updating a valid page
|
|
32
32
|
And I change the page template to "My new content is here"
|
33
33
|
And I press "Save"
|
34
34
|
Then I should see "Page was successfully updated."
|
35
|
+
Then I go to pages
|
36
|
+
And updated_at of the index page should respect site's timezone
|
35
37
|
And I should have "My new content is here" in the index page
|
36
38
|
|
37
39
|
@javascript
|
@@ -32,6 +32,13 @@ Scenario: Add a new site with chosen locale
|
|
32
32
|
When I press "Create"
|
33
33
|
Then I should see "Site was successfully created." in the html code
|
34
34
|
|
35
|
+
Scenario: Change timezone of site
|
36
|
+
Given I am an authenticated user
|
37
|
+
When I go to the site settings
|
38
|
+
And I select "(GMT+04:00) Moscow" from "Timezone"
|
39
|
+
Then I press "Save"
|
40
|
+
Then I should see "My site was successfully updated." in the html code
|
41
|
+
|
35
42
|
@javascript
|
36
43
|
Scenario: Adding a domain to a site
|
37
44
|
Given I am an authenticated user
|
@@ -10,6 +10,8 @@ Feature: Contact form
|
|
10
10
|
| label | type | required |
|
11
11
|
| Email | string | true |
|
12
12
|
| Message | text | true |
|
13
|
+
| Category | select | true |
|
14
|
+
And I have "Design, Code, Business" as "Category" values of the "Messages" model
|
13
15
|
And I enable the public submission of the "Messages" model
|
14
16
|
And a page named "contact" with the template:
|
15
17
|
"""
|
@@ -23,6 +25,13 @@ Feature: Contact form
|
|
23
25
|
<label for="email">E-Mail Address</label>
|
24
26
|
<input type="text" id="email" name="content[email]" />
|
25
27
|
{% if message.errors.email %}Email is required{% endif %}
|
28
|
+
<label for="category">Category</label>
|
29
|
+
<select id="category" name="content[category]">
|
30
|
+
<option value=""></option>
|
31
|
+
{% for name in contents.messages.category_options %}
|
32
|
+
<option value="{{ name }}">{{ name }}</option>
|
33
|
+
{% endfor %}
|
34
|
+
</select>
|
26
35
|
<label for="message">Message</label>
|
27
36
|
<textarea name="content[message]" id="message"></textarea>
|
28
37
|
<input name="submit" type="submit" id="submit" value="Submit" />
|
@@ -54,6 +63,7 @@ Feature: Contact form
|
|
54
63
|
When I view the rendered page at "/contact"
|
55
64
|
And I fill in "E-Mail Address" with "did@locomotivecms.com"
|
56
65
|
And I fill in "Message" with "LocomotiveCMS rocks"
|
66
|
+
And I select "Code" from "Category"
|
57
67
|
And I press "Submit"
|
58
68
|
Then I should see "Thanks did@locomotivecms.com"
|
59
69
|
|
@@ -68,6 +78,7 @@ Feature: Contact form
|
|
68
78
|
And I view the rendered page at "/contact"
|
69
79
|
And I fill in "E-Mail Address" with "did@locomotivecms.com"
|
70
80
|
And I fill in "Message" with "LocomotiveCMS rocks"
|
81
|
+
And I select "Code" from "Category"
|
71
82
|
And I press "Submit"
|
72
83
|
Then I should see "Thanks did@locomotivecms.com"
|
73
84
|
|
@@ -53,4 +53,17 @@ Scenario: Filter by a date
|
|
53
53
|
Then the rendered output should look like:
|
54
54
|
"""
|
55
55
|
Lorem ipsum, Yadi Yada
|
56
|
+
"""
|
57
|
+
|
58
|
+
Scenario: Filter with regexp
|
59
|
+
Given a page named "my-articles" with the template:
|
60
|
+
"""
|
61
|
+
{% with_scope title: /ello|adi/ %}
|
62
|
+
{% for article in contents.articles %}{{ article.title }}, {% endfor %}
|
63
|
+
{% endwith_scope %}
|
64
|
+
"""
|
65
|
+
When I view the rendered page at "/my-articles"
|
66
|
+
Then the rendered output should look like:
|
67
|
+
"""
|
68
|
+
Hello world, Yadi Yada
|
56
69
|
"""
|
@@ -67,6 +67,30 @@ Scenario: link_to tag
|
|
67
67
|
<i class="icon-info-sign"></i> Acerca de
|
68
68
|
</a>
|
69
69
|
"""
|
70
|
+
|
71
|
+
Scenario: link_to templatized page
|
72
|
+
Given I have a custom model named "Articles" with
|
73
|
+
| label | type | required |
|
74
|
+
| Title | string | true |
|
75
|
+
And I have entries for "Articles" with
|
76
|
+
| title |
|
77
|
+
| Hello world |
|
78
|
+
And a templatized page for the "Articles" model and with the template:
|
79
|
+
"""
|
80
|
+
Here is the title: "{{ article.title }}"
|
81
|
+
"""
|
82
|
+
And a page named "page-with-links" with the template:
|
83
|
+
"""
|
84
|
+
{% for article in contents.articles %}
|
85
|
+
Link to article: {% link_to article %}
|
86
|
+
{% endfor %}
|
87
|
+
"""
|
88
|
+
When I view the rendered page at "/page-with-links"
|
89
|
+
And I follow "Hello world"
|
90
|
+
Then the rendered output should look like:
|
91
|
+
"""
|
92
|
+
Here is the title: "Hello world"
|
93
|
+
"""
|
70
94
|
|
71
95
|
Scenario: Default locale fallback
|
72
96
|
Given the site "test site" has locales "en, es"
|
@@ -124,4 +124,10 @@ Then /^I should not see delete page buttons$/ do
|
|
124
124
|
page.has_css?("ul#pages-list li .more a.remove").should be_false
|
125
125
|
end
|
126
126
|
|
127
|
+
Then /^updated_at of the (.*) page should respect site's timezone$/ do |slug|
|
128
|
+
edited_page = @site.pages.where(slug: slug).first
|
129
|
+
t = edited_page.updated_at.in_time_zone(@site.timezone)
|
130
|
+
page.source.should =~ /#{t.strftime('%-d %b %H:%M')}/
|
131
|
+
end
|
132
|
+
|
127
133
|
|
@@ -44,11 +44,11 @@ When /^(?:|I )follow "([^"]*)"$/ do |link|
|
|
44
44
|
end
|
45
45
|
|
46
46
|
When /^(?:|I )fill in "([^"]*)" with "([^"]*)"$/ do |field, value|
|
47
|
-
fill_in(field, :
|
47
|
+
fill_in(field, with: value)
|
48
48
|
end
|
49
49
|
|
50
50
|
When /^(?:|I )fill in "([^"]*)" for "([^"]*)"$/ do |value, field|
|
51
|
-
fill_in(field, :
|
51
|
+
fill_in(field, with: value)
|
52
52
|
end
|
53
53
|
|
54
54
|
# Use this to fill in an entire form with data from a table. Example:
|
@@ -69,7 +69,24 @@ When /^(?:|I )fill in the following:$/ do |fields|
|
|
69
69
|
end
|
70
70
|
|
71
71
|
When /^(?:|I )select "([^"]*)" from "([^"]*)"$/ do |value, field|
|
72
|
-
|
72
|
+
begin
|
73
|
+
select(value, from: field)
|
74
|
+
rescue Capybara::ElementNotFound
|
75
|
+
container = find('.select2', text: field)
|
76
|
+
container.find('a').click
|
77
|
+
find(:css, 'input.select2-input').set(value.first)
|
78
|
+
page.has_css?('ul.select2-results li.select2-result', visible: true)
|
79
|
+
clicked = false
|
80
|
+
page.all('ul.select2-results li.select2-result').each do |e|
|
81
|
+
if e.text == value
|
82
|
+
e.click
|
83
|
+
clicked = true
|
84
|
+
break
|
85
|
+
end
|
86
|
+
end
|
87
|
+
find('.select2-drop').click unless clicked
|
88
|
+
page.has_no_css?("ul.select2-results li.select2-result", visible: true)
|
89
|
+
end
|
73
90
|
end
|
74
91
|
|
75
92
|
When /^(?:|I )check "([^"]*)"$/ do |field|
|
@@ -100,9 +117,9 @@ Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp|
|
|
100
117
|
regexp = Regexp.new(regexp)
|
101
118
|
|
102
119
|
if page.respond_to? :should
|
103
|
-
page.should have_xpath('//*', :
|
120
|
+
page.should have_xpath('//*', text: regexp)
|
104
121
|
else
|
105
|
-
assert page.has_xpath?('//*', :
|
122
|
+
assert page.has_xpath?('//*', text: regexp)
|
106
123
|
end
|
107
124
|
end
|
108
125
|
|
@@ -118,9 +135,9 @@ Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp|
|
|
118
135
|
regexp = Regexp.new(regexp)
|
119
136
|
|
120
137
|
if page.respond_to? :should
|
121
|
-
page.should have_no_xpath('//*', :
|
138
|
+
page.should have_no_xpath('//*', text: regexp)
|
122
139
|
else
|
123
|
-
assert page.has_no_xpath?('//*', :
|
140
|
+
assert page.has_no_xpath?('//*', text: regexp)
|
124
141
|
end
|
125
142
|
end
|
126
143
|
|
@@ -23,11 +23,11 @@ Locomotive.configure do |config|
|
|
23
23
|
# per_page: 10
|
24
24
|
# }
|
25
25
|
|
26
|
-
# default locale (for now, only en, de, fr, pl, pt-BR, it, nb and
|
26
|
+
# default locale (for now, only en, de, fr, pl, pt-BR, it, nb, ja and zh-CN are supported)
|
27
27
|
config.default_locale = :en
|
28
28
|
|
29
29
|
# available locales suggested to "localize" a site. You will have to pick up at least one among that list.
|
30
|
-
# config.site_locales = %w{en de fr pl pt-BR it nl nb es ru ja}
|
30
|
+
# config.site_locales = %w{en de fr pl pt-BR it nl nb es ru ja zh-CN}
|
31
31
|
|
32
32
|
# tell if logs are enabled. Useful for debug purpose.
|
33
33
|
config.enable_logs = true
|
@@ -1,34 +1,28 @@
|
|
1
|
-
defaults: &defaults
|
2
|
-
host: localhost
|
3
|
-
port: 27017
|
4
|
-
# slaves:
|
5
|
-
# - host: slave1.local
|
6
|
-
# port: 27018
|
7
|
-
# - host: slave2.local
|
8
|
-
# port: 27019
|
9
|
-
|
10
1
|
development:
|
11
|
-
|
12
|
-
|
2
|
+
sessions:
|
3
|
+
default:
|
4
|
+
database: locomotive_dev
|
5
|
+
hosts:
|
6
|
+
- localhost:27017
|
7
|
+
options:
|
8
|
+
identity_map_enabled: true
|
13
9
|
|
14
10
|
test:
|
15
|
-
|
16
|
-
|
11
|
+
sessions:
|
12
|
+
default:
|
13
|
+
database: locomotive_test
|
14
|
+
hosts:
|
15
|
+
- localhost:27017
|
16
|
+
options:
|
17
|
+
identity_map_enabled: true
|
17
18
|
|
18
|
-
# set these environment variables on your prod server
|
19
19
|
production:
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
# heroku
|
31
|
-
# uri: <%%= ENV['MONGOHQ_URL'] %>
|
32
|
-
|
33
|
-
# bushido (mongohq_url will also work)
|
34
|
-
uri: <%%= ENV['MONGODB_URL'] %>
|
20
|
+
sessions:
|
21
|
+
default:
|
22
|
+
database: locomotive_production
|
23
|
+
# heroku
|
24
|
+
# uri: <%%= ENV['MONGOHQ_URL'] %>
|
25
|
+
hosts:
|
26
|
+
- localhost:27017
|
27
|
+
options:
|
28
|
+
identity_map_enabled: true
|
data/lib/locomotive.rb
CHANGED
@@ -20,7 +20,6 @@ require 'locomotive/cancan'
|
|
20
20
|
require 'locomotive/regexps'
|
21
21
|
require 'locomotive/render'
|
22
22
|
require 'locomotive/middlewares'
|
23
|
-
require 'locomotive/session_store'
|
24
23
|
|
25
24
|
module Locomotive
|
26
25
|
extend ActiveSupport::Autoload
|
@@ -89,8 +88,6 @@ module Locomotive
|
|
89
88
|
self.app_middleware.insert_before 'Dragonfly::Middleware', '::Locomotive::Middlewares::Cache', self.config.rack_cache
|
90
89
|
end
|
91
90
|
|
92
|
-
self.app_middleware.insert_after 'Dragonfly::Middleware', '::Locomotive::Middlewares::Fonts', path: %r{^/fonts}
|
93
|
-
|
94
91
|
self.app_middleware.use '::Locomotive::Middlewares::SeoTrailingSlash'
|
95
92
|
|
96
93
|
self.app_middleware.use '::Locomotive::Middlewares::InlineEditor'
|
@@ -145,4 +142,4 @@ module Locomotive
|
|
145
142
|
Rails.application.middleware
|
146
143
|
end
|
147
144
|
|
148
|
-
end
|
145
|
+
end
|
@@ -7,8 +7,8 @@ module Locomotive
|
|
7
7
|
reserved_subdomains: %w{www admin email blog webmail mail support help site sites},
|
8
8
|
# forbidden_paths: %w{layouts snippets stylesheets javascripts assets admin system api},
|
9
9
|
reserved_slugs: %w{stylesheets javascripts assets admin locomotive images api pages edit},
|
10
|
-
locales: %w{en de fr pl pt-BR it nl nb es ru et ja},
|
11
|
-
site_locales: %w{en de fr pl pt-BR it nl nb es ru et ja},
|
10
|
+
locales: %w{en de fr pl pt-BR it nl nb es ru et ja zh-CN},
|
11
|
+
site_locales: %w{en de fr pl pt-BR it nl nb es ru et ja zh-CN},
|
12
12
|
cookie_key: '_locomotive_session',
|
13
13
|
enable_logs: false,
|
14
14
|
enable_admin_ssl: false,
|
@@ -125,4 +125,4 @@ module Locomotive
|
|
125
125
|
end
|
126
126
|
end
|
127
127
|
end
|
128
|
-
end
|
128
|
+
end
|
data/lib/locomotive/engine.rb
CHANGED
@@ -37,7 +37,8 @@ module Locomotive
|
|
37
37
|
tinymce/plugins/locomotive_media/langs/*.js
|
38
38
|
tinymce/themes/advanced/skins/locomotive/*.css
|
39
39
|
aloha/plugins/custom/locomotive_media/**/*.js
|
40
|
-
aloha/plugins/custom/
|
40
|
+
aloha/plugins/custom/inputcontrol/**/*.css
|
41
|
+
aloha/plugins/custom/inputcontrol/**/*.js)
|
41
42
|
|
42
43
|
# Uncomment the lines below to view the names of assets as they are
|
43
44
|
# precompiled for the rails asset pipeline
|
@@ -3,7 +3,7 @@ module Locomotive
|
|
3
3
|
module Drops
|
4
4
|
class Page < Base
|
5
5
|
|
6
|
-
delegate :seo_title, :meta_keywords, :meta_description, :redirect_url, to: '_source'
|
6
|
+
delegate :seo_title, :meta_keywords, :meta_description, :redirect_url, :handle, to: '_source'
|
7
7
|
|
8
8
|
def title
|
9
9
|
self._source.templatized? ? @context['entry']._label : self._source.title
|
@@ -2,7 +2,7 @@ module Locomotive
|
|
2
2
|
module Liquid
|
3
3
|
module Filters
|
4
4
|
module Date
|
5
|
-
|
5
|
+
|
6
6
|
def distance_of_time_in_words(input, from_time = Time.now)
|
7
7
|
# make sure we deals with instances of Time
|
8
8
|
input = to_time(input)
|
@@ -30,6 +30,8 @@ module Locomotive
|
|
30
30
|
|
31
31
|
return input.to_s unless input.respond_to?(:strftime)
|
32
32
|
|
33
|
+
input = input.in_time_zone(@context.registers[:site].timezone) if input.respond_to?(:in_time_zone)
|
34
|
+
|
33
35
|
I18n.l input, format: format, locale: locale
|
34
36
|
end
|
35
37
|
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'locomotive/liquid/tags/editable/base'
|
2
|
-
require 'locomotive/liquid/tags/editable/
|
3
|
-
require 'locomotive/liquid/tags/editable/long_text'
|
2
|
+
require 'locomotive/liquid/tags/editable/text'
|
4
3
|
require 'locomotive/liquid/tags/editable/file'
|
5
4
|
require 'locomotive/liquid/tags/editable/control'
|