locomotive_cms 2.2.2 → 2.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. data/app/cells/locomotive/global_actions_cell.rb +2 -2
  2. data/app/cells/locomotive/main_menu_cell.rb +2 -2
  3. data/app/cells/locomotive/settings_menu_cell.rb +4 -4
  4. data/app/controllers/locomotive/accounts_controller.rb +1 -1
  5. data/app/controllers/locomotive/api/tokens_controller.rb +1 -1
  6. data/app/controllers/locomotive/base_controller.rb +1 -1
  7. data/app/controllers/locomotive/content_entries_controller.rb +3 -3
  8. data/app/controllers/locomotive/content_types_controller.rb +3 -3
  9. data/app/controllers/locomotive/current_site_controller.rb +1 -1
  10. data/app/controllers/locomotive/memberships_controller.rb +4 -4
  11. data/app/controllers/locomotive/my_account_controller.rb +2 -2
  12. data/app/controllers/locomotive/pages_controller.rb +2 -2
  13. data/app/controllers/locomotive/sessions_controller.rb +1 -1
  14. data/app/controllers/locomotive/sites_controller.rb +2 -2
  15. data/app/controllers/locomotive/snippets_controller.rb +3 -3
  16. data/app/controllers/locomotive/theme_assets_controller.rb +2 -2
  17. data/app/helpers/locomotive/installation_helper.rb +1 -1
  18. data/app/models/locomotive/content_type.rb +1 -1
  19. data/app/models/locomotive/editable_file.rb +3 -0
  20. data/app/views/locomotive/accounts/new.html.haml +4 -4
  21. data/app/views/locomotive/content_assets/_picker.html.haml +2 -2
  22. data/app/views/locomotive/content_entries/_list.html.haml +4 -4
  23. data/app/views/locomotive/content_entries/edit.html.haml +4 -4
  24. data/app/views/locomotive/content_entries/index.html.haml +4 -4
  25. data/app/views/locomotive/content_entries/new.html.haml +3 -3
  26. data/app/views/locomotive/content_types/edit.html.haml +4 -4
  27. data/app/views/locomotive/content_types/new.html.haml +2 -2
  28. data/app/views/locomotive/current_site/edit.html.haml +2 -2
  29. data/app/views/locomotive/custom_fields/types/_belongs_to.html.haml +1 -1
  30. data/app/views/locomotive/custom_fields/types/_has_many_form.html.haml +1 -1
  31. data/app/views/locomotive/errors/404.html.haml +1 -1
  32. data/app/views/locomotive/errors/500.html.haml +1 -1
  33. data/app/views/locomotive/installation/step_1.html.haml +1 -1
  34. data/app/views/locomotive/installation/step_2.html.haml +1 -1
  35. data/app/views/locomotive/memberships/new.html.haml +2 -2
  36. data/app/views/locomotive/my_account/edit.html.haml +3 -3
  37. data/app/views/locomotive/pages/_form.html.haml +1 -1
  38. data/app/views/locomotive/pages/edit.html.haml +2 -2
  39. data/app/views/locomotive/pages/index.html.haml +2 -2
  40. data/app/views/locomotive/pages/new.html.haml +2 -2
  41. data/app/views/locomotive/passwords/edit.html.haml +1 -1
  42. data/app/views/locomotive/shared/_header.html.haml +1 -1
  43. data/app/views/locomotive/shared/_site_picker.html.haml +2 -2
  44. data/app/views/locomotive/shared/actions/_contents.html.haml +1 -1
  45. data/app/views/locomotive/shared/menu/_contents.html.haml +8 -8
  46. data/app/views/locomotive/sites/new.html.haml +2 -2
  47. data/app/views/locomotive/snippets/edit.html.haml +3 -3
  48. data/app/views/locomotive/snippets/new.html.haml +2 -2
  49. data/app/views/locomotive/theme_assets/_picker.html.haml +2 -2
  50. data/app/views/locomotive/theme_assets/edit.html.haml +3 -3
  51. data/app/views/locomotive/theme_assets/index.html.haml +9 -9
  52. data/app/views/locomotive/theme_assets/new.html.haml +2 -2
  53. data/app/views/locomotive/translations/edit.html.haml +2 -2
  54. data/app/views/locomotive/translations/index.html.haml +1 -1
  55. data/app/views/locomotive/translations/new.html.haml +1 -1
  56. data/features/backoffice/contents.feature +9 -2
  57. data/features/public/contact_form.feature +1 -1
  58. data/features/step_definitions/content_types_steps.rb +6 -1
  59. data/lib/locomotive/action_controller/locale_helpers.rb +3 -0
  60. data/lib/locomotive/action_controller/url_helpers.rb +2 -1
  61. data/lib/locomotive/liquid/drops/content_types.rb +1 -1
  62. data/lib/locomotive/liquid/filters/date.rb +2 -2
  63. data/lib/locomotive/version.rb +1 -1
  64. data/spec/lib/locomotive/liquid/tags/link_to_spec.rb +9 -0
  65. metadata +8 -8
@@ -12,7 +12,7 @@ module Locomotive
12
12
  protected
13
13
 
14
14
  def build_list
