alchemy_cms 3.0.4 → 3.1.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -6
- data/Gemfile +4 -7
- data/README.md +207 -115
- data/alchemy_cms.gemspec +10 -9
- data/app/assets/javascripts/alchemy/alchemy.dragndrop.js.coffee +2 -2
- data/app/assets/javascripts/alchemy/alchemy.image_cropper.js.coffee +2 -2
- data/app/assets/javascripts/alchemy/alchemy.js +6 -7
- data/app/assets/javascripts/alchemy/alchemy.translations.js.coffee +1 -43
- data/app/assets/javascripts/alchemy/alchemy.uploader.js.coffee +1 -1
- data/app/assets/stylesheets/alchemy/_mixins.scss +2 -1
- data/app/assets/stylesheets/alchemy/buttons.scss +0 -5
- data/app/assets/stylesheets/alchemy/dialogs.scss +1 -0
- data/app/assets/stylesheets/alchemy/frame.scss +9 -12
- data/app/assets/stylesheets/tinymce/skins/alchemy/content.min.css.scss +11 -2
- data/app/assets/stylesheets/tinymce/skins/alchemy/skin.min.css.scss +9 -1
- data/app/controllers/alchemy/admin/attachments_controller.rb +2 -4
- data/app/controllers/alchemy/admin/essence_pictures_controller.rb +34 -38
- data/app/controllers/alchemy/api/base_controller.rb +19 -0
- data/app/controllers/alchemy/api/contents_controller.rb +35 -0
- data/app/controllers/alchemy/api/elements_controller.rb +29 -0
- data/app/controllers/alchemy/api/pages_controller.rb +32 -0
- data/app/controllers/alchemy/contents_controller.rb +1 -0
- data/app/controllers/alchemy/elements_controller.rb +5 -2
- data/app/controllers/alchemy/pages_controller.rb +4 -1
- data/app/controllers/alchemy/pictures_controller.rb +4 -36
- data/app/helpers/alchemy/admin/essences_helper.rb +5 -2
- data/app/helpers/alchemy/essences_helper.rb +14 -1
- data/app/models/alchemy/content.rb +32 -4
- data/app/models/alchemy/element.rb +2 -16
- data/app/models/alchemy/element/presenters.rb +2 -2
- data/app/models/alchemy/essence_file.rb +5 -0
- data/app/models/alchemy/essence_picture.rb +12 -8
- data/app/models/alchemy/picture.rb +1 -74
- data/app/models/alchemy/picture/transformations.rb +249 -0
- data/app/serializers/alchemy/content_serializer.rb +3 -10
- data/app/serializers/alchemy/element_serializer.rb +6 -3
- data/app/serializers/alchemy/legacy_element_serializer.rb +17 -0
- data/app/views/alchemy/admin/dashboard/_sites.html.erb +14 -4
- data/app/views/alchemy/admin/essence_pictures/crop.html.erb +8 -5
- data/app/views/alchemy/admin/pages/edit.html.erb +9 -9
- data/app/views/alchemy/admin/pictures/info.html.erb +2 -3
- data/app/views/alchemy/admin/tags/edit.html.erb +1 -1
- data/app/views/alchemy/essences/_essence_boolean_editor.html.erb +8 -7
- data/app/views/alchemy/essences/_essence_boolean_view.html.erb +3 -3
- data/app/views/alchemy/essences/_essence_date_editor.html.erb +8 -2
- data/app/views/alchemy/essences/_essence_date_view.html.erb +10 -8
- data/app/views/alchemy/essences/_essence_file_editor.html.erb +48 -53
- data/app/views/alchemy/essences/_essence_file_view.html.erb +5 -5
- data/app/views/alchemy/essences/_essence_html_editor.html.erb +5 -4
- data/app/views/alchemy/essences/_essence_link_editor.html.erb +17 -15
- data/app/views/alchemy/essences/_essence_link_view.html.erb +11 -7
- data/app/views/alchemy/essences/_essence_picture_editor.html.erb +4 -2
- data/app/views/alchemy/essences/_essence_picture_view.html.erb +4 -2
- data/app/views/alchemy/essences/_essence_richtext_view.html.erb +5 -4
- data/app/views/alchemy/essences/_essence_select_editor.html.erb +22 -32
- data/app/views/alchemy/essences/_essence_text_view.html.erb +7 -6
- data/app/views/alchemy/essences/shared/_essence_picture_tools.html.erb +1 -1
- data/app/views/layouts/alchemy/admin.html.erb +5 -3
- data/config/initializers/inflections.rb +3 -0
- data/config/initializers/simple_form.rb +1 -1
- data/config/locales/alchemy.en.yml +0 -1
- data/config/routes.rb +14 -0
- data/lib/alchemy/capistrano.rb +71 -0
- data/lib/alchemy/engine.rb +0 -3
- data/lib/alchemy/essence.rb +1 -1
- data/lib/alchemy/permissions.rb +19 -5
- data/lib/alchemy/picture_attributes.rb +1 -1
- data/lib/alchemy/test_support/auth_helpers.rb +1 -1
- data/lib/alchemy/test_support/essence_shared_examples.rb +37 -22
- data/lib/alchemy/test_support/integration_helpers.rb +1 -1
- data/lib/alchemy/tinymce.rb +21 -4
- data/lib/alchemy/upgrader/three_point_one.rb +43 -0
- data/lib/alchemy/upgrader/three_point_zero.rb +13 -0
- data/lib/alchemy/version.rb +2 -1
- data/lib/rails/generators/alchemy/module/module_generator.rb +30 -0
- data/lib/rails/generators/alchemy/module/templates/ability.rb.tt +11 -0
- data/lib/rails/generators/alchemy/module/templates/controller.rb.tt +2 -0
- data/lib/rails/generators/alchemy/module/templates/module_config.rb.tt +15 -0
- data/lib/rails/generators/alchemy/scaffold/scaffold_generator.rb +0 -1
- data/lib/rails/templates/alchemy.rb +2 -2
- data/lib/tasks/alchemy/db.rake +7 -1
- data/spec/controllers/admin/attachments_controller_spec.rb +38 -38
- data/spec/controllers/admin/base_controller_spec.rb +18 -18
- data/spec/controllers/admin/clipboard_controller_spec.rb +23 -18
- data/spec/controllers/admin/contents_controller_spec.rb +33 -27
- data/spec/controllers/admin/dashboard_controller_spec.rb +14 -14
- data/spec/controllers/admin/elements_controller_spec.rb +125 -105
- data/spec/controllers/admin/essence_files_controller_spec.rb +6 -7
- data/spec/controllers/admin/essence_pictures_controller_spec.rb +52 -42
- data/spec/controllers/admin/languages_controller_spec.rb +3 -3
- data/spec/controllers/admin/pages_controller_spec.rb +81 -71
- data/spec/controllers/admin/pictures_controller_spec.rb +69 -72
- data/spec/controllers/admin/resources_controller_spec.rb +5 -5
- data/spec/controllers/admin/trash_controller_spec.rb +15 -12
- data/spec/controllers/alchemy/admin/tags_controller_spec.rb +8 -8
- data/spec/controllers/alchemy/api/contents_controller_spec.rb +73 -0
- data/spec/controllers/alchemy/api/elements_controller_spec.rb +69 -0
- data/spec/controllers/alchemy/api/pages_controller_spec.rb +86 -0
- data/spec/controllers/attachments_controller_spec.rb +8 -8
- data/spec/controllers/contents_controller_spec.rb +22 -0
- data/spec/controllers/elements_controller_spec.rb +10 -4
- data/spec/controllers/messages_controller_spec.rb +35 -34
- data/spec/controllers/pages_controller_spec.rb +37 -28
- data/spec/controllers/pictures_controller_spec.rb +90 -23
- data/spec/dummy/app/models/dummy_user.rb +0 -4
- data/spec/dummy/app/views/alchemy/elements/_all_you_can_eat_editor.html.erb +11 -0
- data/spec/dummy/config/alchemy/elements.yml +22 -1
- data/spec/dummy/config/alchemy/page_layouts.yml +4 -0
- data/spec/dummy/config/application.rb +2 -1
- data/spec/dummy/config/environments/test.rb +3 -1
- data/spec/features/admin/dashboard_spec.rb +41 -6
- data/spec/features/admin/language_tree_feature_spec.rb +3 -3
- data/spec/features/admin/legacy_page_url_management_spec.rb +1 -1
- data/spec/features/admin/link_overlay_spec.rb +7 -7
- data/spec/features/admin/locale_select_feature_spec.rb +5 -2
- data/spec/features/admin/modules_integration_spec.rb +1 -1
- data/spec/features/admin/page_creation_feature_spec.rb +3 -2
- data/spec/features/admin/page_editing_feature_spec.rb +66 -79
- data/spec/features/admin/picture_library_integration_spec.rb +8 -8
- data/spec/features/admin/resources_integration_spec.rb +21 -21
- data/spec/features/admin/tinymce_feature_spec.rb +36 -0
- data/spec/features/navigation_spec.rb +1 -1
- data/spec/features/page_feature_spec.rb +34 -34
- data/spec/features/picture_security_spec.rb +4 -4
- data/spec/features/security_spec.rb +1 -1
- data/spec/features/translation_integration_spec.rb +7 -7
- data/spec/helpers/admin/base_helper_spec.rb +51 -49
- data/spec/helpers/admin/contents_helper_spec.rb +11 -11
- data/spec/helpers/admin/elements_helper_spec.rb +20 -17
- data/spec/helpers/admin/essences_helper_spec.rb +42 -11
- data/spec/helpers/admin/navigation_helper_spec.rb +64 -54
- data/spec/helpers/admin/pages_helper_spec.rb +10 -10
- data/spec/helpers/admin/tags_helper_spec.rb +16 -16
- data/spec/helpers/base_helper_spec.rb +11 -11
- data/spec/helpers/elements_block_helper_spec.rb +24 -24
- data/spec/helpers/elements_helper_spec.rb +46 -46
- data/spec/helpers/essences_helper_spec.rb +90 -17
- data/spec/helpers/pages_helper_spec.rb +53 -53
- data/spec/helpers/picture_url_helpers_spec.rb +6 -6
- data/spec/helpers/url_helper_spec.rb +32 -32
- data/spec/libraries/config_spec.rb +9 -9
- data/spec/libraries/controller_actions_spec.rb +14 -14
- data/spec/libraries/i18n_spec.rb +6 -6
- data/spec/libraries/kaminari/scoped_pagination_url_helper_spec.rb +4 -4
- data/spec/libraries/modules_spec.rb +4 -4
- data/spec/libraries/mount_point_spec.rb +13 -13
- data/spec/libraries/page_layout_spec.rb +24 -24
- data/spec/libraries/permissions_spec.rb +97 -80
- data/spec/libraries/resource_spec.rb +37 -37
- data/spec/libraries/resources_helper_spec.rb +19 -19
- data/spec/libraries/shell_spec.rb +17 -17
- data/spec/libraries/template_tracker_spec.rb +14 -14
- data/spec/libraries/tinymce_spec.rb +8 -8
- data/spec/libraries/userstamp_spec.rb +2 -2
- data/spec/mailers/messages_spec.rb +4 -4
- data/spec/models/attachment_spec.rb +86 -30
- data/spec/models/cell_spec.rb +10 -10
- data/spec/models/content_spec.rb +106 -46
- data/spec/models/element_spec.rb +94 -115
- data/spec/models/essence_date_spec.rb +1 -1
- data/spec/models/essence_file_spec.rb +4 -4
- data/spec/models/essence_picture_spec.rb +56 -25
- data/spec/models/essence_richtext_spec.rb +1 -1
- data/spec/models/essence_text_spec.rb +7 -7
- data/spec/models/language_spec.rb +12 -12
- data/spec/models/legacy_page_url_spec.rb +2 -2
- data/spec/models/message_spec.rb +12 -5
- data/spec/models/page_spec.rb +259 -235
- data/spec/models/picture_spec.rb +72 -166
- data/spec/models/site_spec.rb +41 -41
- data/spec/models/tag_spec.rb +7 -7
- data/spec/routing/api_routing_spec.rb +150 -0
- data/spec/routing/routing_spec.rb +28 -28
- data/spec/spec_helper.rb +6 -5
- data/spec/support/hint_examples.rb +5 -5
- data/spec/support/transformation_examples.rb +173 -0
- data/spec/tasks/helpers_spec.rb +29 -29
- data/spec/views/essences/essence_boolean_editor_spec.rb +32 -0
- data/spec/views/essences/essence_boolean_view_spec.rb +2 -2
- data/spec/views/essences/essence_date_view_spec.rb +1 -1
- data/spec/views/essences/essence_link_view_spec.rb +11 -0
- data/spec/views/essences/essence_picture_view_spec.rb +56 -11
- data/spec/views/essences/essence_richtext_view_spec.rb +12 -0
- data/spec/views/essences/essence_text_view_spec.rb +12 -0
- data/vendor/assets/javascripts/tinymce/langs/de.js +20 -2
- data/vendor/assets/javascripts/tinymce/langs/fr.js +14 -1
- data/vendor/assets/javascripts/tinymce/langs/nl.js +22 -4
- data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.min.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.min.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.min.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/code/plugin.min.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/directionality/plugin.min.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.min.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/hr/plugin.min.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/link/plugin.min.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/paste/plugin.min.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/tabfocus/plugin.min.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/table/plugin.min.js +1 -1
- data/vendor/assets/javascripts/tinymce/themes/modern/theme.min.js +1 -1
- data/vendor/assets/javascripts/tinymce/tinymce.min.js +11 -10
- metadata +72 -42
- data/app/views/alchemy/messages/contact_form_mail.es.text.erb +0 -12
- data/config/locales/alchemy.es.yml +0 -958
- data/config/locales/alchemy.ru.yml +0 -837
- data/config/locales/simple_form.es.yml +0 -6
- data/config/locales/simple_form.ru.yml +0 -25
- data/lib/rails/generators/alchemy/scaffold/files/alchemy.es.yml +0 -31
- data/vendor/assets/javascripts/tinymce/langs/es.js +0 -197
- data/vendor/assets/javascripts/tinymce/langs/ru.js +0 -197
@@ -1,9 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
<%- cache(content) do -%>
|
2
|
+
<%- date_format = content_settings_value(content, :date_format,
|
3
|
+
local_assigns.fetch(:options, {})) -%>
|
4
|
+
<%- if content.ingredient.present? -%>
|
5
|
+
<%- if date_format == 'rfc822' -%>
|
4
6
|
<%= content.ingredient.to_s(:rfc822) %>
|
5
|
-
|
6
|
-
<%= l(content.ingredient, format:
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
<%- else -%>
|
8
|
+
<%= l(content.ingredient, format: date_format) %>
|
9
|
+
<%- end -%>
|
10
|
+
<%- end -%>
|
11
|
+
<%- end -%>
|
@@ -1,66 +1,61 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
<% cache(content) do %>
|
2
|
+
|
3
|
+
<% dialog_link = link_to_dialog('',
|
4
|
+
alchemy.admin_attachments_path(
|
5
|
+
content_id: content.id,
|
6
|
+
only: content_settings_value(content,
|
7
|
+
:file_assign_show_only,
|
8
|
+
local_assigns.fetch(:options, {})),
|
9
|
+
except: content_settings_value(content,
|
10
|
+
:file_assign_do_not_show,
|
11
|
+
local_assigns.fetch(:options, {})),
|
12
|
+
options: local_assigns.fetch(:options, {}).to_json
|
13
|
+
),
|
14
|
+
{
|
15
|
+
title: _t(:assign_file),
|
16
|
+
size: '780x585',
|
17
|
+
padding: false
|
18
|
+
},
|
19
|
+
{
|
20
|
+
class: 'assign_file',
|
21
|
+
title: _t(:assign_file)
|
22
|
+
}
|
23
|
+
) %>
|
24
|
+
|
25
|
+
<div class="content_editor essence_file" id="<%= content.dom_id %>" data-content-id="<%= content.id %>">
|
26
|
+
<%= label_and_remove_link(content) %>
|
6
27
|
<div class="file" id="file_<%= content.id %>">
|
7
28
|
<div class="file_icon">
|
8
29
|
<% if content.ingredient.nil? %>
|
9
|
-
<%=
|
10
|
-
alchemy.admin_attachments_path(
|
11
|
-
content_id: content.id,
|
12
|
-
only: options[:file_assign_show_only],
|
13
|
-
except: options[:file_assign_do_not_show],
|
14
|
-
options: options.to_json
|
15
|
-
),
|
16
|
-
{
|
17
|
-
title: _t(:assign_file),
|
18
|
-
size: '780x585',
|
19
|
-
padding: false
|
20
|
-
},
|
21
|
-
class: 'assign_file',
|
22
|
-
title: _t(:assign_file)
|
23
|
-
%>
|
30
|
+
<%= dialog_link %>
|
24
31
|
<% else %>
|
25
32
|
<%= render_icon(content.ingredient.icon_css_class) %>
|
26
33
|
<% end %>
|
27
34
|
</div>
|
28
35
|
<div class="file_name">
|
29
|
-
<%= content.ingredient.
|
36
|
+
<%= content.ingredient.try(:name) ||
|
37
|
+
("←" + _t(:assign_file_from_archive)).html_safe %>
|
30
38
|
</div>
|
31
39
|
<% unless content.ingredient.nil? %>
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
url_for(
|
51
|
-
controller: 'essence_files',
|
52
|
-
action: 'edit',
|
53
|
-
options: options.to_json,
|
54
|
-
id: content
|
55
|
-
),
|
56
|
-
{
|
57
|
-
title: _t(:edit_file_properties),
|
58
|
-
size: '400x165'
|
59
|
-
},
|
60
|
-
class: 'edit_file',
|
61
|
-
title: _t(:edit_file_properties)
|
62
|
-
%>
|
63
|
-
</div>
|
40
|
+
<%= hidden_field_tag content.form_field_name(:attachment_id),
|
41
|
+
content.ingredient.id %>
|
42
|
+
<div class="essence_file_tools">
|
43
|
+
<%= dialog_link %>
|
44
|
+
<%= link_to_dialog '',
|
45
|
+
url_for(
|
46
|
+
controller: 'essence_files',
|
47
|
+
action: 'edit',
|
48
|
+
options: local_assigns.fetch(:options, {}).to_json,
|
49
|
+
id: content
|
50
|
+
),
|
51
|
+
{
|
52
|
+
title: _t(:edit_file_properties),
|
53
|
+
size: '400x165'
|
54
|
+
},
|
55
|
+
class: 'edit_file',
|
56
|
+
title: _t(:edit_file_properties) %>
|
57
|
+
</div>
|
64
58
|
<% end %>
|
65
59
|
</div>
|
66
60
|
</div>
|
61
|
+
<% end %>
|
@@ -1,10 +1,10 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
<%- cache(content) do -%>
|
2
|
+
<%- if attachment = content.ingredient -%>
|
3
3
|
<%= link_to(
|
4
4
|
h(attachment.name),
|
5
5
|
alchemy.download_attachment_path(attachment),
|
6
6
|
class: "file_link #{content.essence.css_class.blank? ? "" : content.essence.css_class}",
|
7
7
|
title: "#{content.essence.title.blank? ? attachment.file_name : content.essence.title}"
|
8
|
-
)
|
9
|
-
|
10
|
-
|
8
|
+
) -%>
|
9
|
+
<%- end -%>
|
10
|
+
<%- end -%>
|
@@ -1,8 +1,9 @@
|
|
1
|
-
|
1
|
+
<% cache(content) do %>
|
2
|
+
<div class="content_editor essence_html_editor" data-content-id="<%= content.id %>">
|
2
3
|
<%= label_and_remove_link(content) %>
|
3
4
|
<%= text_area_tag(
|
4
5
|
content.form_field_name,
|
5
|
-
content.ingredient
|
6
|
-
:class => 'thin_border'
|
6
|
+
content.ingredient
|
7
7
|
) %>
|
8
|
-
</div>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
@@ -1,19 +1,21 @@
|
|
1
1
|
<% cache(content) do %>
|
2
|
-
<div class="content_editor essence_link" id="<%= content.dom_id %>">
|
3
|
-
|
4
|
-
<%= text_field_tag
|
5
|
-
|
6
|
-
|
7
|
-
:
|
8
|
-
:
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
<%= hidden_field_tag content.form_field_name(:
|
13
|
-
|
14
|
-
<%= hidden_field_tag content.form_field_name(:link_class_name),
|
15
|
-
|
16
|
-
<%=
|
2
|
+
<div class="content_editor essence_link" id="<%= content.dom_id %>" data-content-id="<%= content.id %>">
|
3
|
+
<%= label_and_remove_link(content) %>
|
4
|
+
<%= text_field_tag '', content.ingredient,
|
5
|
+
class: "thin_border text_with_icon disabled",
|
6
|
+
name: nil,
|
7
|
+
id: nil,
|
8
|
+
disabled: true
|
9
|
+
%>
|
10
|
+
<%= hidden_field_tag content.form_field_name(:link),
|
11
|
+
content.essence.link %>
|
12
|
+
<%= hidden_field_tag content.form_field_name(:link_title),
|
13
|
+
content.essence.link_title %>
|
14
|
+
<%= hidden_field_tag content.form_field_name(:link_class_name),
|
15
|
+
content.essence.link_class_name %>
|
16
|
+
<%= hidden_field_tag content.form_field_name(:link_target),
|
17
|
+
content.essence.link_target %>
|
18
|
+
<%= render 'alchemy/essences/shared/linkable_essence_tools', content: content %>
|
17
19
|
</div>
|
18
20
|
<script type="text/javascript" charset="utf-8">
|
19
21
|
$('#<%= content.form_field_id(:link) %>').on('change', function() {
|
@@ -1,7 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
<%-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
<%- cache(content) do -%>
|
2
|
+
<%- if content.ingredient.present? -%>
|
3
|
+
<%- html_options = {
|
4
|
+
target: content.essence.link_target == "blank" ? "_blank" : nil
|
5
|
+
}.merge(local_assigns.fetch(:html_options, {})) -%>
|
6
|
+
<%= link_to(content.ingredient, html_options) do -%>
|
7
|
+
<%= content_settings_value(content, :text, local_assigns.fetch(:options, {})) ||
|
8
|
+
content.ingredient -%>
|
9
|
+
<%- end -%>
|
10
|
+
<%- end -%>
|
11
|
+
<%- end -%>
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
<% cache(content) do %>
|
2
|
+
<div id="<%= content.dom_id %>" class="essence_picture_editor<%= ' dragable_picture' if options[:dragable] %><%= ' content_editor' unless options[:grouped] %>" data-content-id="<%= content.id %>">
|
2
3
|
<% unless options[:grouped] %>
|
3
4
|
<%= label_and_remove_link(content) %>
|
4
5
|
<% end %>
|
@@ -35,7 +36,7 @@
|
|
35
36
|
<% end %>
|
36
37
|
</div>
|
37
38
|
</div>
|
38
|
-
<%-
|
39
|
+
<%- if content.essence.css_class.present? -%>
|
39
40
|
<div class="essence_picture_css_class">
|
40
41
|
<%= _t("alchemy.essence_pictures.css_classes.#{content.essence.css_class}", default: content.essence.css_class.camelcase) %>
|
41
42
|
</div>
|
@@ -55,3 +56,4 @@
|
|
55
56
|
<%= hidden_field_tag content.form_field_name(:link_class_name), content.essence.link_class_name %>
|
56
57
|
<%= hidden_field_tag content.form_field_name(:link_target), content.essence.link_target %>
|
57
58
|
</div>
|
59
|
+
<% end %>
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
<%- cache(content) do -%>
|
2
|
+
<%- options = local_assigns.fetch(:options, {}) -%>
|
3
|
+
<%- plain_text = !!content_settings_value(content, :plain_text, options) -%>
|
4
|
+
<%= raw content.essence.send(plain_text ? :stripped_body : :body) -%>
|
5
|
+
<%- end -%>
|
@@ -1,35 +1,25 @@
|
|
1
1
|
<% cache(content) do %>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
25
|
-
%>
|
26
|
-
|
27
|
-
<%= select_tag(content.form_field_name, options_tags, {
|
28
|
-
:class => ["alchemy_selectbox", "essence_editor_select", html_options[:class]].join(' '),
|
29
|
-
:style => html_options[:style]
|
30
|
-
}) %>
|
31
|
-
|
32
|
-
<% end %>
|
33
|
-
|
2
|
+
<%- select_values = content_settings_value(content,
|
3
|
+
:select_values, local_assigns.fetch(:options, {})) -%>
|
4
|
+
|
5
|
+
<div class="content_editor essence_select<%= options[:display_inline].to_s == 'true' ? ' display_inline' : '' %>" id="<%= content.dom_id %>" data-content-id="<%= content.id %>">
|
6
|
+
<%= label_and_remove_link(content) %>
|
7
|
+
|
8
|
+
<% if select_values.nil? %>
|
9
|
+
<%= warning(':select_values is nil', "<strong>No select values given.</strong><br>Please provide :<code>select_values</code> either as argument to <code>render_essence_editor</code> helper or as setting on the content definition in <code>elements.yml</code>.".html_safe) %>
|
10
|
+
<% else %>
|
11
|
+
<% if select_values.is_a?(Hash)
|
12
|
+
options_tags = grouped_options_for_select select_values,
|
13
|
+
content.ingredient, ''
|
14
|
+
else
|
15
|
+
options_tags = options_for_select select_values,
|
16
|
+
content.ingredient
|
17
|
+
end %>
|
18
|
+
|
19
|
+
<%= select_tag content.form_field_name, options_tags, {
|
20
|
+
class: ["alchemy_selectbox", "essence_editor_select", html_options[:class]].join(' '),
|
21
|
+
style: html_options[:style]
|
22
|
+
} %>
|
23
|
+
<% end %>
|
34
24
|
</div>
|
35
25
|
<% end %>
|
@@ -1,7 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
<%- if content.essence.link.blank? ||
|
1
|
+
<%- cache(content) do -%>
|
2
|
+
<%- options = local_assigns.fetch(:options, {}) -%>
|
3
|
+
<%- html_options = local_assigns.fetch(:html_options, {}) -%>
|
4
|
+
<%- if content.essence.link.blank? ||
|
5
|
+
content_settings_value(content, :disable_link, options) -%>
|
5
6
|
<%= content.ingredient -%>
|
6
7
|
<%- else -%>
|
7
8
|
<%= link_to(
|
@@ -12,6 +13,6 @@
|
|
12
13
|
target: (content.essence.link_target == "blank" ? "_blank" : nil),
|
13
14
|
'data-link-target' => content.essence.link_target
|
14
15
|
}.merge(html_options)
|
15
|
-
)
|
16
|
+
) -%>
|
16
17
|
<%- end -%>
|
17
|
-
|
18
|
+
<%- end -%>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<% if options[:crop] && content.ingredient %>
|
1
|
+
<% if options[:crop] && content.ingredient && content.ingredient.can_be_cropped_to(options[:image_size], options[:upsample]) %>
|
2
2
|
<%= link_to_dialog(
|
3
3
|
render_icon('crop'),
|
4
4
|
alchemy.crop_admin_essence_picture_path(content.essence, options: options.to_json),
|
@@ -14,7 +14,11 @@
|
|
14
14
|
var Alchemy = {};
|
15
15
|
// Setting TinyMCE path.
|
16
16
|
var tinyMCEPreInit = {
|
17
|
-
|
17
|
+
<% if ActionController::Base.config.asset_host_set? %>
|
18
|
+
base: '<%= asset_url(assets_prefix + '/tinymce') %>',
|
19
|
+
<% else %>
|
20
|
+
base: '<%= asset_path(assets_prefix + '/tinymce') %>',
|
21
|
+
<% end %>
|
18
22
|
suffix: '.min'
|
19
23
|
};
|
20
24
|
// Store regular expression for external link url matching.
|
@@ -92,8 +96,6 @@
|
|
92
96
|
<script>
|
93
97
|
// Store current locale for javascript translations.
|
94
98
|
Alchemy.locale = '<%= ::I18n.locale %>';
|
95
|
-
// Setting the correct locale for select2 dropdown replacement.
|
96
|
-
$.extend($.fn.select2.defaults, $.fn.select2.locales['<%= ::I18n.locale %>']);
|
97
99
|
</script>
|
98
100
|
<%= yield(:javascripts) %>
|
99
101
|
</body>
|
@@ -94,7 +94,7 @@ SimpleForm.setup do |config|
|
|
94
94
|
# config.item_wrapper_class = nil
|
95
95
|
|
96
96
|
# How the label text should be generated altogether with the required text.
|
97
|
-
config.label_text =
|
97
|
+
config.label_text = proc { |label, required| "#{label}#{required}" }
|
98
98
|
|
99
99
|
# You can define the class to use on all labels. Default is nil.
|
100
100
|
config.label_class = 'control-label'
|
@@ -501,7 +501,6 @@ en:
|
|
501
501
|
last_upload: "from last upload"
|
502
502
|
recent: "that where recently uploaded"
|
503
503
|
without_tag: "without tag"
|
504
|
-
pictures_in_page: "%{page} in %{pictures}"
|
505
504
|
place_link: "Link text"
|
506
505
|
player_version: "Flash Player version"
|
507
506
|
"please enter subject and mail address": "Please enter recipient and subject."
|
data/config/routes.rb
CHANGED
@@ -36,6 +36,20 @@ Alchemy::Engine.routes.draw do
|
|
36
36
|
resources :elements, :only => :show
|
37
37
|
resources :contents, :only => :show
|
38
38
|
|
39
|
+
namespace :api, defaults: {format: 'json'} do
|
40
|
+
resources :contents, only: [:index, :show]
|
41
|
+
resources :elements, only: [:index, :show] do
|
42
|
+
get '/contents' => 'contents#index', as: 'contents'
|
43
|
+
get '/contents/:name' => 'contents#show', as: 'content'
|
44
|
+
end
|
45
|
+
resources :pages, only: [:index] do
|
46
|
+
get 'elements' => 'elements#index', as: 'elements'
|
47
|
+
get 'elements/:named' => 'elements#index', as: 'named_elements'
|
48
|
+
end
|
49
|
+
get '/pages/*urlname(.:format)' => 'pages#show', as: 'page'
|
50
|
+
get '/admin/pages/:id(.:format)' => 'pages#show', as: 'preview_page'
|
51
|
+
end
|
52
|
+
|
39
53
|
namespace :admin do
|
40
54
|
|
41
55
|
resources :contents do
|
data/lib/alchemy/capistrano.rb
CHANGED
@@ -156,6 +156,77 @@ EOF
|
|
156
156
|
end
|
157
157
|
end
|
158
158
|
|
159
|
+
namespace :export do
|
160
|
+
desc "Sends all data (Pictures, attachments and the database) to your remote machine."
|
161
|
+
task :all, :roles => [:app, :db] do
|
162
|
+
pictures
|
163
|
+
attachments
|
164
|
+
database
|
165
|
+
end
|
166
|
+
|
167
|
+
desc "Imports the server database into your local development machine."
|
168
|
+
task :database, :roles => [:db], :only => {:primary => true} do
|
169
|
+
if Capistrano::CLI.ui.agree('WARNING: This task will override your remote database. Do you want me to make a backup? (y/n)')
|
170
|
+
backup_database
|
171
|
+
export_database
|
172
|
+
else
|
173
|
+
if Capistrano::CLI.ui.agree('Are you sure? (y/n)')
|
174
|
+
export_database
|
175
|
+
else
|
176
|
+
backup_database
|
177
|
+
export_database
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
desc "Sends attachments to your remote machine using rsync."
|
183
|
+
task :attachments, :roles => [:app] do
|
184
|
+
send_files :attachments
|
185
|
+
end
|
186
|
+
|
187
|
+
desc "Sends pictures to your remote machine using rsync."
|
188
|
+
task :pictures, :roles => [:app] do
|
189
|
+
send_files :pictures
|
190
|
+
end
|
191
|
+
|
192
|
+
# Makes a backup of the remote database and stores it in db/ folder
|
193
|
+
def backup_database
|
194
|
+
Capistrano::CLI.ui.say('Backing up database')
|
195
|
+
timestamp = Time.now.strftime('%Y-%m-%d-%H-%M')
|
196
|
+
run "cd #{current_path} && #{rake} RAILS_ENV=#{fetch(:rails_env, 'production')} alchemy:db:dump DUMP_FILENAME=db/dump-#{timestamp}.sql"
|
197
|
+
end
|
198
|
+
|
199
|
+
# Sends the database via ssh to the server
|
200
|
+
def export_database
|
201
|
+
require 'spinner'
|
202
|
+
server = find_servers_for_task(current_task).first
|
203
|
+
spinner = Spinner.new
|
204
|
+
print "\n"
|
205
|
+
spinner.task("Exporting the database. Please wait...") do
|
206
|
+
system db_export_cmd(server)
|
207
|
+
end
|
208
|
+
spinner.spin!
|
209
|
+
end
|
210
|
+
|
211
|
+
# The actual export command that sends the data
|
212
|
+
def db_export_cmd(server)
|
213
|
+
import_cmd = "cd #{current_path} && #{rake} RAILS_ENV=#{fetch(:rails_env, 'production')} alchemy:db:import"
|
214
|
+
ssh_cmd = "ssh -p #{fetch(:port, 22)} #{user}@#{server} '#{import_cmd}'"
|
215
|
+
"#{database_dump_command(database_config['adapter'])} | #{ssh_cmd}"
|
216
|
+
end
|
217
|
+
|
218
|
+
# Sends files of given type via rsync to server
|
219
|
+
def send_files(type)
|
220
|
+
FileUtils.mkdir_p "./uploads/#{type}"
|
221
|
+
server = find_servers_for_task(current_task).first
|
222
|
+
if server
|
223
|
+
system "rsync --progress -rue 'ssh -p #{fetch(:port, 22)}' uploads/#{type} #{user}@#{server}:#{shared_path}/uploads/"
|
224
|
+
else
|
225
|
+
raise "No server found"
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
159
230
|
end
|
160
231
|
|
161
232
|
end
|