alchemy_cms 2.5.0.b5 → 2.5.0.b9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +1 -1
- data/alchemy_cms.gemspec +2 -2
- data/app/assets/javascripts/alchemy/alchemy.base.js +0 -24
- data/app/assets/javascripts/alchemy/alchemy.growler.js +2 -4
- data/app/assets/javascripts/alchemy/alchemy.gui.js.coffee +0 -1
- data/app/assets/javascripts/alchemy/alchemy.page_sorter.js +1 -1
- data/app/assets/stylesheets/alchemy/base.scss +4 -20
- data/app/assets/stylesheets/alchemy/elements.scss +19 -31
- data/app/assets/stylesheets/alchemy/flash.scss +11 -0
- data/app/assets/stylesheets/alchemy/form_elements.scss +2 -14
- data/app/assets/stylesheets/alchemy/menubar.css.scss +1 -0
- data/app/assets/stylesheets/alchemy/mixins.scss +37 -2
- data/app/assets/stylesheets/alchemy/notices.scss +1 -0
- data/app/assets/stylesheets/alchemy/sitemap.scss +30 -0
- data/app/assets/stylesheets/alchemy/tables.scss +20 -27
- data/app/controllers/alchemy/admin/attachments_controller.rb +3 -3
- data/app/controllers/alchemy/admin/base_controller.rb +1 -1
- data/app/controllers/alchemy/admin/contents_controller.rb +2 -2
- data/app/controllers/alchemy/admin/elements_controller.rb +3 -3
- data/app/controllers/alchemy/admin/essence_pictures_controller.rb +2 -2
- data/app/controllers/alchemy/admin/pages_controller.rb +16 -9
- data/app/controllers/alchemy/admin/pictures_controller.rb +8 -8
- data/app/controllers/alchemy/admin/resources_controller.rb +1 -1
- data/app/controllers/alchemy/admin/tags_controller.rb +4 -4
- data/app/controllers/alchemy/admin/users_controller.rb +3 -3
- data/app/controllers/alchemy/base_controller.rb +10 -12
- data/app/controllers/alchemy/messages_controller.rb +2 -2
- data/app/controllers/alchemy/pages_controller.rb +4 -1
- data/app/controllers/alchemy/pictures_controller.rb +1 -4
- data/app/controllers/alchemy/user_sessions_controller.rb +5 -5
- data/app/helpers/alchemy/admin/attachments_helper.rb +1 -1
- data/app/helpers/alchemy/admin/base_helper.rb +13 -13
- data/app/helpers/alchemy/admin/contents_helper.rb +6 -6
- data/app/helpers/alchemy/admin/elements_helper.rb +2 -2
- data/app/helpers/alchemy/admin/essences_helper.rb +8 -8
- data/app/helpers/alchemy/admin/pages_helper.rb +13 -7
- data/app/helpers/alchemy/base_helper.rb +20 -5
- data/app/helpers/alchemy/elements_helper.rb +2 -2
- data/app/helpers/alchemy/essences_helper.rb +2 -2
- data/app/helpers/alchemy/pages_helper.rb +2 -3
- data/app/models/alchemy/cell.rb +11 -3
- data/app/models/alchemy/content.rb +17 -17
- data/app/models/alchemy/element.rb +49 -26
- data/app/models/alchemy/legacy_page_url.rb +6 -0
- data/app/models/alchemy/page.rb +24 -45
- data/app/models/alchemy/picture.rb +1 -2
- data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +3 -3
- data/app/views/alchemy/admin/attachments/_attachment.html.erb +6 -6
- data/app/views/alchemy/admin/attachments/_files_list.html.erb +2 -2
- data/app/views/alchemy/admin/attachments/edit.html.erb +5 -3
- data/app/views/alchemy/admin/attachments/index.html.erb +3 -3
- data/app/views/alchemy/admin/attachments/new.html.erb +2 -2
- data/app/views/alchemy/admin/clipboard/clear.js.erb +1 -1
- data/app/views/alchemy/admin/clipboard/index.html.erb +3 -3
- data/app/views/alchemy/admin/clipboard/insert.js.erb +2 -2
- data/app/views/alchemy/admin/clipboard/remove.js.erb +4 -4
- data/app/views/alchemy/admin/contents/_missing.html.erb +2 -2
- data/app/views/alchemy/admin/contents/create.js.erb +1 -1
- data/app/views/alchemy/admin/contents/new.html.erb +3 -3
- data/app/views/alchemy/admin/dashboard/index.html.erb +12 -12
- data/app/views/alchemy/admin/elements/_add_picture.html.erb +1 -1
- data/app/views/alchemy/admin/elements/_element.html.erb +1 -1
- data/app/views/alchemy/admin/elements/_element_foot.html.erb +5 -5
- data/app/views/alchemy/admin/elements/_element_head.html.erb +6 -6
- data/app/views/alchemy/admin/elements/_elements_select.html.erb +2 -2
- data/app/views/alchemy/admin/elements/_new_element_form.html.erb +4 -4
- data/app/views/alchemy/admin/elements/_picture_gallery_editor.html.erb +1 -1
- data/app/views/alchemy/admin/elements/create.js.erb +2 -2
- data/app/views/alchemy/admin/elements/index.html.erb +2 -2
- data/app/views/alchemy/admin/elements/list.js.erb +1 -1
- data/app/views/alchemy/admin/elements/new.html.erb +4 -4
- data/app/views/alchemy/admin/elements/order.js.erb +1 -1
- data/app/views/alchemy/admin/elements/trash.js.erb +1 -1
- data/app/views/alchemy/admin/elements/update.js.erb +1 -1
- data/app/views/alchemy/admin/essence_files/edit.html.erb +5 -5
- data/app/views/alchemy/admin/essence_pictures/crop.html.erb +4 -4
- data/app/views/alchemy/admin/essence_pictures/edit.html.erb +4 -4
- data/app/views/alchemy/admin/languages/_form.html.erb +6 -10
- data/app/views/alchemy/admin/languages/_language.html.erb +4 -4
- data/app/views/alchemy/admin/languages/_table.html.erb +1 -1
- data/app/views/alchemy/admin/languages/index.html.erb +1 -1
- data/app/views/alchemy/admin/layoutpages/_layoutpage.html.erb +6 -6
- data/app/views/alchemy/admin/layoutpages/index.html.erb +8 -8
- data/app/views/alchemy/admin/pages/_contactform_links.html.erb +7 -7
- data/app/views/alchemy/admin/pages/_create_language_form.html.erb +10 -9
- data/app/views/alchemy/admin/pages/_external_link.html.erb +7 -7
- data/app/views/alchemy/admin/pages/_file_link.html.erb +6 -6
- data/app/views/alchemy/admin/pages/_internal_link.html.erb +5 -5
- data/app/views/alchemy/admin/pages/_new_page_form.html.erb +1 -1
- data/app/views/alchemy/admin/pages/_page.html.erb +28 -28
- data/app/views/alchemy/admin/pages/_page_for_links.html.erb +5 -5
- data/app/views/alchemy/admin/pages/_page_infos.html.erb +3 -3
- data/app/views/alchemy/admin/pages/_page_status.html.erb +3 -3
- data/app/views/alchemy/admin/pages/_sitemap.html.erb +1 -1
- data/app/views/alchemy/admin/pages/configure.html.erb +11 -11
- data/app/views/alchemy/admin/pages/configure_external.html.erb +4 -4
- data/app/views/alchemy/admin/pages/destroy.js.erb +0 -1
- data/app/views/alchemy/admin/pages/edit.html.erb +35 -35
- data/app/views/alchemy/admin/pages/flush.js.erb +1 -1
- data/app/views/alchemy/admin/pages/fold.js.erb +0 -1
- data/app/views/alchemy/admin/pages/index.html.erb +14 -14
- data/app/views/alchemy/admin/pages/link.html.erb +4 -4
- data/app/views/alchemy/admin/pages/locked.html.erb +1 -1
- data/app/views/alchemy/admin/pages/new.html.erb +4 -4
- data/app/views/alchemy/admin/pages/update.js.erb +2 -2
- data/app/views/alchemy/admin/partials/_autocomplete_tag_list.html.erb +1 -1
- data/app/views/alchemy/admin/partials/_flash_notices.html.erb +3 -3
- data/app/views/alchemy/admin/partials/_flash_upload.html.erb +8 -8
- data/app/views/alchemy/admin/partials/_language_tree_select.html.erb +1 -1
- data/app/views/alchemy/admin/partials/_main_navigation_entry.html.erb +1 -1
- data/app/views/alchemy/admin/partials/_remote_search_form.html.erb +2 -2
- data/app/views/alchemy/admin/partials/_search_form.html.erb +2 -2
- data/app/views/alchemy/admin/partials/_sub_navigation_tab.html.erb +1 -1
- data/app/views/alchemy/admin/partials/_upload_form.html.erb +11 -11
- data/app/views/alchemy/admin/pictures/_archive.html.erb +13 -13
- data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +7 -7
- data/app/views/alchemy/admin/pictures/_filter_bar.html.erb +4 -4
- data/app/views/alchemy/admin/pictures/_overlay_picture_list.html.erb +1 -1
- data/app/views/alchemy/admin/pictures/_picture.html.erb +7 -7
- data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +1 -1
- data/app/views/alchemy/admin/pictures/_tag_list.html.erb +2 -2
- data/app/views/alchemy/admin/pictures/edit.html.erb +2 -2
- data/app/views/alchemy/admin/pictures/edit_multiple.html.erb +6 -6
- data/app/views/alchemy/admin/pictures/index.html.erb +10 -10
- data/app/views/alchemy/admin/pictures/info.html.erb +2 -2
- data/app/views/alchemy/admin/pictures/new.html.erb +2 -2
- data/app/views/alchemy/admin/resources/_boolean.html.erb +5 -0
- data/app/views/alchemy/admin/resources/_datetime.html.erb +2 -0
- data/app/views/alchemy/admin/resources/_form.html.erb +17 -28
- data/app/views/alchemy/admin/resources/_resource.html.erb +4 -4
- data/app/views/alchemy/admin/resources/_string.html.erb +5 -0
- data/app/views/alchemy/admin/resources/_table.html.erb +1 -1
- data/app/views/alchemy/admin/resources/_text.html.erb +5 -0
- data/app/views/alchemy/admin/resources/index.html.erb +1 -1
- data/app/views/alchemy/admin/tags/_tag.html.erb +4 -4
- data/app/views/alchemy/admin/tags/edit.html.erb +4 -4
- data/app/views/alchemy/admin/tags/index.html.erb +5 -5
- data/app/views/alchemy/admin/tags/new.html.erb +2 -2
- data/app/views/alchemy/admin/trash/clear.js.coffee +1 -1
- data/app/views/alchemy/admin/trash/index.html.erb +3 -3
- data/app/views/alchemy/admin/users/_table.html.erb +3 -3
- data/app/views/alchemy/admin/users/_user.html.erb +6 -6
- data/app/views/alchemy/admin/users/index.html.erb +4 -4
- data/app/views/alchemy/base/error_notice.html.erb +1 -4
- data/app/views/alchemy/elements/_editor_not_found.html.erb +2 -2
- data/app/views/alchemy/essences/_essence_boolean_view.html.erb +1 -1
- data/app/views/alchemy/essences/_essence_file_editor.html.erb +7 -7
- data/app/views/alchemy/essences/_essence_picture_editor.html.erb +5 -5
- data/app/views/alchemy/essences/_essence_picture_tools.html.erb +8 -8
- data/app/views/alchemy/essences/_linkable_essence_tools.html.erb +2 -2
- data/app/views/alchemy/search/_form.html.erb +2 -2
- data/app/views/alchemy/search/_result.html.erb +1 -1
- data/app/views/alchemy/search/_results.html.erb +3 -3
- data/app/views/alchemy/user_sessions/leave.html.erb +5 -5
- data/app/views/alchemy/user_sessions/login.html.erb +1 -1
- data/app/views/alchemy/user_sessions/signup.html.erb +2 -2
- data/app/views/kaminari/_gap.html.erb +1 -1
- data/app/views/kaminari/_next_page.html.erb +2 -2
- data/app/views/kaminari/_prev_page.html.erb +2 -2
- data/app/views/layouts/alchemy/admin.html.erb +7 -7
- data/bin/alchemy +1 -1
- data/config/authorization_rules.rb +1 -3
- data/config/locales/alchemy.de.yml +33 -23
- data/config/locales/alchemy.en.yml +31 -6
- data/db/migrate/{20121026100815_alchemy_two_point_three.rb → 20121118000000_alchemy_two_point_four.rb} +51 -28
- data/db/migrate/20130110212411_create_alchemy_legacy_page_urls.rb +11 -0
- data/lib/alchemy/capistrano.rb +22 -30
- data/lib/alchemy/errors.rb +45 -0
- data/lib/alchemy/i18n.rb +7 -5
- data/lib/alchemy/logger.rb +16 -0
- data/lib/alchemy/page_layout.rb +3 -3
- data/lib/alchemy/resource.rb +17 -1
- data/lib/alchemy/resources_helper.rb +8 -1
- data/lib/alchemy/upgrader.rb +9 -0
- data/lib/alchemy/version.rb +1 -1
- data/lib/alchemy_cms.rb +1 -6
- data/lib/rails/generators/alchemy/scaffold/files/elements.yml +41 -19
- data/lib/rails/generators/alchemy/scaffold/scaffold_generator.rb +13 -0
- data/lib/tasks/alchemy/db.rake +5 -11
- data/lib/tasks/alchemy/install.rake +7 -7
- data/spec/controllers/admin/pages_controller_spec.rb +14 -2
- data/spec/controllers/pages_controller_spec.rb +50 -17
- data/spec/dummy/config/application.rb +1 -1
- data/spec/dummy/db/migrate/{20121026100815_alchemy_two_point_three.rb → 20121118000000_alchemy_two_point_four.rb} +51 -28
- data/spec/dummy/db/migrate/20130110212411_create_alchemy_legacy_page_urls.rb +11 -0
- data/spec/dummy/db/schema.rb +10 -1
- data/spec/factories.rb +1 -0
- data/spec/integration/admin/picture_library_integration_spec.rb +8 -2
- data/spec/integration/security_spec.rb +2 -2
- data/spec/integration/translation_integration_spec.rb +20 -4
- data/spec/libraries/resources_helper_spec.rb +1 -1
- data/spec/models/cell_spec.rb +45 -0
- data/spec/models/page_spec.rb +19 -2
- data/spec/models/picture_spec.rb +12 -0
- data/spec/routing_spec.rb +115 -115
- data/spec/spec_helper.rb +3 -0
- data/spec/support/alchemy/specs_helpers.rb +6 -2
- data/spec/support/image.png +0 -0
- data/spec/support/image2.PNG +0 -0
- data/spec/support/image3.jpeg +0 -0
- metadata +27 -23
- data/db/migrate/20121113115120_create_alchemy_essence_links.rb +0 -13
- data/db/migrate/20121115100736_add_cached_tag_list_to_elements_pages_and_users.rb +0 -7
- data/db/migrate/20121116140636_add_cached_tag_list_to_alchemy_attachments.rb +0 -5
- data/db/migrate/20121116141016_change_alchemy_pictures_tag_list_column.rb +0 -9
- data/spec/dummy/db/migrate/20121113115120_create_alchemy_essence_links.rb +0 -13
- data/spec/dummy/db/migrate/20121115100736_add_cached_tag_list_to_elements_pages_and_users.rb +0 -7
- data/spec/dummy/db/migrate/20121116140636_add_cached_tag_list_to_alchemy_attachments.rb +0 -5
- data/spec/dummy/db/migrate/20121116141016_change_alchemy_pictures_tag_list_column.rb +0 -9
|
@@ -35,7 +35,7 @@ module Alchemy
|
|
|
35
35
|
@options = hashified_options
|
|
36
36
|
end
|
|
37
37
|
@attachments = Attachment.find_paginated(params, per_page_value_for_screen_size)
|
|
38
|
-
@message =
|
|
38
|
+
@message = _t('File %{name} uploaded succesfully', :name => @attachment.name)
|
|
39
39
|
# Are we using the Flash uploader? Or the plain html file uploader?
|
|
40
40
|
if params[Rails.application.config.session_options[:key]].blank?
|
|
41
41
|
flash[:notice] = @message
|
|
@@ -52,7 +52,7 @@ module Alchemy
|
|
|
52
52
|
@attachment = Attachment.find(params[:id])
|
|
53
53
|
oldname = @attachment.name
|
|
54
54
|
if @attachment.update_attributes(params[:attachment])
|
|
55
|
-
flash[:notice] =
|
|
55
|
+
flash[:notice] = _t("File renamed successfully from: '%{from}' to '%{to}'", :from => oldname, :to => @attachment.name)
|
|
56
56
|
else
|
|
57
57
|
render :action => "edit"
|
|
58
58
|
end
|
|
@@ -63,7 +63,7 @@ module Alchemy
|
|
|
63
63
|
@attachment = Attachment.find(params[:id])
|
|
64
64
|
name = @attachment.name
|
|
65
65
|
@attachment.destroy
|
|
66
|
-
flash[:notice] =
|
|
66
|
+
flash[:notice] = _t("File: '%{name}' deleted successfully", :name => name)
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
def show
|
|
@@ -93,7 +93,7 @@ module Alchemy
|
|
|
93
93
|
def render_errors_or_redirect(object, redirect_url, flash_notice)
|
|
94
94
|
if object.errors.empty?
|
|
95
95
|
@redirect_url = redirect_url
|
|
96
|
-
flash[:notice] =
|
|
96
|
+
flash[:notice] = _t(flash_notice)
|
|
97
97
|
respond_to do |format|
|
|
98
98
|
format.js { render :action => :redirect }
|
|
99
99
|
format.html { redirect_to @redirect_url }
|
|
@@ -44,13 +44,13 @@ module Alchemy
|
|
|
44
44
|
content = Content.find(id)
|
|
45
45
|
content.move_to_bottom
|
|
46
46
|
end
|
|
47
|
-
@notice =
|
|
47
|
+
@notice = _t("Successfully saved content position")
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
def destroy
|
|
51
51
|
@content = Content.find(params[:id])
|
|
52
52
|
@content_dup = @content.clone
|
|
53
|
-
@notice =
|
|
53
|
+
@notice = _t("Successfully deleted content", :content => @content.name_for_label)
|
|
54
54
|
@content.destroy
|
|
55
55
|
end
|
|
56
56
|
|
|
@@ -70,8 +70,8 @@ module Alchemy
|
|
|
70
70
|
@element_validated = @element.update_attributes!(params[:element])
|
|
71
71
|
else
|
|
72
72
|
@element_validated = false
|
|
73
|
-
@notice =
|
|
74
|
-
@error_message = "<h2>#{@notice}</h2><p>#{
|
|
73
|
+
@notice = _t('Validation failed')
|
|
74
|
+
@error_message = "<h2>#{@notice}</h2><p>#{_t(:content_validations_headline)}</p>".html_safe
|
|
75
75
|
end
|
|
76
76
|
end
|
|
77
77
|
|
|
@@ -116,7 +116,7 @@ module Alchemy
|
|
|
116
116
|
cell_name = element_with_cell_name.split('#').last
|
|
117
117
|
cell_definition = Cell.definition_for(cell_name)
|
|
118
118
|
if cell_definition.blank?
|
|
119
|
-
raise "Cell definition not found for #{cell_name}"
|
|
119
|
+
raise CellDefinitionError, "Cell definition not found for #{cell_name}"
|
|
120
120
|
end
|
|
121
121
|
@page.cells.find_or_create_by_name(cell_definition['name'])
|
|
122
122
|
end
|
|
@@ -40,7 +40,7 @@ module Alchemy
|
|
|
40
40
|
end
|
|
41
41
|
@ratio = @options[:fixed_ratio] == 'false' ? false : (@size_x.to_f / @size_y.to_f)
|
|
42
42
|
else
|
|
43
|
-
@no_image_notice =
|
|
43
|
+
@no_image_notice = _t('No image found. Did you saved the element?')
|
|
44
44
|
end
|
|
45
45
|
render :layout => false
|
|
46
46
|
end
|
|
@@ -73,7 +73,7 @@ module Alchemy
|
|
|
73
73
|
@picture_essence.link = params[:link]
|
|
74
74
|
@picture_essence.link_title = params[:title]
|
|
75
75
|
@picture_essence.open_link_in_new_window = params[:blank]
|
|
76
|
-
@notice =
|
|
76
|
+
@notice = _t("saved_link")
|
|
77
77
|
@picture_essence.save
|
|
78
78
|
end
|
|
79
79
|
|
|
@@ -28,8 +28,9 @@ module Alchemy
|
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
+
# Used by page preview iframe in Page#edit view.
|
|
32
|
+
#
|
|
31
33
|
def show
|
|
32
|
-
# fetching page via before filter
|
|
33
34
|
@preview_mode = true
|
|
34
35
|
@root_page = Page.language_root_for(session[:language_id])
|
|
35
36
|
# Setting the locale to pages language. so the page content has its correct translation
|
|
@@ -63,14 +64,20 @@ module Alchemy
|
|
|
63
64
|
else
|
|
64
65
|
@page = Page.create(params[:page])
|
|
65
66
|
end
|
|
66
|
-
|
|
67
|
+
redirect_path =
|
|
68
|
+
if @page.valid?
|
|
69
|
+
params[:redirect_to] || edit_admin_page_path(@page)
|
|
70
|
+
else
|
|
71
|
+
admin_pages_path
|
|
72
|
+
end
|
|
73
|
+
render_errors_or_redirect(@page, redirect_path, _t("Page created", :name => @page.name))
|
|
67
74
|
end
|
|
68
75
|
|
|
69
76
|
# Edit the content of the page and all its elements and contents.
|
|
70
77
|
def edit
|
|
71
78
|
# fetching page via before filter
|
|
72
79
|
if @page.locked? && @page.locker && @page.locker.logged_in? && @page.locker != current_user
|
|
73
|
-
flash[:notice] =
|
|
80
|
+
flash[:notice] = _t("This page is locked by %{name}", :name => (@page.locker.name rescue _t('unknown')))
|
|
74
81
|
redirect_to admin_pages_path
|
|
75
82
|
else
|
|
76
83
|
@page.lock(current_user)
|
|
@@ -95,7 +102,7 @@ module Alchemy
|
|
|
95
102
|
# storing old page_layout value, because unfurtunally rails @page.changes does not work here.
|
|
96
103
|
@old_page_layout = @page.page_layout
|
|
97
104
|
if @page.update_attributes(params[:page])
|
|
98
|
-
@notice =
|
|
105
|
+
@notice = _t("Page saved", :name => @page.name)
|
|
99
106
|
@while_page_edit = request.referer.include?('edit')
|
|
100
107
|
else
|
|
101
108
|
render_remote_errors(@page, "#alchemyOverlay button.button")
|
|
@@ -109,7 +116,7 @@ module Alchemy
|
|
|
109
116
|
@layoutpage = @page.layoutpage?
|
|
110
117
|
if @page.destroy
|
|
111
118
|
@page_root = Page.language_root_for(session[:language_id])
|
|
112
|
-
@message =
|
|
119
|
+
@message = _t("Page deleted", :name => name)
|
|
113
120
|
flash[:notice] = @message
|
|
114
121
|
respond_to do |format|
|
|
115
122
|
format.js
|
|
@@ -153,7 +160,7 @@ module Alchemy
|
|
|
153
160
|
def unlock
|
|
154
161
|
# fetching page via before filter
|
|
155
162
|
@page.unlock
|
|
156
|
-
flash[:notice] =
|
|
163
|
+
flash[:notice] = _t("unlocked_page", :name => @page.name)
|
|
157
164
|
@pages_locked_by_user = Page.all_locked_by(current_user)
|
|
158
165
|
respond_to do |format|
|
|
159
166
|
format.js
|
|
@@ -173,7 +180,7 @@ module Alchemy
|
|
|
173
180
|
# fetching page via before filter
|
|
174
181
|
@page.public = true
|
|
175
182
|
@page.save
|
|
176
|
-
flash[:notice] =
|
|
183
|
+
flash[:notice] = _t("page_published", :name => @page.name)
|
|
177
184
|
redirect_back_or_to_default(admin_pages_path)
|
|
178
185
|
end
|
|
179
186
|
|
|
@@ -191,7 +198,7 @@ module Alchemy
|
|
|
191
198
|
)
|
|
192
199
|
new_language_root.move_to_child_of Page.root
|
|
193
200
|
original_language_root.copy_children_to(new_language_root)
|
|
194
|
-
flash[:notice] =
|
|
201
|
+
flash[:notice] = _t('language_pages_copied')
|
|
195
202
|
redirect_to params[:layoutpage] == "true" ? admin_layoutpages_path : :action => :index
|
|
196
203
|
end
|
|
197
204
|
|
|
@@ -213,7 +220,7 @@ module Alchemy
|
|
|
213
220
|
prev_item = dbitem.reload
|
|
214
221
|
end
|
|
215
222
|
|
|
216
|
-
flash[:notice] =
|
|
223
|
+
flash[:notice] = _t("Pages order saved")
|
|
217
224
|
@redirect_url = admin_pages_path
|
|
218
225
|
render :action => :redirect
|
|
219
226
|
end
|
|
@@ -57,7 +57,7 @@ module Alchemy
|
|
|
57
57
|
@per_page = pictures_per_page_for_size(@size)
|
|
58
58
|
end
|
|
59
59
|
@pictures = Picture.find_paginated(params, pictures_per_page_for_size(@size))
|
|
60
|
-
@message =
|
|
60
|
+
@message = _t('Picture uploaded succesfully', :name => @picture.name)
|
|
61
61
|
# Are we using the single file uploader?
|
|
62
62
|
if params[Rails.application.config.session_options[:key]].blank?
|
|
63
63
|
flash[:notice] = @message
|
|
@@ -82,9 +82,9 @@ module Alchemy
|
|
|
82
82
|
@picture = Picture.find(params[:id])
|
|
83
83
|
|
|
84
84
|
if @picture.update_attributes(params[:picture])
|
|
85
|
-
flash[:notice] =
|
|
85
|
+
flash[:notice] = _t('picture_updated_successfully', :name => @picture.name)
|
|
86
86
|
else
|
|
87
|
-
flash[:error] =
|
|
87
|
+
flash[:error] = _t('picture_update_failed')
|
|
88
88
|
end
|
|
89
89
|
redirect_to_index
|
|
90
90
|
end
|
|
@@ -97,7 +97,7 @@ module Alchemy
|
|
|
97
97
|
picture.tag_list = params[:pictures_tag_list]
|
|
98
98
|
picture.save
|
|
99
99
|
end
|
|
100
|
-
flash[:notice] =
|
|
100
|
+
flash[:notice] = _t("Pictures updated successfully")
|
|
101
101
|
redirect_to_index
|
|
102
102
|
end
|
|
103
103
|
|
|
@@ -110,9 +110,9 @@ module Alchemy
|
|
|
110
110
|
names << picture.name
|
|
111
111
|
picture.destroy
|
|
112
112
|
end
|
|
113
|
-
flash[:notice] =
|
|
113
|
+
flash[:notice] = _t("Pictures deleted successfully", :names => names.to_sentence)
|
|
114
114
|
else
|
|
115
|
-
flash[:notice] =
|
|
115
|
+
flash[:notice] = _t("Could not delete Pictures")
|
|
116
116
|
end
|
|
117
117
|
rescue Exception => e
|
|
118
118
|
flash[:error] = e.message
|
|
@@ -124,7 +124,7 @@ module Alchemy
|
|
|
124
124
|
@picture = Picture.find(params[:id])
|
|
125
125
|
name = @picture.name
|
|
126
126
|
@picture.destroy
|
|
127
|
-
flash[:notice] =
|
|
127
|
+
flash[:notice] = _t("Picture deleted successfully", :name => name)
|
|
128
128
|
rescue Exception => e
|
|
129
129
|
flash[:error] = e.message
|
|
130
130
|
ensure
|
|
@@ -135,7 +135,7 @@ module Alchemy
|
|
|
135
135
|
def flush
|
|
136
136
|
# FileUtils.rm_rf only takes arrays of folders...
|
|
137
137
|
FileUtils.rm_rf Dir.glob(Rails.root.join('public', Alchemy.mount_point, 'pictures', '*'))
|
|
138
|
-
@notice =
|
|
138
|
+
@notice = _t('Picture cache flushed')
|
|
139
139
|
end
|
|
140
140
|
|
|
141
141
|
def show_in_window
|
|
@@ -75,7 +75,7 @@ module Alchemy
|
|
|
75
75
|
when :destroy
|
|
76
76
|
verb = "removed"
|
|
77
77
|
end
|
|
78
|
-
flash[:notice] =
|
|
78
|
+
flash[:notice] = _t("#{resource_handler.model_name.classify} successfully #{verb}", :default => _t("Succesfully #{verb}"))
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
def is_alchemy_module?
|
|
@@ -17,7 +17,7 @@ module Alchemy
|
|
|
17
17
|
|
|
18
18
|
def create
|
|
19
19
|
@tag = ActsAsTaggableOn::Tag.create(params[:tag])
|
|
20
|
-
render_errors_or_redirect @tag, admin_tags_path,
|
|
20
|
+
render_errors_or_redirect @tag, admin_tags_path, _t('New Tag Created')
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def edit
|
|
@@ -29,12 +29,12 @@ module Alchemy
|
|
|
29
29
|
if params[:replace]
|
|
30
30
|
@new_tag = ActsAsTaggableOn::Tag.find(params[:tag][:merge_to])
|
|
31
31
|
Tag.replace(@tag, @new_tag)
|
|
32
|
-
operation_text =
|
|
32
|
+
operation_text = _t('Replaced Tag %{old_tag} with %{new_tag}') % {:old_tag => @tag.name, :new_tag => @new_tag.name}
|
|
33
33
|
@tag.destroy
|
|
34
34
|
else
|
|
35
35
|
@tag.update_attributes(params[:tag])
|
|
36
36
|
@tag.save
|
|
37
|
-
operation_text =
|
|
37
|
+
operation_text = _t(:successfully_updated_tag)
|
|
38
38
|
end
|
|
39
39
|
render_errors_or_redirect @tag, admin_tags_path, operation_text
|
|
40
40
|
end
|
|
@@ -42,7 +42,7 @@ module Alchemy
|
|
|
42
42
|
def destroy
|
|
43
43
|
if request.delete?
|
|
44
44
|
@tag.destroy
|
|
45
|
-
flash[:notice] =
|
|
45
|
+
flash[:notice] = _t(:successfully_deleted_tag)
|
|
46
46
|
end
|
|
47
47
|
@redirect_url = admin_tags_path
|
|
48
48
|
render :action => :redirect
|
|
@@ -39,7 +39,7 @@ module Alchemy
|
|
|
39
39
|
render_errors_or_redirect(
|
|
40
40
|
@user,
|
|
41
41
|
admin_users_path,
|
|
42
|
-
|
|
42
|
+
_t("User created", :name => @user.name)
|
|
43
43
|
)
|
|
44
44
|
end
|
|
45
45
|
|
|
@@ -55,7 +55,7 @@ module Alchemy
|
|
|
55
55
|
render_errors_or_redirect(
|
|
56
56
|
@user,
|
|
57
57
|
admin_users_path,
|
|
58
|
-
|
|
58
|
+
_t("User updated", :name => @user.name)
|
|
59
59
|
)
|
|
60
60
|
end
|
|
61
61
|
|
|
@@ -63,7 +63,7 @@ module Alchemy
|
|
|
63
63
|
# User is fetched via before filter
|
|
64
64
|
name = @user.name
|
|
65
65
|
if @user.destroy
|
|
66
|
-
flash[:notice] =
|
|
66
|
+
flash[:notice] = _t("User deleted", :name => name)
|
|
67
67
|
end
|
|
68
68
|
@redirect_url = admin_users_path
|
|
69
69
|
render :action => :redirect
|
|
@@ -10,7 +10,7 @@ module Alchemy
|
|
|
10
10
|
before_filter :set_language
|
|
11
11
|
before_filter :mailer_set_url_options
|
|
12
12
|
|
|
13
|
-
helper_method :current_server, :current_site
|
|
13
|
+
helper_method :current_server, :current_site
|
|
14
14
|
|
|
15
15
|
# Returns a host string with the domain the app is running on.
|
|
16
16
|
def current_server
|
|
@@ -39,9 +39,9 @@ module Alchemy
|
|
|
39
39
|
raise ActionController::RoutingError.new('Not Found')
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
#
|
|
43
|
-
def
|
|
44
|
-
|
|
42
|
+
# Shortcut for Alchemy::I18n.translate method
|
|
43
|
+
def _t(key, *args)
|
|
44
|
+
I18n.t(key, *args)
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
private
|
|
@@ -74,10 +74,8 @@ module Alchemy
|
|
|
74
74
|
session[:current_locale] = ::I18n.locale = params[:locale]
|
|
75
75
|
elsif current_user && current_user.language.present?
|
|
76
76
|
::I18n.locale = current_user.language
|
|
77
|
-
elsif Rails.env == 'test' # OMG I hate to do this. But it helps...
|
|
78
|
-
::I18n.locale = 'en'
|
|
79
77
|
else
|
|
80
|
-
::I18n.locale = request.env['HTTP_ACCEPT_LANGUAGE'].try(:scan, /^[a-z]{2}/).try(:first)
|
|
78
|
+
::I18n.locale = request.env['HTTP_ACCEPT_LANGUAGE'].try(:scan, /^[a-z]{2}/).try(:first) || ::I18n.default_locale
|
|
81
79
|
end
|
|
82
80
|
end
|
|
83
81
|
|
|
@@ -117,7 +115,7 @@ module Alchemy
|
|
|
117
115
|
end
|
|
118
116
|
|
|
119
117
|
def load_language_default
|
|
120
|
-
Language.get_default
|
|
118
|
+
Language.get_default || raise(DefaultLanguageNotFoundError)
|
|
121
119
|
end
|
|
122
120
|
|
|
123
121
|
def store_language_in_session(language)
|
|
@@ -201,19 +199,19 @@ module Alchemy
|
|
|
201
199
|
elsif request.xhr?
|
|
202
200
|
respond_to do |format|
|
|
203
201
|
format.js {
|
|
204
|
-
render :js => "Alchemy.growl('#{
|
|
202
|
+
render :js => "Alchemy.growl('#{_t('You are not authorized')}', 'warning'); Alchemy.Buttons.enable();"
|
|
205
203
|
}
|
|
206
204
|
format.html {
|
|
207
|
-
render :partial => 'alchemy/admin/partials/flash', :locals => {:message =>
|
|
205
|
+
render :partial => 'alchemy/admin/partials/flash', :locals => {:message => _t('You are not authorized'), :flash_type => 'warning'}
|
|
208
206
|
}
|
|
209
207
|
end
|
|
210
208
|
else
|
|
211
|
-
flash[:error] =
|
|
209
|
+
flash[:error] = _t('You are not authorized')
|
|
212
210
|
redirect_to alchemy.admin_dashboard_path
|
|
213
211
|
end
|
|
214
212
|
end
|
|
215
213
|
else
|
|
216
|
-
flash[:info] =
|
|
214
|
+
flash[:info] = _t('Please log in')
|
|
217
215
|
if request.xhr?
|
|
218
216
|
render :action => :permission_denied
|
|
219
217
|
else
|
|
@@ -17,7 +17,7 @@ module Alchemy
|
|
|
17
17
|
# - name: mail_from
|
|
18
18
|
# type: EssenceText
|
|
19
19
|
# - name: success_page
|
|
20
|
-
# type:
|
|
20
|
+
# type: EssenceSelect
|
|
21
21
|
#
|
|
22
22
|
# The fields +mail_to+, +mail_from+, +subject+ and +success_page+ are recommended.
|
|
23
23
|
# The +Alchemy::MessagesController+ uses them to send your mails. So your customer has full controll of these values inside his contactform element.
|
|
@@ -99,12 +99,12 @@ module Alchemy
|
|
|
99
99
|
end
|
|
100
100
|
|
|
101
101
|
def redirect_to_success_page
|
|
102
|
+
flash[:notice] = _t(:success, :scope => 'contactform.messages')
|
|
102
103
|
if @element.ingredient("success_page")
|
|
103
104
|
urlname = @element.ingredient("success_page")
|
|
104
105
|
elsif mailer_config['forward_to_page'] && mailer_config['mail_success_page']
|
|
105
106
|
urlname = Page.find_by_urlname(mailer_config['mail_success_page']).urlname
|
|
106
107
|
else
|
|
107
|
-
flash[:notice] = t(:success, :scope => 'contactform.messages')
|
|
108
108
|
urlname = Page.language_root_for(session[:language_id]).urlname
|
|
109
109
|
end
|
|
110
110
|
redirect_to show_page_path(:urlname => urlname, :lang => multi_language? ? session[:language_code] : nil)
|
|
@@ -80,7 +80,7 @@ module Alchemy
|
|
|
80
80
|
|
|
81
81
|
def enforce_primary_host_for_site
|
|
82
82
|
if needs_redirect_to_primary_host?
|
|
83
|
-
redirect_to url_for(host: current_site.host)
|
|
83
|
+
redirect_to url_for(host: current_site.host), :status => 301
|
|
84
84
|
end
|
|
85
85
|
end
|
|
86
86
|
|
|
@@ -94,6 +94,9 @@ module Alchemy
|
|
|
94
94
|
@page ||= load_page
|
|
95
95
|
if User.admins.count == 0 && @page.nil?
|
|
96
96
|
redirect_to signup_path
|
|
97
|
+
elsif @page.nil? && legacy_url = LegacyPageUrl.where(urlname: params[:urlname]).last
|
|
98
|
+
@page = legacy_url.page
|
|
99
|
+
redirect_page
|
|
97
100
|
elsif @page.blank?
|
|
98
101
|
raise_not_found_error
|
|
99
102
|
elsif multi_language? && params[:lang].blank?
|
|
@@ -33,6 +33,7 @@ module Alchemy
|
|
|
33
33
|
image_file = image_file.process(:resize, size + '>')
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
+
expires_in 1.month, public: !@picture.restricted?
|
|
36
37
|
respond_to { |format| send_image(image_file, format) }
|
|
37
38
|
end
|
|
38
39
|
|
|
@@ -106,8 +107,4 @@ module Alchemy
|
|
|
106
107
|
end
|
|
107
108
|
|
|
108
109
|
end
|
|
109
|
-
|
|
110
|
-
class MissingImageFileError < StandardError
|
|
111
|
-
end
|
|
112
|
-
|
|
113
110
|
end
|
|
@@ -21,22 +21,22 @@ module Alchemy
|
|
|
21
21
|
if params[:send_credentials]
|
|
22
22
|
Notifications.admin_user_created(@user).deliver
|
|
23
23
|
end
|
|
24
|
-
flash[:notice] =
|
|
24
|
+
flash[:notice] = _t('Successfully signup admin user')
|
|
25
25
|
redirect_to admin_dashboard_path
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
rescue Errno::ECONNREFUSED => e
|
|
29
|
-
flash[:error] =
|
|
29
|
+
flash[:error] = _t(:signup_mail_delivery_error)
|
|
30
30
|
redirect_to admin_dashboard_path
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def login
|
|
34
34
|
if current_user
|
|
35
|
-
redirect_to admin_dashboard_path, :notice =>
|
|
35
|
+
redirect_to admin_dashboard_path, :notice => _t('You are already logged in')
|
|
36
36
|
else
|
|
37
37
|
if request.get?
|
|
38
38
|
@user_session = UserSession.new()
|
|
39
|
-
flash.now[:info] = params[:message] ||
|
|
39
|
+
flash.now[:info] = params[:message] || _t("welcome_please_identify_notice")
|
|
40
40
|
else
|
|
41
41
|
@user_session = UserSession.new(params[:alchemy_user_session])
|
|
42
42
|
store_screen_size
|
|
@@ -59,7 +59,7 @@ module Alchemy
|
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
def logout
|
|
62
|
-
message = params[:message] ||
|
|
62
|
+
message = params[:message] || _t("logged_out")
|
|
63
63
|
@user_session = UserSession.find
|
|
64
64
|
if @user_session
|
|
65
65
|
@user_session.destroy
|