15
- add :welcome, url: edit_my_account_url, i18n_options: {
15
+ add :welcome, url: edit_my_account_path, i18n_options: {
16
16
  key: 'locomotive.shared.header.welcome',
17
17
  arg: :name,
18
18
  value: @current_locomotive_account.name
@@ -25,7 +25,7 @@ module Locomotive
25
25
  end
26
26
 
27
27
  add :help, url: 'http://doc.locomotivecms.com', class: 'tutorial', id: 'help', target: '_blank'
28
- add :logout, url: destroy_locomotive_session_url, data: { confirm: t('locomotive.messages.confirm') }, method: :delete
28
+ add :logout, url: destroy_locomotive_session_path, data: { confirm: t('locomotive.messages.confirm') }, method: :delete
29
29
  end
30
30
 
31
31
  def localize_label(label, options = {})
@@ -4,8 +4,8 @@ module Locomotive
4
4
  protected
5
5
 
6
6
  def build_list
7
- add :contents, url: pages_url, icon: 'icon-folder-open'
8
- add :settings, url: edit_current_site_url, icon: 'icon-cog'
7
+ add :contents, url: pages_path, icon: 'icon-folder-open'
8
+ add :settings, url: edit_current_site_path, icon: 'icon-cog'
9
9
  end
10
10
 
11
11
  end
@@ -4,10 +4,10 @@ module Locomotive
4
4
  protected
5
5
 
6
6
  def build_list
7
- add :site, url: edit_current_site_url
8
- add :theme_assets, url: theme_assets_url
9
- add :translations, url: translations_url
10
- add :account, url: edit_my_account_url
7
+ add :site, url: edit_current_site_path
8
+ add :theme_assets, url: theme_assets_path
9
+ add :translations, url: translations_path
10
+ add :account, url: edit_my_account_path
11
11
  end
12
12
 
13
13
  end
@@ -11,7 +11,7 @@ module Locomotive
11
11
  def create
12
12
  @account = Account.create(params[:account])
13
13
  current_site.memberships.create(account: @account) if @account.errors.empty?
14
- respond_with @account, location: edit_current_site_url
14
+ respond_with @account, location: edit_current_site_path
15
15
  end
16
16
 
17
17
  end
@@ -2,7 +2,7 @@ module Locomotive
2
2
  module Api
3
3
  class TokensController < Locomotive::Api::BaseController
4
4
 
5
- skip_before_filter :require_account, :require_site, :set_locale, :set_current_thread_variables
5
+ skip_before_filter :require_account, :require_site, :set_current_thread_variables
6
6
 
7
7
  def create
8
8
  begin
@@ -41,7 +41,7 @@ module Locomotive
41
41
  else
42
42
  flash[:alert] = exception.message
43
43
 
44
- redirect_to pages_url
44
+ redirect_to pages_path
45
45
  end
46
46
  end
47
47
 
@@ -49,7 +49,7 @@ module Locomotive
49
49
 
50
50
  def create
51
51
  @content_entry = @content_type.entries.create(params[:content_entry])
52
- respond_with @content_entry, location: edit_content_entry_url(@content_type.slug, @content_entry._id)
52
+ respond_with @content_entry, location: edit_content_entry_path(@content_type.slug, @content_entry._id)
53
53
  end
54
54
 
55
55
  def edit
@@ -60,7 +60,7 @@ module Locomotive
60
60
  def update
61
61
  @content_entry = @content_type.entries.find(params[:id])
62
62
  @content_entry.update_attributes(params[:content_entry])
63
- respond_with @content_entry, location: edit_content_entry_url(@content_type.slug, @content_entry._id)
63
+ respond_with @content_entry, location: edit_content_entry_path(@content_type.slug, @content_entry._id)
64
64
  end
65
65
 
66
66
  def sort
@@ -71,7 +71,7 @@ module Locomotive
71
71
  def destroy
72
72
  @content_entry = @content_type.entries.find(params[:id])
73
73
  @content_entry.destroy
74
- respond_with @content_entry, location: content_entries_url(@content_type.slug)
74
+ respond_with @content_entry, location: content_entries_path(@content_type.slug)
75
75
  end
76
76
 
77
77
  protected
@@ -16,7 +16,7 @@ module Locomotive
16
16
 
17
17
  def create
18
18
  @content_type = current_site.content_types.create(params[:content_type])
19
- respond_with @content_type, location: edit_content_type_url(@content_type._id)
19
+ respond_with @content_type, location: edit_content_type_path(@content_type._id)
20
20
  end
21
21
 
22
22
  def edit
@@ -27,13 +27,13 @@ module Locomotive
27
27
  def update
28
28
  @content_type = current_site.content_types.find(params[:id])
29
29
  @content_type.update_attributes(params[:content_type])
30
- respond_with @content_type, location: edit_content_type_url(@content_type._id)
30
+ respond_with @content_type, location: edit_content_type_path(@content_type._id)
31
31
  end
32
32
 
33
33
  def destroy
34
34
  @content_type = current_site.content_types.find(params[:id])
35
35
  @content_type.destroy
36
- respond_with @content_type, location: pages_url
36
+ respond_with @content_type, location: pages_path
37
37
  end
38
38
 
39
39
  end
@@ -25,7 +25,7 @@ module Locomotive
25
25
  def update
26
26
  @site = current_site
27
27
  @site.update_attributes(params[:site])
28
- respond_with @site, location: edit_current_site_url(new_host_if_subdomain_changed)
28
+ respond_with @site, location: edit_current_site_path(new_host_if_subdomain_changed)
29
29
  end
30
30
 
31
31
  protected
@@ -9,20 +9,20 @@ module Locomotive
9
9
 
10
10
  case @membership.process!
11
11
  when :create_account
12
- redirect_to new_account_url(email: @membership.email)
12
+ redirect_to new_account_path(email: @membership.email)
13
13
  when :save_it
14
- respond_with @membership, location: edit_current_site_url
14
+ respond_with @membership, location: edit_current_site_path
15
15
  when :error
16
16
  respond_with @membership, flash: true
17
17
  when :already_created
18
- respond_with @membership, alert: t('flash.locomotive.memberships.create.already_created'), location: edit_current_site_url
18
+ respond_with @membership, alert: t('flash.locomotive.memberships.create.already_created'), location: edit_current_site_path
19
19
  end
20
20
  end
21
21
 
22
22
  def destroy
23
23
  @membership = current_site.memberships.find(params[:id])
24
24
  @membership.destroy
25
- respond_with @membership, location: edit_current_site_url
25
+ respond_with @membership, location: edit_current_site_path
26
26
  end
27
27
 
28
28
  end
@@ -17,13 +17,13 @@ module Locomotive
17
17
  def update
18
18
  @account = current_locomotive_account
19
19
  @account.update_attributes(params[:account])
20
- respond_with @account, location: edit_my_account_url
20
+ respond_with @account, location: edit_my_account_path
21
21
  end
22
22
 
23
23
  def regenerate_api_key
24
24
  @account = current_locomotive_account
25
25
  @account.regenerate_api_key!
26
- respond_with({ api_key: @account.api_key }, location: edit_my_account_url)
26
+ respond_with({ api_key: @account.api_key }, location: edit_my_account_path)
27
27
  end
28
28
 
29
29
  end
@@ -26,7 +26,7 @@ module Locomotive
26
26
 
27
27
  def create
28
28
  @page = current_site.pages.create(params[:page])
29
- respond_with @page, location: edit_page_url(@page._id)
29
+ respond_with @page, location: edit_page_path(@page._id)
30
30
  end
31
31
 
32
32
  def edit
@@ -37,7 +37,7 @@ module Locomotive
37
37
  def update
38
38
  @page = current_site.pages.find(params[:id])
39
39
  @page.update_attributes(params[:page])
40
- respond_with @page, location: edit_page_url(@page._id)
40
+ respond_with @page, location: edit_page_path(@page._id)
41
41
  end
42
42
 
43
43
  def destroy
@@ -14,7 +14,7 @@ module Locomotive
14
14
  protected
15
15
 
16
16
  def after_sign_in_path_for(resource)
17
- pages_url
17
+ pages_path
18
18
  end
19
19
 
20
20
  def after_sign_out_path_for(resource)
@@ -14,7 +14,7 @@ module Locomotive
14
14
  @site = Site.new(params[:site])
15
15
  @site.memberships.build account: self.current_locomotive_account, role: 'admin'
16
16
  @site.save
17
- respond_with @site, location: edit_my_account_url
17
+ respond_with @site, location: edit_my_account_path
18
18
  end
19
19
 
20
20
  def destroy
@@ -26,7 +26,7 @@ module Locomotive
26
26
  @site.errors.add(:base, 'Can not destroy the site you are logging in now')
27
27
  end
28
28
 
29
- respond_with @site, location: edit_my_account_url
29
+ respond_with @site, location: edit_my_account_path
30
30
  end
31
31
 
32
32
  end
@@ -21,7 +21,7 @@ module Locomotive
21
21
 
22
22
  def create
23
23
  @snippet = current_site.snippets.create(params[:snippet])
24
- respond_with @snippet, location: edit_snippet_url(@snippet._id)
24
+ respond_with @snippet, location: edit_snippet_path(@snippet._id)
25
25
  end
26
26
 
27
27
  def edit
@@ -32,13 +32,13 @@ module Locomotive
32
32
  def update
33
33
  @snippet = current_site.snippets.find(params[:id])
34
34
  @snippet.update_attributes(params[:snippet])
35
- respond_with @snippet, location: edit_snippet_url(@snippet._id)
35
+ respond_with @snippet, location: edit_snippet_path(@snippet._id)
36
36
  end
37
37
 
38
38
  def destroy
39
39
  @snippet = current_site.snippets.find(params[:id])
40
40
  @snippet.destroy
41
- respond_with @snippet, location: theme_assets_url
41
+ respond_with @snippet, location: theme_assets_path
42
42
  end
43
43
 
44
44
  end
@@ -26,7 +26,7 @@ module Locomotive
26
26
 
27
27
  def create
28
28
  @theme_asset = current_site.theme_assets.create(params[:theme_asset])
29
- respond_with @theme_asset, location: edit_theme_asset_url(@theme_asset._id)
29
+ respond_with @theme_asset, location: edit_theme_asset_path(@theme_asset._id)
30
30
  end
31
31
 
32
32
  def edit
@@ -38,7 +38,7 @@ module Locomotive
38
38
  def update
39
39
  @theme_asset = current_site.theme_assets.find(params[:id])
40
40
  @theme_asset.update_attributes(params[:theme_asset])
41
- respond_with @theme_asset, location: edit_theme_asset_url(@theme_asset._id)
41
+ respond_with @theme_asset, location: edit_theme_asset_path(@theme_asset._id)
42
42
  end
43
43
 
44
44
  def destroy
@@ -2,7 +2,7 @@ module Locomotive
2
2
  module InstallationHelper
3
3
 
4
4
  def next_installation_step_link(step = 1, label = nil)
5
- link_to(content_tag(:span, label || t('admin.installation.common.next')), installation_step_url(step), class: 'button')
5
+ link_to(content_tag(:span, label || t('admin.installation.common.next')), installation_step_path(step), class: 'button')
6
6
  end
7
7
 
8
8
  end
@@ -91,7 +91,7 @@ module Locomotive
91
91
  _entries = self.entries.order_by([_order_by_definition]).where(options)
92
92
 
93
93
  # pagination or full list
94
- page ? _entries.page(page).per(per_page) : _entries
94
+ !self.order_manually? && page ? _entries.page(page).per(per_page) : _entries
95
95
  end
96
96
 
97
97
  def groupable?
@@ -56,6 +56,9 @@ module Locomotive
56
56
 
57
57
  locale = ::Mongoid::Fields::I18n.locale.to_s
58
58
 
59
+ # make sure the default_source_url is safely defined
60
+ self.attributes['default_source_url'] ||= { locale => nil }
61
+
59
62
  if self.attributes['default_source_url'][locale].nil?
60
63
  self.default_source_url = el.default_source_url
61
64
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  %p!= t('.help')
7
7
 
8
- = semantic_form_for @account, url: accounts_url do |f|
8
+ = semantic_form_for @account, url: accounts_path do |f|
9
9
 
10
10
  = f.inputs name: :information do
11
11
  = f.input :name
@@ -15,7 +15,7 @@
15
15
  - if f.object.respond_to?(:password)
16
16
  = f.inputs name: :credentials do
17
17
  = f.input :email
18
- = f.input :password, input_html: { autocomplete: "off" }
19
- = f.input :password_confirmation, input_html: { autocomplete: "off" }
18
+ = f.input :password, input_html: { autocomplete: 'off' }
19
+ = f.input :password_confirmation, input_html: { autocomplete: 'off' }
20
20
 
21
- = render 'locomotive/shared/form_actions', back_url: edit_current_site_url, button_label: :create
21
+ = render 'locomotive/shared/form_actions', back_url: edit_current_site_path, button_label: :create
@@ -11,9 +11,9 @@
11
11
  = link_to t('locomotive.buttons.close'), '#', id: 'close-link'
12
12
 
13
13
  .button-wrapper.upload
14
- = form_tag content_assets_url(:json), class: 'quick-upload' do
14
+ = form_tag content_assets_path(:json), class: 'quick-upload' do
15
15
  = file_field_tag 'content_asset[source]', multiple: 'multiple'
16
- = link_to t('locomotive.content_assets.image_picker.upload'), content_assets_url(:json), class: 'new', id: 'upload-link'
16
+ = link_to t('locomotive.content_assets.image_picker.upload'), content_assets_path(:json), class: 'new', id: 'upload-link'
17
17
 
18
18
  %script{ type: 'text/html', id: 'content_asset' }
19
19
 
@@ -1,12 +1,12 @@
1
1
  - if entries.empty?
2
- %p.no-items!= t('.no_items', url: new_content_entry_url(content_type.slug))
2
+ %p.no-items!= t('.no_items', url: new_content_entry_path(content_type.slug))
3
3
  - else
4
- %ul{ id: 'entries-list', class: "#{'list' unless content_type.groupable?} #{'sortable' if content_type.order_manually?}", :'data-url' => sort_content_entries_url(content_type.slug, :json) }
4
+ %ul{ id: 'entries-list', class: "#{'list' unless content_type.groupable?} #{'sortable' if content_type.order_manually?}", :'data-url' => sort_content_entries_path(content_type.slug, :json) }
5
5
  - entries.each do |entry|
6
6
  %li.item{ id: "entry-#{entry._id}" }
7
7
  %span.handle
8
8
 
9
- %strong= link_to entry_label(content_type, entry), edit_content_entry_url(content_type.slug, entry)
9
+ %strong= link_to entry_label(content_type, entry), edit_content_entry_path(content_type.slug, entry)
10
10
 
11
11
  - unless entry.translated?
12
12
  %span.untranslated= t('locomotive.shared.list.untranslated')
@@ -15,7 +15,7 @@
15
15
  != t('locomotive.content_entries.index.updated_at')
16
16
  = l entry.updated_at, format: :short rescue 'n/a'
17
17
 
18
- = link_to_icon :trash, content_entry_url(content_type.slug, entry), title: t('locomotive.buttons.delete'), class: 'remove', data: { confirm: t('locomotive.messages.confirm') }, method: :delete
18
+ = link_to_icon :trash, content_entry_path(content_type.slug, entry), title: t('locomotive.buttons.delete'), class: 'remove', data: { confirm: t('locomotive.messages.confirm') }, method: :delete
19
19
 
20
20
  - if entries.respond_to?(:current_page)
21
21
  = paginate entries, namespace: 'locomotive'
@@ -8,17 +8,17 @@
8
8
 
9
9
  - content_for :buttons do
10
10
  - if can?(:manage, Locomotive::ContentType)
11
- = local_action_button t('locomotive.content_entries.index.edit'), edit_content_type_url(@content_type), icon: 'icon-pencil'
11
+ = local_action_button t('locomotive.content_entries.index.edit'), edit_content_type_path(@content_type), icon: 'icon-pencil'
12
12
 
13
- = local_action_button t('locomotive.content_entries.index.new'), new_content_entry_url(@content_type.slug), icon: 'icon-plus'
13
+ = local_action_button t('locomotive.content_entries.index.new'), new_content_entry_path(@content_type.slug), icon: 'icon-plus'
14
14
 
15
15
  %p= @content_type.description
16
16
 
17
- = semantic_form_for @content_entry, as: :content_entry, url: content_entry_url(@content_type.slug, @content_entry), html: { multipart: true } do |form|
17
+ = semantic_form_for @content_entry, as: :content_entry, url: content_entry_path(@content_type.slug, @content_entry), html: { multipart: true } do |form|
18
18
 
19
19
  = render 'form', f: form
20
20
 
21
- = render 'locomotive/shared/form_actions', back_url: content_entries_url(@content_type.slug), button_label: :update
21
+ = render 'locomotive/shared/form_actions', back_url: content_entries_path(@content_type.slug), button_label: :update
22
22
 
23
23
  - content_for :foot do
24
24
  = render_has_many_forms
@@ -5,11 +5,11 @@
5
5
 
6
6
  - content_for :buttons do
7
7
  - if can?(:manage, Locomotive::ContentType)
8
- = local_action_button :edit, edit_content_type_url(@content_type), icon: 'icon-pencil'
8
+ = local_action_button :edit, edit_content_type_path(@content_type), icon: 'icon-pencil'
9
9
 
10
- = local_action_button :export, export_content_entries_url(@content_type.slug, :csv), icon: 'icon-download'
10
+ = local_action_button :export, export_content_entries_path(@content_type.slug, :csv), icon: 'icon-download'
11
11
 
12
- = local_action_button :new, new_content_entry_url(@content_type.slug), icon: 'icon-plus'
12
+ = local_action_button :new, new_content_entry_path(@content_type.slug), icon: 'icon-plus'
13
13
 
14
14
  - if @content_type.description.present?
15
15
  %p= @content_type.description
@@ -31,4 +31,4 @@
31
31
  - if can?(:manage, Locomotive::ContentType)
32
32
  #local-actions-bottom-bar
33
33
  %p.tleft
34
- = link_to t('.destroy'), content_type_url(@content_type), data: { confirm: t('locomotive.messages.confirm') }, method: :delete, class: 'button remove'
34
+ = link_to t('.destroy'), content_type_path(@content_type), data: { confirm: t('locomotive.messages.confirm') }, method: :delete, class: 'button remove'
@@ -8,15 +8,15 @@
8
8
 
9
9
  - if can?(:manage, Locomotive::ContentType)
10
10
  - content_for :buttons do
11
- = local_action_button t('locomotive.content_entries.index.edit'), edit_content_type_url(@content_type), icon: 'icon-pencil'
11
+ = local_action_button t('locomotive.content_entries.index.edit'), edit_content_type_path(@content_type), icon: 'icon-pencil'
12
12
 
13
13
  %p= @content_type.description
14
14
 
15
- = semantic_form_for @content_entry, as: :content_entry, url: content_entries_url(@content_type.slug), html: { multipart: true } do |form|
15
+ = semantic_form_for @content_entry, as: :content_entry, url: content_entries_path(@content_type.slug), html: { multipart: true } do |form|
16
16
 
17
17
  = render 'form', f: form
18
18
 
19
- = render 'locomotive/shared/form_actions', back_url: content_entries_url(@content_type.slug), button_label: :create
19
+ = render 'locomotive/shared/form_actions', back_url: content_entries_path(@content_type.slug), button_label: :create
20
20
 
21
21
  - content_for :foot do
22
22
  = render_has_many_forms
@@ -7,13 +7,13 @@
7
7
  = render 'locomotive/shared/actions/contents'
8
8
 
9
9
  - content_for :buttons do
10
- = local_action_button :show_entries, content_entries_url(@content_type.slug_was), icon: 'icon-eye-open'
11
- = local_action_button :new_entry, new_content_entry_url(@content_type.slug_was), icon: 'icon-plus'
10
+ = local_action_button :show_entries, content_entries_path(@content_type.slug_was), icon: 'icon-eye-open'
11
+ = local_action_button :new_entry, new_content_entry_path(@content_type.slug_was), icon: 'icon-plus'
12
12
 
13
13
  %p!= t('.help')
14
14
 
15
- = semantic_form_for @content_type, url: content_type_url(@content_type) do |f|
15
+ = semantic_form_for @content_type, url: content_type_path(@content_type) do |f|
16
16
 
17
17
  = render 'form', f: f
18
18
 
19
- = render 'locomotive/shared/form_actions', back_url: content_entries_url(@content_type.slug_was), button_label: :update
19
+ = render 'locomotive/shared/form_actions', back_url: content_entries_path(@content_type.slug_was), button_label: :update
@@ -8,8 +8,8 @@
8
8
 
9
9
  %p!= t('.help')
10
10
 
11
- = semantic_form_for @content_type, url: content_types_url do |f|
11
+ = semantic_form_for @content_type, url: content_types_path do |f|
12
12
 
13
13
  = render 'form', f: f
14
14
 
15
- = render 'locomotive/shared/form_actions', back_url: pages_url, button_label: :create
15
+ = render 'locomotive/shared/form_actions', back_url: pages_path, button_label: :create
@@ -8,11 +8,11 @@
8
8
 
9
9
  - content_for :buttons do
10
10
  - if can?(:create, Locomotive::Account)
11
- = local_action_button t('.new_membership'), new_membership_url, icon: 'icon-plus'
11
+ = local_action_button t('.new_membership'), new_membership_path, icon: 'icon-plus'
12
12
 
13
13
  %p!= t('.help')
14
14
 
15
- = semantic_form_for @site, url: current_site_url do |form|
15
+ = semantic_form_for @site, url: current_site_path do |form|
16
16
 
17
17
  = render 'form', f: form
18
18
 
@@ -3,4 +3,4 @@
3
3
  hint: field.hint,
4
4
  as: :string,
5
5
  wrapper_html: { class: 'select2' },
6
- input_html: { data: { value: f.object.send(field.name.to_sym).try(:_label), url: content_entries_url(field.class_name_to_content_type.slug, :json), per_page: Locomotive.config.ui[:per_page] } }
6
+ input_html: { data: { value: f.object.send(field.name.to_sym).try(:_label), url: content_entries_path(field.class_name_to_content_type.slug, :json), per_page: Locomotive.config.ui[:per_page] } }
@@ -9,7 +9,7 @@
9
9
  %span.new-section= t('locomotive.content_entries.new.title', type: name.capitalize).html_safe
10
10
  %span.edit-section= t('locomotive.content_entries.edit.title', type: name.capitalize).html_safe
11
11
 
12
- = semantic_form_for content_entry, as: :content_entry, namespace: name.to_s, url: content_entries_url(content_type.slug), html: { multipart: true, data: { sending_form_message: t('locomotive.messages.sending_form') } } do |form|
12
+ = semantic_form_for content_entry, as: :content_entry, namespace: name.to_s, url: content_entries_path(content_type.slug), html: { multipart: true, data: { sending_form_message: t('locomotive.messages.sending_form') } } do |form|
13
13
 
14
14
  = form.inputs name: :attributes do
15
15
  - content_type.ordered_entries_custom_fields.each_with_index do |_field, index|
@@ -4,4 +4,4 @@
4
4
  %p.notice= t('.notice')
5
5
 
6
6
  %p.link.tright
7
- = link_to preserve(t('.link')), pages_url
7
+ = link_to preserve(t('.link')), pages_path
@@ -4,4 +4,4 @@
4
4
  %p.notice= t('.notice')
5
5
 
6
6
  %p.link.tright
7
- = link_to preserve(t('.link')), pages_url
7
+ = link_to preserve(t('.link')), pages_path
@@ -4,7 +4,7 @@
4
4
  - title t('.title')
5
5
 
6
6
  - if @step_done.blank?
7
- = semantic_form_for(@account, url: installation_step_url(1)) do |f|
7
+ = semantic_form_for(@account, url: installation_step_path(1)) do |f|
8
8
  .inner
9
9
  = f.inputs do
10
10
  = f.input :name, label: t('.name'), required: false
@@ -3,7 +3,7 @@
3
3
 
4
4
  - title t('.title')
5
5
 
6
- = semantic_form_for(@site, url: installation_step_url(2), html: { multipart: true }) do |f|
6
+ = semantic_form_for(@site, url: installation_step_path(2), html: { multipart: true }) do |f|
7
7
  .inner
8
8
 
9
9
  %p.explanations
@@ -5,10 +5,10 @@
5
5
 
6
6
  %p!= t('.help')
7
7
 
8
- = semantic_form_for @membership, url: memberships_url do |f|
8
+ = semantic_form_for @membership, url: memberships_path do |f|
9
9
 
10
10
  = f.inputs name: :membership_email, class: 'inputs email' do
11
11
 
12
12
  = f.input :email, label: false, wrapper_html: { class: 'no-label' }
13
13
 
14
- = render 'locomotive/shared/form_actions', back_url: edit_current_site_url, button_label: :create
14
+ = render 'locomotive/shared/form_actions', back_url: edit_current_site_path, button_label: :create
@@ -9,11 +9,11 @@
9
9
 
10
10
  - if multi_sites?
11
11
  - content_for :buttons do
12
- = local_action_button t('.new_site'), new_site_url, icon: 'icon-plus' if can?(:create, Locomotive::Site)
12
+ = local_action_button t('.new_site'), new_site_path, icon: 'icon-plus' if can?(:create, Locomotive::Site)
13
13
 
14
14
  %p= t('.help')
15
15
 
16
- = semantic_form_for @account, url: my_account_url do |f|
16
+ = semantic_form_for @account, url: my_account_path do |f|
17
17
 
18
18
  = f.inputs name: :information do
19
19
  = f.input :name
@@ -23,7 +23,7 @@
23
23
  = f.input :email
24
24
  = f.input :password, input_html: { autocomplete: 'off' }
25
25
  = f.input :password_confirmation, input_html: { autocomplete: 'off' }
26
- = f.input :api_key, as: '::Locomotive::ApiKey', url: regenerate_api_key_my_account_url
26
+ = f.input :api_key, as: '::Locomotive::ApiKey', url: regenerate_api_key_my_account_path
27
27
 
28
28
  - if multi_sites?
29
29
  = f.inputs name: :sites, class: "sites inputs foldable" do
@@ -14,7 +14,7 @@
14
14
  - if not @page.index? and not @page.not_found?
15
15
  = f.input :parent_id, as: :select, collection: parent_pages_options, include_blank: false
16
16
 
17
- = f.input :slug, required: false, hint: @page.slug.blank? ? t('.empty_slug') : public_page_url(@page, locale: current_content_locale), input_html: { :'data-url' => get_path_pages_url, disabled: @page.index? || @page.not_found? }, wrapper_html: { style: "#{'display: none' if @page.templatized? && !@page.templatized_from_parent?};", class: 'em-inline-hints' }
17
+ = f.input :slug, required: false, hint: @page.slug.blank? ? t('.empty_slug') : public_page_url(@page, locale: current_content_locale), input_html: { :'data-url' => get_path_pages_path, disabled: @page.index? || @page.not_found? }, wrapper_html: { style: "#{'display: none' if @page.templatized? && !@page.templatized_from_parent?};", class: 'em-inline-hints' }
18
18
 
19
19
  = f.inputs name: :seo, class: "inputs foldable #{'folded' if inputs_folded?(@page)}" do
20
20
 
@@ -11,8 +11,8 @@
11
11
 
12
12
  %p!= t('.help')
13
13
 
14
- = semantic_form_for @page, url: page_url(@page), html: { multipart: true } do |form|
14
+ = semantic_form_for @page, url: page_path(@page), html: { multipart: true } do |form|
15
15
 
16
16
  = render 'form', f: form
17
17
 
18
- = render 'locomotive/shared/form_actions', back_url: pages_url, button_label: :update
18
+ = render 'locomotive/shared/form_actions', back_url: pages_path, button_label: :update
@@ -8,12 +8,12 @@
8
8
 
9
9
  - if can? :create, Locomotive::Page
10
10
  - content_for :buttons do
11
- = local_action_button :new, new_page_url, icon: 'icon-plus', id: 'newpage'
11
+ = local_action_button :new, new_page_path, icon: 'icon-plus', id: 'newpage'
12
12
 
13
13
  %p!= t('.help')
14
14
 
15
15
  - if @pages.empty?
16
- %p.no-items!= t('.no_items', url: new_page_url)
16
+ %p.no-items!= t('.no_items', url: new_page_path)
17
17
  - else
18
18
  %ul#pages-list
19
19
  = render @pages
@@ -8,8 +8,8 @@
8
8
 
9
9
  %p!= t('.help')
10
10
 
11
- = semantic_form_for @page, url: pages_url do |form|
11
+ = semantic_form_for @page, url: pages_path do |form|
12
12
 
13
13
  = render 'form', f: form
14
14
 
15
- = render 'locomotive/shared/form_actions', back_url: pages_url, button_label: :create
15
+ = render 'locomotive/shared/form_actions', back_url: pages_path, button_label: :create
@@ -1,6 +1,6 @@
1
1
  - title t('.title')
2
2
 
3
- = semantic_form_for(resource, as: resource_name, url: locomotive_account_password_url, html: { method: :put }) do |f|
3
+ = semantic_form_for(resource, as: resource_name, url: locomotive_account_password_path, html: { method: :put }) do |f|
4
4
 
5
5
  = f.hidden_field :reset_password_token
6
6
 
@@ -1,5 +1,5 @@
1
1
  %h1
2
- = link_to current_site.name, locomotive.pages_url
2
+ = link_to current_site.name, locomotive.pages_path
3
3
 
4
4
  = render_cell 'locomotive/global_actions', :show, current_locomotive_account: current_locomotive_account, current_site_url: current_site_public_url
5
5
 
@@ -3,8 +3,8 @@
3
3
  - current_locomotive_account.sites.each do |site|
4
4
  - unless current_site._id == site._id
5
5
  %li
6
- = link_to site.name, locomotive.pages_url(host: site.full_subdomain, port: request.port)
6
+ = link_to site.name, locomotive.pages_url(host: site.full_subdomain, port: request.port, protocol: request.ssl? ? 'https' : 'http')
7
7
 
8
8
  - if can?(:manage, Locomotive::Site)
9
9
  %p.action
10
- = link_to t('locomotive.sites_picker.new'), locomotive.new_site_url
10
+ = link_to t('locomotive.sites_picker.new'), locomotive.new_site_path
@@ -1,6 +1,6 @@
1
1
  - if can? :manage, Locomotive::ContentType
2
2
  .action
3
- = link_to new_content_type_url, class: 'button' do
3
+ = link_to new_content_type_path, class: 'button' do
4
4
  %i.icon-plus
5
5
  = t('locomotive.content_types.index.new')
6
6
 
@@ -1,9 +1,9 @@
1
- = submenu_entry 'pages', pages_url do
1
+ = submenu_entry 'pages', pages_path do
2
2
  .wrapper
3
3
  - if can? :manage, @page
4
4
  .header
5
5
  %p
6
- = link_to new_page_url do
6
+ = link_to new_page_path do
7
7
  %i.icon-plus
8
8
  = t('locomotive.pages.index.new')
9
9
  .inner
@@ -12,7 +12,7 @@
12
12
  - current_site.pages.unscoped.latest_updated.minimal_attributes.each do |page|
13
13
  %li
14
14
  %i.icon-chevron-right
15
- = link_to truncate(page.title, length: 25), edit_page_url(page)
15
+ = link_to truncate(page.title, length: 25), edit_page_path(page)
16
16
  %span= time_ago_in_words(page.updated_at)
17
17
 
18
18
  - each_content_type do |menu_item|
@@ -24,20 +24,20 @@
24
24
  %ul.big-links
25
25
  - content_types.each do |content_type|
26
26
  %li
27
- = link_to truncate(content_type.name, length: 20), content_entries_url(content_type.slug)
27
+ = link_to truncate(content_type.name, length: 20), content_entries_path(content_type.slug)
28
28
  - else
29
29
  - content_type = menu_item
30
- = submenu_entry truncate(content_type.name, length: 15), content_entries_url(content_type.slug), i18n: false, css: "#{'on' if is_content_type_selected(content_type)}" do
30
+ = submenu_entry truncate(content_type.name, length: 15), content_entries_path(content_type.slug), i18n: false, css: "#{'on' if is_content_type_selected(content_type)}" do
31
31
  .wrapper
32
32
  .header
33
33
  %p
34
- = link_to new_content_entry_url(content_type.slug) do
34
+ = link_to new_content_entry_path(content_type.slug) do
35
35
  %i.icon-plus
36
36
  = t('locomotive.content_entries.index.new')
37
37
 
38
38
  - if can? :manage, content_type
39
39
  %p.edit
40
- = link_to edit_content_type_url(content_type) do
40
+ = link_to edit_content_type_path(content_type) do
41
41
  %i.icon-pencil
42
42
  = t('locomotive.content_types.index.edit')
43
43
 
@@ -47,5 +47,5 @@
47
47
  - content_type.entries.latest_updated.each do |entry|
48
48
  %li
49
49
  %i.icon-chevron-right
50
- = link_to truncate(entry._label(content_type), length: 20), edit_content_entry_url(content_type.slug, entry)
50
+ = link_to truncate(entry._label(content_type), length: 20), edit_content_entry_path(content_type.slug, entry)
51
51
  %span= time_ago_in_words(entry.updated_at)
@@ -5,8 +5,8 @@
5
5
 
6
6
  %p!= t('.help')
7
7
 
8
- = semantic_form_for @site, url: sites_url do |form|
8
+ = semantic_form_for @site, url: sites_path do |form|
9
9
 
10
10
  = render 'form', f: form
11
11
 
12
- = render 'locomotive/shared/form_actions', back_url: edit_my_account_url, button_label: :create
12
+ = render 'locomotive/shared/form_actions', back_url: edit_my_account_path, button_label: :create
@@ -7,12 +7,12 @@
7
7
  = locale_picker_link
8
8
 
9
9
  - content_for :buttons do
10
- = local_action_button t('locomotive.snippets.index.new'), new_snippet_url, icon: 'icon-plus'
10
+ = local_action_button t('locomotive.snippets.index.new'), new_snippet_path, icon: 'icon-plus'
11
11
 
12
12
  %p!= t('.help', slug: @snippet.slug)
13
13
 
14
- = semantic_form_for @snippet, url: snippet_url(@snippet), html: { class: 'save-with-shortcut' } do |form|
14
+ = semantic_form_for @snippet, url: snippet_path(@snippet), html: { class: 'save-with-shortcut' } do |form|
15
15
 
16
16
  = render 'form', f: form
17
17
 
18
- = render 'locomotive/shared/form_actions', back_url: theme_assets_url, button_label: :update
18
+ = render 'locomotive/shared/form_actions', back_url: theme_assets_path, button_label: :update
@@ -8,8 +8,8 @@
8
8
 
9
9
  %p!= t('.help')
10
10
 
11
- = semantic_form_for @snippet, url: snippets_url do |form|
11
+ = semantic_form_for @snippet, url: snippets_path do |form|
12
12
 
13
13
  = render 'form', f: form
14
14
 
15
- = render 'locomotive/shared/form_actions', back_url: theme_assets_url, button_label: :create
15
+ = render 'locomotive/shared/form_actions', back_url: theme_assets_path, button_label: :create
@@ -10,9 +10,9 @@
10
10
  = link_to t('locomotive.buttons.close'), '#', id: 'close-link'
11
11
 
12
12
  .button-wrapper.upload
13
- = form_tag theme_assets_url(:json), class: 'quick-upload' do
13
+ = form_tag theme_assets_path(:json), class: 'quick-upload' do
14
14
  = file_field_tag 'theme_asset[source]', multiple: 'multiple'
15
- = link_to t('locomotive.theme_assets.image_picker.upload'), theme_assets_url(:json), class: 'new', id: 'upload-link'
15
+ = link_to t('locomotive.theme_assets.image_picker.upload'), theme_assets_path(:json), class: 'new', id: 'upload-link'
16
16
 
17
17
  %script{ type: 'text/html', id: 'theme_asset' }
18
18
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  - if can?(:manage, Locomotive::ThemeAsset)
7
7
  - content_for :buttons do
8
- = local_action_button t('locomotive.theme_assets.index.new'), new_theme_asset_url, icon: 'icon-plus'
8
+ = local_action_button t('locomotive.theme_assets.index.new'), new_theme_asset_path, icon: 'icon-plus'
9
9
 
10
10
  %p.help
11
11
  - if %w(image javascript stylesheet).include?(@theme_asset.content_type.to_s)
@@ -14,8 +14,8 @@
14
14
  != t('.help', url: @theme_asset.source.url)
15
15
 
16
16
 
17
- = semantic_form_for @theme_asset, url: theme_asset_url(@theme_asset), html: { multipart: true, class: 'save-with-shortcut' } do |form|
17
+ = semantic_form_for @theme_asset, url: theme_asset_path(@theme_asset), html: { multipart: true, class: 'save-with-shortcut' } do |form|
18
18
 
19
19
  = render 'form', f: form
20
20
 
21
- = render 'locomotive/shared/form_actions', back_url: theme_assets_url, button_label: :update
21
+ = render 'locomotive/shared/form_actions', back_url: theme_assets_path, button_label: :update
@@ -3,17 +3,17 @@
3
3
  - content_for :head do
4
4
  = render 'asset'
5
5
 
6
- = render 'list', name: 'images', title: t('.images'), empty_message: t('.no_items', url: new_theme_asset_url)
7
- = render 'list', name: 'media', title: t('.media'), empty_message: t('.no_items', url: new_theme_asset_url)
8
- = render 'list', name: 'others', title: t('.others'), empty_message: t('.no_items', url: new_theme_asset_url)
6
+ = render 'list', name: 'images', title: t('.images'), empty_message: t('.no_items', url: new_theme_asset_path)
7
+ = render 'list', name: 'media', title: t('.media'), empty_message: t('.no_items', url: new_theme_asset_path)
8
+ = render 'list', name: 'others', title: t('.others'), empty_message: t('.no_items', url: new_theme_asset_path)
9
9
 
10
10
  - if can?(:manage, Locomotive::Snippet)
11
11
  = render '/locomotive/snippets/snippet'
12
- = render 'list', name: 'snippets', title: t('.snippets'), empty_message: t('locomotive.snippets.index.no_items', url: new_snippet_url)
12
+ = render 'list', name: 'snippets', title: t('.snippets'), empty_message: t('locomotive.snippets.index.no_items', url: new_snippet_path)
13
13
 
14
14
  - if can?(:manage, Locomotive::ThemeAsset)
15
- = render 'list', name: 'js_and_css', title: t('.css_and_js'), empty_message: t('.no_items', url: new_theme_asset_url)
16
- = render 'list', name: 'fonts', title: t('.fonts'), empty_message: t('.no_items', url: new_theme_asset_url)
15
+ = render 'list', name: 'js_and_css', title: t('.css_and_js'), empty_message: t('.no_items', url: new_theme_asset_path)
16
+ = render 'list', name: 'fonts', title: t('.fonts'), empty_message: t('.no_items', url: new_theme_asset_path)
17
17
 
18
18
  - content_for :backbone_view_data do
19
19
  :plain
@@ -29,12 +29,12 @@
29
29
 
30
30
  - content_for :buttons do
31
31
  - if can?(:manage, Locomotive::ThemeAsset)
32
- = form_tag theme_assets_url(:json), id: 'theme-assets-quick-upload', class: 'quick-upload', :'data-sending-form-message' => t('locomotive.messages.sending_form') do
32
+ = form_tag theme_assets_path(:json), id: 'theme-assets-quick-upload', class: 'quick-upload', :'data-sending-form-message' => t('locomotive.messages.sending_form') do
33
33
  = file_field_tag 'theme_asset[source]', multiple: 'multiple'
34
34
  = local_action_button :quick_upload, '#', icon: :upload, class: 'new'
35
35
 
36
- = local_action_button t('locomotive.snippets.index.new'), new_snippet_url, icon: 'icon-plus' if can?(:manage, Locomotive::Snippet)
37
- = local_action_button :new, new_theme_asset_url, icon: :plus if can?(:manage, Locomotive::ThemeAsset)
36
+ = local_action_button t('locomotive.snippets.index.new'), new_snippet_path, icon: 'icon-plus' if can?(:manage, Locomotive::Snippet)
37
+ = local_action_button :new, new_theme_asset_path, icon: :plus if can?(:manage, Locomotive::ThemeAsset)
38
38
 
39
39
  %p!= t('.help')
40
40
 
@@ -5,8 +5,8 @@
5
5
 
6
6
  %p!= t('.help')
7
7
 
8
- = semantic_form_for @theme_asset, url: theme_assets_url, html: { multipart: true } do |form|
8
+ = semantic_form_for @theme_asset, url: theme_assets_path, html: { multipart: true } do |form|
9
9
 
10
10
  = render 'form', f: form
11
11
 
12
- = render 'locomotive/shared/form_actions', back_url: theme_assets_url, button_label: :create
12
+ = render 'locomotive/shared/form_actions', back_url: theme_assets_path, button_label: :create
@@ -4,7 +4,7 @@
4
4
  = render_cell 'locomotive/settings_menu', :show
5
5
 
6
6
  - content_for :buttons do
7
- = local_action_button t('locomotive.translations.index.new'), new_translation_url, icon: 'icon-plus'
7
+ = local_action_button t('locomotive.translations.index.new'), new_translation_path, icon: 'icon-plus'
8
8
 
9
9
  %p!= t('.help', key: @translation.key)
10
10
 
@@ -12,4 +12,4 @@
12
12
 
13
13
  = render 'form', f: form
14
14
 
15
- = render 'locomotive/shared/form_actions', back_url: translations_url, button_label: :update
15
+ = render 'locomotive/shared/form_actions', back_url: translations_path, button_label: :update
@@ -25,6 +25,6 @@
25
25
  %span!= t('.updated_at')
26
26
  = l translation.updated_at, format: :short
27
27
 
28
- = link_to_icon :trash, translation_url(translation), title: t('.remove', key: translation.key, default: ''), class: 'remove', data: { confirm: t('locomotive.messages.confirm') }, method: :delete
28
+ = link_to_icon :trash, translation_path(translation), title: t('.remove', key: translation.key, default: ''), class: 'remove', data: { confirm: t('locomotive.messages.confirm') }, method: :delete
29
29
 
30
30
  = paginate @translations, namespace: 'locomotive'
@@ -9,4 +9,4 @@
9
9
 
10
10
  = render 'form', f: form
11
11
 
12
- = render 'locomotive/shared/form_actions', back_url: translations_url, button_label: :create
12
+ = render 'locomotive/shared/form_actions', back_url: translations_path, button_label: :create
@@ -21,15 +21,22 @@ Background:
21
21
  | Other project #2 | Lorem ipsum... | Design |
22
22
  | Other project #3 | Lorem ipsum... | Design |
23
23
 
24
- Scenario:
24
+ Scenario: Listing content entries
25
25
  When I go to the list of "Projects"
26
26
  Then I should see "My sexy project"
27
27
  And I should see "Other project #2"
28
28
  And I should see "Other project #3"
29
29
 
30
- Scenario:
30
+ Scenario: Listing content entries without pagination
31
31
  When I change the number of items to display per page to 4
32
32
  And I go to the list of "Projects"
33
+ Then I should see "Other project #2"
34
+ And I should see "Other project #3"
35
+
36
+ Scenario: Listing content entries with pagination
37
+ When I change the number of items to display per page to 4
38
+ And the custom model named "Projects" is ordered by "name"
39
+ And I go to the list of "Projects"
33
40
  Then I should not see "Other project #2"
34
41
  And I should not see "Other project #3"
35
42
 
@@ -48,7 +48,7 @@ Feature: Contact form
48
48
  When I view the rendered page at "/contact"
49
49
  Then the rendered output should look like:
50
50
  """
51
- <form action="http://test.example.com/entry_submissions/messages" method="post">
51
+ <form action="/entry_submissions/messages" method="post">
52
52
  """
53
53
 
54
54
  Scenario: Prevents users to post messages if the public submission option is disabled
@@ -64,13 +64,18 @@ Given %r{^I have entries for "([^"]*)" with$} do |name, entries|
64
64
  content_type.save.should be_true
65
65
  end
66
66
 
67
+ When(/^the custom model named "(.*?)" is ordered by "(.*?)"$/) do |name, order_by|
68
+ content_type = Locomotive::ContentType.where(name: name).first
69
+ content_type.update_attribute :order_by, order_by
70
+ end
71
+
67
72
  #the "client" "Alpha, Inc" has "Fun project" as one of its "projects"
68
73
  Given(/^the "(.*?)" "(.*?)" has "(.*?)" as one of its "(.*?)"$/) do |source, source_label, target_label, target|
69
74
  source_model = Locomotive::ContentType.where(name: source.classify.pluralize).first
70
75
  source_entry = source_model.entries.where(source_model.label_field_name => source_label).first
71
76
  target_model = Locomotive::ContentType.where(name: target.classify.pluralize).first
72
77
  target_entry = target_model.entries.where(target_model.label_field_name => target_label).first
73
-
78
+
74
79
  source_entry.send("#{target}").send("<<", target_entry)
75
80
  end
76
81
 
@@ -33,6 +33,9 @@ module Locomotive
33
33
  end
34
34
 
35
35
  def back_to_default_site_locale
36
+ # we do force the content locale to the site default locale
37
+ params.delete(:content_locale)
38
+
36
39
  session[:content_locale] = ::Mongoid::Fields::I18n.locale = current_site.default_locale
37
40
  end
38
41
 
@@ -9,7 +9,8 @@ module Locomotive
9
9
  end
10
10
 
11
11
  def current_site_public_url
12
- request.protocol + request.host_with_port
12
+ # by convention, a public site is displayed in http not https.
13
+ 'http://' + request.host_with_port
13
14
  end
14
15
 
15
16
  def switch_to_site_url(site, options = {})
@@ -18,7 +18,7 @@ module Locomotive
18
18
  end
19
19
 
20
20
  def public_submission_url
21
- @context.registers[:controller].main_app.locomotive_entry_submissions_url(@content_type.slug)
21
+ @context.registers[:controller].main_app.locomotive_entry_submissions_path(@content_type.slug)
22
22
  end
23
23
 
24
24
  def api
@@ -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)
@@ -31,7 +31,7 @@ module Locomotive
31
31
  return input.to_s unless input.respond_to?(:strftime)
