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.
Files changed (143) hide show
  1. data/Gemfile +1 -5
  2. data/app/assets/images/locomotive/icons/flags/zh-CN.png +0 -0
  3. data/app/assets/javascripts/aloha/plugins/custom/inputcontrol/css/inputcontrol.css +3 -0
  4. data/app/assets/javascripts/aloha/plugins/custom/inputcontrol/lib/inputcontrol-plugin.js +94 -0
  5. data/app/assets/javascripts/aloha/plugins/custom/inputcontrol/package.json +1 -0
  6. data/app/assets/javascripts/locomotive.js +2 -1
  7. data/app/assets/javascripts/locomotive/models/content_type.js.coffee +6 -2
  8. data/app/assets/javascripts/locomotive/models/page.js.coffee +1 -1
  9. data/app/assets/javascripts/locomotive/models/site.js.coffee +1 -1
  10. data/app/assets/javascripts/locomotive/utils/aloha_settings.js.coffee +17 -7
  11. data/app/assets/javascripts/locomotive/utils/tinymce_settings.js.coffee +6 -0
  12. data/app/assets/javascripts/locomotive/views/application_view.js.coffee +13 -2
  13. data/app/assets/javascripts/locomotive/views/content_entries/_form_view.js.coffee +19 -2
  14. data/app/assets/javascripts/locomotive/views/content_entries/_popup_form_view.js.coffee +1 -1
  15. data/app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee +2 -2
  16. data/app/assets/javascripts/locomotive/views/content_types/_form_view.js.coffee +2 -1
  17. data/app/assets/javascripts/locomotive/views/content_types/custom_field_entry_view.js.coffee +3 -0
  18. data/app/assets/javascripts/locomotive/views/current_site/edit_view.js.coffee +2 -1
  19. data/app/assets/javascripts/locomotive/views/editable_elements/edit_all_view.js.coffee +3 -6
  20. data/app/assets/javascripts/locomotive/views/editable_elements/text_view.js.coffee +47 -0
  21. data/app/assets/javascripts/locomotive/views/inline_editor/toolbar_view.js.coffee +1 -1
  22. data/app/assets/javascripts/locomotive/views/pages/_form_view.js.coffee +2 -1
  23. data/app/assets/javascripts/locomotive/views/pages/list_view.js.coffee +2 -2
  24. data/app/assets/javascripts/locomotive/views/shared/fields/belongs_to_view.js.coffee +32 -0
  25. data/app/assets/javascripts/locomotive/views/shared/fields/has_many_view.js.coffee +2 -2
  26. data/app/assets/javascripts/locomotive/views/shared/fields/many_to_many_view.js.coffee +2 -2
  27. data/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee +2 -0
  28. data/app/assets/javascripts/locomotive/views/snippets/_form_view.js.coffee +2 -1
  29. data/app/assets/javascripts/locomotive/views/theme_assets/_form_view.js.coffee +2 -1
  30. data/app/assets/javascripts/locomotive/views/theme_assets/index_view.js.coffee +0 -1
  31. data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/es.js +1 -0
  32. data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/et.js +1 -0
  33. data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/it.js +1 -0
  34. data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/ja.js +1 -0
  35. data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/nb.js +1 -0
  36. data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/nl.js +1 -0
  37. data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/no.js +1 -0
  38. data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/pl.js +1 -0
  39. data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/pt.js +1 -0
  40. data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/zh-cn.js +1 -0
  41. data/app/assets/stylesheets/locomotive.css +1 -0
  42. data/app/assets/stylesheets/locomotive/backoffice/codemirror_changes.css.scss +2 -0
  43. data/app/assets/stylesheets/locomotive/backoffice/formtastic_changes.css.scss +17 -3
  44. data/app/controllers/locomotive/content_entries_controller.rb +6 -2
  45. data/app/controllers/locomotive/public/content_entries_controller.rb +6 -0
  46. data/app/helpers/locomotive/base_helper.rb +8 -0
  47. data/app/helpers/locomotive/sites_helper.rb +6 -0
  48. data/app/models/locomotive/content_entry.rb +35 -5
  49. data/app/models/locomotive/content_type.rb +26 -8
  50. data/app/models/locomotive/editable_element.rb +15 -1
  51. data/app/models/locomotive/editable_file.rb +0 -2
  52. data/app/models/locomotive/editable_long_text.rb +3 -3
  53. data/app/models/locomotive/editable_short_text.rb +3 -64
  54. data/app/models/locomotive/editable_text.rb +84 -0
  55. data/app/models/locomotive/extensions/content_entry/csv.rb +7 -3
  56. data/app/models/locomotive/extensions/page/editable_elements.rb +3 -5
  57. data/app/models/locomotive/extensions/site/locales.rb +20 -0
  58. data/app/models/locomotive/extensions/site/timezone.rb +35 -0
  59. data/app/models/locomotive/site.rb +20 -16
  60. data/app/models/locomotive/theme_asset.rb +1 -1
  61. data/app/presenters/locomotive/content_entry_presenter.rb +1 -1
  62. data/app/presenters/locomotive/{editable_short_text_presenter.rb → editable_text_presenter.rb} +14 -2
  63. data/app/views/locomotive/current_site/_form.html.haml +1 -0
  64. data/app/views/locomotive/custom_fields/types/_belongs_to.html.haml +6 -5
  65. data/app/views/locomotive/pages/_editable_elements.html.haml +1 -1
  66. data/app/views/locomotive/shared/_head.html.haml +2 -0
  67. data/app/views/locomotive/shared/_main_app_head_before_backbone.html.haml +1 -0
  68. data/config/locales/admin_ui.de.yml +1 -0
  69. data/config/locales/admin_ui.en.yml +1 -0
  70. data/config/locales/admin_ui.et.yml +1 -0
  71. data/config/locales/admin_ui.fr.yml +1 -0
  72. data/config/locales/admin_ui.ja.yml +1 -0
  73. data/config/locales/admin_ui.nb.yml +2 -0
  74. data/config/locales/admin_ui.pl.yml +1 -0
  75. data/config/locales/admin_ui.pt-BR.yml +2 -1
  76. data/config/locales/admin_ui.ru.yml +24 -4
  77. data/config/locales/admin_ui.zh-CN.yml +347 -0
  78. data/config/locales/carrierwave.zh-CN.yml +4 -0
  79. data/config/locales/default.zh-CN.yml +116 -0
  80. data/config/locales/devise.nb.yml +1 -0
  81. data/config/locales/devise.zh-CN.yml +64 -0
  82. data/config/locales/flash.zh-CN.yml +115 -0
  83. data/config/locales/formtastic.en.yml +1 -0
  84. data/config/locales/formtastic.ru.yml +4 -1
  85. data/config/locales/formtastic.zh-CN.yml +112 -0
  86. data/features/backoffice/content_types/localized.feature +63 -0
  87. data/features/backoffice/pages.feature +3 -1
  88. data/features/backoffice/site.feature +7 -0
  89. data/features/public/contact_form.feature +11 -0
  90. data/features/public/content_entries.feature +13 -0
  91. data/features/public/pages.feature +24 -0
  92. data/features/step_definitions/page_steps.rb +6 -0
  93. data/features/step_definitions/web_steps.rb +24 -7
  94. data/lib/generators/locomotive/install/templates/locomotive.rb +2 -2
  95. data/lib/generators/locomotive/install/templates/mongoid.yml +23 -29
  96. data/lib/locomotive.rb +1 -4
  97. data/lib/locomotive/configuration.rb +3 -3
  98. data/lib/locomotive/dependencies.rb +1 -0
  99. data/lib/locomotive/engine.rb +2 -1
  100. data/lib/locomotive/liquid/drops/page.rb +1 -1
  101. data/lib/locomotive/liquid/filters/date.rb +3 -1
  102. data/lib/locomotive/liquid/filters/misc.rb +4 -0
  103. data/lib/locomotive/liquid/filters/text.rb +4 -0
  104. data/lib/locomotive/liquid/tags/editable.rb +1 -2
  105. data/lib/locomotive/liquid/tags/editable/text.rb +79 -0
  106. data/lib/locomotive/liquid/tags/inline_editor.rb +1 -1
  107. data/lib/locomotive/liquid/tags/link_to.rb +72 -13
  108. data/lib/locomotive/liquid/tags/with_scope.rb +3 -3
  109. data/lib/locomotive/middlewares.rb +0 -1
  110. data/lib/locomotive/mongoid/patches.rb +0 -16
  111. data/lib/locomotive/render.rb +1 -1
  112. data/lib/locomotive/version.rb +1 -1
  113. data/lib/tasks/locomotive.rake +15 -9
  114. data/mongodb/migrate/20130326201349_rename_entry_to_content_entry.rb +1 -1
  115. data/mongodb/migrate/20130621135025_create_editable_texts.rb +42 -0
  116. data/mongodb/migrate/20130627101548_localize_slugs_of_content_entries.rb +43 -0
  117. data/spec/dummy/config/initializers/locomotive.rb +1 -1
  118. data/spec/dummy/config/initializers/session_store.rb +1 -1
  119. data/spec/lib/locomotive/liquid/drops/page_spec.rb +1 -1
  120. data/spec/lib/locomotive/liquid/filters/misc_spec.rb +26 -0
  121. data/spec/lib/locomotive/liquid/tags/editable/text_spec.rb +85 -0
  122. data/spec/lib/locomotive/liquid/tags/link_to_spec.rb +111 -0
  123. data/spec/lib/locomotive/liquid/tags/with_scope_spec.rb +6 -0
  124. data/spec/models/locomotive/content_entry_spec.rb +27 -7
  125. data/spec/models/locomotive/{editable_short_text_spec.rb → editable_text_spec.rb} +53 -8
  126. data/spec/models/locomotive/extensions/page/editable_elements_spec.rb +6 -6
  127. data/spec/models/locomotive/site_spec.rb +52 -32
  128. data/vendor/assets/images/select2-spinner.gif +0 -0
  129. data/vendor/assets/images/select2.png +0 -0
  130. data/vendor/assets/images/select2x2.png +0 -0
  131. data/vendor/assets/javascripts/locomotive/liquid_mode.js +1 -1
  132. data/vendor/assets/javascripts/select2/select2.js +3054 -0
  133. data/vendor/assets/stylesheets/select2/select2.css.scss +652 -0
  134. metadata +77 -33
  135. data/app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee +0 -36
  136. data/app/assets/javascripts/locomotive/views/editable_elements/short_text_view.js.coffee +0 -22
  137. data/app/presenters/locomotive/editable_long_text_presenter.rb +0 -5
  138. data/lib/locomotive/liquid/tags/editable/long_text.rb +0 -33
  139. data/lib/locomotive/liquid/tags/editable/short_text.rb +0 -41
  140. data/lib/locomotive/middlewares/fonts.rb +0 -42
  141. data/lib/locomotive/session_store.rb +0 -64
  142. data/spec/lib/locomotive/liquid/tags/editable/short_text_spec.rb +0 -46
  143. 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, :with => value)
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, :with => value)
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
- select(value, :from => field)
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('//*', :text => regexp)
120
+ page.should have_xpath('//*', text: regexp)
104
121
  else
