alchemy_cms 3.4.2 → 3.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/.codeclimate.yml +9 -3
- data/.teatro.yml +1 -0
- data/.travis.yml +14 -17
- data/CHANGELOG.md +44 -6
- data/Gemfile +7 -4
- data/README.md +60 -10
- data/Rakefile +1 -1
- data/alchemy_cms.gemspec +5 -8
- data/app/assets/javascripts/alchemy/admin.js +2 -0
- data/app/assets/javascripts/alchemy/alchemy.dialog.js.coffee +1 -0
- data/app/assets/javascripts/alchemy/alchemy.gui.js.coffee +1 -0
- data/app/assets/javascripts/alchemy/alchemy.hotkeys.js.coffee +1 -1
- data/app/assets/javascripts/alchemy/alchemy.initializer.js.coffee +9 -7
- data/app/assets/javascripts/alchemy/alchemy.link_dialog.js.coffee +1 -0
- data/app/assets/javascripts/alchemy/alchemy.preview_window.js.coffee +11 -7
- data/app/assets/javascripts/alchemy/alchemy.sitemap.js.coffee +1 -1
- data/app/assets/javascripts/alchemy/alchemy.tinymce.js.coffee +8 -3
- data/app/assets/javascripts/alchemy/alchemy.tooltips.coffee +10 -0
- data/app/assets/javascripts/alchemy/alchemy.uploader.js.coffee +104 -73
- data/app/assets/stylesheets/alchemy/_defaults.scss +1 -4
- data/app/assets/stylesheets/alchemy/_extends.scss +13 -35
- data/app/assets/stylesheets/alchemy/_mixins.scss +82 -18
- data/app/assets/stylesheets/alchemy/_variables.scss +21 -8
- data/app/assets/stylesheets/alchemy/admin.scss +4 -0
- data/app/assets/stylesheets/alchemy/archive.scss +8 -12
- data/app/assets/stylesheets/alchemy/attachments.scss +39 -0
- data/app/assets/stylesheets/alchemy/base.scss +26 -15
- data/app/assets/stylesheets/alchemy/buttons.scss +59 -31
- data/app/assets/stylesheets/alchemy/dashboard.scss +3 -3
- data/app/assets/stylesheets/alchemy/dialogs.scss +10 -8
- data/app/assets/stylesheets/alchemy/elements.scss +65 -41
- data/app/assets/stylesheets/alchemy/errors.scss +7 -0
- data/app/assets/stylesheets/alchemy/flash.scss +1 -1
- data/app/assets/stylesheets/alchemy/form_fields.scss +0 -37
- data/app/assets/stylesheets/alchemy/forms.scss +18 -27
- data/app/assets/stylesheets/alchemy/frame.scss +104 -204
- data/app/assets/stylesheets/alchemy/hints.scss +62 -0
- data/app/assets/stylesheets/alchemy/icon-font.scss +2 -1
- data/app/assets/stylesheets/alchemy/icons.scss +9 -4
- data/app/assets/stylesheets/alchemy/image_library.scss +6 -6
- data/app/assets/stylesheets/alchemy/jquery-ui.scss +6 -4
- data/app/assets/stylesheets/alchemy/lists.scss +0 -1
- data/app/assets/stylesheets/alchemy/menubar.scss +3 -4
- data/app/assets/stylesheets/alchemy/modules.scss +0 -6
- data/app/assets/stylesheets/alchemy/navigation.scss +242 -0
- data/app/assets/stylesheets/alchemy/pagination.scss +3 -3
- data/app/assets/stylesheets/alchemy/print.scss +1 -0
- data/app/assets/stylesheets/alchemy/resource_info.scss +45 -0
- data/app/assets/stylesheets/alchemy/search.scss +72 -1
- data/app/assets/stylesheets/alchemy/selects.scss +38 -44
- data/app/assets/stylesheets/alchemy/sitemap.scss +89 -79
- data/app/assets/stylesheets/alchemy/tables.scss +6 -10
- data/app/assets/stylesheets/alchemy/toolbar.scss +7 -36
- data/app/assets/stylesheets/alchemy/upload.scss +12 -3
- data/app/assets/stylesheets/tinymce/skins/alchemy/content.min.css.scss +6 -3
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.svg +58 -170
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.ttf +0 -0
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.woff +0 -0
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.svg +124 -148
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.ttf +0 -0
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.woff +0 -0
- data/app/assets/stylesheets/tinymce/skins/alchemy/skin.min.css.scss +426 -144
- data/app/controllers/alchemy/admin/attachments_controller.rb +24 -16
- data/app/controllers/alchemy/admin/clipboard_controller.rb +1 -1
- data/app/controllers/alchemy/admin/essence_files_controller.rb +1 -1
- data/app/controllers/alchemy/admin/essence_pictures_controller.rb +9 -8
- data/app/controllers/alchemy/admin/layoutpages_controller.rb +1 -0
- data/app/controllers/alchemy/admin/pages_controller.rb +2 -2
- data/app/controllers/alchemy/admin/resources_controller.rb +2 -2
- data/app/controllers/alchemy/admin/tags_controller.rb +1 -1
- data/app/controllers/alchemy/api/pages_controller.rb +16 -0
- data/app/controllers/alchemy/messages_controller.rb +1 -1
- data/app/controllers/concerns/alchemy/admin/uploader_responses.rb +2 -2
- data/app/helpers/alchemy/admin/attachments_helper.rb +11 -0
- data/app/helpers/alchemy/admin/base_helper.rb +37 -4
- data/app/helpers/alchemy/admin/contents_helper.rb +11 -4
- data/app/helpers/alchemy/admin/elements_helper.rb +0 -19
- data/app/helpers/alchemy/admin/essences_helper.rb +7 -30
- data/app/helpers/alchemy/admin/navigation_helper.rb +13 -51
- data/app/helpers/alchemy/admin/pages_helper.rb +21 -16
- data/app/helpers/alchemy/admin/pictures_helper.rb +9 -0
- data/app/helpers/alchemy/deprecated_pages_helper.rb +54 -0
- data/app/helpers/alchemy/essences_helper.rb +1 -1
- data/app/helpers/alchemy/pages_helper.rb +8 -109
- data/app/helpers/alchemy/url_helper.rb +8 -13
- data/app/models/alchemy/attachment.rb +7 -4
- data/app/models/alchemy/cell.rb +2 -2
- data/app/models/alchemy/content.rb +2 -2
- data/app/models/alchemy/content/factory.rb +12 -9
- data/app/models/alchemy/element.rb +6 -3
- data/app/models/alchemy/essence_file.rb +1 -1
- data/app/models/alchemy/essence_picture.rb +37 -47
- data/app/models/alchemy/essence_picture_view.rb +8 -1
- data/app/models/alchemy/folded_page.rb +3 -2
- data/app/models/alchemy/legacy_page_url.rb +3 -3
- data/app/models/alchemy/page.rb +50 -5
- data/app/models/alchemy/page/fixed_attributes.rb +63 -0
- data/app/models/alchemy/page/page_elements.rb +10 -7
- data/app/models/alchemy/page/page_natures.rb +19 -0
- data/app/models/alchemy/picture.rb +1 -0
- data/app/models/alchemy/picture/transformations.rb +1 -1
- data/app/models/alchemy/picture/url.rb +82 -0
- data/app/serializers/alchemy/page_tree_serializer.rb +29 -8
- data/app/views/alchemy/_edit_mode.html.erb +2 -0
- data/app/views/alchemy/_menubar.html.erb +1 -1
- data/app/views/alchemy/_preview_mode_code.html.erb +6 -0
- data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +1 -1
- data/app/views/alchemy/admin/attachments/_attachment.html.erb +25 -5
- data/app/views/alchemy/admin/attachments/_replace_button.html.erb +26 -0
- data/app/views/alchemy/admin/attachments/index.html.erb +1 -1
- data/app/views/alchemy/admin/attachments/show.html.erb +52 -0
- data/app/views/alchemy/admin/elements/_element_header.html.erb +6 -3
- data/app/views/alchemy/admin/elements/create.js.erb +0 -2
- data/app/views/alchemy/admin/elements/trash.js.erb +0 -1
- data/app/views/alchemy/admin/elements/update.js.erb +0 -2
- data/app/views/alchemy/admin/essence_pictures/crop.html.erb +1 -4
- data/app/views/alchemy/admin/essence_pictures/edit.html.erb +1 -1
- data/app/views/alchemy/admin/languages/index.html.erb +1 -0
- data/app/views/alchemy/admin/layoutpages/_layoutpage.html.erb +26 -27
- data/app/views/alchemy/admin/layoutpages/edit.html.erb +1 -1
- data/app/views/alchemy/admin/pages/_form.html.erb +13 -40
- data/app/views/alchemy/admin/pages/_locked_page.html.erb +1 -1
- data/app/views/alchemy/admin/pages/_page.html.erb +119 -61
- data/app/views/alchemy/admin/pages/_page_for_links.html.erb +4 -2
- data/app/views/alchemy/admin/pages/_page_infos.html.erb +12 -12
- data/app/views/alchemy/admin/pages/_page_status.html.erb +1 -1
- data/app/views/alchemy/admin/pages/_publication_fields.html.erb +35 -0
- data/app/views/alchemy/admin/pages/edit.html.erb +13 -2
- data/app/views/alchemy/admin/pages/index.html.erb +3 -8
- data/app/views/alchemy/admin/pages/info.html.erb +15 -2
- data/app/views/alchemy/admin/pages/sort.js.erb +1 -1
- data/app/views/alchemy/admin/pages/update.js.erb +1 -14
- data/app/views/alchemy/admin/partials/_main_navigation_entry.html.erb +12 -8
- data/app/views/alchemy/admin/partials/_remote_search_form.html.erb +4 -4
- data/app/views/alchemy/admin/partials/_search_form.html.erb +1 -1
- data/app/views/alchemy/admin/partials/_sub_navigation.html.erb +9 -6
- data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +1 -1
- data/app/views/alchemy/admin/pictures/_picture.html.erb +1 -6
- data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +1 -6
- data/app/views/alchemy/admin/pictures/index.html.erb +1 -1
- data/app/views/alchemy/admin/pictures/show.html.erb +1 -6
- data/app/views/alchemy/admin/uploader/_button.html.erb +4 -4
- data/app/views/alchemy/base/500.html.erb +15 -1
- data/app/views/alchemy/essences/_essence_boolean_editor.html.erb +13 -15
- data/app/views/alchemy/essences/_essence_boolean_view.html.erb +1 -3
- data/app/views/alchemy/essences/_essence_date_editor.html.erb +0 -2
- data/app/views/alchemy/essences/_essence_date_view.html.erb +0 -2
- data/app/views/alchemy/essences/_essence_file_editor.html.erb +2 -7
- data/app/views/alchemy/essences/_essence_file_view.html.erb +1 -3
- data/app/views/alchemy/essences/_essence_html_editor.html.erb +0 -2
- data/app/views/alchemy/essences/_essence_html_view.html.erb +1 -3
- data/app/views/alchemy/essences/_essence_link_editor.html.erb +0 -2
- data/app/views/alchemy/essences/_essence_link_view.html.erb +0 -2
- data/app/views/alchemy/essences/_essence_picture_editor.html.erb +47 -49
- data/app/views/alchemy/essences/_essence_picture_view.html.erb +1 -3
- data/app/views/alchemy/essences/_essence_richtext_editor.html.erb +0 -2
- data/app/views/alchemy/essences/_essence_richtext_view.html.erb +1 -3
- data/app/views/alchemy/essences/_essence_select_editor.html.erb +27 -29
- data/app/views/alchemy/essences/_essence_select_view.html.erb +1 -3
- data/app/views/alchemy/essences/_essence_text_editor.html.erb +17 -19
- data/app/views/alchemy/essences/_essence_text_view.html.erb +0 -2
- data/app/views/alchemy/pages/_meta_data.html.erb +9 -0
- data/app/views/layouts/alchemy/admin.html.erb +9 -11
- data/bin/alchemy +1 -2
- data/config/alchemy/config.yml +1 -1
- data/config/alchemy/modules.yml +0 -16
- data/config/initializers/dragonfly.rb +0 -18
- data/config/initializers/mini_profiler.rb +6 -0
- data/config/locales/alchemy.de.yml +9 -1
- data/config/locales/alchemy.en.yml +7 -1
- data/config/locales/alchemy.es.yml +6 -0
- data/config/locales/alchemy.fr.yml +2 -0
- data/config/locales/alchemy.it.yml +3 -1
- data/config/locales/alchemy.nl.yml +2 -0
- data/config/locales/alchemy.ru.yml +2 -0
- data/config/routes.rb +3 -8
- data/db/migrate/20160912223112_add_index_to_alchemy_pages_rgt.rb +9 -0
- data/db/migrate/20160927205604_add_foreign_key_indices_and_null_constraints.rb +20 -0
- data/db/migrate/20160928080104_add_foreign_keys.rb +27 -0
- data/lib/alchemy/admin/locale.rb +4 -3
- data/lib/alchemy/engine.rb +2 -4
- data/lib/alchemy/errors.rb +9 -2
- data/lib/alchemy/forms/builder.rb +8 -0
- data/lib/alchemy/modules.rb +20 -19
- data/lib/alchemy/permissions.rb +15 -4
- data/lib/alchemy/resources_helper.rb +4 -2
- data/lib/alchemy/sass_support.rb +9 -0
- data/lib/alchemy/seeder.rb +89 -1
- data/lib/alchemy/test_support/essence_shared_examples.rb +2 -0
- data/lib/alchemy/test_support/factories/attachment_factory.rb +1 -1
- data/lib/alchemy/test_support/factories/content_factory.rb +1 -0
- data/lib/alchemy/test_support/factories/element_factory.rb +1 -0
- data/lib/alchemy/test_support/factories/picture_factory.rb +1 -1
- data/lib/alchemy/test_support/fixtures/image.png +0 -0
- data/lib/alchemy/tinymce.rb +2 -6
- data/lib/alchemy/upgrader.rb +4 -55
- data/lib/alchemy/upgrader/tasks/install_dragonfly_config.rb +14 -0
- data/lib/alchemy/upgrader/three_point_five.rb +32 -0
- data/lib/alchemy/upgrader/three_point_four.rb +2 -8
- data/lib/alchemy/upgrader/three_point_one.rb +30 -30
- data/lib/alchemy/upgrader/three_point_three.rb +31 -31
- data/lib/alchemy/upgrader/three_point_two.rb +25 -25
- data/lib/alchemy/upgrader/three_point_zero.rb +59 -59
- data/lib/alchemy/version.rb +1 -1
- data/lib/rails/generators/alchemy/elements/templates/view.html.erb +1 -1
- data/lib/rails/generators/alchemy/elements/templates/view.html.haml +1 -1
- data/lib/rails/generators/alchemy/elements/templates/view.html.slim +1 -1
- data/lib/rails/generators/alchemy/essence/templates/editor.html.erb +1 -3
- data/lib/rails/generators/alchemy/install/files/_article_view.html.erb +1 -1
- data/lib/rails/generators/alchemy/install/files/application.html.erb +3 -4
- data/lib/rails/generators/alchemy/install/install_generator.rb +4 -0
- data/lib/rails/generators/alchemy/install/templates/dragonfly.rb.tt +35 -0
- data/lib/rails/generators/alchemy/module/module_generator.rb +1 -1
- data/lib/tasks/alchemy/db.rake +6 -0
- data/lib/tasks/alchemy/tidy.rake +85 -0
- data/lib/tasks/alchemy/upgrade.rake +165 -16
- data/vendor/assets/javascripts/clipboard.min.js +7 -0
- data/vendor/assets/javascripts/fileupload/jquery.fileupload-process.js +4 -4
- data/vendor/assets/javascripts/fileupload/jquery.fileupload-validate.js +2 -2
- data/vendor/assets/javascripts/fileupload/jquery.fileupload.js +29 -14
- data/vendor/assets/javascripts/fileupload/jquery.iframe-transport.js +2 -2
- data/vendor/assets/javascripts/tinymce/langs/es.js +2 -2
- data/vendor/assets/javascripts/tinymce/langs/fr.js +1 -1
- data/vendor/assets/javascripts/tinymce/langs/it.js +1 -1
- data/vendor/assets/javascripts/tinymce/langs/nl.js +3 -3
- data/vendor/assets/javascripts/tinymce/tinymce.min.js +15 -12
- metadata +44 -88
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/readme.md +0 -1
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.eot +0 -0
- data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.eot +0 -0
- data/app/assets/stylesheets/tinymce/skins/alchemy/img/wline.gif +0 -0
- data/app/assets/stylesheets/tinymce/skins/alchemy/skin.ie7.min.css +0 -1
- data/app/controllers/alchemy/pictures_controller.rb +0 -97
- data/app/views/alchemy/admin/elements/_refresh_editor.js.erb +0 -8
- data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/code/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/directionality/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/hr/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/link/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/paste/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/tabfocus/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/plugins/table/plugin.min.js +0 -1
- data/vendor/assets/javascripts/tinymce/themes/modern/theme.min.js +0 -1
@@ -1,7 +1,7 @@
|
|
1
1
|
module Alchemy
|
2
2
|
module Admin
|
3
3
|
module PagesHelper
|
4
|
-
include Alchemy::BaseHelper
|
4
|
+
include Alchemy::Admin::BaseHelper
|
5
5
|
|
6
6
|
# Returns options tags for the screen sizes select in page edit view.
|
7
7
|
#
|
@@ -17,17 +17,6 @@ module Alchemy
|
|
17
17
|
])
|
18
18
|
end
|
19
19
|
|
20
|
-
# Returns the translated explanation of the page status.
|
21
|
-
#
|
22
|
-
def combined_page_status(page)
|
23
|
-
page.status.map do |state, _value|
|
24
|
-
next if state == :locked
|
25
|
-
css_class = page.send("#{state}?") ? "page_status #{state}" : "page_status not_#{state}"
|
26
|
-
val = content_tag(:span, '', class: css_class)
|
27
|
-
val + page.status_title(state)
|
28
|
-
end.delete_if(&:blank?).join("<br>").html_safe
|
29
|
-
end
|
30
|
-
|
31
20
|
# Renders a label for page's page layout
|
32
21
|
#
|
33
22
|
# If the page layout definition of the page is missing, it displays a warning.
|
@@ -35,16 +24,32 @@ module Alchemy
|
|
35
24
|
def page_layout_label(page)
|
36
25
|
if page.persisted? && page.definition.blank?
|
37
26
|
[
|
38
|
-
|
39
|
-
class: 'inline warning icon',
|
40
|
-
title: Alchemy.t(:page_definition_missing)
|
41
|
-
),
|
27
|
+
page_layout_missing_warning,
|
42
28
|
Alchemy.t(:page_type)
|
43
29
|
].join(' ').html_safe
|
44
30
|
else
|
45
31
|
Alchemy.t(:page_type)
|
46
32
|
end
|
47
33
|
end
|
34
|
+
|
35
|
+
def page_status_checkbox(page, attribute)
|
36
|
+
label = page.class.human_attribute_name(attribute)
|
37
|
+
|
38
|
+
if page.attribute_fixed?(attribute)
|
39
|
+
checkbox = check_box(:page, attribute, disabled: true)
|
40
|
+
hint = content_tag(:span, class: 'hint-bubble') do
|
41
|
+
Alchemy.t(:attribute_fixed, attribute: attribute)
|
42
|
+
end
|
43
|
+
content = content_tag(:span, class: 'with-hint') do
|
44
|
+
"#{checkbox}\n#{label}\n#{hint}".html_safe
|
45
|
+
end
|
46
|
+
else
|
47
|
+
checkbox = check_box(:page, attribute)
|
48
|
+
content = "#{checkbox}\n#{label}".html_safe
|
49
|
+
end
|
50
|
+
|
51
|
+
content_tag(:label, class: 'checkbox') { content }
|
52
|
+
end
|
48
53
|
end
|
49
54
|
end
|
50
55
|
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module Alchemy
|
2
|
+
module DeprecatedPagesHelper
|
3
|
+
# All these helper methods are deprecated.
|
4
|
+
# They are mixed into Alchemy::PagesHelper but will be removed in the future.
|
5
|
+
|
6
|
+
def alchemy_preview_mode_code
|
7
|
+
ActiveSupport::Deprecation.warn('PageHelper `alchemy_preview_mode_code` is deprecated and will be removed with Alchemy v4.0. Please use `render "alchemy/preview_mode_code"` in your layout instead.')
|
8
|
+
render "alchemy/preview_mode_code"
|
9
|
+
end
|
10
|
+
|
11
|
+
def render_meta_data(options = {})
|
12
|
+
ActiveSupport::Deprecation.warn('PageHelper `render_meta_data` is deprecated and will be removed with Alchemy v4.0. Please use `render "alchemy/pages/meta_data"` in your view instead.')
|
13
|
+
render "alchemy/pages/meta_data", options
|
14
|
+
end
|
15
|
+
|
16
|
+
def render_page_title(options = {})
|
17
|
+
ActiveSupport::Deprecation.warn('PageHelper `render_page_title` is deprecated and will be removed with Alchemy v4.0. Please use `render "alchemy/pages/meta_data"` in your view instead.')
|
18
|
+
return "" if @page.title.blank?
|
19
|
+
options = {
|
20
|
+
prefix: "",
|
21
|
+
separator: ""
|
22
|
+
}.update(options)
|
23
|
+
title_parts = [options[:prefix]]
|
24
|
+
if response.status == 200
|
25
|
+
title_parts << @page.title
|
26
|
+
else
|
27
|
+
title_parts << response.status
|
28
|
+
end
|
29
|
+
title_parts.join(options[:separator]).html_safe
|
30
|
+
end
|
31
|
+
|
32
|
+
def render_title_tag(options = {})
|
33
|
+
ActiveSupport::Deprecation.warn('PageHelper `render_title_tag` is deprecated and will be removed with Alchemy v4.0. Please use `render "alchemy/pages/meta_data"` in your view instead.')
|
34
|
+
default_options = {
|
35
|
+
prefix: "",
|
36
|
+
separator: ""
|
37
|
+
}
|
38
|
+
options = default_options.merge(options)
|
39
|
+
content_tag(:title, render_page_title(options))
|
40
|
+
end
|
41
|
+
|
42
|
+
def render_meta_tag(options = {})
|
43
|
+
ActiveSupport::Deprecation.warn('PageHelper `render_meta_tag` is deprecated and will be removed with Alchemy v4.0. Please use `tag()` instead. (http://api.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html#method-i-tag)')
|
44
|
+
default_options = {
|
45
|
+
name: "",
|
46
|
+
default_language: "de",
|
47
|
+
content: ""
|
48
|
+
}
|
49
|
+
options = default_options.merge(options)
|
50
|
+
lang = (@page.language.blank? ? options[:default_language] : @page.language.code)
|
51
|
+
tag(:meta, name: options[:name], content: options[:content], lang: lang)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -78,7 +78,7 @@ module Alchemy
|
|
78
78
|
#
|
79
79
|
# == Options:
|
80
80
|
#
|
81
|
-
# :
|
81
|
+
# :size => "111x93" # Used by EssencePicture to resize the image to that size. [Default nil]
|
82
82
|
# :date_format => "Am %d. %m. %Y, um %H:%Mh" # Especially for EssenceDate. See Rubys Date.strftime for date formatting options. [Default nil]
|
83
83
|
# :show_caption => false # Pass Boolean to show/hide the caption of an EssencePicture. [Default true]
|
84
84
|
# :disable_link => true # You can surpress the link of an EssencePicture. Default false
|
@@ -2,6 +2,7 @@ module Alchemy
|
|
2
2
|
module PagesHelper
|
3
3
|
include Alchemy::BaseHelper
|
4
4
|
include Alchemy::ElementsHelper
|
5
|
+
include Alchemy::DeprecatedPagesHelper
|
5
6
|
|
6
7
|
def picture_essence_caption(content)
|
7
8
|
content.try(:essence).try(:caption)
|
@@ -266,12 +267,7 @@ module Alchemy
|
|
266
267
|
# prefix: "" # Prefix
|
267
268
|
# separator: "" # Separating prefix and title
|
268
269
|
#
|
269
|
-
|
270
|
-
#
|
271
|
-
# Please use the render_meta_data() helper instead. There all important meta information gets rendered in one helper.
|
272
|
-
# So you dont have to worry about anything.
|
273
|
-
#
|
274
|
-
def render_page_title(options = {})
|
270
|
+
def page_title(options = {})
|
275
271
|
return "" if @page.title.blank?
|
276
272
|
options = {
|
277
273
|
prefix: "",
|
@@ -286,105 +282,16 @@ module Alchemy
|
|
286
282
|
title_parts.join(options[:separator]).html_safe
|
287
283
|
end
|
288
284
|
|
289
|
-
|
290
|
-
|
291
|
-
# === Webdevelopers:
|
292
|
-
#
|
293
|
-
# Please use the render_meta_data() helper. There all important meta information gets rendered in one helper.
|
294
|
-
# So you dont have to worry about anything.
|
295
|
-
#
|
296
|
-
def render_title_tag(options = {})
|
297
|
-
default_options = {
|
298
|
-
prefix: "",
|
299
|
-
separator: ""
|
300
|
-
}
|
301
|
-
options = default_options.merge(options)
|
302
|
-
content_tag(:title, render_page_title(options))
|
285
|
+
def meta_description
|
286
|
+
@page.meta_description.presence || Language.current_root_page.try(:meta_description)
|
303
287
|
end
|
304
288
|
|
305
|
-
|
306
|
-
|
307
|
-
# === Webdevelopers:
|
308
|
-
#
|
309
|
-
# Please use the render_meta_data() helper. There all important meta information gets rendered in one helper.
|
310
|
-
# So you dont have to worry about anything.
|
311
|
-
#
|
312
|
-
def render_meta_tag(options = {})
|
313
|
-
default_options = {
|
314
|
-
name: "",
|
315
|
-
default_language: "de",
|
316
|
-
content: ""
|
317
|
-
}
|
318
|
-
options = default_options.merge(options)
|
319
|
-
lang = (@page.language.blank? ? options[:default_language] : @page.language.code)
|
320
|
-
tag(:meta, name: options[:name], content: options[:content], lang: lang)
|
289
|
+
def meta_keywords
|
290
|
+
@page.meta_keywords.presence || Language.current_root_page.try(:meta_keywords)
|
321
291
|
end
|
322
292
|
|
323
|
-
|
324
|
-
|
325
|
-
# The meta data is been taken from the @page.title, @page.meta_description, @page.meta_keywords, @page.updated_at and @page.language database entries managed by the Alchemy user via the Alchemy cockpit.
|
326
|
-
#
|
327
|
-
# Assume that the user has entered following data into the Alchemy cockpit of the Page "home" and that the user wants that the searchengine (aka. google) robot should index the page and should follow all links on this page:
|
328
|
-
#
|
329
|
-
# Title = Homepage
|
330
|
-
# Description = Your page description
|
331
|
-
# Keywords: cms, ruby, rubyonrails, rails, software, development, html, javascript, ajax
|
332
|
-
#
|
333
|
-
# Then placing +render_meta_data(title_prefix: "Company", title_separator: "-")+ into the <head> part of the +pages.html.erb+ layout produces:
|
334
|
-
#
|
335
|
-
# <meta charset="utf-8">
|
336
|
-
# <title>Company - #{@page.title}</title>
|
337
|
-
# <meta name="description" content="Your page description">
|
338
|
-
# <meta name="keywords" content="cms, ruby, rubyonrails, rails, software, development, html, javascript, ajax">
|
339
|
-
# <meta name="created" content="Tue Dec 16 10:21:26 +0100 2008">
|
340
|
-
# <meta name="robots" content="index, follow">
|
341
|
-
#
|
342
|
-
def render_meta_data(options = {})
|
343
|
-
if @page.blank?
|
344
|
-
warning("No Page found!")
|
345
|
-
return nil
|
346
|
-
end
|
347
|
-
default_options = {
|
348
|
-
title_prefix: "",
|
349
|
-
title_separator: "",
|
350
|
-
default_lang: "de"
|
351
|
-
}
|
352
|
-
options = default_options.merge(options)
|
353
|
-
# render meta description of the root page from language if the current meta description is empty
|
354
|
-
if @page.meta_description.blank?
|
355
|
-
description = Language.current_root_page.try(:meta_description)
|
356
|
-
else
|
357
|
-
description = @page.meta_description
|
358
|
-
end
|
359
|
-
# render meta keywords of the root page from language if the current meta keywords is empty
|
360
|
-
if @page.meta_keywords.blank?
|
361
|
-
keywords = Language.current_root_page.try(:meta_keywords)
|
362
|
-
else
|
363
|
-
keywords = @page.meta_keywords
|
364
|
-
end
|
365
|
-
robot = "#{@page.robot_index? ? '' : 'no'}index, #{@page.robot_follow? ? '' : 'no'}follow"
|
366
|
-
meta_string = %(
|
367
|
-
#{tag(:meta, charset: 'utf-8')}
|
368
|
-
#{render_title_tag(prefix: options[:title_prefix], separator: options[:title_separator])}
|
369
|
-
#{render_meta_tag(name: 'created', content: @page.updated_at)}
|
370
|
-
#{render_meta_tag(name: 'robots', content: robot)}
|
371
|
-
)
|
372
|
-
if description.present?
|
373
|
-
meta_string += %(
|
374
|
-
#{render_meta_tag(name: 'description', content: description.html_safe)}
|
375
|
-
)
|
376
|
-
end
|
377
|
-
if keywords.present?
|
378
|
-
meta_string += %(
|
379
|
-
#{render_meta_tag(name: 'keywords', content: keywords.html_safe)}
|
380
|
-
)
|
381
|
-
end
|
382
|
-
if @page.contains_feed?
|
383
|
-
meta_string += %(
|
384
|
-
#{auto_discovery_link_tag(:rss, show_alchemy_page_url(@page, format: :rss))}
|
385
|
-
)
|
386
|
-
end
|
387
|
-
meta_string.html_safe
|
293
|
+
def meta_robots
|
294
|
+
"#{@page.robot_index? ? '' : 'no'}index, #{@page.robot_follow? ? '' : 'no'}follow"
|
388
295
|
end
|
389
296
|
|
390
297
|
# Renders the partial for the cell with the given name of the current page.
|
@@ -412,13 +319,5 @@ module Alchemy
|
|
412
319
|
return true if cell.blank?
|
413
320
|
cell.elements.not_trashed.empty?
|
414
321
|
end
|
415
|
-
|
416
|
-
# Include this in your layout file to have element selection magic in the page edit preview window.
|
417
|
-
def alchemy_preview_mode_code
|
418
|
-
if @preview_mode
|
419
|
-
javascript_tag("Alchemy = { locale: '#{session[:alchemy_locale]}' };") +
|
420
|
-
javascript_include_tag("alchemy/preview")
|
421
|
-
end
|
422
|
-
end
|
423
322
|
end
|
424
323
|
end
|
@@ -22,8 +22,11 @@ module Alchemy
|
|
22
22
|
#
|
23
23
|
# <%= image_tag show_alchemy_picture_path(picture, size: '320x200', format: :png) %>
|
24
24
|
#
|
25
|
+
# @deprecated Use Alchemy::Picture#url instead
|
26
|
+
#
|
25
27
|
def show_alchemy_picture_path(picture, optional_params = {})
|
26
|
-
|
28
|
+
ActiveSupport::Deprecation.warn("`show_alchemy_picture_path` helper is deprecated and will be removed in Alchemy 4.0. Please use the `picture.url` method instead.")
|
29
|
+
picture.url(optional_params)
|
27
30
|
end
|
28
31
|
|
29
32
|
# This helper returns an url to picture for use inside a image_tag helper.
|
@@ -34,19 +37,11 @@ module Alchemy
|
|
34
37
|
#
|
35
38
|
# <%= image_tag show_alchemy_picture_url(picture, size: '320x200', format: :png) %>
|
36
39
|
#
|
40
|
+
# @deprecated Use Alchemy::Picture#url instead
|
41
|
+
#
|
37
42
|
def show_alchemy_picture_url(picture, optional_params = {})
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
# Returns the correct params hash for passing to show_picture_path
|
42
|
-
def show_picture_path_params(picture, optional_params = {})
|
43
|
-
url_params = {
|
44
|
-
id: picture.id,
|
45
|
-
name: picture.urlname,
|
46
|
-
format: picture.default_render_format,
|
47
|
-
sh: picture.security_token(optional_params)
|
48
|
-
}
|
49
|
-
url_params.update(optional_params.update(crop: optional_params[:crop] ? 'crop' : nil))
|
43
|
+
ActiveSupport::Deprecation.warn("`show_alchemy_picture_url` helper is deprecated and will be removed in Alchemy 4.0. Please use the `picture.url` method instead.")
|
44
|
+
picture.url(optional_params)
|
50
45
|
end
|
51
46
|
|
52
47
|
# Returns the correct params-hash for passing to show_page_path
|
@@ -49,7 +49,6 @@ module Alchemy
|
|
49
49
|
end
|
50
50
|
|
51
51
|
validates_presence_of :file
|
52
|
-
validates_format_of :file_name, with: /\A[A-Za-z0-9\. \-_äÄöÖüÜß]+\z/, on: :update
|
53
52
|
validates_size_of :file, maximum: Config.get(:uploader)['file_size_limit'].megabytes
|
54
53
|
validates_property :ext, of: :file,
|
55
54
|
in: allowed_filetypes,
|
@@ -57,9 +56,7 @@ module Alchemy
|
|
57
56
|
message: Alchemy.t("not a valid file"),
|
58
57
|
unless: -> { self.class.allowed_filetypes.include?('*') }
|
59
58
|
|
60
|
-
|
61
|
-
write_attribute(:name, convert_to_humanized_name(file_name, file.ext))
|
62
|
-
end
|
59
|
+
before_save :set_name, if: :file_name_changed?
|
63
60
|
|
64
61
|
after_update :touch_contents
|
65
62
|
|
@@ -123,5 +120,11 @@ module Alchemy
|
|
123
120
|
"file"
|
124
121
|
end
|
125
122
|
end
|
123
|
+
|
124
|
+
private
|
125
|
+
|
126
|
+
def set_name
|
127
|
+
self.name = convert_to_humanized_name(file_name, file.ext)
|
128
|
+
end
|
126
129
|
end
|
127
130
|
end
|
data/app/models/alchemy/cell.rb
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
# Elements are displayed in tabs inside the elements window in page edit view.
|
16
16
|
# Every cell is a list of elements with the position scoped to +cell_id+ and +page_id+.
|
17
17
|
#
|
18
|
-
# Define cells inside a +cells.yml+ file located in the +config/
|
18
|
+
# Define cells inside a +cells.yml+ file located in the +config/alchemy+ folder of your project.
|
19
19
|
#
|
20
20
|
# Render cells with the +render_cell+ helper
|
21
21
|
#
|
@@ -25,7 +25,7 @@ module Alchemy
|
|
25
25
|
class Cell < ActiveRecord::Base
|
26
26
|
include Alchemy::Logger
|
27
27
|
|
28
|
-
belongs_to :page
|
28
|
+
belongs_to :page, required: true
|
29
29
|
validates_uniqueness_of :name, scope: 'page_id'
|
30
30
|
validates_format_of :name, with: /\A[a-z0-9_-]+\z/
|
31
31
|
has_many :elements, -> { where(parent_element_id: nil).order(:position) }, dependent: :destroy
|
@@ -23,8 +23,8 @@ module Alchemy
|
|
23
23
|
# Concerns
|
24
24
|
include Alchemy::Content::Factory
|
25
25
|
|
26
|
-
belongs_to :essence, polymorphic: true, dependent: :destroy
|
27
|
-
belongs_to :element, touch: true
|
26
|
+
belongs_to :essence, required: true, polymorphic: true, dependent: :destroy
|
27
|
+
belongs_to :element, required: true, touch: true
|
28
28
|
has_one :page, through: :element
|
29
29
|
|
30
30
|
stampable stamper_class_name: Alchemy.user_class_name
|
@@ -38,23 +38,26 @@ module Alchemy
|
|
38
38
|
content
|
39
39
|
end
|
40
40
|
|
41
|
-
#
|
41
|
+
# Creates a copy of source and also copies the associated essence.
|
42
42
|
#
|
43
43
|
# You can pass a differences hash to update the attributes of the copy.
|
44
44
|
#
|
45
45
|
# === Example
|
46
46
|
#
|
47
|
-
# @copy = Alchemy::Content.copy(@content, {:
|
47
|
+
# @copy = Alchemy::Content.copy(@content, {element_id: 3})
|
48
48
|
# @copy.element_id # => 3
|
49
49
|
#
|
50
50
|
def copy(source, differences = {})
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
51
|
+
new_content = Content.new(
|
52
|
+
source.attributes.except(*SKIPPED_ATTRIBUTES_ON_COPY).merge(differences.stringify_keys)
|
53
|
+
)
|
54
|
+
|
55
|
+
new_essence = new_content.essence.class.create!(
|
56
|
+
new_content.essence.attributes.except(*SKIPPED_ATTRIBUTES_ON_COPY)
|
57
|
+
)
|
58
|
+
|
59
|
+
new_content.update!(essence_id: new_essence.id)
|
60
|
+
new_content
|
58
61
|
end
|
59
62
|
|
60
63
|
# Returns the content definition for building a content.
|
@@ -68,11 +68,14 @@ module Alchemy
|
|
68
68
|
foreign_key: :parent_element_id,
|
69
69
|
dependent: :destroy
|
70
70
|
|
71
|
-
belongs_to :cell
|
72
|
-
belongs_to :page
|
71
|
+
belongs_to :cell, required: false
|
72
|
+
belongs_to :page, required: true
|
73
73
|
|
74
74
|
# A nested element belongs to a parent element.
|
75
|
-
belongs_to :parent_element,
|
75
|
+
belongs_to :parent_element,
|
76
|
+
class_name: 'Alchemy::Element',
|
77
|
+
required: false,
|
78
|
+
touch: true
|
76
79
|
|
77
80
|
has_and_belongs_to_many :touchable_pages, -> { uniq },
|
78
81
|
class_name: 'Alchemy::Page',
|