locomotivecms 3.0.0.rc5 → 3.0.0.rc6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -2
- data/app/api/locomotive/api/entities/site_entity.rb +1 -1
- data/app/api/locomotive/api/forms/site_form.rb +1 -1
- data/app/api/locomotive/api/resources/content_entry_resource.rb +3 -3
- data/app/api/locomotive/api/resources/current_site_resource.rb +1 -1
- data/app/api/locomotive/api/resources/my_account_resource.rb +1 -1
- data/app/api/locomotive/api/resources/site_resource.rb +4 -0
- data/app/api/locomotive/api/resources/translation_resource.rb +0 -1
- data/app/assets/javascripts/locomotive/views/current_site/edit_view.js.coffee +8 -0
- data/app/assets/javascripts/locomotive/views/inputs/text_view.js.coffee +2 -0
- data/app/controllers/locomotive/base_controller.rb +3 -4
- data/app/controllers/locomotive/concerns/redirect_to_main_host_controller.rb +28 -0
- data/{lib/locomotive/action_controller/ssl.rb → app/controllers/locomotive/concerns/ssl_controller.rb} +12 -3
- data/app/controllers/locomotive/editable_elements_controller.rb +4 -2
- data/app/controllers/locomotive/passwords_controller.rb +2 -0
- data/app/controllers/locomotive/registrations_controller.rb +3 -0
- data/app/controllers/locomotive/sessions_controller.rb +2 -0
- data/app/helpers/locomotive/base_helper.rb +2 -2
- data/app/models/locomotive/concerns/asset/vignette.rb +2 -6
- data/app/models/locomotive/concerns/site/private_access.rb +19 -0
- data/app/models/locomotive/content_type.rb +1 -2
- data/app/models/locomotive/site.rb +1 -0
- data/app/policies/locomotive/site_policy.rb +2 -2
- data/app/services/locomotive/content_entry_service.rb +18 -0
- data/app/services/locomotive/page_parsing_service.rb +3 -0
- data/app/services/locomotive/site_service.rb +6 -2
- data/app/views/locomotive/content_entries/index.html.slim +0 -1
- data/app/views/locomotive/current_site/form/_access_points.html.slim +4 -0
- data/app/views/locomotive/developers_documentation/_wagon.html.slim +1 -1
- data/app/views/locomotive/devise_mailer/reset_password_instructions.html.slim +2 -1
- data/app/views/locomotive/editable_elements/_edit.html.slim +10 -4
- data/app/views/locomotive/pages/form/_actions.html.slim +1 -1
- data/app/views/locomotive/pages/form/_main.html.slim +1 -1
- data/app/views/locomotive/pages/show.html.slim +1 -1
- data/config/locales/en.yml +1 -0
- data/config/locales/simple_form.en.yml +7 -2
- data/lib/locomotive/action_controller.rb +0 -1
- data/lib/locomotive/engine.rb +1 -0
- data/lib/locomotive/middlewares/site.rb +2 -0
- data/lib/locomotive/steam/middlewares/cache.rb +2 -1
- data/lib/locomotive/version.rb +1 -1
- data/spec/requests/locomotive/steam/cache_spec.rb +9 -2
- data/spec/support/database_cleaner.rb +23 -0
- metadata +24 -22
- data/spec/requests/admin_ssl_spec.rb +0 -51
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5f51bef4ee0791b87690640ed9bac3b70097adf
|
4
|
+
data.tar.gz: 2958657d00470ca1de733eb2bcc838cd86e78e68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 024727de5fc80100901abf5966edf2964d630edff1bf26162ac94ea30c46d95a4db8a1da23d6a2e6ffa0ad0846ae184ca508eed6d1d44c44316304500f1a8b79
|
7
|
+
data.tar.gz: bebf58fa7965d9528098ae44860dc168870079f1865f68bd3fb13c508919d1af1a2570ff66ddf8a55a56f36136bf8d16e71299a5893916a413d33d8207ed7713
|
data/Gemfile
CHANGED
@@ -22,7 +22,7 @@ group :development do
|
|
22
22
|
# gem 'custom_fields', github: 'locomotivecms/custom_fields', ref: '279c6744eb6b7dd'
|
23
23
|
|
24
24
|
# gem 'locomotivecms_steam', path: '../gems/steam', require: false
|
25
|
-
# gem 'locomotivecms_steam', github: 'locomotivecms/steam', ref: '
|
25
|
+
# gem 'locomotivecms_steam', github: 'locomotivecms/steam', ref: '2e147df', require: false
|
26
26
|
|
27
27
|
# gem 'locomotive_liquid', path: '../gems/liquid' # for Developers
|
28
28
|
# gem 'locomotivecms_solid', path: '../gems/solid' # for Developers
|
@@ -64,7 +64,7 @@ group :test do
|
|
64
64
|
gem 'factory_girl_rails'
|
65
65
|
gem 'pickle'
|
66
66
|
gem 'json_spec', '~> 1.1.4'
|
67
|
-
gem 'database_cleaner',
|
67
|
+
gem 'database_cleaner', github: 'DatabaseCleaner/database_cleaner'
|
68
68
|
gem 'timecop', '~> 0.7.1'
|
69
69
|
|
70
70
|
gem 'email_spec'
|
@@ -4,7 +4,7 @@ module Locomotive
|
|
4
4
|
|
5
5
|
class SiteForm < BaseForm
|
6
6
|
|
7
|
-
attrs :name, :handle, :robots_txt, :locales, :domains, :timezone, :picture, :cache_enabled
|
7
|
+
attrs :name, :handle, :robots_txt, :locales, :domains, :timezone, :picture, :cache_enabled, :private_access, :password
|
8
8
|
attrs :seo_title, :meta_keywords, :meta_description, localized: true
|
9
9
|
|
10
10
|
# Make sure locales and domains are in arrays.
|
@@ -62,7 +62,7 @@ module Locomotive
|
|
62
62
|
back_to_default_site_locale
|
63
63
|
|
64
64
|
form = form_klass.new(content_type, content_entry_params)
|
65
|
-
@content_entry = service.create(form.serializable_hash)
|
65
|
+
@content_entry = service.create!(form.serializable_hash)
|
66
66
|
|
67
67
|
present content_entry, with: entity_klass
|
68
68
|
end
|
@@ -77,10 +77,10 @@ module Locomotive
|
|
77
77
|
|
78
78
|
if @content_entry = content_type.entries.by_id_or_slug(params[:id]).first
|
79
79
|
authorize @content_entry, :update?
|
80
|
-
@content_entry = service.update(@content_entry, form.serializable_hash)
|
80
|
+
@content_entry = service.update!(@content_entry, form.serializable_hash)
|
81
81
|
else
|
82
82
|
authorize ContentEntry, :create?
|
83
|
-
@content_entry = service.create(form.serializable_hash)
|
83
|
+
@content_entry = service.create!(form.serializable_hash)
|
84
84
|
end
|
85
85
|
|
86
86
|
present @content_entry, with: entity_klass
|
@@ -47,7 +47,7 @@ module Locomotive
|
|
47
47
|
authorize current_site, :update?
|
48
48
|
|
49
49
|
current_site_form = Forms::SiteForm.new(permitted_params_from_policy(current_site, :site, [:picture]))
|
50
|
-
service.update(current_site, current_site_form.serializable_hash)
|
50
|
+
service.update!(current_site, current_site_form.serializable_hash)
|
51
51
|
|
52
52
|
present current_site, with: entity_klass
|
53
53
|
end
|
@@ -66,6 +66,8 @@ module Locomotive
|
|
66
66
|
optional :timezone
|
67
67
|
optional :picture
|
68
68
|
optional :cache_enabled
|
69
|
+
optional :private_access
|
70
|
+
optional :password
|
69
71
|
end
|
70
72
|
end
|
71
73
|
post do
|
@@ -92,6 +94,8 @@ module Locomotive
|
|
92
94
|
optional :timezone
|
93
95
|
optional :picture
|
94
96
|
optional :cache_enabled
|
97
|
+
optional :private_access
|
98
|
+
optional :password
|
95
99
|
end
|
96
100
|
end
|
97
101
|
put ':id' do
|
@@ -5,3 +5,11 @@ Locomotive.Views.CurrentSite ||= {}
|
|
5
5
|
class Locomotive.Views.CurrentSite.EditView extends Locomotive.Views.Shared.FormView
|
6
6
|
|
7
7
|
el: '.main'
|
8
|
+
|
9
|
+
initialize: ->
|
10
|
+
@attach_events_on_private_access_attribute()
|
11
|
+
|
12
|
+
attach_events_on_private_access_attribute: ->
|
13
|
+
@$('#site_private_access').on 'switchChange.bootstrapSwitch', (event, state) ->
|
14
|
+
$inputs = $('.locomotive_site_password')
|
15
|
+
$inputs.toggleClass('hide')
|
@@ -1,19 +1,18 @@
|
|
1
1
|
module Locomotive
|
2
2
|
class BaseController < ApplicationController
|
3
3
|
|
4
|
-
include Locomotive::
|
4
|
+
include Locomotive::Concerns::SslController
|
5
|
+
include Locomotive::Concerns::RedirectToMainHostController
|
5
6
|
include Locomotive::Concerns::UrlHelpersController
|
6
|
-
|
7
7
|
include Locomotive::Concerns::AccountController
|
8
8
|
include Locomotive::Concerns::ExceptionController
|
9
9
|
include Locomotive::Concerns::AuthorizationController
|
10
10
|
include Locomotive::Concerns::StoreLocationController
|
11
11
|
include Locomotive::Concerns::WithinSiteController
|
12
|
+
include Locomotive::Concerns::WithinSiteController
|
12
13
|
|
13
14
|
layout '/locomotive/layouts/application'
|
14
15
|
|
15
|
-
before_filter :require_ssl
|
16
|
-
|
17
16
|
helper Locomotive::BaseHelper, Locomotive::ErrorsHelper
|
18
17
|
|
19
18
|
self.responder = Locomotive::ActionController::Responder # custom responder
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Locomotive
|
2
|
+
module Concerns
|
3
|
+
module RedirectToMainHostController
|
4
|
+
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
|
9
|
+
before_filter :redirect_to_main_host
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def redirect_to_main_host
|
16
|
+
return if Locomotive.config.host.blank?
|
17
|
+
|
18
|
+
if request.host != Locomotive.config.host
|
19
|
+
options = { host: Locomotive.config.host }
|
20
|
+
options[:port] = request.port if request.port != 80
|
21
|
+
|
22
|
+
redirect_to options
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -1,6 +1,16 @@
|
|
1
1
|
module Locomotive
|
2
|
-
module
|
3
|
-
module
|
2
|
+
module Concerns
|
3
|
+
module SslController
|
4
|
+
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
|
9
|
+
before_filter :require_ssl
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
4
14
|
|
5
15
|
def require_ssl
|
6
16
|
# already a ssl request or ssl disabled ?
|
@@ -12,4 +22,3 @@ module Locomotive
|
|
12
22
|
end
|
13
23
|
end
|
14
24
|
end
|
15
|
-
|
@@ -45,8 +45,10 @@ module Locomotive
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def render_index
|
48
|
-
|
49
|
-
|
48
|
+
if @editable_elements
|
49
|
+
@editable_elements_by_block = parsing_service.group_and_sort_editable_elements(@editable_elements)
|
50
|
+
@blocks = parsing_service.blocks_from_grouped_editable_elements(@editable_elements_by_block)
|
51
|
+
end
|
50
52
|
|
51
53
|
@content_entry = @page.content_type.entries.find(params[:content_entry_id]) if params[:content_entry_id]
|
52
54
|
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Locomotive
|
2
2
|
class PasswordsController < ::Devise::PasswordsController
|
3
3
|
|
4
|
+
include Locomotive::Concerns::SslController
|
5
|
+
include Locomotive::Concerns::RedirectToMainHostController
|
4
6
|
include Locomotive::Concerns::WithinSiteController
|
5
7
|
|
6
8
|
within_site_only_if_existing true
|
@@ -1,6 +1,9 @@
|
|
1
1
|
module Locomotive
|
2
2
|
class RegistrationsController < ::Devise::RegistrationsController
|
3
3
|
|
4
|
+
include Locomotive::Concerns::SslController
|
5
|
+
include Locomotive::Concerns::RedirectToMainHostController
|
6
|
+
|
4
7
|
layout '/locomotive/layouts/account'
|
5
8
|
|
6
9
|
before_action :configure_permitted_parameters
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Locomotive
|
2
2
|
class SessionsController < ::Devise::SessionsController
|
3
3
|
|
4
|
+
include Locomotive::Concerns::SslController
|
5
|
+
include Locomotive::Concerns::RedirectToMainHostController
|
4
6
|
include Locomotive::Concerns::WithinSiteController
|
5
7
|
|
6
8
|
within_site_only_if_existing true # Note: do not validate the membership
|
@@ -230,13 +230,13 @@ module Locomotive
|
|
230
230
|
def cache_key_for_sidebar_pages
|
231
231
|
count = current_site.pages.count
|
232
232
|
max_updated_at = current_site.pages.max(:updated_at).try(:utc).try(:to_s, :number).to_i
|
233
|
-
"#{Locomotive::VERSION}/site/#{current_site._id}/sidebar/pages-#{count}-#{max_updated_at}/locale/#{::Mongoid::Fields::I18n.locale}"
|
233
|
+
"#{Locomotive::VERSION}/site/#{current_site._id}/#{current_site.handle}/sidebar/pages-#{count}-#{max_updated_at}/locale/#{::Mongoid::Fields::I18n.locale}"
|
234
234
|
end
|
235
235
|
|
236
236
|
def cache_key_for_sidebar_content_types
|
237
237
|
count = current_site.content_types.count
|
238
238
|
max_updated_at = current_site.content_entries.max(:updated_at).try(:utc).try(:to_s, :number).to_i
|
239
|
-
"#{Locomotive::VERSION}/site/#{current_site._id}/sidebar/content_types-#{count}-#{max_updated_at}"
|
239
|
+
"#{Locomotive::VERSION}/site/#{current_site._id}/#{current_site.handle}/sidebar/content_types-#{count}-#{max_updated_at}"
|
240
240
|
end
|
241
241
|
|
242
242
|
end
|
@@ -16,12 +16,8 @@ module Locomotive
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def alternative_vignette_url
|
19
|
-
format = if self.image?
|
20
|
-
|
21
|
-
'190x120>'
|
22
|
-
else
|
23
|
-
'190x120>'
|
24
|
-
end
|
19
|
+
format = if self.image? && self.width && self.height
|
20
|
+
'190x120>'
|
25
21
|
elsif self.pdf?
|
26
22
|
'190x120#'
|
27
23
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Locomotive
|
2
|
+
module Concerns
|
3
|
+
module Site
|
4
|
+
module PrivateAccess
|
5
|
+
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
included do
|
9
|
+
|
10
|
+
## fields ##
|
11
|
+
field :private_access, type: Boolean, default: false
|
12
|
+
field :password
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -31,8 +31,7 @@ module Locomotive
|
|
31
31
|
field :display_settings, type: Hash
|
32
32
|
|
33
33
|
## associations ##
|
34
|
-
|
35
|
-
has_many :entries, class_name: 'Locomotive::ContentEntry', dependent: :destroy
|
34
|
+
has_many :entries, class_name: 'Locomotive::ContentEntry', dependent: :destroy
|
36
35
|
|
37
36
|
## named scopes ##
|
38
37
|
scope :ordered, -> { order_by(updated_at: :desc) }
|
@@ -46,7 +46,7 @@ module Locomotive
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def permitted_attributes
|
49
|
-
plain = [:name, :handle, :picture, :remove_picture, :seo_title, :meta_keywords, :meta_description, :timezone_name, :robots_txt, :cache_enabled, :redirect_to_first_domain]
|
49
|
+
plain = [:name, :handle, :picture, :remove_picture, :seo_title, :meta_keywords, :meta_description, :timezone_name, :robots_txt, :cache_enabled, :redirect_to_first_domain, :private_access, :password]
|
50
50
|
hash = { domains: [], locales: [], url_redirections: [] }
|
51
51
|
|
52
52
|
unless update_advanced?
|
@@ -56,7 +56,7 @@ module Locomotive
|
|
56
56
|
end
|
57
57
|
|
58
58
|
unless point?
|
59
|
-
plain -= [:handle, :redirect_to_first_domain]
|
59
|
+
plain -= [:handle, :redirect_to_first_domain, :private_access, :password]
|
60
60
|
hash.delete(:domains)
|
61
61
|
end
|
62
62
|
|
@@ -55,6 +55,14 @@ module Locomotive
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
+
def create!(attributes)
|
59
|
+
if (entry = create(attributes)).errors.empty?
|
60
|
+
entry
|
61
|
+
else
|
62
|
+
entry.fail_due_to_validation!
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
58
66
|
# Create a content entry from the attributes passed in parameter.
|
59
67
|
# It does not set the created_by column since it's called
|
60
68
|
# from the public side of the site with no logged in account.
|
@@ -99,6 +107,16 @@ module Locomotive
|
|
99
107
|
end
|
100
108
|
end
|
101
109
|
|
110
|
+
def update!(entry, attributes)
|
111
|
+
update(entry, attributes)
|
112
|
+
|
113
|
+
if entry.errors.empty?
|
114
|
+
entry
|
115
|
+
else
|
116
|
+
entry.fail_due_to_validation!
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
102
120
|
def destroy(entry)
|
103
121
|
entry.destroy.tap do
|
104
122
|
track_activity 'content_entry.destroyed', parameters: activity_parameters(entry)
|
@@ -45,19 +45,23 @@ module Locomotive
|
|
45
45
|
create(attributes, true)
|
46
46
|
end
|
47
47
|
|
48
|
-
def update(site, attributes)
|
48
|
+
def update(site, attributes, raise_if_not_valid = false)
|
49
49
|
site.attributes = attributes
|
50
50
|
|
51
51
|
new_locales = site.locales_changed? ? site.locales - site.locales_was : nil
|
52
52
|
previous_default_locale = site.default_locale_was
|
53
53
|
|
54
|
-
site.save.tap do |success|
|
54
|
+
(raise_if_not_valid ? site.save! : site.save).tap do |success|
|
55
55
|
if success
|
56
56
|
localize_pages_and_content_entries(site, new_locales, previous_default_locale)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
+
def update!(site, attributes)
|
62
|
+
update(site, attributes, true)
|
63
|
+
end
|
64
|
+
|
61
65
|
private
|
62
66
|
|
63
67
|
def localize_pages_and_content_entries(site, new_locales, previous_default_locale)
|
@@ -6,5 +6,9 @@
|
|
6
6
|
|
7
7
|
= f.input :redirect_to_first_domain, as: :toggle
|
8
8
|
|
9
|
+
= f.inputs :private_access do
|
10
|
+
= f.input :private_access, as: :toggle
|
11
|
+
= f.input :password, as: :string, wrapper_html: { class: "#{'hide' unless f.object.private_access?}" }
|
12
|
+
|
9
13
|
= f.actions do
|
10
14
|
= f.action
|
@@ -22,11 +22,17 @@
|
|
22
22
|
.text-right
|
23
23
|
- if current_site.localized?
|
24
24
|
= locale_picker_link
|
25
|
-
- unless @editable_elements.
|
25
|
+
- unless @editable_elements.blank?
|
26
26
|
|
|
27
27
|
= f.action
|
28
28
|
|
29
|
-
- if @editable_elements.
|
29
|
+
- if @editable_elements.nil?
|
30
|
+
.col-sm-12.col-xs-12
|
31
|
+
br
|
32
|
+
.alert.alert-warning.text-center role="alert"
|
33
|
+
== t('.parsing_error')
|
34
|
+
|
35
|
+
- elsif @editable_elements.empty?
|
30
36
|
- if @content_entry.nil?
|
31
37
|
.col-sm-12.col-xs-12
|
32
38
|
br
|
@@ -42,7 +48,7 @@
|
|
42
48
|
span.form-wrapper
|
43
49
|
= select_tag 'block', options_for_page_blocks(@blocks)
|
44
50
|
|
45
|
-
.scrollable class="#{'no-editable-elements' if @editable_elements.
|
51
|
+
.scrollable class="#{'no-editable-elements' if @editable_elements.blank?}"
|
46
52
|
.container-fluid
|
47
53
|
.row
|
48
54
|
.col-md-12
|
@@ -56,4 +62,4 @@
|
|
56
62
|
span.form_wrapper
|
57
63
|
= link_to t(:edit, scope: 'locomotive.editable_elements.form.model.buttons'), edit_content_entry_path(current_site, @content_entry.content_type.slug, @content_entry, _location: request.fullpath), class: 'btn btn-primary btn-sm'
|
58
64
|
|
59
|
-
= render 'form', f: f
|
65
|
+
= render 'form', f: f unless @editable_elements.blank?
|
@@ -2,7 +2,7 @@
|
|
2
2
|
.row
|
3
3
|
.col-sm-6.text-left
|
4
4
|
- if policy(@page).destroy?
|
5
|
-
= link_to t(:delete, scope: 'simple_form.buttons.locomotive.
|
5
|
+
= link_to t(:delete, scope: 'simple_form.buttons.locomotive.page'), page_path(current_site, @page), data: { confirm: I18n.t('locomotive.messages.confirm') }, class:'btn btn-sm btn-danger', method: :delete
|
6
6
|
|
7
7
|
.col-sm-6.text-right
|
8
8
|
= f.actions_with_back_button back_url: @page.default_response_type? ? editable_elements_path(current_site, @page) : nil, use_stored_location: @page.templatized?
|
@@ -1,2 +1,2 @@
|
|
1
1
|
.embed-responsive.embed-page
|
2
|
-
iframe.embed-responsive-item src=
|
2
|
+
iframe.embed-responsive-item src=preview_url(current_site) + '/' + current_site.localized_page_fullpath(@page)
|
data/config/locales/en.yml
CHANGED
@@ -214,6 +214,7 @@ en:
|
|
214
214
|
edit:
|
215
215
|
settings_link: 'Settings'
|
216
216
|
no_editable_elements: 'No editable elements found'
|
217
|
+
parsing_error: "<b>We are sorry but we couldn't parse the template of your page.</b><br/>Please make sure your template first works with Wagon."
|
217
218
|
blocks:
|
218
219
|
all: All
|
219
220
|
unknown: Unknown
|
@@ -48,6 +48,8 @@ en:
|
|
48
48
|
locales: Languages
|
49
49
|
timezone_name: Timezone
|
50
50
|
cache_enabled: Cache
|
51
|
+
private_access: "Enable password-protection"
|
52
|
+
password: "Site-Wide Password"
|
51
53
|
new:
|
52
54
|
locales: First language
|
53
55
|
membership:
|
@@ -70,7 +72,6 @@ en:
|
|
70
72
|
head: "Head row?"
|
71
73
|
class_name: "CSS class"
|
72
74
|
|
73
|
-
|
74
75
|
hints:
|
75
76
|
locomotive:
|
76
77
|
account:
|
@@ -99,6 +100,8 @@ en:
|
|
99
100
|
cache_enabled: "When enabled, your pages will be cached as long as the content doesn't change. Disabling cache per page is allowed."
|
100
101
|
redirect_to_first_domain: "When enabled, requests made to any domains listed above will be redirected to the first domain."
|
101
102
|
url_redirections: "Redirect (301) legacy urls to pages you created in the back-office. The origin and the destination URLs are separated by a <u>space</u>."
|
103
|
+
private_access: You can hide your site behind a password.
|
104
|
+
password: The password public visitors will have to enter to see the content of your site.
|
102
105
|
new:
|
103
106
|
locales: "You can add other languages once your site will be created."
|
104
107
|
translation:
|
@@ -155,5 +158,7 @@ en:
|
|
155
158
|
loading_text: Resizing...
|
156
159
|
submit: Resize
|
157
160
|
site:
|
158
|
-
delete:
|
161
|
+
delete: Delete this site
|
162
|
+
page:
|
163
|
+
delete: Delete
|
159
164
|
|
data/lib/locomotive/engine.rb
CHANGED
@@ -46,7 +46,8 @@ module Locomotive
|
|
46
46
|
CACHEABLE_REQUEST_METHODS.include?(env['REQUEST_METHOD']) &&
|
47
47
|
!env['steam.live_editing'] &&
|
48
48
|
env['steam.site'].try(:cache_enabled) &&
|
49
|
-
env['steam.page'].try(:cache_enabled)
|
49
|
+
env['steam.page'].try(:cache_enabled) &&
|
50
|
+
env['steam.page'].try(:redirect_url).blank?
|
50
51
|
end
|
51
52
|
|
52
53
|
def cache_key(env)
|
data/lib/locomotive/version.rb
CHANGED
@@ -5,7 +5,7 @@ describe Locomotive::Steam::Middlewares::Cache do
|
|
5
5
|
let(:site_cache) { false }
|
6
6
|
let(:page_cache) { false }
|
7
7
|
let(:site) { instance_double('CacheSite', _id: '0001', cache_enabled: site_cache, last_modified_at: DateTime.parse('2007/06/29 00:00:00')) }
|
8
|
-
let(:page) { instance_double('CachedPage', _id: '0042', cache_enabled: page_cache) }
|
8
|
+
let(:page) { instance_double('CachedPage', _id: '0042', cache_enabled: page_cache, redirect_url: nil) }
|
9
9
|
let(:app) { ->(env) { [200, env, 'app'] } }
|
10
10
|
let(:middleware) { described_class.new(app) }
|
11
11
|
let(:steam_env) { { 'REQUEST_METHOD' => 'GET', 'steam.site' => site, 'steam.page' => page, 'steam.live_editing' => false, 'PATH_INFO' => 'foo', 'QUERY_STRING' => 'a=1&c=3' } }
|
@@ -39,7 +39,7 @@ describe Locomotive::Steam::Middlewares::Cache do
|
|
39
39
|
|
40
40
|
subject { middleware.send(:cache_key, steam_env) }
|
41
41
|
|
42
|
-
it { expect(subject).to eq '
|
42
|
+
it { expect(subject).to eq 'baf811bda8ae9dbeab661855d023de69' }
|
43
43
|
|
44
44
|
end
|
45
45
|
|
@@ -72,6 +72,13 @@ describe Locomotive::Steam::Middlewares::Cache do
|
|
72
72
|
|
73
73
|
end
|
74
74
|
|
75
|
+
context 'page is a redirection' do
|
76
|
+
|
77
|
+
let(:page) { instance_double('CachedPage', _id: '0042', cache_enabled: page_cache, redirect_url: 'http://locomotive.works') }
|
78
|
+
it { expect(subject).to eq false }
|
79
|
+
|
80
|
+
end
|
81
|
+
|
75
82
|
end
|
76
83
|
|
77
84
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'database_cleaner'
|
2
|
+
|
3
|
+
# https://github.com/DatabaseCleaner/database_cleaner/issues/409
|
4
|
+
# https://docs.mongodb.org/v3.0/reference/command/listCollections/#dbcmd.listCollections
|
5
|
+
module DatabaseCleaner
|
6
|
+
module Mongoid
|
7
|
+
class Truncation
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def collections
|
12
|
+
if db != :default
|
13
|
+
database.use(db)
|
14
|
+
end
|
15
|
+
|
16
|
+
database.collections.collect { |c| c.namespace.split('.', 2)[1] }
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: locomotivecms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.
|
4
|
+
version: 3.0.0.rc6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Didier Lafforgue
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -150,20 +150,6 @@ dependencies:
|
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: 6.0.0
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: mime-types
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - "~>"
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: '2.5'
|
160
|
-
type: :runtime
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - "~>"
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: '2.5'
|
167
153
|
- !ruby/object:Gem::Dependency
|
168
154
|
name: custom_fields
|
169
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,14 +170,14 @@ dependencies:
|
|
184
170
|
requirements:
|
185
171
|
- - "~>"
|
186
172
|
- !ruby/object:Gem::Version
|
187
|
-
version: 1.0.0.
|
173
|
+
version: 1.0.0.rc9
|
188
174
|
type: :runtime
|
189
175
|
prerelease: false
|
190
176
|
version_requirements: !ruby/object:Gem::Requirement
|
191
177
|
requirements:
|
192
178
|
- - "~>"
|
193
179
|
- !ruby/object:Gem::Version
|
194
|
-
version: 1.0.0.
|
180
|
+
version: 1.0.0.rc9
|
195
181
|
- !ruby/object:Gem::Dependency
|
196
182
|
name: slim
|
197
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -500,6 +486,20 @@ dependencies:
|
|
500
486
|
- - "~>"
|
501
487
|
- !ruby/object:Gem::Version
|
502
488
|
version: '1.1'
|
489
|
+
- !ruby/object:Gem::Dependency
|
490
|
+
name: mime-types
|
491
|
+
requirement: !ruby/object:Gem::Requirement
|
492
|
+
requirements:
|
493
|
+
- - "~>"
|
494
|
+
- !ruby/object:Gem::Version
|
495
|
+
version: '2.5'
|
496
|
+
type: :runtime
|
497
|
+
prerelease: false
|
498
|
+
version_requirements: !ruby/object:Gem::Requirement
|
499
|
+
requirements:
|
500
|
+
- - "~>"
|
501
|
+
- !ruby/object:Gem::Version
|
502
|
+
version: '2.5'
|
503
503
|
- !ruby/object:Gem::Dependency
|
504
504
|
name: mimetype-fu
|
505
505
|
requirement: !ruby/object:Gem::Requirement
|
@@ -804,7 +804,9 @@ files:
|
|
804
804
|
- app/controllers/locomotive/concerns/exception_controller.rb
|
805
805
|
- app/controllers/locomotive/concerns/locale_helpers_controller.rb
|
806
806
|
- app/controllers/locomotive/concerns/membership_controller.rb
|
807
|
+
- app/controllers/locomotive/concerns/redirect_to_main_host_controller.rb
|
807
808
|
- app/controllers/locomotive/concerns/site_dispatcher_controller.rb
|
809
|
+
- app/controllers/locomotive/concerns/ssl_controller.rb
|
808
810
|
- app/controllers/locomotive/concerns/store_location_controller.rb
|
809
811
|
- app/controllers/locomotive/concerns/timezone_controller.rb
|
810
812
|
- app/controllers/locomotive/concerns/token_authentication_controller.rb
|
@@ -893,6 +895,7 @@ files:
|
|
893
895
|
- app/models/locomotive/concerns/site/access_points.rb
|
894
896
|
- app/models/locomotive/concerns/site/cache.rb
|
895
897
|
- app/models/locomotive/concerns/site/locales.rb
|
898
|
+
- app/models/locomotive/concerns/site/private_access.rb
|
896
899
|
- app/models/locomotive/concerns/site/timezone.rb
|
897
900
|
- app/models/locomotive/concerns/site/url_redirections.rb
|
898
901
|
- app/models/locomotive/concerns/theme_asset/plain_text.rb
|
@@ -1181,7 +1184,6 @@ files:
|
|
1181
1184
|
- lib/locomotive.rb
|
1182
1185
|
- lib/locomotive/action_controller.rb
|
1183
1186
|
- lib/locomotive/action_controller/responder.rb
|
1184
|
-
- lib/locomotive/action_controller/ssl.rb
|
1185
1187
|
- lib/locomotive/carrierwave.rb
|
1186
1188
|
- lib/locomotive/carrierwave/asset.rb
|
1187
1189
|
- lib/locomotive/carrierwave/base.rb
|
@@ -1302,12 +1304,12 @@ files:
|
|
1302
1304
|
- spec/models/locomotive/snippet_spec.rb
|
1303
1305
|
- spec/models/locomotive/theme_asset_spec.rb
|
1304
1306
|
- spec/models/locomotive/translation_spec.rb
|
1305
|
-
- spec/requests/admin_ssl_spec.rb
|
1306
1307
|
- spec/requests/locomotive/steam/cache_spec.rb
|
1307
1308
|
- spec/requests/locomotive/steam/wysihtml_css_spec.rb
|
1308
1309
|
- spec/requests/site_spec.rb
|
1309
1310
|
- spec/support/capybara.rb
|
1310
1311
|
- spec/support/carrierwave.rb
|
1312
|
+
- spec/support/database_cleaner.rb
|
1311
1313
|
- spec/support/entity.rb
|
1312
1314
|
- spec/support/factories.rb
|
1313
1315
|
- spec/support/features/session_helpers.rb
|
@@ -1526,7 +1528,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1526
1528
|
version: 1.3.1
|
1527
1529
|
requirements: []
|
1528
1530
|
rubyforge_project:
|
1529
|
-
rubygems_version: 2.5.
|
1531
|
+
rubygems_version: 2.4.5.1
|
1530
1532
|
signing_key:
|
1531
1533
|
specification_version: 4
|
1532
1534
|
summary: A platform to create, publish and edit sites
|
@@ -1572,12 +1574,12 @@ test_files:
|
|
1572
1574
|
- spec/models/locomotive/snippet_spec.rb
|
1573
1575
|
- spec/models/locomotive/theme_asset_spec.rb
|
1574
1576
|
- spec/models/locomotive/translation_spec.rb
|
1575
|
-
- spec/requests/admin_ssl_spec.rb
|
1576
1577
|
- spec/requests/locomotive/steam/cache_spec.rb
|
1577
1578
|
- spec/requests/locomotive/steam/wysihtml_css_spec.rb
|
1578
1579
|
- spec/requests/site_spec.rb
|
1579
1580
|
- spec/support/capybara.rb
|
1580
1581
|
- spec/support/carrierwave.rb
|
1582
|
+
- spec/support/database_cleaner.rb
|
1581
1583
|
- spec/support/entity.rb
|
1582
1584
|
- spec/support/factories.rb
|
1583
1585
|
- spec/support/features/session_helpers.rb
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Enable SSL admin' do
|
4
|
-
|
5
|
-
before :each do
|
6
|
-
FactoryGirl.create('existing site')
|
7
|
-
FactoryGirl.create(:account)
|
8
|
-
host!('models.example.com')
|
9
|
-
Locomotive.config.enable_admin_ssl = true
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'should redirect to SSL on admin when enabled' do
|
13
|
-
get '/locomotive/pages'
|
14
|
-
expect(response.status).to eq(302)
|
15
|
-
expect(response.location).to match(/https/)
|
16
|
-
end
|
17
|
-
|
18
|
-
context 'admin ssl disabled' do
|
19
|
-
|
20
|
-
before do
|
21
|
-
Locomotive.config.enable_admin_ssl = false
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'should not redirect to SSL on admin when disabled' do
|
25
|
-
get '/locomotive/pages'
|
26
|
-
expect(response.status).to eq(302)
|
27
|
-
expect(response.location).to match(/http/)
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
context 'request for the non main domain' do
|
33
|
-
|
34
|
-
before do
|
35
|
-
|
36
|
-
host!('myexample.com')
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'should not redirect to SSL' do
|
40
|
-
get '/locomotive/pages'
|
41
|
-
expect(response.status).to eq(302)
|
42
|
-
expect(response.location).to match(/http/)
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
after(:all) do
|
48
|
-
Locomotive.config.enable_admin_ssl = false
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|