105
- assert page.has_xpath?('//*', :text => regexp)
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('//*', :text => regexp)
138
+ page.should have_no_xpath('//*', text: regexp)
122
139
  else
123
- assert page.has_no_xpath?('//*', :text => regexp)
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 ja are supported)
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
- <<: *defaults
12
- database: locomotive_dev
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
- <<: *defaults
16
- database: locomotive_test
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
- # <<: *defaults
21
- # database: locomotive_prod
22
-
23
- # other settings for production
24
- # host: <%%= ENV['MONGOID_HOST'] %>
25
- # port: <%%= ENV['MONGOID_PORT'] %>
26
- # username: <%%= ENV['MONGOID_USERNAME'] %>
27
- # password: <%%= ENV['MONGOID_PASSWORD'] %>
28
- # database: <%%= ENV['MONGOID_DATABASE'] %>
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
@@ -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
@@ -2,6 +2,7 @@ require 'mongoid'
2
2
  require 'mongoid/railtie'
3
3
  require 'mongoid/tree'
4
4
  require 'mongoid_migration'
5
+ require 'mongo_session_store-rails3'
5
6
  require 'devise'
6
7
  require 'devise/orm/mongoid'
7
8
  require 'devise-encryptable'
@@ -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/locomotive_media/**/*.css)
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
 
@@ -56,6 +56,10 @@ module Locomotive
56
56
  </div>}
57
57
  end
58
58
 
59
+ def random(input)
60
+ rand(input.to_i)
61
+ end
62
+
59
63
  end
60
64
 
61
65
  ::Liquid::Template.register_filter(Misc)
@@ -11,6 +11,10 @@ module Locomotive
11
11
  input.to_s.gsub(' ', '-').gsub('/', '-').dasherize
12
12
  end
13
13
 
14
+ def encode(input)
15
+ Rack::Utils.escape(input)
16
+ end
17
+
14
18
  # alias newline_to_br
15
19
  def multi_line(input)
16
20
  input.to_s.gsub("\n", '<br/>')
@@ -1,5 +1,4 @@
1
1
  require 'locomotive/liquid/tags/editable/base'
2
- require 'locomotive/liquid/tags/editable/short_text'
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'