locomotivecms 3.0.0.rc1 → 3.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -3
- data/README.md +7 -1
- data/app/api/locomotive/api/entities/content_type_entity.rb +4 -1
- data/app/api/locomotive/api/forms/base_form.rb +4 -2
- data/app/api/locomotive/api/forms/content_type_form.rb +1 -0
- data/app/api/locomotive/api/forms/theme_asset_form.rb +1 -1
- data/app/api/locomotive/api/resources/content_type_resource.rb +4 -2
- data/app/assets/javascripts/locomotive/views/inputs/array_view.js.coffee +1 -0
- data/app/controllers/locomotive/current_site_controller.rb +8 -0
- data/app/helpers/locomotive/editable_elements_helper.rb +2 -2
- data/app/helpers/locomotive/errors_helper.rb +7 -3
- data/app/helpers/locomotive/pages_helper.rb +2 -2
- data/app/helpers/locomotive/shared/accounts_helper.rb +1 -1
- data/app/inputs/locomotive/api_key_input.rb +2 -2
- data/app/mailers/locomotive/notifications.rb +14 -3
- data/app/models/locomotive/concerns/content_type/entry_template.rb +7 -1
- data/app/models/locomotive/concerns/content_type/public_submission_title_template.rb +24 -0
- data/app/models/locomotive/concerns/site/access_points.rb +1 -0
- data/app/models/locomotive/concerns/site/url_redirections.rb +30 -0
- data/app/models/locomotive/content_entry.rb +9 -1
- data/app/models/locomotive/content_type.rb +1 -0
- data/app/models/locomotive/page.rb +1 -1
- data/app/models/locomotive/site.rb +1 -0
- data/app/policies/locomotive/site_policy.rb +4 -3
- data/app/uploaders/locomotive/theme_asset_uploader.rb +6 -9
- data/app/views/locomotive/content_assets/_list.html.slim +1 -1
- data/app/views/locomotive/content_entries/_entry.html.slim +1 -1
- data/app/views/locomotive/content_entries/_list.html.slim +1 -1
- data/app/views/locomotive/content_entries/edit.html.slim +2 -0
- data/app/views/locomotive/content_entries/form/_tabs.html.slim +3 -3
- data/app/views/locomotive/content_entries/new.html.slim +3 -0
- data/app/views/locomotive/current_site/_membership.html.slim +1 -1
- data/app/views/locomotive/current_site/_url_redirection.html.slim +17 -0
- data/app/views/locomotive/current_site/form/_access_points.html.slim +2 -0
- data/app/views/locomotive/current_site/form/_panes.html.slim +1 -1
- data/app/views/locomotive/current_site/form/_tabs.html.slim +3 -0
- data/app/views/locomotive/current_site/form/_url_redirections.html.slim +5 -0
- data/app/views/locomotive/custom_fields/select_options/_option.html.slim +3 -1
- data/app/views/locomotive/editable_elements/index_without_preview.html.slim +3 -3
- data/app/views/locomotive/notifications/new_content_entry.html.slim +4 -0
- data/app/views/locomotive/pages/form/_actions.html.slim +1 -1
- data/app/views/locomotive/pages/form/_tabs.html.slim +3 -3
- data/app/views/locomotive/passwords/edit.html.slim +1 -1
- data/app/views/locomotive/passwords/new.html.slim +1 -1
- data/app/views/locomotive/public_submission_accounts/edit.html.slim +1 -1
- data/app/views/locomotive/registrations/new.html.slim +1 -1
- data/app/views/locomotive/sessions/new.html.slim +1 -1
- data/app/views/locomotive/translations/index.html.slim +2 -1
- data/config/i18n-tasks.yml +110 -0
- data/config/locales/carrierwave.fr.yml +1 -1
- data/config/locales/default.en.yml +0 -49
- data/config/locales/default.fr.yml +1 -232
- data/config/locales/devise.fr.yml +1 -68
- data/config/locales/{admin_ui.en.yml → en.yml} +31 -91
- data/config/locales/flash.en.yml +8 -37
- data/config/locales/flash.fr.yml +1 -106
- data/config/locales/fr.yml +5 -0
- data/config/locales/inputs.fr.yml +1 -0
- data/config/locales/mongoid.en.yml +49 -0
- data/config/locales/mongoid.fr.yml +12 -0
- data/config/locales/simple_form.en.yml +26 -65
- data/config/locales/simple_form.fr.yml +1 -0
- data/config/{locales → old-locales}/admin_ui.bg.yml +0 -0
- data/config/{locales → old-locales}/admin_ui.cs.yml +0 -0
- data/config/{locales → old-locales}/admin_ui.de.yml +0 -0
- data/config/{locales → old-locales}/admin_ui.es.yml +0 -0
- data/config/{locales → old-locales}/admin_ui.et.yml +0 -0
- data/config/{locales → old-locales}/admin_ui.fr.yml +0 -0
- data/config/{locales → old-locales}/admin_ui.it.yml +0 -0
- data/config/{locales → old-locales}/admin_ui.ja.yml +0 -0
- data/config/{locales → old-locales}/admin_ui.nb.yml +0 -0
- data/config/{locales → old-locales}/admin_ui.nl.yml +0 -0
- data/config/{locales → old-locales}/admin_ui.pl.yml +0 -0
- data/config/{locales → old-locales}/admin_ui.pt-BR.yml +0 -0
- data/config/{locales → old-locales}/admin_ui.pt.yml +0 -0
- data/config/{locales → old-locales}/admin_ui.ru.yml +0 -0
- data/config/{locales → old-locales}/admin_ui.sk.yml +0 -0
- data/config/{locales → old-locales}/admin_ui.sr.yml +0 -0
- data/config/{locales → old-locales}/admin_ui.zh-CN.yml +0 -0
- data/config/{locales → old-locales}/carrierwave.bg.yml +0 -0
- data/config/{locales → old-locales}/carrierwave.cs.yml +0 -0
- data/config/{locales → old-locales}/carrierwave.de.yml +0 -0
- data/config/{locales → old-locales}/carrierwave.es.yml +0 -0
- data/config/{locales → old-locales}/carrierwave.et.yml +0 -0
- data/config/old-locales/carrierwave.fr.yml +4 -0
- data/config/{locales → old-locales}/carrierwave.it.yml +0 -0
- data/config/{locales → old-locales}/carrierwave.ja.yml +0 -0
- data/config/{locales → old-locales}/carrierwave.nb.yml +0 -0
- data/config/{locales → old-locales}/carrierwave.nl.yml +0 -0
- data/config/{locales → old-locales}/carrierwave.pl.yml +0 -0
- data/config/{locales → old-locales}/carrierwave.pt-BR.yml +0 -0
- data/config/{locales → old-locales}/carrierwave.pt.yml +0 -0
- data/config/{locales → old-locales}/carrierwave.ru.yml +0 -0
- data/config/{locales → old-locales}/carrierwave.sk.yml +0 -0
- data/config/{locales → old-locales}/carrierwave.sr.yml +0 -0
- data/config/{locales → old-locales}/carrierwave.zh-CN.yml +0 -0
- data/config/{locales → old-locales}/default.bg.yml +0 -0
- data/config/{locales → old-locales}/default.cs.yml +0 -0
- data/config/{locales → old-locales}/default.de.yml +0 -0
- data/config/{locales → old-locales}/default.es.yml +0 -0
- data/config/{locales → old-locales}/default.et.yml +0 -0
- data/config/old-locales/default.fr.yml +232 -0
- data/config/{locales → old-locales}/default.it.yml +0 -0
- data/config/{locales → old-locales}/default.ja.yml +0 -0
- data/config/{locales → old-locales}/default.nb.yml +0 -0
- data/config/{locales → old-locales}/default.nl.yml +0 -0
- data/config/{locales → old-locales}/default.pl.yml +0 -0
- data/config/{locales → old-locales}/default.pt-BR.yml +0 -0
- data/config/{locales → old-locales}/default.pt.yml +0 -0
- data/config/{locales → old-locales}/default.ru.yml +0 -0
- data/config/{locales → old-locales}/default.sk.yml +0 -0
- data/config/{locales → old-locales}/default.sr.yml +0 -0
- data/config/{locales → old-locales}/default.zh-CN.yml +0 -0
- data/config/{locales → old-locales}/devise.bg.yml +0 -0
- data/config/{locales → old-locales}/devise.cs.yml +0 -0
- data/config/{locales → old-locales}/devise.de.yml +0 -0
- data/config/{locales → old-locales}/devise.es.yml +0 -0
- data/config/{locales → old-locales}/devise.et.yml +0 -0
- data/config/old-locales/devise.fr.yml +68 -0
- data/config/{locales → old-locales}/devise.it.yml +0 -0
- data/config/{locales → old-locales}/devise.ja.yml +0 -0
- data/config/{locales → old-locales}/devise.nb.yml +0 -0
- data/config/{locales → old-locales}/devise.nl.yml +0 -0
- data/config/{locales → old-locales}/devise.pl.yml +0 -0
- data/config/{locales → old-locales}/devise.pt-BR.yml +0 -0
- data/config/{locales → old-locales}/devise.pt.yml +0 -0
- data/config/{locales → old-locales}/devise.ru.yml +0 -0
- data/config/{locales → old-locales}/devise.sk.yml +0 -0
- data/config/{locales → old-locales}/devise.sr.yml +0 -0
- data/config/{locales → old-locales}/devise.zh-CN.yml +0 -0
- data/config/{locales → old-locales}/flash.bg.yml +0 -0
- data/config/{locales → old-locales}/flash.cs.yml +0 -0
- data/config/{locales → old-locales}/flash.de.yml +0 -0
- data/config/{locales → old-locales}/flash.es.yml +0 -0
- data/config/{locales → old-locales}/flash.et.yml +0 -0
- data/config/old-locales/flash.fr.yml +106 -0
- data/config/{locales → old-locales}/flash.it.yml +0 -0
- data/config/{locales → old-locales}/flash.ja.yml +0 -0
- data/config/{locales → old-locales}/flash.nb.yml +0 -0
- data/config/{locales → old-locales}/flash.nl.yml +0 -0
- data/config/{locales → old-locales}/flash.pl.yml +0 -0
- data/config/{locales → old-locales}/flash.pt-BR.yml +0 -0
- data/config/{locales → old-locales}/flash.pt.yml +0 -0
- data/config/{locales → old-locales}/flash.ru.yml +0 -0
- data/config/{locales → old-locales}/flash.sk.yml +0 -0
- data/config/{locales → old-locales}/flash.sr.yml +0 -0
- data/config/{locales → old-locales}/flash.zh-CN.yml +0 -0
- data/config/routes.rb +1 -0
- data/lib/generators/locomotive/install/templates/carrierwave.rb +12 -7
- data/lib/generators/locomotive/install/templates/devise.rb +127 -55
- data/lib/generators/locomotive/install/templates/dragonfly.rb +1 -1
- data/lib/generators/locomotive/install/templates/locomotive.rb +2 -0
- data/lib/locomotive/carrierwave/asset.rb +23 -11
- data/lib/locomotive/carrierwave/patches.rb +18 -0
- data/lib/locomotive/configuration.rb +6 -5
- data/lib/locomotive/dependencies.rb +1 -0
- data/lib/locomotive/engine.rb +4 -0
- data/lib/locomotive/middlewares/site.rb +1 -0
- data/lib/locomotive/steam/middlewares/missing_translations.rb +1 -1
- data/lib/locomotive/steam/services/api_entry_submission_service.rb +8 -1
- data/lib/locomotive/steam_adaptor.rb +9 -7
- data/lib/locomotive/version.rb +1 -1
- data/spec/fixtures/assets/ruby_logo.svg +948 -0
- data/spec/lib/locomotive/steam/services/api_entry_submission_service_spec.rb +1 -1
- data/spec/mailers/locomotive/notifications_spec.rb +39 -1
- data/spec/models/locomotive/concerns/site/url_redirections_spec.rb +42 -0
- data/spec/models/locomotive/theme_asset_spec.rb +29 -0
- data/spec/support/factories.rb +15 -1
- data/spec/support/features/site_helpers.rb +8 -1
- data/spec/support/shared_contexts/api_site_setup.rb +1 -1
- metadata +120 -106
- data/app/views/locomotive/shared/_footer.html.slim +0 -2
- data/app/views/locomotive/shared/_form_actions.html.slim +0 -14
- data/app/views/locomotive/shared/actions/_contents.html.slim +0 -7
- data/config/cucumber.yml +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5fcc2bd87ac0d01a19c8ea5f798ff338f1eb8fc
|
4
|
+
data.tar.gz: b189780fd9fbc5c04631715245fa79a068d355f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b3a1a9f8d51163f4c16999f78e02d9cbcde1b00875bbb8694be328d50d2afcece5af4f8eb087b6ebb0d0bae1322770f363a5100d99acd8785f148c86334762c
|
7
|
+
data.tar.gz: a48ea5fc1565b9a175ae2b3e515644fed3dd15664961c75a37ab152630108cd3052db6f50bd867f21381d6601ad2dfde8420d8180f3e57d25dcc99a0e72a8231
|
data/Gemfile
CHANGED
@@ -22,10 +22,8 @@ group :development do
|
|
22
22
|
# gem 'custom_fields', github: 'locomotivecms/custom_fields', ref: '15cceb66ed'
|
23
23
|
|
24
24
|
# gem 'locomotivecms_steam', path: '../in_progress/steam', require: false
|
25
|
-
# gem 'locomotivecms_steam', github: 'locomotivecms/steam', ref: '
|
25
|
+
# gem 'locomotivecms_steam', github: 'locomotivecms/steam', ref: 'c1d1120', require: false
|
26
26
|
|
27
|
-
# gem 'locomotive-aloha-rails', path: '../gems/aloha-rails' # for Developers
|
28
|
-
# gem 'locomotive-tinymce-rails', path: '../gems/tinymce-rails' # for Developers
|
29
27
|
# gem 'locomotive_liquid', path: '../gems/liquid' # for Developers
|
30
28
|
# gem 'locomotivecms_solid', path: '../gems/solid' # for Developers
|
31
29
|
|
@@ -42,6 +40,9 @@ group :development do
|
|
42
40
|
# gem 'unicorn-rails' # Using unicorn_rails instead of webrick (default server)
|
43
41
|
# gem 'thin'
|
44
42
|
gem 'puma'
|
43
|
+
|
44
|
+
# i18n-tasks helps you find and manage missing and unused translations.
|
45
|
+
gem 'i18n-tasks', '~> 0.8.7'
|
45
46
|
end
|
46
47
|
|
47
48
|
group :profile, :development do
|
data/README.md
CHANGED
@@ -40,7 +40,7 @@ If you can not wait for playing with our new version, you still can use the curr
|
|
40
40
|
|
41
41
|
## Technologies ##
|
42
42
|
|
43
|
-
Here is a list of the main gems used to power the Locomotive
|
43
|
+
Here is a list of the main gems used to power the Locomotive platform:
|
44
44
|
|
45
45
|
- Rails 4.2 - *web framework*
|
46
46
|
- Bootstrap - *UI framework*
|
@@ -55,6 +55,12 @@ Here is a list of the main gems used to power the Locomotive backend:
|
|
55
55
|
- Get help or discuss Locomotive at the [Locomotive Google group](https://groups.google.com/forum/?fromgroups#!forum/locomotivecms)
|
56
56
|
- [Follow us on twitter](http://twitter.com/locomotivecms)
|
57
57
|
|
58
|
+
## Translating the back-office ##
|
59
|
+
|
60
|
+
By default, the Locomotive back-office is fully translated in English. But adding a new language is pretty straightforward since we now manage all our I18n translation keys in [Transifex](https://www.transifex.com), a platform dedicated to this kind of task.
|
61
|
+
|
62
|
+
Here is our Transifex portal page: [https://www.transifex.com/locomotive/locomotive-engine](https://www.transifex.com/locomotive/locomotive-engine). Feel free to sign up and translate!
|
63
|
+
|
58
64
|
## Contributing to Locomotive ##
|
59
65
|
|
60
66
|
Locomotive is an open source project, we encourage contributions. If you have found a bug and want to contribute a fix, or have a new feature you would like to add, follow the steps below to get your patch into the project:
|
@@ -5,7 +5,10 @@ module Locomotive
|
|
5
5
|
class ContentTypeEntity < BaseEntity
|
6
6
|
|
7
7
|
expose :name, :slug, :description, :label_field_name, :order_direction,
|
8
|
-
:public_submission_enabled,
|
8
|
+
:public_submission_enabled,
|
9
|
+
:public_submission_accounts,
|
10
|
+
:public_submission_title_template,
|
11
|
+
:entry_template, :display_settings
|
9
12
|
|
10
13
|
expose :fields, using: ContentTypeFieldEntity do |content_type, _|
|
11
14
|
content_type.ordered_entries_custom_fields || []
|
@@ -52,9 +52,11 @@ module Locomotive
|
|
52
52
|
|
53
53
|
# @override - only return set attributes
|
54
54
|
def serializable_hash
|
55
|
-
changed.
|
55
|
+
changed.sort_by do |name|
|
56
|
+
self.class.attributes.index(:"#{name}=")
|
57
|
+
end.inject({}) do |hash, attribute|
|
56
58
|
hash.merge({ attribute => send(attribute) })
|
57
|
-
end.with_indifferent_access
|
59
|
+
end.to_h.with_indifferent_access
|
58
60
|
end
|
59
61
|
|
60
62
|
def persisted?
|
@@ -61,8 +61,9 @@ module Locomotive
|
|
61
61
|
optional :entry_template
|
62
62
|
optional :raw_item_template # deprecated
|
63
63
|
optional :display_settings
|
64
|
-
optional :public_submission_account_emails
|
65
64
|
optional :public_submission_enabled
|
65
|
+
optional :public_submission_account_emails
|
66
|
+
optional :public_submission_title_template
|
66
67
|
end
|
67
68
|
end
|
68
69
|
post do
|
@@ -105,8 +106,9 @@ module Locomotive
|
|
105
106
|
optional :entry_template
|
106
107
|
optional :raw_item_template # deprecated
|
107
108
|
optional :display_settings
|
108
|
-
optional :public_submission_account_emails
|
109
109
|
optional :public_submission_enabled
|
110
|
+
optional :public_submission_account_emails
|
111
|
+
optional :public_submission_title_template
|
110
112
|
end
|
111
113
|
end
|
112
114
|
put ':id' do
|
@@ -44,6 +44,14 @@ module Locomotive
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
+
def new_url_redirection
|
48
|
+
if params[:url_redirection].present? && params[:url_redirection].include?(' ')
|
49
|
+
render partial: 'url_redirection', locals: { url_redirection: params[:url_redirection].split(' ') }
|
50
|
+
else
|
51
|
+
head :unprocessable_entity
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
47
55
|
private
|
48
56
|
|
49
57
|
def load_site
|
@@ -46,9 +46,9 @@ module Locomotive
|
|
46
46
|
|
47
47
|
def options_for_page_blocks(blocks)
|
48
48
|
options_for_select(
|
49
|
-
[[t('.blocks
|
49
|
+
[[t(:all, scope: 'locomotive.editable_elements.edit.blocks'), '']] +
|
50
50
|
blocks.map do |block|
|
51
|
-
block[:name].nil? ? [t('.blocks
|
51
|
+
block[:name].nil? ? [t(:unknown, scope: 'locomotive.editable_elements.edit.blocks'), '_unknown'] : [block[:label], block[:name]]
|
52
52
|
end)
|
53
53
|
end
|
54
54
|
|
@@ -9,13 +9,17 @@ module Locomotive
|
|
9
9
|
options = Locomotive.config.host ? { host: Locomotive.config.host } : { only_path: true }
|
10
10
|
|
11
11
|
if Locomotive::Account.count == 0
|
12
|
-
[
|
12
|
+
[no_site_message(:create_account), sign_up_url(options)]
|
13
13
|
elsif current_locomotive_account
|
14
|
-
[
|
14
|
+
[no_site_message(:add_domain), sites_url(options)]
|
15
15
|
else
|
16
|
-
[
|
16
|
+
[no_site_message(:sign_in), new_locomotive_account_session_url(options)]
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
def no_site_message(error_type)
|
21
|
+
t(error_type, host: request.host, scope: 'locomotive.errors.no_site.messsage')
|
22
|
+
end
|
23
|
+
|
20
24
|
end
|
21
25
|
end
|
@@ -39,8 +39,8 @@ module Locomotive
|
|
39
39
|
|
40
40
|
def options_for_page_redirect_type
|
41
41
|
[
|
42
|
-
[t('
|
43
|
-
[t('
|
42
|
+
[t('redirect_type.permanent', scope: 'locomotive.pages.form'), 301],
|
43
|
+
[t('redirect_type.temporary', scope: 'locomotive.pages.form'), 302]
|
44
44
|
]
|
45
45
|
end
|
46
46
|
|
@@ -12,7 +12,7 @@ module Locomotive
|
|
12
12
|
|
13
13
|
def account_avatar_and_name(account, size = '70x70#')
|
14
14
|
avatar = image_tag(account_avatar_url(account, size), class: 'img-circle', style: 'width: 20px')
|
15
|
-
profile = avatar + (account.try(:name) || t('.
|
15
|
+
profile = avatar + (account.try(:name) || t(:unknown_account, scope: 'locomotive.dashboard.activity'))
|
16
16
|
end
|
17
17
|
|
18
18
|
end
|
@@ -8,13 +8,13 @@ module Locomotive
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def api_key_html
|
11
|
-
api_key = object.api_key || I18n.t('locomotive.
|
11
|
+
api_key = object.api_key || I18n.t('simple_form.labels.locomotive.account.no_api_key')
|
12
12
|
template.content_tag :code, api_key
|
13
13
|
end
|
14
14
|
|
15
15
|
def regenerate_button
|
16
16
|
url = options[:url]
|
17
|
-
template.content_tag :button, I18n.t('locomotive.
|
17
|
+
template.content_tag :button, I18n.t('simple_form.buttons.locomotive.account.new_api_key'),
|
18
18
|
class: 'btn btn-default btn-primary btn-sm',
|
19
19
|
data: {
|
20
20
|
url: url,
|
@@ -4,16 +4,27 @@ module Locomotive
|
|
4
4
|
default from: Locomotive.config.mailer_sender
|
5
5
|
|
6
6
|
def new_content_entry(account, entry)
|
7
|
-
@
|
7
|
+
@site, @account = entry.site, account
|
8
|
+
@entry, @type = entry, entry.content_type
|
8
9
|
|
9
10
|
@domain = entry.site.domains.first ||
|
10
11
|
ActionMailer::Base.default_url_options[:host] ||
|
11
12
|
'localhost'
|
12
13
|
|
13
|
-
subject =
|
14
|
+
subject = new_content_entry_subject(entry, domain: @domain, type: @type.name, locale: account.locale)
|
14
15
|
|
15
16
|
mail subject: subject, to: account.email
|
16
17
|
end
|
17
|
-
end
|
18
18
|
|
19
|
+
protected
|
20
|
+
|
21
|
+
def new_content_entry_subject(entry, options)
|
22
|
+
if entry.content_type.public_submission_title_template.blank?
|
23
|
+
t('locomotive.notifications.new_content_entry.subject', options)
|
24
|
+
else
|
25
|
+
entry.content_type.public_submission_title(entry, options)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
19
30
|
end
|
@@ -25,7 +25,13 @@ module Locomotive
|
|
25
25
|
def to_steam_entry(entry)
|
26
26
|
entry_attributes = entry.attributes.symbolize_keys
|
27
27
|
|
28
|
-
steam_repositories.content_entry.with(to_steam).build(entry_attributes)
|
28
|
+
steam_repositories.content_entry.with(to_steam).build(entry_attributes).tap do |entity|
|
29
|
+
# copy error messages
|
30
|
+
entry.errors.each do |name, message|
|
31
|
+
next if name == :_slug
|
32
|
+
entity.errors.add(name, message)
|
33
|
+
end
|
34
|
+
end
|
29
35
|
end
|
30
36
|
|
31
37
|
def steam_repositories
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Locomotive
|
2
|
+
module Concerns
|
3
|
+
module ContentType
|
4
|
+
module PublicSubmissionTitleTemplate
|
5
|
+
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
included do
|
9
|
+
field :public_submission_title_template
|
10
|
+
end
|
11
|
+
|
12
|
+
def public_submission_title(entry, options)
|
13
|
+
template = ::Liquid::Template.parse(self.public_submission_title_template, {})
|
14
|
+
|
15
|
+
assigns = { 'site' => self.site, 'entry' => entry }.merge(options)
|
16
|
+
registers = { site: self.site }
|
17
|
+
|
18
|
+
template.render(::Liquid::Context.new({}, assigns, registers))
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Locomotive
|
2
|
+
module Concerns
|
3
|
+
module Site
|
4
|
+
module UrlRedirections
|
5
|
+
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
included do
|
9
|
+
|
10
|
+
## fields ##
|
11
|
+
field :url_redirections, type: Array
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
def url_redirections=(array)
|
16
|
+
super((array || []).flatten.map do |path|
|
17
|
+
add_leading_slash_to(path)
|
18
|
+
end.each_slice(2).to_a)
|
19
|
+
end
|
20
|
+
|
21
|
+
protected
|
22
|
+
|
23
|
+
def add_leading_slash_to(path)
|
24
|
+
path.starts_with?('/') ? path : "/#{path}"
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -77,6 +77,10 @@ module Locomotive
|
|
77
77
|
|
78
78
|
alias :to_label :_label
|
79
79
|
|
80
|
+
def content_type_slug
|
81
|
+
self.content_type.try(:slug)
|
82
|
+
end
|
83
|
+
|
80
84
|
def as_json(*args)
|
81
85
|
super.tap { |json| json['_label'] = _label }
|
82
86
|
end
|
@@ -116,8 +120,12 @@ module Locomotive
|
|
116
120
|
end
|
117
121
|
end
|
118
122
|
|
123
|
+
def to_steam(type = nil)
|
124
|
+
(type || self.content_type).to_steam_entry(self)
|
125
|
+
end
|
126
|
+
|
119
127
|
def to_liquid(type = nil)
|
120
|
-
(type
|
128
|
+
to_steam(type).to_liquid
|
121
129
|
end
|
122
130
|
|
123
131
|
def touch_site_attribute
|
@@ -130,7 +130,7 @@ module Locomotive
|
|
130
130
|
|
131
131
|
def build_fullpath
|
132
132
|
if self.index_or_not_found?
|
133
|
-
self.fullpath = self.slug
|
133
|
+
self.site.each_locale { |locale, current| self.fullpath = self.slug }
|
134
134
|
else
|
135
135
|
_parent = self.parent # do not hit the database more than once
|
136
136
|
|
@@ -46,16 +46,17 @@ 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]
|
50
|
-
hash = { domains: [], locales: [] }
|
49
|
+
plain = [:name, :handle, :picture, :remove_picture, :seo_title, :meta_keywords, :meta_description, :timezone_name, :robots_txt, :cache_enabled, :redirect_to_first_domain]
|
50
|
+
hash = { domains: [], locales: [], url_redirections: [] }
|
51
51
|
|
52
52
|
unless update_advanced?
|
53
53
|
plain -= [:timezone_name, :robots_txt, :cache_enabled]
|
54
54
|
hash.delete(:locales)
|
55
|
+
hash.delete(:url_redirections)
|
55
56
|
end
|
56
57
|
|
57
58
|
unless point?
|
58
|
-
plain -= [:handle]
|
59
|
+
plain -= [:handle, :redirect_to_first_domain]
|
59
60
|
hash.delete(:domains)
|
60
61
|
end
|
61
62
|
|
@@ -13,15 +13,12 @@ module Locomotive
|
|
13
13
|
%w(jpg jpeg gif png css js swf flv eot svg ttf woff woff2 otf ico htc map)
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
uploader = ThemeAssetUploader.new(asset)
|
23
|
-
uploader.retrieve_from_store!(File.basename(path))
|
24
|
-
uploader
|
16
|
+
def apply_content_type_exception(value)
|
17
|
+
if content_type == 'image/svg+xml' && model.folder.starts_with?('fonts')
|
18
|
+
:font
|
19
|
+
else
|
20
|
+
value
|
21
|
+
end
|
25
22
|
end
|
26
23
|
|
27
24
|
def self.content_types
|
@@ -31,7 +31,7 @@
|
|
31
31
|
|
32
32
|
|
|
33
33
|
|
34
|
-
= link_to content_asset_path(current_site, asset, params.slice(:types, :query, :page, :per_page)), class: 'remove', method: :delete, data: { confirm: t('locomotive.messages.confirm'), return_url: request.original_url }, title: t('
|
34
|
+
= link_to content_asset_path(current_site, asset, params.slice(:types, :query, :page, :per_page)), class: 'remove', method: :delete, data: { confirm: t('locomotive.messages.confirm'), return_url: request.original_url }, title: t(:delete, scope: 'simple_form.buttons.defaults.locomotive'), remote: remote do
|
35
35
|
i.fa.fa-trash-o
|
36
36
|
|
37
37
|
.text-center
|
@@ -17,7 +17,7 @@
|
|
17
17
|
= item._label
|
18
18
|
|
19
19
|
.buttons
|
20
|
-
= link_to t(:edit, scope: 'locomotive.
|
20
|
+
= link_to t(:edit, scope: 'locomotive.inputs.array'), edit_content_entry_path(current_site, slug, item, _location: false), class: 'choose btn btn-primary btn-sm'
|
21
21
|
|
|
22
22
|
= link_to '#', class: 'delete' do
|
23
23
|
i.fa.fa-trash-o
|