32
32
 
33
33
  input = input.in_time_zone(@context.registers[:site].timezone) if input.respond_to?(:in_time_zone)
34
-
34
+
35
35
  I18n.l input, format: format, locale: locale
36
36
  end
37
37
 
@@ -1,3 +1,3 @@
1
1
  module Locomotive #:nodoc
2
- VERSION = '2.2.2'
2
+ VERSION = '2.2.3'
3
3
  end
@@ -43,6 +43,15 @@ describe Locomotive::Liquid::Tags::LinkTo do
43
43
 
44
44
  end
45
45
 
46
+ context 'with a custom label' do
47
+
48
+ let(:assigns) { { 'page' => page } }
49
+ let(:template) { "{% link_to page %}Here{% endlink_to %}" }
50
+
51
+ it { should == %{<a href="/hello-world">Here</a>} }
52
+
53
+ end
54
+
46
55
  end
47
56
 
48
57
  describe 'templatized page' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: locomotive_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-16 00:00:00.000000000 Z
12
+ date: 2013-08-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -162,7 +162,7 @@ dependencies:
162
162
  requirements:
163
163
  - - ~>
164
164
  - !ruby/object:Gem::Version
165
- version: 2.2.1
165
+ version: 2.2.3
166
166
  type: :runtime
167
167
  prerelease: false
