alchemy_cms 2.1.beta6 → 2.1.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -1
- data/Gemfile +10 -2
- data/Guardfile +16 -0
- data/README.md +3 -3
- data/Rakefile +0 -5
- data/alchemy_cms.gemspec +1 -9
- data/app/assets/javascripts/alchemy/alchemy.base.js +5 -4
- data/app/assets/javascripts/alchemy/{alchemy.dragndrop.js.erb → alchemy.dragndrop.js} +0 -0
- data/app/assets/javascripts/alchemy/alchemy.elements_window.js +96 -0
- data/app/assets/javascripts/alchemy/alchemy.image_cropper.js +48 -50
- data/app/assets/javascripts/alchemy/alchemy.jquery_loader.js +41 -0
- data/app/assets/javascripts/alchemy/alchemy.js +2 -0
- data/app/assets/javascripts/alchemy/alchemy.menubar.js +55 -0
- data/app/assets/javascripts/alchemy/alchemy.preview.js +94 -139
- data/app/assets/javascripts/alchemy/alchemy.preview_window.js +98 -0
- data/app/assets/javascripts/alchemy/alchemy.windows.js +1 -174
- data/app/assets/javascripts/alchemy/menubar.js +2 -0
- data/app/assets/javascripts/alchemy/preview.js +2 -1
- data/app/assets/stylesheets/alchemy/_defaults.scss +7 -8
- data/app/assets/stylesheets/alchemy/base.css.scss +29 -33
- data/app/assets/stylesheets/alchemy/elements.css.scss +4 -4
- data/app/assets/stylesheets/alchemy/jquery-ui.alchemy.css.scss +1 -1
- data/app/assets/stylesheets/alchemy/jquery.Jcrop.css.scss +1 -1
- data/app/assets/stylesheets/alchemy/jquery.sb.css.scss +19 -4
- data/app/assets/stylesheets/alchemy/menubar.css.scss +85 -0
- data/app/assets/stylesheets/alchemy/standard_set.css +3 -5
- data/app/assets/stylesheets/alchemy/tinymce_content.css.scss +1 -1
- data/app/assets/stylesheets/alchemy/tinymce_dialog.css.scss +1 -1
- data/app/controllers/alchemy/admin/attachments_controller.rb +2 -18
- data/app/controllers/alchemy/admin/base_controller.rb +1 -1
- data/app/controllers/alchemy/admin/elements_controller.rb +2 -2
- data/app/controllers/alchemy/admin/essence_files_controller.rb +4 -2
- data/app/controllers/alchemy/admin/pictures_controller.rb +6 -20
- data/app/controllers/alchemy/admin/resources_controller.rb +7 -5
- data/app/controllers/alchemy/base_controller.rb +14 -4
- data/app/controllers/alchemy/messages_controller.rb +4 -4
- data/app/controllers/alchemy/pages_controller.rb +51 -32
- data/app/controllers/alchemy/pictures_controller.rb +0 -3
- data/app/controllers/alchemy/user_sessions_controller.rb +1 -1
- data/app/helpers/alchemy/admin/base_helper.rb +6 -4
- data/app/helpers/alchemy/base_helper.rb +26 -0
- data/app/helpers/alchemy/pages_helper.rb +42 -22
- data/app/models/alchemy/attachment.rb +10 -2
- data/app/models/alchemy/cell.rb +1 -0
- data/app/models/alchemy/content.rb +8 -6
- data/app/models/alchemy/element.rb +1 -1
- data/app/models/alchemy/essence_audio.rb +1 -8
- data/app/models/alchemy/essence_date.rb +2 -9
- data/app/models/alchemy/essence_file.rb +1 -8
- data/app/models/alchemy/essence_flash.rb +0 -7
- data/app/models/alchemy/essence_html.rb +1 -8
- data/app/models/alchemy/essence_picture.rb +0 -11
- data/app/models/alchemy/essence_richtext.rb +4 -12
- data/app/models/alchemy/essence_text.rb +1 -13
- data/app/models/alchemy/essence_video.rb +1 -8
- data/app/models/alchemy/page.rb +28 -22
- data/app/models/alchemy/picture.rb +19 -0
- data/app/sweepers/alchemy/pages_sweeper.rb +17 -6
- data/app/sweepers/alchemy/pictures_sweeper.rb +1 -3
- data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +2 -2
- data/app/views/alchemy/admin/attachments/_attachment.html.erb +1 -1
- data/app/views/alchemy/admin/attachments/_file_to_assign.html.erb +2 -2
- data/app/views/alchemy/admin/attachments/_files_list.html.erb +13 -11
- data/app/views/alchemy/admin/attachments/create.js.erb +1 -1
- data/app/views/alchemy/admin/attachments/edit.html.erb +2 -2
- data/app/views/alchemy/admin/elements/_new_element_form.html.erb +1 -2
- data/app/views/alchemy/admin/elements/new.html.erb +1 -1
- data/app/views/alchemy/admin/essence_files/edit.html.erb +32 -32
- data/app/views/alchemy/admin/essence_pictures/crop.html.erb +29 -29
- data/app/views/alchemy/admin/essence_pictures/update.js.erb +13 -12
- data/app/views/alchemy/admin/pages/_create_language_form.html.erb +4 -1
- data/app/views/alchemy/admin/pages/_new_page_form.html.erb +1 -1
- data/app/views/alchemy/admin/pages/edit.html.erb +8 -8
- data/app/views/alchemy/admin/pages/index.html.erb +1 -1
- data/app/views/alchemy/admin/pages/new.html.erb +1 -1
- data/app/views/alchemy/admin/pages/update.js.erb +19 -12
- data/app/views/alchemy/admin/pictures/_picture.html.erb +1 -1
- data/app/views/alchemy/admin/pictures/_pictures_list.html.erb +8 -6
- data/app/views/alchemy/admin/pictures/show_in_window.html.erb +6 -1
- data/app/views/alchemy/admin/resources/_table.html.erb +1 -1
- data/app/views/alchemy/admin/users/_table.html.erb +13 -13
- data/app/views/alchemy/admin/users/_user.html.erb +1 -1
- data/app/views/alchemy/admin/users/index.html.erb +2 -2
- data/app/views/alchemy/elements/_contactform_view.html.erb +78 -78
- data/app/views/alchemy/elements/_download_editor.html.erb +1 -0
- data/app/views/alchemy/elements/_download_view.html.erb +3 -0
- data/app/views/alchemy/essences/_essence_date_editor.html.erb +1 -1
- data/app/views/alchemy/essences/_essence_file_editor.html.erb +1 -0
- data/app/views/alchemy/essences/_essence_file_view.html.erb +6 -2
- data/app/views/alchemy/essences/_essence_picture_editor.html.erb +3 -2
- data/app/views/alchemy/essences/_essence_picture_view.html.erb +1 -1
- data/app/views/alchemy/navigation/_link.html.erb +1 -2
- data/app/views/alchemy/notifications/admin_user_created.text.erb +7 -7
- data/app/views/alchemy/notifications/registered_user_created.text.erb +5 -5
- data/app/views/alchemy/user_sessions/login.html.erb +34 -35
- data/app/views/layouts/alchemy/login.html.erb +3 -8
- data/app/views/layouts/alchemy/pages.html.erb +1 -0
- data/bin/alchemy +43 -75
- data/config/alchemy/config.yml +10 -0
- data/config/alchemy/elements.yml +5 -0
- data/config/alchemy/page_layouts.yml +1 -1
- data/config/locales/alchemy.de.yml +21 -8
- data/config/locales/alchemy.en.yml +20 -4
- data/config/routes.rb +25 -20
- data/db/migrate/{20111116125112_namespace_models.rb → 20111116125112_namespace_alchemy_models.rb} +1 -1
- data/lib/alchemy/capistrano.rb +4 -17
- data/lib/alchemy/engine.rb +2 -0
- data/lib/alchemy/essence.rb +29 -41
- data/lib/alchemy/i18n.rb +1 -1
- data/lib/alchemy/mount_point.rb +10 -0
- data/lib/alchemy/page_layout.rb +7 -7
- data/lib/alchemy/seeder.rb +85 -47
- data/lib/alchemy/upgrader.rb +115 -0
- data/lib/alchemy/version.rb +1 -1
- data/lib/alchemy_cms.rb +4 -3
- data/lib/rails/generators/alchemy/scaffold/scaffold_generator.rb +6 -2
- data/lib/tasks/ferret.rake +12 -0
- data/lib/tasks/install.rake +16 -105
- data/lib/tasks/routes.rake +29 -0
- data/lib/tasks/upgrade.rake +5 -67
- data/spec/controllers/admin/pages_controller_spec.rb +1 -1
- data/spec/controllers/pages_controller_spec.rb +31 -0
- data/spec/factories.rb +24 -15
- data/spec/helpers/admin/base_helper_spec.rb +0 -7
- data/spec/helpers/pages_helper_spec.rb +54 -29
- data/spec/helpers/url_helpers_spec.rb +40 -0
- data/spec/integration/admin/pages_controller_spec.rb +3 -3
- data/spec/integration/pages_controller_spec.rb +80 -6
- data/spec/integration/security_spec.rb +2 -2
- data/spec/models/content_spec.rb +24 -0
- data/spec/models/page_spec.rb +174 -47
- data/spec/models/picture_spec.rb +54 -0
- data/spec/page_layout_spec.rb +2 -2
- data/spec/routing_spec.rb +205 -1
- data/spec/spec_helper.rb +53 -32
- metadata +51 -46
- data/lib/alchemy/file_utilz.rb +0 -73
data/config/alchemy/config.yml
CHANGED
@@ -39,6 +39,16 @@
|
|
39
39
|
:show_root: true
|
40
40
|
:show_flag: false
|
41
41
|
|
42
|
+
# === URL nesting
|
43
|
+
# By default Alchemy does not nest page urls respectivley to their page tree position.
|
44
|
+
# Enable +url_nesting+ to get nested urls.
|
45
|
+
# ==== Example of a nested url:
|
46
|
+
# +http://homepage.com/company/history/the-early-years+
|
47
|
+
# Alchemy supports url nesting up to three levels deep. We think that's more then enough,
|
48
|
+
# because URLs like this are possible:
|
49
|
+
# +http://homepage.com/en/2011/12/08/my-post
|
50
|
+
url_nesting: false
|
51
|
+
|
42
52
|
# === Picture rendering settings
|
43
53
|
# Alchemy uses Fleximage and RMagick to render images. Use {:image_size => "XXXxYYY", :crop => BOOLEAN [true]} to resize images.
|
44
54
|
# See https://github.com/Squeegy/fleximage for further infos.
|
data/config/alchemy/elements.yml
CHANGED
@@ -34,7 +34,7 @@
|
|
34
34
|
autogenerate: [header, intro_image_text]
|
35
35
|
|
36
36
|
- name: standard
|
37
|
-
elements: [article, claim, header, bild, bild_text, text, intro, headline, image_mosaic]
|
37
|
+
elements: [article, claim, header, bild, bild_text, text, intro, headline, image_mosaic, download]
|
38
38
|
autogenerate: [header, claim, article]
|
39
39
|
|
40
40
|
- name: contact
|
@@ -70,6 +70,7 @@ de:
|
|
70
70
|
news_headline: "News Überschrift"
|
71
71
|
image_mosaic:
|
72
72
|
caption: "Mosaik Bildunterschrift"
|
73
|
+
file: Datei
|
73
74
|
|
74
75
|
content_validations:
|
75
76
|
errors:
|
@@ -83,10 +84,13 @@ de:
|
|
83
84
|
no_float: 'Über dem Text'
|
84
85
|
|
85
86
|
# == Translations for the build in full text search.
|
86
|
-
|
87
|
+
search_result_page:
|
87
88
|
no_results: 'Ihre Suche ergab kein Ergebnis.'
|
88
89
|
result_heading: "Ihre Suche nach '%{query}'"
|
89
|
-
result_count:
|
90
|
+
result_count:
|
91
|
+
zero: "Ergab keine Ergebnisse"
|
92
|
+
one: "Ergab ein Ergebnis"
|
93
|
+
other: "Ergab %{count} Ergebnisse"
|
90
94
|
|
91
95
|
# == Contactform translations
|
92
96
|
contactform:
|
@@ -195,7 +199,6 @@ de:
|
|
195
199
|
"Element trashed": "Das Element wurde in den Papierkorb gelegt"
|
196
200
|
"Error with the Flash® Uploader!": "Fehler mit dem Flash® Uploader!"
|
197
201
|
"Excerpt": "Auszug"
|
198
|
-
"Explain|Sitemap|Dragndrop sorting": "Tip: Halten Sie zum Sortieren der Seiten das Seitensymbol mit der Maus fest und bewegen Sie sie an ihre neue Position."
|
199
202
|
"File %{name} uploaded succesfully": "Datei %{name} wurde hochgeladen"
|
200
203
|
"File renamed successfully from: '%{from}' to '%{to}'": "Datei wurde erfolgreich von: '%{from}' nach '%{to}' umbenannt."
|
201
204
|
"File upload error: %{error}": "Datei konnte nicht hochgeladen werden: %{error}"
|
@@ -222,6 +225,7 @@ de:
|
|
222
225
|
"New page": "Neue Seite"
|
223
226
|
"No": "Nein"
|
224
227
|
"No EssenceType given": ""
|
228
|
+
"No image found. Did you saved the element?": "Es wurde kein Bild gefunden. Haben Sie das Element auch gespeichert?"
|
225
229
|
"No items in your clipboard": "Ihre Zwischenablage ist leer"
|
226
230
|
"None": ""
|
227
231
|
"Open Link in": "Link öffnen in"
|
@@ -283,7 +287,7 @@ de:
|
|
283
287
|
"User deleted": "%{name} wurde gelöscht"
|
284
288
|
"User updated": "%{name} wurde aktualisiert"
|
285
289
|
"Username": "Benutzername"
|
286
|
-
"Validation failed
|
290
|
+
"Validation failed": "Pflichtfelder wurden nicht ausgefüllt."
|
287
291
|
"Version": "Version"
|
288
292
|
"View File": "Datei anzeigen"
|
289
293
|
"Visit page": "zur Seite gehen"
|
@@ -366,6 +370,7 @@ de:
|
|
366
370
|
enter_external_link: "Geben Sie hier die Adresse der Seite ein zu der Sie einen Link setzen wollen."
|
367
371
|
explain cropping: "Sie können den Rahmen verschieben und in der Größe verändern um den Bildausschnitt festzulegen. Wenn Sie zufrieden sind, dann klicken Sie bitte auf speichern."
|
368
372
|
explain_publishing: "Die gecachte Version vom Server löschen und die aktuellen Änderungen veröffentlichen"
|
373
|
+
explain_sitemap_dragndrop_sorting: "Tip: Halten Sie zum Sortieren der Seiten das Seitensymbol mit der Maus fest und bewegen Sie sie an ihre neue Position."
|
369
374
|
explain_unlocking: "Die Seite verlassen und für andere Benutzer zum Bearbeiten freigeben."
|
370
375
|
explain_upload:
|
371
376
|
footnote: "TIP! Halten Sie die Strg-Taste (cmd-Taste auf einem Mac) während Sie die %{name} mit der Maus anklicken, um mehrere %{name} gleichzeitig hochzuladen."
|
@@ -524,9 +529,9 @@ de:
|
|
524
529
|
"Succesfully created": "Erfolgreich erstellt"
|
525
530
|
"Succesfully updated": "Erfolgreich aktualisiert"
|
526
531
|
"Succesfully removed": "Erfolgreich gelöscht"
|
527
|
-
"You are already logged in
|
528
|
-
"No users found
|
529
|
-
"Nothing found
|
532
|
+
"You are already logged in": "Sie sind bereits angemeldet."
|
533
|
+
"No users found": "Keine Benutzer gefunden."
|
534
|
+
"Nothing found": "Keine Einträge gefunden."
|
530
535
|
|
531
536
|
# END of Alchemy translation
|
532
537
|
|
@@ -554,6 +559,7 @@ de:
|
|
554
559
|
default: "%d. %b. %Y, %H:%M Uhr"
|
555
560
|
short: "%d. %B, %H:%Mh"
|
556
561
|
long: "%A, %d. %B %Y um %H:%M Uhr"
|
562
|
+
date: "%d.%m.%Y"
|
557
563
|
time: "%H:%M"
|
558
564
|
am: "vormittags"
|
559
565
|
pm: "nachmittags"
|
@@ -680,6 +686,9 @@ de:
|
|
680
686
|
name: "Name"
|
681
687
|
public: "sichtbar"
|
682
688
|
|
689
|
+
alchemy/essence_file:
|
690
|
+
css_class: Textanordnung
|
691
|
+
|
683
692
|
alchemy/essence_picture:
|
684
693
|
caption: "Untertitel"
|
685
694
|
title: "Titel"
|
@@ -687,7 +696,7 @@ de:
|
|
687
696
|
link: Link
|
688
697
|
link_class_name: "Link CSS-Klasse"
|
689
698
|
link_title: Link-Titel
|
690
|
-
css_class:
|
699
|
+
css_class: Textanordnung
|
691
700
|
link_target: Link-Ziel
|
692
701
|
render_size: Darstellungsgröße
|
693
702
|
crop_from: Bildmaskenursprung
|
@@ -768,6 +777,10 @@ de:
|
|
768
777
|
even: "%{attribute} muss gerade sein"
|
769
778
|
|
770
779
|
models:
|
780
|
+
alchemy/content:
|
781
|
+
attributes:
|
782
|
+
essence:
|
783
|
+
validation_failed: 'Validierung fehlgeschlagen.'
|
771
784
|
alchemy/language:
|
772
785
|
attributes:
|
773
786
|
code:
|
@@ -70,10 +70,13 @@ en:
|
|
70
70
|
caption: "Mosaic Caption"
|
71
71
|
|
72
72
|
# == Translations for the build in full text search.
|
73
|
-
|
73
|
+
search_result_page:
|
74
74
|
no_results: 'No results found'
|
75
75
|
result_heading: "Your search for '%{query}'"
|
76
|
-
result_count:
|
76
|
+
result_count:
|
77
|
+
zero: 'Offers no results'
|
78
|
+
one: 'Offers one result'
|
79
|
+
other: 'Offers %{count} results'
|
77
80
|
|
78
81
|
# == Contactform translations
|
79
82
|
contactform:
|
@@ -213,7 +216,7 @@ en:
|
|
213
216
|
edit_file_properties: "Edit Fileproperties"
|
214
217
|
edit_image_properties: "Edit image properties."
|
215
218
|
edit_language: "Edit language"
|
216
|
-
edit_page: "Edit this page
|
219
|
+
edit_page: "Edit this page"
|
217
220
|
edit_page_properties: "Edit the page properties."
|
218
221
|
edit_user: "Edit this users properties."
|
219
222
|
element_editor_not_found: "Error within this Element"
|
@@ -221,6 +224,7 @@ en:
|
|
221
224
|
element_saved: "Saved element."
|
222
225
|
enter_external_link: "Please enter the URL you want to link with"
|
223
226
|
explain_publishing: "Publish the page and remove the cached version from the server."
|
227
|
+
explain_sitemap_dragndrop_sorting: "Tip: Drag the pages at the icon in order to sort them."
|
224
228
|
explain_unlocking: "Leave page and unlock it for other users."
|
225
229
|
explain_upload:
|
226
230
|
footnote: "HINT! Hold the CTRL button (CMD on a Mac) while clicking the %{name} with the mouse to upload multiple %{name} at once."
|
@@ -278,6 +282,7 @@ en:
|
|
278
282
|
no_images_in_archive: "You don't have any images in your archive."
|
279
283
|
no_more_elements_to_add: "No more elements available."
|
280
284
|
no_search_results: "Your search did not return any results."
|
285
|
+
"No users found": "No users found."
|
281
286
|
"not a valid image": "This is not an valid image."
|
282
287
|
"Page created": "Page: '%{name}' created."
|
283
288
|
page_for_links.choose_page: "Choose %{name}"
|
@@ -343,9 +348,12 @@ en:
|
|
343
348
|
want_to_make_copy_of_existing_language: "Do you want to copy an existing language tree?"
|
344
349
|
welcome_please_identify_notice: "Welcome! Please identify."
|
345
350
|
width: "Width"
|
351
|
+
"You are already logged in": "You are already logged in."
|
346
352
|
"You may upload files with following extensions": "You may upload %{file_types_description} with following extensions: %{file_types}"
|
347
353
|
zoom_image: "Zoom this image."
|
348
|
-
|
354
|
+
"Nothing found": "Nothing found."
|
355
|
+
"Validation failed": "Validation failed."
|
356
|
+
|
349
357
|
# END of Alchemy translation
|
350
358
|
|
351
359
|
will_paginate:
|
@@ -376,6 +384,7 @@ en:
|
|
376
384
|
default: "%a, %d %b %Y %H:%M:%S %z"
|
377
385
|
short: "%d %b %H:%M"
|
378
386
|
long: "%B %d, %Y %H:%M"
|
387
|
+
date: "%Y-%m-%d"
|
379
388
|
am: "am"
|
380
389
|
pm: "pm"
|
381
390
|
support:
|
@@ -486,6 +495,9 @@ en:
|
|
486
495
|
name: "Name"
|
487
496
|
public: "visible"
|
488
497
|
|
498
|
+
alchemy/essence_file:
|
499
|
+
css_class: CSS Class
|
500
|
+
|
489
501
|
alchemy/language:
|
490
502
|
code: "Languagecode"
|
491
503
|
default: "Default"
|
@@ -557,6 +569,10 @@ en:
|
|
557
569
|
odd: "must be odd"
|
558
570
|
even: "must be even"
|
559
571
|
models:
|
572
|
+
alchemy/content:
|
573
|
+
attributes:
|
574
|
+
essence:
|
575
|
+
validation_failed: 'Validation failed.'
|
560
576
|
alchemy/language:
|
561
577
|
attributes:
|
562
578
|
code:
|
data/config/routes.rb
CHANGED
@@ -2,7 +2,9 @@ Alchemy::Engine.routes.draw do
|
|
2
2
|
|
3
3
|
root :to => 'pages#show'
|
4
4
|
|
5
|
-
match '/admin' => redirect(
|
5
|
+
match '/admin' => redirect(
|
6
|
+
"#{Alchemy.mount_point}/admin/dashboard"
|
7
|
+
)
|
6
8
|
match '/admin/login' => 'user_sessions#login',
|
7
9
|
:as => :login
|
8
10
|
match '/admin/signup' => 'user_sessions#signup',
|
@@ -13,30 +15,24 @@ Alchemy::Engine.routes.draw do
|
|
13
15
|
:as => :logout
|
14
16
|
match '/admin/dashboard' => 'admin/dashboard#index',
|
15
17
|
:as => :admin_dashboard
|
16
|
-
|
18
|
+
|
19
|
+
match '/attachment/:id/download(/:name)(.:format)' => 'attachments#download',
|
17
20
|
:as => :download_attachment
|
18
|
-
|
19
|
-
:as => :show_attachment
|
20
|
-
match '/pictures/show/:id/:size/:crop_from/:crop_size/:name.:format' => 'pictures#show',
|
21
|
-
:as => :show_cropped_picture
|
22
|
-
match '/pictures/show/:id/:size/:crop/:name.:format' => 'pictures#show',
|
23
|
-
:as => :show_picture_with_crop
|
24
|
-
match '/pictures/show/:id/:size/:name.:format' => 'pictures#show',
|
25
|
-
:as => :show_picture
|
26
|
-
match '/pictures/zoom/:id/picture.:format' => 'pictures#zoom',
|
27
|
-
:as => :zoom_picture
|
28
|
-
match '/pictures/thumbnails/:id/:size(/:crop_from)(/:crop_size)/thumbnail.png' => 'pictures#thumbnail',
|
29
|
-
:as => :thumbnail, :defaults => { :format => 'png' }
|
30
|
-
match '/:lang' => 'pages#show',
|
31
|
-
:constraints => {:lang => /[a-z]{2}/},
|
32
|
-
:as => :show_language_root
|
33
|
-
match '(/:lang)/:urlname(.:format)' => 'pages#show',
|
34
|
-
:constraints => {:lang => /[a-z]{2}/},
|
35
|
-
:as => :show_page
|
21
|
+
|
36
22
|
# catching legacy download urls
|
37
23
|
match '/wa_files/download/:id' => 'attachments#download'
|
38
24
|
match '/uploads/files/0000/:id/:name(.:suffix)' => 'attachments#download'
|
39
25
|
|
26
|
+
match '/attachment/:id/show' => 'attachments#show',
|
27
|
+
:as => :show_attachment
|
28
|
+
|
29
|
+
match "/pictures/:id/show/:size(/:crop)(/:crop_from/:crop_size)/:name.:format" => 'pictures#show',
|
30
|
+
:as => :show_picture, :defaults => { :format => Alchemy::Config.get(:image_output_format) }
|
31
|
+
match '/pictures/:id/zoom/:name.:format' => 'pictures#zoom',
|
32
|
+
:as => :zoom_picture, :defaults => { :format => Alchemy::Config.get(:image_store_format) }
|
33
|
+
match "/pictures/:id/thumbnails/:size(/:crop)(/:crop_from/:crop_size)/:name.:format" => 'pictures#thumbnail',
|
34
|
+
:as => :thumbnail, :defaults => { :format => 'png', :name => "thumbnail" }
|
35
|
+
|
40
36
|
resources :messages, :only => [:index, :new, :create]
|
41
37
|
|
42
38
|
resources :user_sessions
|
@@ -142,4 +138,13 @@ Alchemy::Engine.routes.draw do
|
|
142
138
|
|
143
139
|
end
|
144
140
|
|
141
|
+
match '/:lang' => 'pages#show',
|
142
|
+
:constraints => {:lang => /[a-z]{2}/},
|
143
|
+
:as => :show_language_root
|
144
|
+
|
145
|
+
# The page show action has to be last route
|
146
|
+
match '(/:lang)(/:level1(/:level2(/:level3)))/:urlname(.:format)' => 'pages#show',
|
147
|
+
:constraints => {:lang => /[a-z]{2}/},
|
148
|
+
:as => :show_page
|
149
|
+
|
145
150
|
end
|
data/lib/alchemy/capistrano.rb
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
# This recipe contains Capistrano recipes for handling the uploads, ferret index and picture cache files while deploying your application.
|
2
2
|
# It also contains a ferret:rebuild_index task to rebuild the index after deploying your application.
|
3
3
|
require "rails"
|
4
|
+
require "alchemy/mount_point"
|
4
5
|
|
5
6
|
Capistrano::Configuration.instance(:must_exist).load do
|
6
7
|
|
7
8
|
after "deploy:setup", "alchemy:shared_folders:create"
|
8
9
|
after "deploy:symlink", "alchemy:shared_folders:symlink"
|
9
|
-
|
10
|
-
if Rails.version < '3.1'
|
11
|
-
before "deploy:restart", "alchemy:files:copy"
|
12
|
-
end
|
10
|
+
before "deploy:start", "alchemy:seed"
|
13
11
|
|
14
12
|
namespace :alchemy do
|
15
13
|
|
@@ -22,7 +20,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
22
20
|
run "mkdir -p #{shared_path}/index"
|
23
21
|
run "mkdir -p #{shared_path}/uploads/pictures"
|
24
22
|
run "mkdir -p #{shared_path}/uploads/attachments"
|
25
|
-
run "mkdir -p #{shared_path
|
23
|
+
run "mkdir -p #{File.join(shared_path, 'cache', Capistrano::CLI.ui.ask("Where is Alchemy CMS mounted at? (/)"), 'pictures')}"
|
26
24
|
end
|
27
25
|
|
28
26
|
# This task sets the symlinks for uploads, picture cache and ferret index folder.
|
@@ -31,22 +29,11 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
31
29
|
task :symlink, :roles => :app do
|
32
30
|
run "rm -rf #{current_path}/uploads"
|
33
31
|
run "ln -nfs #{shared_path}/uploads #{current_path}/"
|
34
|
-
|
35
|
-
run "ln -nfs #{shared_path}/cache/pictures #{current_path}/public/"
|
32
|
+
run "ln -nfs #{shared_path}/cache/* #{current_path}/public/"
|
36
33
|
run "rm -rf #{current_path}/index"
|
37
34
|
run "ln -nfs #{shared_path}/index #{current_path}/"
|
38
35
|
end
|
39
36
|
|
40
|
-
end
|
41
|
-
|
42
|
-
namespace :files do
|
43
|
-
|
44
|
-
desc "Copies all assets and migration files from Alchemy to project"
|
45
|
-
task :copy do
|
46
|
-
run "cd #{current_path} && RAILS_ENV=production #{rake} alchemy:assets:copy:all"
|
47
|
-
run "cd #{current_path} && RAILS_ENV=production #{rake} alchemy:migrations:sync"
|
48
|
-
end
|
49
|
-
|
50
37
|
end
|
51
38
|
|
52
39
|
desc "Upgrades production database to current Alchemy CMS version"
|
data/lib/alchemy/engine.rb
CHANGED
data/lib/alchemy/essence.rb
CHANGED
@@ -29,6 +29,7 @@ module Alchemy #:nodoc:
|
|
29
29
|
include Alchemy::Essence::InstanceMethods
|
30
30
|
stampable
|
31
31
|
validate :essence_validations, :on => :update
|
32
|
+
has_many :contents, :as => :essence
|
32
33
|
|
33
34
|
def acts_as_essence_class
|
34
35
|
#{self.name}
|
@@ -92,47 +93,34 @@ module Alchemy #:nodoc:
|
|
92
93
|
# validate: [format]
|
93
94
|
# validate_format_with: '^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$'
|
94
95
|
#
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
def essence_errors
|
125
|
-
@essence_errors ||= []
|
126
|
-
end
|
127
|
-
|
128
|
-
def essence_errors=(errors)
|
129
|
-
@essence_errors ||= errors
|
130
|
-
end
|
131
|
-
|
132
|
-
def add_essence_error(error)
|
133
|
-
essence_errors << error
|
134
|
-
errors.add(:base, :essence_validation_failed)
|
135
|
-
end
|
96
|
+
def essence_validations
|
97
|
+
return true if description.blank? || description['validate'].blank?
|
98
|
+
description['validate'].each do |validation|
|
99
|
+
if validation == 'presence' && ingredient.blank?
|
100
|
+
errors.add(ingredient_column.to_sym, :blank)
|
101
|
+
elsif validation == 'format'
|
102
|
+
if description['validate_format_as'].blank? && !description['validate_format_with'].blank?
|
103
|
+
matcher = Regexp.new(description['validate_format_with'])
|
104
|
+
elsif !description['validate_format_as'].blank? && description['validate_format_with'].blank?
|
105
|
+
case description['validate_format_as']
|
106
|
+
when 'email'
|
107
|
+
then matcher = Authlogic::Regex.email
|
108
|
+
when 'url'
|
109
|
+
then matcher = /^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/ix
|
110
|
+
else
|
111
|
+
raise "No validation format matcher found for #{description['validate_format_as']}"
|
112
|
+
end
|
113
|
+
else
|
114
|
+
raise 'No validation format matcher given'
|
115
|
+
end
|
116
|
+
if ingredient.match(matcher).nil?
|
117
|
+
errors.add(ingredient_column.to_sym, :invalid)
|
118
|
+
end
|
119
|
+
elsif validation == 'uniqueness' && !acts_as_essence_class.send("find_by_#{ingredient_column}", ingredient).blank?
|
120
|
+
errors.add(ingredient_column.to_sym, :taken)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
136
124
|
|
137
125
|
# Essence description from config/elements.yml
|
138
126
|
def description
|
data/lib/alchemy/i18n.rb
CHANGED
@@ -22,7 +22,7 @@ module Alchemy
|
|
22
22
|
#
|
23
23
|
def self.t(msg, *args)
|
24
24
|
options = args.extract_options!
|
25
|
-
options[:default] = options[:default] ? options[:default] : msg
|
25
|
+
options[:default] = options[:default] ? options[:default] : msg
|
26
26
|
scope = ['alchemy']
|
27
27
|
case options[:scope].class.name
|
28
28
|
when "Array"
|