alchemy_cms 2.2.rc13 → 2.2.rc14
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/Rakefile +3 -0
- data/alchemy_cms.gemspec +1 -0
- data/app/assets/javascripts/alchemy/alchemy.base.js +95 -94
- data/app/assets/javascripts/alchemy/alchemy.buttons.js +15 -11
- data/app/assets/javascripts/alchemy/alchemy.datepicker.js +18 -18
- data/app/assets/javascripts/alchemy/alchemy.dirty.js +20 -20
- data/app/assets/javascripts/alchemy/alchemy.dragndrop.js +50 -44
- data/app/assets/javascripts/alchemy/alchemy.element_editor_selector.js +15 -12
- data/app/assets/javascripts/alchemy/alchemy.elements_window.js +47 -43
- data/app/assets/javascripts/alchemy/alchemy.file_progress.js +27 -17
- data/app/assets/javascripts/alchemy/alchemy.growler.js +19 -15
- data/app/assets/javascripts/alchemy/alchemy.html5.js +1 -2
- data/app/assets/javascripts/alchemy/alchemy.image_cropper.js +10 -11
- data/app/assets/javascripts/alchemy/alchemy.jquery_loader.js +6 -6
- data/app/assets/javascripts/alchemy/alchemy.js_extensions.js +4 -6
- data/app/assets/javascripts/alchemy/alchemy.menubar.js +16 -20
- data/app/assets/javascripts/alchemy/alchemy.page_sorter.js +18 -16
- data/app/assets/javascripts/alchemy/alchemy.preview.js +30 -30
- data/app/assets/javascripts/alchemy/alchemy.preview_window.js +50 -42
- data/app/assets/javascripts/alchemy/alchemy.routes.js.erb +11 -11
- data/app/assets/javascripts/alchemy/alchemy.swf_upload.js +83 -86
- data/app/assets/javascripts/alchemy/alchemy.uploader.js +106 -112
- data/app/assets/javascripts/alchemy/alchemy.windows.js +158 -130
- data/app/assets/stylesheets/alchemy/base.css.scss +7 -1
- data/app/assets/stylesheets/alchemy/buttons.css.scss +31 -25
- data/app/assets/stylesheets/alchemy/elements.css.scss +4 -0
- data/app/controllers/alchemy/admin/base_controller.rb +5 -1
- data/app/helpers/alchemy/admin/base_helper.rb +21 -13
- data/app/helpers/alchemy/admin/contents_helper.rb +52 -11
- data/app/helpers/alchemy/admin/elements_helper.rb +0 -1
- data/app/helpers/alchemy/admin/essences_helper.rb +5 -5
- data/app/helpers/alchemy/essences_helper.rb +1 -0
- data/app/models/alchemy/content.rb +102 -91
- data/app/models/alchemy/essence_boolean.rb +8 -0
- data/app/models/alchemy/essence_select.rb +7 -0
- data/app/sweepers/alchemy/content_sweeper.rb +2 -4
- data/app/views/alchemy/admin/clipboard/clear.js.erb +3 -2
- data/app/views/alchemy/admin/clipboard/index.html.erb +2 -2
- data/app/views/alchemy/admin/contents/create.js.erb +2 -0
- data/app/views/alchemy/admin/contents/destroy.js.coffee +4 -0
- data/app/views/alchemy/admin/contents/new.html.erb +1 -1
- data/app/views/alchemy/admin/elements/_element_foot.html.erb +3 -2
- data/app/views/alchemy/admin/elements/create.js.coffee +31 -0
- data/app/views/alchemy/admin/elements/fold.js.coffee +37 -0
- data/app/views/alchemy/admin/essence_pictures/assign.js.coffee +15 -0
- data/app/views/alchemy/admin/essence_pictures/destroy.js.coffee +19 -0
- data/app/views/alchemy/admin/essence_pictures/edit.html.erb +12 -2
- data/app/views/alchemy/admin/layoutpages/_layoutpage.html.erb +1 -1
- data/app/views/alchemy/admin/pages/_page.html.erb +1 -1
- data/app/views/alchemy/admin/pages/destroy.js.coffee +19 -0
- data/app/views/alchemy/admin/pages/edit.html.erb +5 -5
- data/app/views/alchemy/admin/pages/update.js.coffee +36 -0
- data/app/views/alchemy/admin/resources/_form.html.erb +12 -1
- data/app/views/alchemy/admin/resources/_resource.html.erb +6 -3
- data/app/views/alchemy/admin/resources/_table.html.erb +1 -1
- data/app/views/alchemy/admin/trash/clear.js.coffee +4 -0
- data/app/views/alchemy/admin/trash/index.html.erb +4 -4
- data/app/views/alchemy/elements/_article_editor.html.erb +4 -2
- data/app/views/alchemy/elements/_article_view.html.erb +7 -7
- data/app/views/alchemy/elements/_download_editor.html.erb +4 -1
- data/app/views/alchemy/elements/_download_view.html.erb +7 -3
- data/app/views/alchemy/elements/_image_mosaic_editor.html.erb +1 -0
- data/app/views/alchemy/elements/_image_mosaic_view.html.erb +11 -9
- data/app/views/alchemy/essences/_essence_boolean_editor.html.erb +14 -0
- data/app/views/alchemy/essences/_essence_boolean_view.html.erb +1 -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_html_editor.html.erb +1 -1
- data/app/views/alchemy/essences/_essence_richtext_editor.html.erb +1 -1
- data/app/views/alchemy/essences/_essence_select_editor.html.erb +35 -0
- data/app/views/alchemy/essences/_essence_select_view.html.erb +1 -0
- data/app/views/alchemy/essences/_essence_text_editor.html.erb +29 -77
- data/app/views/alchemy/essences/_essence_text_view.html.erb +2 -2
- data/config/alchemy/elements.yml +72 -44
- data/config/locales/alchemy.de.yml +46 -45
- data/config/locales/alchemy.en.yml +90 -89
- data/db/migrate/20120608085509_create_alchemy_essence_selects.rb +11 -0
- data/db/migrate/20120611221734_create_alchemy_essence_booleans.rb +11 -0
- data/lib/alchemy/authentication_helpers.rb +3 -7
- data/lib/alchemy/engine.rb +3 -4
- data/lib/alchemy/essence.rb +24 -16
- data/lib/alchemy/resource.rb +22 -3
- data/lib/alchemy/resources_helper.rb +8 -0
- data/lib/alchemy/seeder.rb +26 -1
- data/lib/alchemy/upgrader.rb +70 -1
- data/lib/alchemy/version.rb +1 -1
- data/lib/alchemy_cms.rb +1 -0
- data/spec/controllers/admin/clipboard_controller_spec.rb +16 -4
- data/spec/controllers/admin/contents_controller_spec.rb +21 -4
- data/spec/dummy/app/models/event.rb +1 -1
- data/spec/dummy/db/schema.rb +18 -1
- data/spec/helpers/admin/contents_helper_spec.rb +3 -2
- data/spec/models/clipboard_spec.rb +14 -3
- data/spec/models/essence_boolean_spec.rb +15 -0
- data/spec/models/essence_select_spec.rb +15 -0
- data/spec/models/resource_spec.rb +113 -0
- metadata +40 -12
- data/app/views/alchemy/admin/contents/destroy.js.erb +0 -7
- data/app/views/alchemy/admin/elements/create.js.erb +0 -36
- data/app/views/alchemy/admin/elements/fold.js.erb +0 -41
- data/app/views/alchemy/admin/essence_pictures/assign.js.erb +0 -16
- data/app/views/alchemy/admin/essence_pictures/destroy.js.erb +0 -20
- data/app/views/alchemy/admin/pages/destroy.js.erb +0 -12
- data/app/views/alchemy/admin/pages/update.js.erb +0 -40
- data/app/views/alchemy/admin/trash/clear.js.erb +0 -3
- data/spec/dummy/app/models/.gitkeep +0 -0
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
<div class="
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<div class="downloads" <%= element_preview_code(element) %>>
|
|
2
|
+
<% element.contents.each do |content| %>
|
|
3
|
+
<div class="download">
|
|
4
|
+
<%= render_essence(content) %>
|
|
5
|
+
</div>
|
|
6
|
+
<% end %>
|
|
7
|
+
</div>
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
<div class="image_mosaic" id="<%= element_dom_id(element) %>" <%= element_preview_code(element) -%>>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
</div>
|
|
7
|
-
<%- end -%>
|
|
8
|
-
</div>
|
|
9
|
-
<div class="caption">
|
|
10
|
-
<%= render_essence_view_by_name(element, 'caption') %>
|
|
2
|
+
<div class="image_mosaic_images">
|
|
3
|
+
<%- element.contents.find_all_by_essence_type("Alchemy::EssencePicture").each do |essence| -%>
|
|
4
|
+
<div class="image_mosaic_image">
|
|
5
|
+
<%= render_essence_view(essence, :image_size => '300x200', :crop => true) %>
|
|
11
6
|
</div>
|
|
7
|
+
<%- end -%>
|
|
8
|
+
</div>
|
|
9
|
+
<% if element.ingredient(:show_caption) %>
|
|
10
|
+
<div class="caption">
|
|
11
|
+
<%= render_essence_view_by_name(element, 'caption') %>
|
|
12
|
+
</div>
|
|
13
|
+
<% end %>
|
|
12
14
|
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<% cache(content) do %>
|
|
2
|
+
<div class="content_editor essence_boolean" id="<%= content_dom_id(content) %>">
|
|
3
|
+
<%= check_box_tag(content.form_field_name, 1,
|
|
4
|
+
!content.ingredient.nil? ? content.ingredient : options[:default_value],
|
|
5
|
+
:onclick => "Alchemy.handleEssenceCheckbox(this)",
|
|
6
|
+
:class => html_options[:class],
|
|
7
|
+
:style => html_options[:style]
|
|
8
|
+
) %>
|
|
9
|
+
<label for="<%= content.form_field_id %>" style="display: inline">
|
|
10
|
+
<%= render_content_name(content) %>
|
|
11
|
+
<%= delete_content_link(content) %>
|
|
12
|
+
</label>
|
|
13
|
+
</div>
|
|
14
|
+
<% end %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= t(content.ingredient) %>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div class="content_editor content_text_editor"<%= " style=\"float: left;\"" if options[:css_class] == "text_short" %>>
|
|
2
|
-
|
|
2
|
+
<%= label_and_remove_link(content) %>
|
|
3
3
|
<%= text_field_tag(
|
|
4
4
|
content.form_field_name,
|
|
5
5
|
content.ingredient,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<% cache(content) do -%>
|
|
2
2
|
<div class="content_editor content_rtf_editor" id="<%= content_dom_id(content) %>">
|
|
3
|
-
|
|
3
|
+
<%= label_and_remove_link(content) %>
|
|
4
4
|
<div style="position: relative">
|
|
5
5
|
<% if content.has_custom_tinymce_config? && content.settings[:tinymce] -%>
|
|
6
6
|
<div class="essence_richtext_loader">
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<% cache(content) do %>
|
|
2
|
+
<div class="content_editor<%= options[:display_inline].to_s == 'true' ? ' display_inline' : '' %>" id="<%= content_dom_id(content) %>">
|
|
3
|
+
|
|
4
|
+
<%= label_and_remove_link(content) %>
|
|
5
|
+
|
|
6
|
+
<% if options[:select_values].nil? %>
|
|
7
|
+
|
|
8
|
+
<%= warning('options[:select_values] is nil', "No select values given. Please provide :select_values as argument to render_essence_editor_by_name() helper inside this element editor view.") %>
|
|
9
|
+
|
|
10
|
+
<% else %>
|
|
11
|
+
|
|
12
|
+
<%
|
|
13
|
+
if options[:select_values].is_a?(Hash)
|
|
14
|
+
options_method = grouped_options_for_select(
|
|
15
|
+
options[:select_values],
|
|
16
|
+
content.ingredient,
|
|
17
|
+
''
|
|
18
|
+
)
|
|
19
|
+
else
|
|
20
|
+
options_method = options_for_select(
|
|
21
|
+
options[:select_values],
|
|
22
|
+
content.ingredient
|
|
23
|
+
)
|
|
24
|
+
end
|
|
25
|
+
%>
|
|
26
|
+
|
|
27
|
+
<%= select_tag(content.form_field_name, options_method, {
|
|
28
|
+
:class => ["alchemy_selectbox", "essence_editor_select", html_options[:class]].join(' '),
|
|
29
|
+
:style => html_options[:style]
|
|
30
|
+
}) %>
|
|
31
|
+
|
|
32
|
+
<% end %>
|
|
33
|
+
|
|
34
|
+
</div>
|
|
35
|
+
<% end %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= content.ingredient %>
|
|
@@ -1,88 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
<div class="content_editor<%= options[:display_inline].to_s == 'true' ? ' display_inline' : '' %>" id="<%= content_dom_id(content) %>">
|
|
1
|
+
<% cache(content) do %>
|
|
2
|
+
<div class="content_editor<%= options[:display_inline].to_s == 'true' ? ' display_inline' : '' %>" id="<%= content_dom_id(content) %>">
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
<% if content.settings[:display_as].present? %>
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
content.form_field_name,
|
|
8
|
-
"1",
|
|
9
|
-
content.ingredient == "1",
|
|
10
|
-
:onclick => "Alchemy.handleEssenceCheckbox(this)",
|
|
11
|
-
:class => html_options[:class],
|
|
12
|
-
:style => html_options[:style]
|
|
13
|
-
) %>
|
|
14
|
-
<label for="<%= content.form_field_id %>" style="display: inline">
|
|
15
|
-
<%= render_content_name(content) %>
|
|
16
|
-
</label>
|
|
6
|
+
<%= warning 'The display_as setting is deprecated! Please run rake alchemy:upgrade', 'You are using the display_as setting in your elements.yml. Please run rake alchemy:upgrade' %>
|
|
17
7
|
|
|
18
|
-
|
|
8
|
+
<% else %>
|
|
19
9
|
|
|
20
|
-
|
|
10
|
+
<%= label_and_remove_link(content) %>
|
|
21
11
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
content.ingredient,
|
|
29
|
-
''
|
|
30
|
-
)
|
|
31
|
-
else
|
|
32
|
-
options_method = options_for_select(
|
|
33
|
-
options[:select_values],
|
|
34
|
-
content.ingredient
|
|
35
|
-
)
|
|
36
|
-
end
|
|
37
|
-
%>
|
|
38
|
-
<%= select_tag(
|
|
39
|
-
content.form_field_name,
|
|
40
|
-
options_method,
|
|
41
|
-
{
|
|
42
|
-
:class => ["alchemy_selectbox", "essence_editor_select", html_options[:class]].join(' '),
|
|
43
|
-
:style => html_options[:style]
|
|
44
|
-
}
|
|
45
|
-
) %>
|
|
46
|
-
<%- end -%>
|
|
12
|
+
<%= text_field_tag(
|
|
13
|
+
content.form_field_name,
|
|
14
|
+
content.ingredient,
|
|
15
|
+
:class => ["thin_border #{content.settings[:linkable] ? ' text_with_icon' : ''}", html_options[:class]].join(' '),
|
|
16
|
+
:style => html_options[:style]
|
|
17
|
+
) %>
|
|
47
18
|
|
|
48
|
-
|
|
19
|
+
<% if content.settings[:linkable] %>
|
|
49
20
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
t('Do you really want to delete this content?'),
|
|
55
|
-
alchemy.admin_content_path(content),
|
|
56
|
-
:class => 'icon_button small',
|
|
57
|
-
:title => t('Remove this content')
|
|
58
|
-
) if content.settings[:deletable] %>
|
|
59
|
-
</label>
|
|
60
|
-
<%= text_field_tag(
|
|
61
|
-
content.form_field_name,
|
|
62
|
-
content.ingredient,
|
|
63
|
-
:class => ["thin_border #{content.settings[:linkable] ? ' text_with_icon' : ''}", html_options[:class]].join(' '),
|
|
64
|
-
:style => html_options[:style]
|
|
65
|
-
) %>
|
|
21
|
+
<%= hidden_field_tag content.form_field_name(:link), content.essence.link %>
|
|
22
|
+
<%= hidden_field_tag content.form_field_name(:link_title), content.essence.link_title %>
|
|
23
|
+
<%= hidden_field_tag content.form_field_name(:link_class_name), content.essence.link_class_name %>
|
|
24
|
+
<%= hidden_field_tag content.form_field_name(:link_target), content.essence.link_target %>
|
|
66
25
|
|
|
67
|
-
|
|
26
|
+
<span class="linkable_text_essence_tools">
|
|
27
|
+
<a href="#" onclick="Alchemy.LinkOverlay.open(this, 420); return false;" title="<%= t('place_link') -%>" class="icon_button <%= content.linked? ? ' linked' : '' -%>" name="essence_text_<%= content.id -%>" id="edit_link_<%= content.id -%>">
|
|
28
|
+
<span class="icon link"></span>
|
|
29
|
+
</a>
|
|
30
|
+
<a href="#" onclick="Alchemy.LinkOverlay.removeLink(this, <%= content.id -%>); return false;" title="<%= t('unlink') %>" class="icon_button unlink<%= content.linked? ? ' linked' : ' disabled' -%>" name="essence_text_<%= content.id -%>">
|
|
31
|
+
<span class="icon unlink"></span>
|
|
32
|
+
</a>
|
|
33
|
+
</span>
|
|
68
34
|
|
|
69
|
-
|
|
70
|
-
<%= hidden_field_tag content.form_field_name(:link_title), content.essence.link_title %>
|
|
71
|
-
<%= hidden_field_tag content.form_field_name(:link_class_name), content.essence.link_class_name %>
|
|
72
|
-
<%= hidden_field_tag content.form_field_name(:link_target), content.essence.link_target %>
|
|
35
|
+
<% end %>
|
|
73
36
|
|
|
74
|
-
|
|
75
|
-
<a href="#" onclick="Alchemy.LinkOverlay.open(this, 420); return false;" title="<%= t('place_link') -%>" class="icon_button <%= content.linked? ? ' linked' : '' -%>" name="essence_text_<%= content.id -%>" id="edit_link_<%= content.id -%>">
|
|
76
|
-
<span class="icon link"></span>
|
|
77
|
-
</a>
|
|
78
|
-
<a href="#" onclick="Alchemy.LinkOverlay.removeLink(this, <%= content.id -%>); return false;" title="<%= t('unlink') %>" class="icon_button unlink<%= content.linked? ? ' linked' : ' disabled' -%>" name="essence_text_<%= content.id -%>">
|
|
79
|
-
<span class="icon unlink"></span>
|
|
80
|
-
</a>
|
|
81
|
-
</span>
|
|
37
|
+
<% end %>
|
|
82
38
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
<%- end -%>
|
|
86
|
-
|
|
87
|
-
</div>
|
|
88
|
-
<%- end -%>
|
|
39
|
+
</div>
|
|
40
|
+
<% end %>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<%- if content.essence.link.blank? || options[:disable_link] -%>
|
|
2
|
-
<%=
|
|
2
|
+
<%= content.ingredient -%>
|
|
3
3
|
<%- else -%>
|
|
4
4
|
<%= link_to(
|
|
5
|
-
|
|
5
|
+
content.ingredient,
|
|
6
6
|
url_for(content.essence.link),
|
|
7
7
|
:title => content.essence.link_title,
|
|
8
8
|
:target => (content.essence.link_target == "blank" ? "_blank" : nil),
|
data/config/alchemy/elements.yml
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# == In this configuration you setup Alchemy´s element layouts.
|
|
2
|
-
#
|
|
2
|
+
#
|
|
3
3
|
# Use rails generate alchemy:scaffold to generate this file for your app.
|
|
4
|
-
#
|
|
4
|
+
#
|
|
5
5
|
# Elements containing all necessary basic tools for displaying and editing content inside Alchemy.
|
|
6
6
|
# They consists of composed contents (different essence-types) as shown in the illustration of an elements-sheme below.
|
|
7
7
|
#
|
|
8
8
|
# == Schema of an element
|
|
9
|
-
#
|
|
9
|
+
#
|
|
10
10
|
# =================================
|
|
11
11
|
# # Content 1 (EssenceText) #
|
|
12
12
|
# # #
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
# =================================
|
|
17
17
|
#
|
|
18
18
|
# == Example of a basic element layout
|
|
19
|
-
#
|
|
19
|
+
#
|
|
20
20
|
# - name: a_unique_name (Used for the partial name in +app/views/elements+ and translated as Element.display_name)
|
|
21
21
|
# unique: Bool //pass true if this element only can be displayed once on page
|
|
22
22
|
# contents:
|
|
@@ -26,55 +26,61 @@
|
|
|
26
26
|
# type: EssenceRichtext
|
|
27
27
|
#
|
|
28
28
|
# As already mentioned above, there are different content-types wich can be defined for each content in an element.
|
|
29
|
+
#
|
|
29
30
|
# Defining these types is used to render predefined views in the element.
|
|
30
31
|
#
|
|
31
32
|
# == Content-Types:
|
|
32
33
|
#
|
|
33
34
|
# * EssenceText (Used to store a String (max. 255 Chars.) i.e. a headline, or productname. The editor is renderd as a single-lined input field. The view output will be sanitized and escaped. So it's XSS save.)
|
|
34
35
|
# * EssenceRichtext (Used to store editable richtext. Editor is rendered as a textarea with TinyMCE Editor.)
|
|
35
|
-
# * EssencePicture (Used to store
|
|
36
|
-
# *
|
|
36
|
+
# * EssencePicture (Used to store pictures assigned through the library. The editor view provides a lot of options (i.e. image cropper). The view renders the assigned picture, resizes it, crops it and caches the result.)
|
|
37
|
+
# * EssenceFile (Used to store attachments assigned through the library. The view renders download link.)
|
|
38
|
+
# * EssenceAudio (Used to store attachments assigned through the library. The view renders an flash audio player.)
|
|
39
|
+
# * EssenceVideo (Used to store attachments assigned through the library. The view renders an flash video player.)
|
|
40
|
+
# * EssenceFlash (Used to store attachments assigned through the library. The view renders the embeded flash object.)
|
|
37
41
|
# * EssenceDate (Used to store a DateTime object. The view output is passed through Rails I18n Library, so it will be fully localized.)
|
|
38
|
-
# * EssenceHtml (Used to store
|
|
39
|
-
#
|
|
42
|
+
# * EssenceHtml (Used to store HTML code. The view output renders the raw, not sanitized or unescaped String. So be careful!)
|
|
43
|
+
# * EssenceSelect (Used to store a String (max. 255 Chars.) value. The editor view is displayed as a select box)
|
|
44
|
+
# * EssenceBoolean (Used to store a Boolean (true or false) value. The editor view is displayed as a check box)
|
|
45
|
+
#
|
|
40
46
|
# After finishing the setup of your element layouts, you need to generate the files for the elements before using them in Alchemy.
|
|
47
|
+
#
|
|
41
48
|
# For creating these files, use the following command in your terminal:
|
|
42
49
|
#
|
|
50
|
+
# rails g alchemy:elements
|
|
51
|
+
#
|
|
52
|
+
# or:
|
|
43
53
|
#
|
|
44
|
-
#
|
|
45
|
-
# rails generate alchemy:elements
|
|
54
|
+
# rails g alchemy:elements --skip
|
|
46
55
|
#
|
|
56
|
+
# to skip existing elements
|
|
47
57
|
#
|
|
48
|
-
# or:
|
|
49
|
-
#
|
|
50
|
-
# rails g alchemy:elements --skip
|
|
51
58
|
#
|
|
52
|
-
#
|
|
53
|
-
# to skip existing elements
|
|
54
|
-
#
|
|
59
|
+
# All new elements will be created as two different partials in +Rails.root/app/views/elements+.
|
|
55
60
|
#
|
|
56
|
-
# All new elements will be created as two different partials in Rails.root/app/views/elements.
|
|
57
61
|
# For each element there is an editor-view wich will be rendered when editing them in Alchemy and another view for the website´s frontend.
|
|
58
|
-
#
|
|
62
|
+
#
|
|
59
63
|
# app/views/elements/_elements_name_editor.html.erb
|
|
60
64
|
# app/views/elements/_elements_name_view.html.erb
|
|
61
|
-
#
|
|
65
|
+
#
|
|
62
66
|
# For most contents in an element you can specify additional options, so they get rendered in a specific way.
|
|
63
67
|
# These options can be defined as symbols, but its too much to list them up here.
|
|
64
68
|
# You can find these options described in the application_helper.rb, most of them at the render_essence method.
|
|
65
69
|
#
|
|
66
70
|
# == Setting a content as preview-text for the element
|
|
67
|
-
#
|
|
68
|
-
# You can set a content-essence as preview-text for its element like this
|
|
69
|
-
# take_me_for_preview: true
|
|
70
71
|
#
|
|
72
|
+
# You can set a content-essence as preview-text for its element like this:
|
|
73
|
+
#
|
|
74
|
+
# take_me_for_preview: true
|
|
71
75
|
#
|
|
72
76
|
# == Adding contents dynamically in the frontend
|
|
73
|
-
#
|
|
77
|
+
#
|
|
74
78
|
# You are able to add content-essences dynamically to the element from the Alchemy frontend.
|
|
79
|
+
#
|
|
75
80
|
# You just have to make contents available for adding them.
|
|
76
|
-
#
|
|
77
|
-
#
|
|
81
|
+
#
|
|
82
|
+
# === Example:
|
|
83
|
+
#
|
|
78
84
|
# - name: headline
|
|
79
85
|
# unique: false
|
|
80
86
|
# contents:
|
|
@@ -86,24 +92,32 @@
|
|
|
86
92
|
# - name: big_text
|
|
87
93
|
# type: EssenceRichtext
|
|
88
94
|
#
|
|
89
|
-
#
|
|
95
|
+
# And add a +<%= render_create_content_link(element, 'big_text') %>+ helper to your element editor partial.
|
|
96
|
+
#
|
|
97
|
+
# Now an Alchemy user can add as many additional +big_text+ contents as s/he wants.
|
|
98
|
+
#
|
|
99
|
+
# If you have more then one additional content defined you should use the:
|
|
100
|
+
#
|
|
101
|
+
# <%= render_new_content_link(element) %>
|
|
102
|
+
#
|
|
103
|
+
# helper. This opens an overlay from where the user can choose which content to add.
|
|
90
104
|
#
|
|
91
105
|
# === Translate element names
|
|
92
|
-
#
|
|
93
|
-
# Element names are passed through the I18n library. So you can translate them in your config/locales language yml file.
|
|
94
|
-
#
|
|
95
|
-
# Example:
|
|
96
|
-
#
|
|
106
|
+
#
|
|
107
|
+
# Element names are passed through the +I18n+ library. So you can translate them in your config/locales language yml file.
|
|
108
|
+
#
|
|
109
|
+
# === Example:
|
|
110
|
+
#
|
|
97
111
|
# de:
|
|
98
112
|
# alchemy:
|
|
99
113
|
# element_names:
|
|
100
114
|
# contact: Kontakt
|
|
101
115
|
# search: Suche
|
|
102
|
-
#
|
|
116
|
+
#
|
|
103
117
|
# == Validations:
|
|
104
|
-
#
|
|
118
|
+
#
|
|
105
119
|
# You can validate the presence of a content. Just pass validate and one of the supported vaidatiosn methods to your content definition:
|
|
106
|
-
#
|
|
120
|
+
#
|
|
107
121
|
# - name: article
|
|
108
122
|
# display_name: Standard-Artikel
|
|
109
123
|
# contents:
|
|
@@ -111,23 +125,32 @@
|
|
|
111
125
|
# type: EssenceText
|
|
112
126
|
# validate:
|
|
113
127
|
# - presence
|
|
114
|
-
#
|
|
128
|
+
#
|
|
115
129
|
# Now the user has to enter a value inside of the intro EssenceText textfield to save the element.
|
|
116
130
|
# Currently supported validations are:
|
|
117
|
-
#
|
|
131
|
+
#
|
|
118
132
|
# * presence
|
|
119
133
|
# * uniqueness
|
|
120
|
-
#
|
|
134
|
+
#
|
|
121
135
|
- name: article
|
|
122
136
|
contents:
|
|
123
137
|
- name: intro
|
|
124
138
|
type: EssenceText
|
|
125
139
|
- name: headline
|
|
126
140
|
type: EssenceText
|
|
141
|
+
settings:
|
|
142
|
+
deletable: true
|
|
127
143
|
- name: image
|
|
128
144
|
type: EssencePicture
|
|
129
145
|
- name: text
|
|
130
146
|
type: EssenceRichtext
|
|
147
|
+
settings:
|
|
148
|
+
deletable: true
|
|
149
|
+
available_contents:
|
|
150
|
+
- name: text
|
|
151
|
+
type: EssenceRichtext
|
|
152
|
+
- name: headline
|
|
153
|
+
type: EssenceText
|
|
131
154
|
|
|
132
155
|
- name: intro_image_text
|
|
133
156
|
unique: true
|
|
@@ -138,19 +161,19 @@
|
|
|
138
161
|
type: EssencePicture
|
|
139
162
|
- name: text
|
|
140
163
|
type: EssenceRichtext
|
|
141
|
-
|
|
164
|
+
|
|
142
165
|
- name: text
|
|
143
166
|
contents:
|
|
144
167
|
- name: text
|
|
145
168
|
type: EssenceRichtext
|
|
146
169
|
|
|
147
170
|
- name: bild
|
|
148
|
-
contents:
|
|
171
|
+
contents:
|
|
149
172
|
- name: image
|
|
150
173
|
type: EssencePicture
|
|
151
174
|
|
|
152
175
|
- name: bild_text
|
|
153
|
-
contents:
|
|
176
|
+
contents:
|
|
154
177
|
- name: image
|
|
155
178
|
type: EssencePicture
|
|
156
179
|
- name: text
|
|
@@ -162,11 +185,13 @@
|
|
|
162
185
|
type: EssenceText
|
|
163
186
|
|
|
164
187
|
- name: image_mosaic
|
|
165
|
-
contents:
|
|
188
|
+
contents:
|
|
166
189
|
- name: image
|
|
167
190
|
type: EssencePicture
|
|
168
191
|
- name: caption
|
|
169
192
|
type: EssenceText
|
|
193
|
+
- name: show_caption
|
|
194
|
+
type: EssenceBoolean
|
|
170
195
|
|
|
171
196
|
- name: footnote
|
|
172
197
|
unique: true
|
|
@@ -206,6 +231,11 @@
|
|
|
206
231
|
contents:
|
|
207
232
|
- name: file
|
|
208
233
|
type: EssenceFile
|
|
234
|
+
settings:
|
|
235
|
+
deletable: true
|
|
236
|
+
available_contents:
|
|
237
|
+
- name: file
|
|
238
|
+
type: EssenceFile
|
|
209
239
|
|
|
210
240
|
- name: news
|
|
211
241
|
contents:
|
|
@@ -238,8 +268,6 @@
|
|
|
238
268
|
validate:
|
|
239
269
|
- presence
|
|
240
270
|
- name: success_page
|
|
241
|
-
type:
|
|
242
|
-
settings:
|
|
243
|
-
display_as: select
|
|
271
|
+
type: EssenceSelect
|
|
244
272
|
validate:
|
|
245
273
|
- presence
|