168
168
  version_requirements: !ruby/object:Gem::Requirement
@@ -170,7 +170,7 @@ dependencies:
170
170
  requirements:
171
171
  - - ~>
172
172
  - !ruby/object:Gem::Version
173
- version: 2.2.1
173
+ version: 2.2.3
174
174
  - !ruby/object:Gem::Dependency
175
175
  name: kaminari
176
176
  requirement: !ruby/object:Gem::Requirement
@@ -434,7 +434,7 @@ dependencies:
434
434
  requirements:
435
435
  - - ~>
436
436
  - !ruby/object:Gem::Version
437
- version: 0.6.0
437
+ version: 0.6.2
438
438
  type: :runtime
439
439
  prerelease: false
440
440
  version_requirements: !ruby/object:Gem::Requirement
@@ -442,7 +442,7 @@ dependencies:
442
442
  requirements:
443
443
  - - ~>
444
444
  - !ruby/object:Gem::Version
445
- version: 0.6.0
445
+ version: 0.6.2
446
446
  - !ruby/object:Gem::Dependency
447
447
  name: fog
448
448
  requirement: !ruby/object:Gem::Requirement
@@ -1416,7 +1416,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
1416
1416
  version: '0'
1417
1417
  segments:
1418
1418
  - 0
1419
- hash: 3728677471282995061
1419
+ hash: 359297222815154012
1420
1420
  required_rubygems_version: !ruby/object:Gem::Requirement
1421
1421
  none: false
1422
1422
  requirements:
@@ -1425,7 +1425,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1425
1425
  version: '0'
1426
1426
  segments:
1427
1427
  - 0
1428
- hash: 3728677471282995061
1428
+ hash: 359297222815154012
1429
1429
  requirements: []
1430
1430
  rubyforge_project:
1431
1431
  rubygems_version: 1.8.23