locomotive_cms 2.4.1 → 2.5.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.textile +3 -3
- data/app/assets/images/locomotive/icons/flags/sk.png +0 -0
- data/app/assets/javascripts/aloha/plugins/custom/locomotive_media/lib/locomotive_media-plugin.js +1 -1
- data/app/assets/javascripts/locomotive/models/content_asset.js.coffee +7 -1
- data/app/assets/javascripts/locomotive/utils/aloha_settings.js.coffee +1 -1
- data/app/assets/javascripts/locomotive/utils/core_ext.js +1 -1
- data/app/assets/javascripts/locomotive/views/content_assets/picker_item_view.js.coffee +12 -0
- data/app/assets/javascripts/locomotive/views/content_assets/picker_view.js.coffee +149 -15
- data/app/assets/javascripts/locomotive/views/shared/asset_picker_view.js.coffee +16 -4
- data/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee +1 -1
- data/app/assets/javascripts/locomotive/views/shared/list_item_view.js.coffee +1 -1
- data/app/assets/javascripts/tinymce/plugins/locomotive_media/editor_plugin.js +1 -1
- data/app/assets/stylesheets/locomotive/backoffice/_buttons.css.scss +56 -0
- data/app/assets/stylesheets/locomotive/backoffice/application.css.scss +6 -0
- data/app/assets/stylesheets/locomotive/backoffice/content_assets.css.scss +74 -4
- data/app/assets/stylesheets/locomotive/backoffice/dialog_changes.css.scss +4 -0
- data/app/assets/stylesheets/locomotive/shared/common.css.scss +7 -0
- data/app/controllers/locomotive/api/documentation_controller.rb +8 -2
- data/app/controllers/locomotive/api/pages_controller.rb +1 -1
- data/app/controllers/locomotive/content_assets_controller.rb +4 -0
- data/app/models/locomotive/content_asset.rb +5 -1
- data/app/models/locomotive/content_entry.rb +7 -2
- data/app/models/locomotive/content_type.rb +1 -1
- data/app/models/locomotive/editable_element.rb +1 -0
- data/app/models/locomotive/extensions/asset/types.rb +9 -4
- data/app/models/locomotive/extensions/asset/vignette.rb +2 -0
- data/app/models/locomotive/extensions/content_entry/csv.rb +2 -2
- data/app/models/locomotive/extensions/content_entry/localized.rb +18 -0
- data/app/models/locomotive/page.rb +2 -2
- data/app/models/locomotive/snippet.rb +8 -7
- data/app/models/locomotive/theme_asset.rb +12 -6
- data/app/models/locomotive/translation.rb +1 -1
- data/app/views/locomotive/content_assets/_picker.html.haml +23 -2
- data/app/views/locomotive/pages/_page.html.haml +2 -0
- data/app/views/locomotive/shared/_header.html.haml +3 -1
- data/app/views/locomotive/shared/_main_app_header.html.haml +1 -0
- data/app/views/locomotive/translations/index.html.haml +1 -1
- data/config/locales/admin_ui.bg.yml +1 -0
- data/config/locales/admin_ui.cs.yml +1 -0
- data/config/locales/admin_ui.de.yml +1 -0
- data/config/locales/admin_ui.en.yml +7 -0
- data/config/locales/admin_ui.es.yml +1 -0
- data/config/locales/admin_ui.et.yml +1 -0
- data/config/locales/admin_ui.fr.yml +12 -2
- data/config/locales/admin_ui.it.yml +1 -0
- data/config/locales/admin_ui.ja.yml +1 -0
- data/config/locales/admin_ui.nb.yml +1 -0
- data/config/locales/admin_ui.nl.yml +1 -0
- data/config/locales/admin_ui.pl.yml +1 -0
- data/config/locales/admin_ui.pt-BR.yml +1 -0
- data/config/locales/admin_ui.ru.yml +8 -4
- data/config/locales/admin_ui.sk.yml +360 -0
- data/config/locales/admin_ui.zh-CN.yml +1 -0
- data/config/locales/carrierwave.sk.yml +4 -0
- data/config/locales/default.fr.yml +3 -0
- data/config/locales/default.ru.yml +18 -7
- data/config/locales/default.sk.yml +249 -0
- data/config/locales/devise.sk.yml +64 -0
- data/config/locales/flash.sk.yml +115 -0
- data/config/locales/formtastic.fr.yml +7 -1
- data/config/locales/formtastic.sk.yml +125 -0
- data/config/routes.rb +2 -0
- data/lib/generators/locomotive/install/install_generator.rb +6 -0
- data/lib/generators/locomotive/install/templates/dragonfly.rb +16 -13
- data/lib/generators/locomotive/install/templates/locomotive.rb +7 -2
- data/lib/locomotive.rb +3 -15
- data/lib/locomotive/action_controller/responder.rb +8 -1
- data/lib/locomotive/carrierwave/asset.rb +0 -4
- data/lib/locomotive/configuration.rb +4 -3
- data/lib/locomotive/dragonfly.rb +20 -5
- data/lib/locomotive/liquid/drops/content_entry.rb +1 -1
- data/lib/locomotive/liquid/filters/base.rb +4 -0
- data/lib/locomotive/liquid/filters/translate.rb +4 -0
- data/lib/locomotive/liquid/tags/path_helper.rb +5 -2
- data/lib/locomotive/middlewares.rb +2 -1
- data/lib/locomotive/misc/api_documentation.rb +3 -1
- data/lib/locomotive/render.rb +7 -6
- data/lib/locomotive/version.rb +1 -1
- data/lib/tasks/development.rake +21 -0
- data/spec/dummy/config/initializers/dragonfly.rb +16 -13
- data/spec/dummy/config/initializers/locomotive.rb +9 -5
- data/spec/fixtures/assets/specs.pdf +0 -0
- data/spec/lib/locomotive/liquid/filters/html_spec.rb +22 -13
- data/spec/models/locomotive/content_asset_spec.rb +9 -0
- data/spec/models/locomotive/content_entry_spec.rb +57 -6
- data/spec/models/locomotive/extensions/content_entry/csv_spec.rb +30 -0
- data/spec/support/locomotive.rb +2 -1
- data/vendor/assets/javascripts/locomotive/ICanHandlebarz.js +1 -1
- data/vendor/assets/javascripts/locomotive/backbone.sync.js +14 -1
- metadata +34 -9
- data/lib/locomotive/middlewares/cache.rb +0 -27
@@ -22,6 +22,7 @@ fr:
|
|
22
22
|
presentation: Présentation
|
23
23
|
attributes: Propriétés
|
24
24
|
upload: Envoi au serveur
|
25
|
+
access_points: Domaines
|
25
26
|
|
26
27
|
labels:
|
27
28
|
theme_asset:
|
@@ -39,8 +40,9 @@ fr:
|
|
39
40
|
raw_item_template: Template d'affichage
|
40
41
|
api_accounts: Comptes à notifier
|
41
42
|
content_entry:
|
42
|
-
_slug:
|
43
|
+
_slug: Permalien
|
43
44
|
_visible: Visible
|
45
|
+
seo_title: Titre Seo
|
44
46
|
account:
|
45
47
|
api_key: Clé API
|
46
48
|
edit:
|
@@ -72,6 +74,7 @@ fr:
|
|
72
74
|
meta_keywords: "Mots-clés utilisés à l'intérieur de la balise HEAD. Ils sont séparés par une virgule. Requis pour un meilleur référencement."
|
73
75
|
meta_description: "Description utilisée à l'intérieur de la balise HEAD. Requis pour un meilleur référencement."
|
74
76
|
domain_name: "ex: locomotiveapp.org"
|
77
|
+
robots_txt: "Contenu du fichier <span class='code'>/robots.txt</span>. Consultez cette <a href='http://www.w3.org/TR/html4/appendix/notes.html#h-B.4.1.1'>page</a> pour plus d'informations."
|
75
78
|
new:
|
76
79
|
locales: "Vous pourrez ajouter d'autres langues une fois le site crée."
|
77
80
|
theme_asset:
|
@@ -101,3 +104,6 @@ fr:
|
|
101
104
|
raw_item_template: "Personnaliser le texte affiché pour chaque élément de la liste. Utilisez simplement du code Liquid. Ex: {{ entry.name }}"
|
102
105
|
public_submission_enabled: "Utilisé pour autoriser la création de nouvelles instances de l'extérieur (ex.: les messages dans un formulaire de contact)"
|
103
106
|
public_submission_accounts: "Un email de notification sera envoyé à chaque compte listé ci-dessus lors de la création d'une nouvelle instance"
|
107
|
+
"custom_fields/field":
|
108
|
+
name: "Nom de l'objet pour les templates liquid. Ex: <span class='code'>{{ votre_objet.<nom_de_votre_champ> }}</span>"
|
109
|
+
hint: "Texte affiché sous le formulaire de modèle juste en dessous du champ"
|
@@ -0,0 +1,125 @@
|
|
1
|
+
cs:
|
2
|
+
formtastic:
|
3
|
+
titles:
|
4
|
+
information: Hlavné informácie
|
5
|
+
advanced_options: Dalšie možnosti
|
6
|
+
meta: SEO Metadata
|
7
|
+
seo: SEO možnosti
|
8
|
+
robots_txt: Súbor robots.txt
|
9
|
+
code: Kód
|
10
|
+
raw_template: Šablona
|
11
|
+
credentials: Prihlasovacie údaje
|
12
|
+
language: Jazyk
|
13
|
+
sites: Weby
|
14
|
+
access_points: Prístupové body
|
15
|
+
memberships: Účty
|
16
|
+
membership_email: Email účtu
|
17
|
+
file: Súbor
|
18
|
+
preview: Náhľad
|
19
|
+
options: Dalšie možnosti
|
20
|
+
custom_fields: Vlastné pole
|
21
|
+
other_fields: Dalšie informácie
|
22
|
+
presentation: Prezentácia
|
23
|
+
attributes: Atribúty
|
24
|
+
upload: Upload
|
25
|
+
labels:
|
26
|
+
theme_asset:
|
27
|
+
plain_text_name: Názov súboru
|
28
|
+
content_type: Typ súboru
|
29
|
+
new:
|
30
|
+
source: Súbor
|
31
|
+
edit:
|
32
|
+
source: Nahradiť súbor
|
33
|
+
custom_fields:
|
34
|
+
field:
|
35
|
+
name: Alias
|
36
|
+
content_type:
|
37
|
+
raw_item_template: Šablóna položky
|
38
|
+
public_submission_enabled: Verejné vkládánie
|
39
|
+
public_submission_accounts: Upozorňované účty
|
40
|
+
"custom_fields/field":
|
41
|
+
select_options: "Možnosti"
|
42
|
+
name: Názov
|
43
|
+
slug: Permalink
|
44
|
+
description: Popis
|
45
|
+
label_field_id: Atribút názvu
|
46
|
+
group_by_field_id: Atribut pre zoskupovanie
|
47
|
+
order_by: zoradiť podľa
|
48
|
+
order_direction: Smer zoradenia
|
49
|
+
content_entry:
|
50
|
+
_slug: Permalink
|
51
|
+
_visible: Viditeľnosť
|
52
|
+
seo_title: SEO titulok
|
53
|
+
meta_keywords: Klúčové slová
|
54
|
+
meta_description: Popis
|
55
|
+
account:
|
56
|
+
api_key: API kľúč
|
57
|
+
edit:
|
58
|
+
locale: Jazyk prostredia
|
59
|
+
password: Nové heslo
|
60
|
+
password_confirmation: Potvrdenie nového hesla
|
61
|
+
page:
|
62
|
+
seo_title: Titulok
|
63
|
+
target_klass_name: Model
|
64
|
+
site:
|
65
|
+
seo_title: SEO titulok
|
66
|
+
meta_keywords: Kľúčové slová
|
67
|
+
meta_description: Popis webu
|
68
|
+
locales: Jazyky
|
69
|
+
timezone_name: Časové pásma
|
70
|
+
new:
|
71
|
+
locales: Prvý jazyk
|
72
|
+
|
73
|
+
hints:
|
74
|
+
page:
|
75
|
+
handle: "Unikátny identifikátor k načítaniu tejto stránky v inštancí externého controlleru."
|
76
|
+
published: "Iba prihlásené účty môžu vidieť nepublikovaný obsah."
|
77
|
+
cache_strategy: "Cache stránky sa využívá k vyššej rýchlosti načítania. Voľba 'Jednoduchá' je dobrým kompromisom."
|
78
|
+
templatized: "Použít stránku ako šablónu pre definovaný model."
|
79
|
+
listed: "Určuje, či zobrazovať stránku v generovaných menu."
|
80
|
+
target_klass_name: "Druh obsahu, ktorému bude tato stránka šablónou."
|
81
|
+
seo_title: "Hodnota, ktorú doplníte, nahradí SEO titulok zo šablóny priradenej tomuto modelu. Nechajte prázdne, ak chcete použíť štandardnú hodnotu z nastavení webu."
|
82
|
+
meta_keywords: "Nahradí klíčové slova webu použité v hlavičke stránky. Sú oddelené čiarkou."
|
83
|
+
meta_description: "Nahradí popis webu použitý v hlavičke stránky."
|
84
|
+
snippet:
|
85
|
+
slug: "Cez tento názov ho vložíte do stránky."
|
86
|
+
site:
|
87
|
+
locales: "Presuňte vlajku na prvé miesto, aby ste ju udelali predvoleným jazykom."
|
88
|
+
seo_title: "Určite obecnú hodnotu, ktorá bude slúžiť na webe ako východzí titulok."
|
89
|
+
meta_keywords: "Klúčové slová webu použitá v hlavičke webu. Sú oddelené čiarkou. Vyžadováné pre SEO."
|
90
|
+
meta_description: "Popis webu použitý v hlavičke webu. Vyžadovaný pre SEO."
|
91
|
+
domain_name: "napr: locomotiveapp.org"
|
92
|
+
robots_txt: "Obsah súboru <span class='code'>/robots.txt</span>. Pre viac informacií kliknite na tuto <a href='http://www.w3.org/TR/html4/appendix/notes.html#h-B.4.1.1'>url</a>."
|
93
|
+
new:
|
94
|
+
locales: "Dalšie jazyky budete môcť pridať po vytvorení webu."
|
95
|
+
theme_asset:
|
96
|
+
slug: "nie je potreba pridávať koncovku (.css alebo .js)"
|
97
|
+
edit:
|
98
|
+
source: "Môžete ho nahradiť súborom rovnakého typu."
|
99
|
+
translation:
|
100
|
+
key: "Nepoužívejte pomlčky, ale radšej podtržníky. Príklad: welcome_message."
|
101
|
+
asset:
|
102
|
+
source: "Povolené sú všetky typy súborov."
|
103
|
+
edit:
|
104
|
+
source: "Súčasný súbor je dostupný na %{url}"
|
105
|
+
update:
|
106
|
+
source: "Súčasný súbor je dostupný na %{url}"
|
107
|
+
content_entry:
|
108
|
+
_slug: "Vlastnosť slúžiaca k vygenerovaniu url adresy stránky pre tento druh obsahu (napr: \"template_page/{{ your_object._permalink }})\"."
|
109
|
+
_visible: "Štandardne sa obsah na stránke zobrazuje. Tento prepínač môže slúžiť k označeniu už publikovaného obsahu."
|
110
|
+
seo_title: "Hodnota, ktorú doplníte, nahradí SEO titulok zo šablóny priradenej tomuto modelu."
|
111
|
+
meta_keywords: "Nahradí kľúčová slová webu použité v hlavičke stránky. Sú oddelené čiarkou."
|
112
|
+
meta_description: "Nahradí popis webu použitý v hlavičke stránky."
|
113
|
+
import:
|
114
|
+
source: "Archív zip obsahujúci database.yml spolu sa všetkými šablónami a potrebnými súbory"
|
115
|
+
samples: "Ak je povolené, budú počas importu kopírované obsahy aj súbory"
|
116
|
+
reset: "Ak je povolené, všetky dáta z webu budú pred importom odstránené"
|
117
|
+
content_type:
|
118
|
+
name: "Odporúčame použiť názov modelu v množnom čísle a v angličtine. Napr.: Projects, Recipes, Posts, Articles, apod."
|
119
|
+
slug: "Bude použitý ako názov kolekcie pre liquid šablóny. Pr.: <span class='code'>{{ contents.my_projects }}</span>"
|
120
|
+
raw_item_template: "Môžete špecifikovať text zobrazený pre každú položku z kolekcie. Jednoducho použite Liquid. Pr.: <span class='code'>{{ zaznam.nazov }})</span>"
|
121
|
+
public_submission_enabled: "Používa sa pre vkladanie obsahu ľuďmi z vonku (príklad: správy v kontaktnom formulári)"
|
122
|
+
public_submission_accounts: "Ak je verejné vkladanie zapnuté, vyššie napísané účty obdržia pri vytvorení nového záznamu informačný email."
|
123
|
+
"custom_fields/field":
|
124
|
+
name: "Názov vlastnosti pre šablóny liquid. Napr: <span class='code'>{{ vas_objekt.<nazev_pole> }}</span>"
|
125
|
+
hint: "Text zobrazený v modeli pod príslušným poľom."
|
data/config/routes.rb
CHANGED
@@ -65,6 +65,8 @@ Rails.application.routes.draw do
|
|
65
65
|
namespace :locomotive, module: 'locomotive' do
|
66
66
|
namespace :api do
|
67
67
|
|
68
|
+
match 'documentation' => 'documentation#show'
|
69
|
+
|
68
70
|
resources :tokens, only: [:create, :destroy]
|
69
71
|
|
70
72
|
resource :current_site, controller: 'current_site', only: [:show, :update, :destroy]
|
@@ -1,21 +1,24 @@
|
|
1
1
|
require 'dragonfly'
|
2
2
|
|
3
|
-
|
3
|
+
# Configure
|
4
|
+
Dragonfly.app.configure do
|
5
|
+
plugin :imagemagick,
|
6
|
+
convert_command: `which convert`.strip.presence || '/usr/local/bin/convert',
|
7
|
+
identify_command: `which identify`.strip.presence || '/usr/local/bin/identify'
|
4
8
|
|
5
|
-
|
6
|
-
app.configure_with(:rails)
|
7
|
-
app.configure_with(:imagemagick)
|
9
|
+
protect_from_dos_attacks true
|
8
10
|
|
9
|
-
|
11
|
+
secret '<%= generate_secret %>'
|
10
12
|
|
11
|
-
|
12
|
-
# Convert absolute location needs to be specified
|
13
|
-
# to avoid issues with Phusion Passenger not using $PATH
|
14
|
-
c.convert_command = `which convert`.strip.presence || "/usr/local/bin/convert"
|
15
|
-
c.identify_command = `which identify`.strip.presence || "/usr/local/bin/identify"
|
13
|
+
url_format '/images/dynamic/:job/:basename.:ext'
|
16
14
|
|
17
|
-
|
18
|
-
c.allow_fetch_file = true
|
15
|
+
fetch_file_whitelist /public/
|
19
16
|
|
20
|
-
|
17
|
+
fetch_url_whitelist /.+/
|
21
18
|
end
|
19
|
+
|
20
|
+
# Logger
|
21
|
+
Dragonfly.logger = Rails.logger
|
22
|
+
|
23
|
+
# Mount as middleware
|
24
|
+
Rails.application.middleware.use Dragonfly::Middleware
|
@@ -23,11 +23,11 @@ Locomotive.configure do |config|
|
|
23
23
|
# per_page: 10
|
24
24
|
# }
|
25
25
|
|
26
|
-
# default locale (for now, only en, de, fr, pl, pt-BR, it, nb, ja, zh-CN, cs and
|
26
|
+
# default locale (for now, only en, de, fr, pl, pt-BR, it, nb, ja, zh-CN, cs, bg and sk are supported)
|
27
27
|
config.default_locale = :en
|
28
28
|
|
29
29
|
# available locales suggested to "localize" a site. You will have to pick up at least one among that list.
|
30
|
-
# config.site_locales = %w{en de fr pl pt-BR it nl nb es ru ja zh-CN cs bg}
|
30
|
+
# config.site_locales = %w{en de fr pl pt-BR it nl nb es ru ja zh-CN cs bg sk}
|
31
31
|
|
32
32
|
# tell if logs are enabled. Useful for debug purpose.
|
33
33
|
config.enable_logs = true
|
@@ -60,6 +60,11 @@ Locomotive.configure do |config|
|
|
60
60
|
#
|
61
61
|
# config.csrf_protection = true
|
62
62
|
|
63
|
+
# Add the checksum of a theme asset at the end of its path to allow public caching.
|
64
|
+
# By default, it's disabled.
|
65
|
+
#
|
66
|
+
# config.theme_assets_checksum = true
|
67
|
+
|
63
68
|
# Rack-cache settings, mainly used for the inline resizing image module. Default options:
|
64
69
|
# config.rack_cache = {
|
65
70
|
# verbose: true,
|
data/lib/locomotive.rb
CHANGED
@@ -59,28 +59,21 @@ module Locomotive
|
|
59
59
|
domain: :all
|
60
60
|
}
|
61
61
|
|
62
|
-
# add middlewares (
|
62
|
+
# add middlewares (font, seo, ...etc)
|
63
63
|
self.add_middlewares
|
64
64
|
|
65
65
|
# enable the hosting solution if both we are not in test or dev and that the config.hosting option has been filled up
|
66
66
|
self.enable_hosting
|
67
67
|
|
68
68
|
# Check for outdated Dragonfly config
|
69
|
-
|
70
|
-
|
71
|
-
Locomotive.log :warn, "WARNING: Old Dragonfly config detected, image uploads might be broken. Use 'rails g locomotive:install' to get the latest configuration files."
|
69
|
+
if ::Dragonfly::VERSION =~ /^0\.9\.([0-9]+)/
|
70
|
+
Locomotive.log :error, "WARNING: Old Dragonfly config detected, image uploads might be broken. Use 'rails g locomotive:install' to get the latest configuration files."
|
72
71
|
end
|
73
72
|
end
|
74
73
|
|
75
74
|
def self.add_middlewares
|
76
75
|
self.app_middleware.insert 0, '::Locomotive::Middlewares::Permalink'
|
77
76
|
|
78
|
-
self.app_middleware.insert 1, 'Dragonfly::Middleware', :images
|
79
|
-
|
80
|
-
if self.rack_cache?
|
81
|
-
self.app_middleware.insert_before 'Dragonfly::Middleware', '::Locomotive::Middlewares::Cache', self.config.rack_cache
|
82
|
-
end
|
83
|
-
|
84
77
|
self.app_middleware.use '::Locomotive::Middlewares::SeoTrailingSlash'
|
85
78
|
|
86
79
|
self.app_middleware.use '::Locomotive::Middlewares::InlineEditor'
|
@@ -120,11 +113,6 @@ module Locomotive
|
|
120
113
|
::Locomotive::Logger.send(level.to_sym, message)
|
121
114
|
end
|
122
115
|
|
123
|
-
# rack_cache: needed by default
|
124
|
-
def self.rack_cache?
|
125
|
-
self.config.rack_cache != false
|
126
|
-
end
|
127
|
-
|
128
116
|
def self.mounted_on
|
129
117
|
Rails.application.routes.named_routes[:locomotive].path.spec.to_s
|
130
118
|
end
|
@@ -23,6 +23,7 @@ module Locomotive
|
|
23
23
|
|
24
24
|
def to_json
|
25
25
|
if get?
|
26
|
+
add_pagination_header if resource.respond_to?(:num_pages)
|
26
27
|
display resource
|
27
28
|
elsif has_errors?
|
28
29
|
with_flash_message(:alert) do
|
@@ -55,7 +56,7 @@ module Locomotive
|
|
55
56
|
def with_flash_message(type = :notice, in_header = true)
|
56
57
|
if in_header
|
57
58
|
set_flash_message!
|
58
|
-
message = URI::escape(controller.flash[type].to_str) if controller.flash[type]
|
59
|
+
message = URI::escape(controller.flash[type].to_str) if controller.flash[type]
|
59
60
|
|
60
61
|
unless message.blank?
|
61
62
|
controller.headers['X-Message'] = ActiveSupport::JSON::Encoding.escape(message)
|
@@ -72,6 +73,12 @@ module Locomotive
|
|
72
73
|
end
|
73
74
|
end
|
74
75
|
|
76
|
+
def add_pagination_header
|
77
|
+
controller.headers['X-Total-Pages'] = resource.num_pages.to_s
|
78
|
+
controller.headers['X-Per-Page'] = resource.limit_value.to_s
|
79
|
+
controller.headers['X-Total-Entries'] = resource.total_count.to_s
|
80
|
+
end
|
81
|
+
|
75
82
|
end
|
76
83
|
end
|
77
84
|
end
|
@@ -57,10 +57,6 @@ module Locomotive
|
|
57
57
|
|
58
58
|
def set_width_and_height
|
59
59
|
if model.image?
|
60
|
-
conf = Dragonfly.app.configuration
|
61
|
-
if conf[:identify_command] == conf[:convert_command]
|
62
|
-
Rails.logger.warn "WARNING: Old Dragonfly config detected, image uploads might be broken. Use 'rails g locomotive:install' to get the latest configuration files."
|
63
|
-
end
|
64
60
|
dragonfly_img = Dragonfly.app.fetch_file(current_path)
|
65
61
|
model.width, model.height = dragonfly_img.width, dragonfly_img.height
|
66
62
|
end
|
@@ -7,8 +7,8 @@ module Locomotive
|
|
7
7
|
reserved_subdomains: %w{www admin email blog webmail mail support help site sites},
|
8
8
|
# forbidden_paths: %w{layouts snippets stylesheets javascripts assets admin system api},
|
9
9
|
reserved_slugs: %w{stylesheets javascripts assets admin locomotive images api pages edit},
|
10
|
-
locales: %w{en de fr pl pt-BR it nl nb es ru et ja zh-CN cs bg},
|
11
|
-
site_locales: %w{en de fr pl pt-BR it nl nb es ru et ja zh-CN cs bg},
|
10
|
+
locales: %w{en de fr pl pt-BR it nl nb es ru et ja zh-CN cs bg sk},
|
11
|
+
site_locales: %w{en de fr pl pt-BR it nl nb es ru et ja zh-CN cs bg sk},
|
12
12
|
cookie_key: '_locomotive_session',
|
13
13
|
enable_logs: false,
|
14
14
|
enable_admin_ssl: false,
|
@@ -30,7 +30,8 @@ module Locomotive
|
|
30
30
|
devise_modules: [:rememberable, :database_authenticatable, :token_authenticatable, :recoverable, :trackable, :validatable, :encryptable, { encryptor: :sha1 }],
|
31
31
|
context_assign_extensions: { },
|
32
32
|
models_for_templatization: [],
|
33
|
-
csrf_protection: false
|
33
|
+
csrf_protection: false,
|
34
|
+
theme_assets_checksum: false
|
34
35
|
}
|
35
36
|
|
36
37
|
cattr_accessor :settings
|
data/lib/locomotive/dragonfly.rb
CHANGED
@@ -2,6 +2,24 @@ module Locomotive
|
|
2
2
|
module Dragonfly
|
3
3
|
|
4
4
|
def self.resize_url(source, resize_string)
|
5
|
+
if file = self.fetch_file(source)
|
6
|
+
file.thumb(resize_string).url
|
7
|
+
else
|
8
|
+
Locomotive.log :error, "Unable to resize on the fly: #{source.inspect}"
|
9
|
+
return
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.thumbnail_pdf(source, resize_string)
|
14
|
+
if file = self.fetch_file(source)
|
15
|
+
file.thumb(resize_string, format: 'png', frame: 0).encode('png').url
|
16
|
+
else
|
17
|
+
Locomotive.log :error, "Unable to convert the pdf: #{source.inspect}"
|
18
|
+
return
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.fetch_file(source)
|
5
23
|
file = nil
|
6
24
|
|
7
25
|
if source.is_a?(String) || source.is_a?(Hash) # simple string or theme asset
|
@@ -22,16 +40,13 @@ module Locomotive
|
|
22
40
|
file = self.app.fetch_file(source.path)
|
23
41
|
end
|
24
42
|
|
25
|
-
else
|
26
|
-
Locomotive.log :error, "Unable to resize on the fly: #{source.inspect}"
|
27
|
-
return
|
28
43
|
end
|
29
44
|
|
30
|
-
file
|
45
|
+
file
|
31
46
|
end
|
32
47
|
|
33
48
|
def self.app
|
34
|
-
::Dragonfly
|
49
|
+
::Dragonfly.app
|
35
50
|
end
|
36
51
|
|
37
52
|
end
|
@@ -3,7 +3,7 @@ module Locomotive
|
|
3
3
|
module Drops
|
4
4
|
class ContentEntry < Base
|
5
5
|
|
6
|
-
delegate :_slug, :_permalink, :seo_title, :meta_keywords, :meta_description, to: :@_source
|
6
|
+
delegate :_slug, :_permalink, :_translated, :seo_title, :meta_keywords, :meta_description, to: :@_source
|
7
7
|
|
8
8
|
def _id
|
9
9
|
@_source._id.to_s
|
@@ -37,6 +37,10 @@ module Locomotive
|
|
37
37
|
|
38
38
|
url = ThemeAssetUploader.url_for(@context.registers[:site], path)
|
39
39
|
|
40
|
+
if checksum = @context.registers[:theme_assets_checksum][path]
|
41
|
+
query_string = "?#{checksum}" if query_string.blank?
|
42
|
+
end
|
43
|
+
|
40
44
|
query_string ? "#{url}#{query_string}" : url
|
41
45
|
end
|
42
46
|
|
@@ -52,7 +52,7 @@ module Locomotive
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def fetch_page(site, handle, templatized = false)
|
55
|
-
::Mongoid::Fields::I18n.with_locale(
|
55
|
+
::Mongoid::Fields::I18n.with_locale(self.locale) do
|
56
56
|
if templatized
|
57
57
|
criteria = site.pages.where(target_klass_name: handle.class.to_s, templatized: true)
|
58
58
|
criteria = criteria.where(handle: @options['with']) if @options['with']
|
@@ -66,7 +66,7 @@ module Locomotive
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def public_page_fullpath(site, page)
|
69
|
-
fullpath = site.localized_page_fullpath(page,
|
69
|
+
fullpath = site.localized_page_fullpath(page, self.locale)
|
70
70
|
|
71
71
|
if page.templatized?
|
72
72
|
fullpath.gsub!('content_type_template', page.content_entry._slug)
|
@@ -75,6 +75,9 @@ module Locomotive
|
|
75
75
|
File.join('/', fullpath)
|
76
76
|
end
|
77
77
|
|
78
|
+
def locale
|
79
|
+
@options['locale'] || I18n.locale
|
80
|
+
end
|
78
81
|
|
79
82
|
end
|
80
83
|
end
|