alchemy_cms 3.0.0.rc5 → 3.0.0.rc6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -5
- data/README.md +32 -5
- data/alchemy_cms.gemspec +1 -1
- data/app/assets/javascripts/alchemy/alchemy.buttons.js.coffee +3 -3
- data/app/assets/javascripts/alchemy/alchemy.char_counter.js.coffee +19 -0
- data/app/assets/javascripts/alchemy/alchemy.confirm_dialog.js.coffee +5 -0
- data/app/assets/javascripts/alchemy/alchemy.dialog.js.coffee +3 -2
- data/app/assets/javascripts/alchemy/alchemy.dragndrop.js.coffee +2 -0
- data/app/assets/javascripts/alchemy/alchemy.element_editors.js.coffee +1 -1
- data/app/assets/javascripts/alchemy/alchemy.elements_window.js.coffee +2 -26
- data/app/assets/javascripts/alchemy/alchemy.file_progress.js.coffee +1 -1
- data/app/assets/javascripts/alchemy/alchemy.gui.js.coffee +2 -0
- data/app/assets/javascripts/alchemy/alchemy.i18n.js.coffee +12 -7
- data/app/assets/javascripts/alchemy/alchemy.js +1 -1
- data/app/assets/javascripts/alchemy/alchemy.link_dialog.js.coffee +33 -4
- data/app/assets/javascripts/alchemy/alchemy.preview_window.js.coffee +1 -1
- data/app/assets/javascripts/alchemy/alchemy.sitemap.js.coffee +2 -13
- data/app/assets/javascripts/alchemy/{alchemy.tinymce.js.coffee.erb → alchemy.tinymce.js.coffee} +1 -25
- data/app/assets/javascripts/alchemy/alchemy.translations.js.coffee +63 -105
- data/app/assets/javascripts/alchemy/alchemy.uploader.js.coffee +3 -3
- data/app/assets/stylesheets/alchemy/_extends.scss +2 -8
- data/app/assets/stylesheets/alchemy/_mixins.scss +4 -9
- data/app/assets/stylesheets/alchemy/base.scss +6 -6
- data/app/assets/stylesheets/alchemy/buttons.scss +56 -29
- data/app/assets/stylesheets/alchemy/elements.scss +66 -14
- data/app/assets/stylesheets/alchemy/form_fields.scss +39 -6
- data/app/assets/stylesheets/alchemy/forms.scss +32 -0
- data/app/assets/stylesheets/alchemy/frame.scss +44 -44
- data/app/assets/stylesheets/alchemy/icons.scss +2 -2
- data/app/assets/stylesheets/alchemy/jquery-ui.scss +2 -0
- data/app/assets/stylesheets/alchemy/notices.scss +6 -0
- data/app/assets/stylesheets/alchemy/selects.scss +10 -0
- data/app/assets/stylesheets/alchemy/sitemap.scss +8 -10
- data/app/assets/stylesheets/alchemy/toolbar.scss +40 -31
- data/app/assets/stylesheets/tinymce/skins/alchemy/skin.min.css.scss +11 -22
- data/app/controllers/alchemy/admin/base_controller.rb +14 -1
- data/app/controllers/alchemy/admin/elements_controller.rb +4 -2
- data/app/controllers/alchemy/admin/layoutpages_controller.rb +5 -0
- data/app/controllers/alchemy/admin/legacy_page_urls_controller.rb +39 -0
- data/app/controllers/alchemy/admin/pages_controller.rb +0 -3
- data/app/controllers/alchemy/base_controller.rb +7 -4
- data/app/helpers/alchemy/admin/base_helper.rb +33 -3
- data/app/helpers/alchemy/pages_helper.rb +1 -1
- data/app/models/alchemy/element.rb +6 -4
- data/app/models/alchemy/legacy_page_url.rb +5 -1
- data/app/models/alchemy/message.rb +2 -2
- data/app/models/alchemy/page.rb +8 -9
- data/app/models/alchemy/page/{cells.rb → page_cells.rb} +1 -1
- data/app/models/alchemy/page/{elements.rb → page_elements.rb} +1 -1
- data/app/models/alchemy/page/{naming.rb → page_naming.rb} +33 -18
- data/app/models/alchemy/page/{natures.rb → page_natures.rb} +1 -1
- data/app/models/alchemy/page/{scopes.rb → page_scopes.rb} +1 -1
- data/app/models/alchemy/page/{users.rb → page_users.rb} +13 -1
- data/app/views/alchemy/admin/elements/_add_element_button.html.erb +18 -0
- data/app/views/alchemy/admin/elements/_add_picture.html.erb +1 -1
- data/app/views/alchemy/admin/elements/_element.html.erb +12 -11
- data/app/views/alchemy/admin/elements/_new_element_form.html.erb +3 -0
- data/app/views/alchemy/admin/elements/create.js.erb +3 -3
- data/app/views/alchemy/admin/elements/index.html.erb +19 -4
- data/app/views/alchemy/admin/elements/new.html.erb +3 -0
- data/app/views/alchemy/admin/elements/trash.js.erb +16 -12
- data/app/views/alchemy/admin/layoutpages/_layoutpage.html.erb +1 -1
- data/app/views/alchemy/admin/layoutpages/edit.html.erb +11 -0
- data/app/views/alchemy/admin/layoutpages/index.html.erb +4 -16
- data/app/views/alchemy/admin/legacy_page_urls/_form.html.erb +5 -0
- data/app/views/alchemy/admin/legacy_page_urls/_label.html.erb +1 -0
- data/app/views/alchemy/admin/legacy_page_urls/_legacy_page_url.html.erb +13 -0
- data/app/views/alchemy/admin/legacy_page_urls/_new.html.erb +20 -0
- data/app/views/alchemy/admin/legacy_page_urls/create.js.erb +10 -0
- data/app/views/alchemy/admin/legacy_page_urls/destroy.js.erb +6 -0
- data/app/views/alchemy/admin/legacy_page_urls/update.js.erb +2 -0
- data/app/views/alchemy/admin/pages/_form.html.erb +58 -0
- data/app/views/alchemy/admin/pages/_internal_link.html.erb +9 -4
- data/app/views/alchemy/admin/pages/_legacy_urls.html.erb +23 -0
- data/app/views/alchemy/admin/pages/_locked_page.html.erb +21 -0
- data/app/views/alchemy/admin/pages/_page.html.erb +2 -2
- data/app/views/alchemy/admin/pages/_page_status.html.erb +11 -9
- data/app/views/alchemy/admin/pages/_tinymce_custom_config.html.erb +13 -0
- data/app/views/alchemy/admin/pages/configure.html.erb +16 -57
- data/app/views/alchemy/admin/pages/edit.html.erb +64 -66
- data/app/views/alchemy/admin/pages/index.html.erb +9 -19
- data/app/views/alchemy/admin/pages/update.js.erb +1 -1
- data/app/views/alchemy/admin/partials/_remote_search_form.html.erb +7 -12
- data/app/views/alchemy/admin/partials/_routes.html.erb +25 -0
- data/app/views/alchemy/admin/partials/_search_form.html.erb +10 -12
- data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +53 -47
- data/app/views/alchemy/admin/pictures/index.html.erb +34 -29
- data/app/views/alchemy/essences/shared/_essence_picture_tools.html.erb +1 -1
- data/app/views/alchemy/navigation/_link.html.erb +9 -9
- data/app/views/alchemy/pages/show.rss.builder +2 -2
- data/app/views/layouts/alchemy/admin.html.erb +20 -9
- data/bin/alchemy +1 -1
- data/config/alchemy/config.yml +1 -0
- data/config/locales/alchemy.de.yml +15 -1
- data/config/locales/alchemy.en.yml +29 -19
- data/config/locales/alchemy.nl.yml +11 -1
- data/config/routes.rb +2 -1
- data/lib/alchemy/errors.rb +2 -2
- data/lib/alchemy/permissions.rb +2 -0
- data/lib/alchemy/resource.rb +22 -9
- data/lib/alchemy/tinymce.rb +13 -7
- data/lib/alchemy/version.rb +1 -1
- data/spec/controllers/admin/base_controller_spec.rb +39 -0
- data/spec/controllers/admin/elements_controller_spec.rb +17 -14
- data/spec/controllers/admin/pages_controller_spec.rb +1 -2
- data/spec/controllers/pages_controller_spec.rb +7 -3
- data/spec/dummy/app/models/dummy_user.rb +12 -2
- data/spec/features/admin/dashboard_spec.rb +45 -0
- data/spec/features/admin/legacy_page_url_management_spec.rb +62 -0
- data/spec/features/admin/page_editing_feature_spec.rb +66 -6
- data/spec/features/page_feature_spec.rb +13 -0
- data/spec/helpers/admin/base_helper_spec.rb +36 -0
- data/spec/libraries/resource_spec.rb +168 -84
- data/spec/libraries/tinymce_spec.rb +10 -0
- data/spec/models/element_spec.rb +16 -0
- data/spec/models/legacy_page_url_spec.rb +21 -0
- data/spec/models/message_spec.rb +23 -7
- data/spec/models/page_spec.rb +89 -12
- data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.min.js +1 -0
- data/vendor/assets/javascripts/tinymce/plugins/hr/plugin.min.js +1 -0
- metadata +96 -75
- data/app/assets/javascripts/alchemy/alchemy.routes.js.erb +0 -38
- data/spec/models/resource_spec.rb +0 -159
@@ -367,7 +367,7 @@ module Alchemy
|
|
367
367
|
)
|
368
368
|
if @page.contains_feed?
|
369
369
|
meta_string += %(
|
370
|
-
<link rel="alternate" type="application/rss+xml" title="RSS" href="#{show_alchemy_page_url(@page,
|
370
|
+
<link rel="alternate" type="application/rss+xml" title="RSS" href="#{show_alchemy_page_url(@page, format: :rss)}">
|
371
371
|
)
|
372
372
|
end
|
373
373
|
return meta_string.html_safe
|
@@ -193,12 +193,13 @@ module Alchemy
|
|
193
193
|
#
|
194
194
|
def content_for_rss_title
|
195
195
|
rss_title = content_descriptions.detect { |c| c['rss_title'] }
|
196
|
+
return if rss_title.blank?
|
196
197
|
contents.find_by_name(rss_title['name'])
|
197
198
|
end
|
198
199
|
|
199
|
-
# Returns the content that is marked as rss
|
200
|
+
# Returns the content that is marked as rss description.
|
200
201
|
#
|
201
|
-
# Mark a content as rss
|
202
|
+
# Mark a content as rss description in your +elements.yml+ file:
|
202
203
|
#
|
203
204
|
# - name: news
|
204
205
|
# contents:
|
@@ -207,8 +208,9 @@ module Alchemy
|
|
207
208
|
# rss_description: true
|
208
209
|
#
|
209
210
|
def content_for_rss_description
|
210
|
-
|
211
|
-
|
211
|
+
rss_description = content_descriptions.detect { |c| c['rss_description'] }
|
212
|
+
return if rss_description.blank?
|
213
|
+
contents.find_by_name(rss_description['name'])
|
212
214
|
end
|
213
215
|
|
214
216
|
# Returns the array with the hashes for all element contents in the elements.yml file
|
@@ -12,5 +12,9 @@
|
|
12
12
|
class Alchemy::LegacyPageUrl < ActiveRecord::Base
|
13
13
|
belongs_to :page, class_name: 'Alchemy::Page'
|
14
14
|
|
15
|
-
|
15
|
+
validates :page_id,
|
16
|
+
presence: true
|
17
|
+
validates :urlname,
|
18
|
+
presence: true,
|
19
|
+
format: {with: /\A[:\.\w\-+_\/\?&%;=]*\z/}
|
16
20
|
end
|
@@ -28,10 +28,10 @@ module Alchemy
|
|
28
28
|
validates_presence_of field
|
29
29
|
|
30
30
|
case field.to_sym
|
31
|
-
when
|
31
|
+
when /email/
|
32
32
|
validates_format_of field,
|
33
33
|
with: Alchemy::Config.get('format_matchers')['email'],
|
34
|
-
if: -> {
|
34
|
+
if: -> { send(field).present? }
|
35
35
|
when :email_confirmation
|
36
36
|
validates_confirmation_of :email
|
37
37
|
end
|
data/app/models/alchemy/page.rb
CHANGED
@@ -30,6 +30,7 @@
|
|
30
30
|
# updater_id :integer
|
31
31
|
# language_id :integer
|
32
32
|
# cached_tag_list :text
|
33
|
+
# published_at :datetime
|
33
34
|
#
|
34
35
|
|
35
36
|
module Alchemy
|
@@ -69,10 +70,8 @@ module Alchemy
|
|
69
70
|
stampable stamper_class_name: Alchemy.user_class_name
|
70
71
|
|
71
72
|
has_many :folded_pages
|
72
|
-
|
73
73
|
has_many :legacy_urls, :class_name => 'Alchemy::LegacyPageUrl'
|
74
74
|
belongs_to :language
|
75
|
-
belongs_to :locker, class_name: Alchemy.user_class_name, foreign_key: 'locked_by'
|
76
75
|
|
77
76
|
validates_presence_of :language, :on => :create, :unless => :root
|
78
77
|
validates_presence_of :page_layout, :unless => :systempage?
|
@@ -89,12 +88,12 @@ module Alchemy
|
|
89
88
|
after_update :create_legacy_url, if: :urlname_changed?, unless: :redirects_to_external?
|
90
89
|
|
91
90
|
# Concerns
|
92
|
-
include Alchemy::Page::
|
93
|
-
include Alchemy::Page::
|
94
|
-
include Alchemy::Page::
|
95
|
-
include Alchemy::Page::
|
96
|
-
include Alchemy::Page::
|
97
|
-
include Alchemy::Page::
|
91
|
+
include Alchemy::Page::PageScopes
|
92
|
+
include Alchemy::Page::PageNatures
|
93
|
+
include Alchemy::Page::PageNaming
|
94
|
+
include Alchemy::Page::PageUsers
|
95
|
+
include Alchemy::Page::PageCells
|
96
|
+
include Alchemy::Page::PageElements
|
98
97
|
|
99
98
|
# Class methods
|
100
99
|
#
|
@@ -356,7 +355,7 @@ module Alchemy
|
|
356
355
|
.where(["#{self.class.table_name}.lft #{dir} ?", lft])
|
357
356
|
.where(public: options[:public])
|
358
357
|
.where(restricted: options[:restricted])
|
359
|
-
.
|
358
|
+
.reorder(dir == '>' ? 'lft' : 'lft DESC')
|
360
359
|
.limit(1).first
|
361
360
|
end
|
362
361
|
|
@@ -1,28 +1,30 @@
|
|
1
1
|
module Alchemy
|
2
|
-
module Page::
|
2
|
+
module Page::PageNaming
|
3
3
|
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
include NameConversions
|
6
6
|
RESERVED_URLNAMES = %w(admin messages new)
|
7
7
|
|
8
8
|
included do
|
9
|
-
before_validation :set_urlname,
|
9
|
+
before_validation :set_urlname,
|
10
|
+
if: :renamed?,
|
11
|
+
unless: -> { systempage? || redirects_to_external? || name.blank? }
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
:urlname,
|
15
|
-
:
|
16
|
-
:if
|
17
|
-
|
18
|
-
|
13
|
+
validates :name,
|
14
|
+
presence: true
|
15
|
+
validates :urlname,
|
16
|
+
uniqueness: {scope: [:language_id, :layoutpage], if: 'urlname.present?'},
|
17
|
+
exclusion: {in: RESERVED_URLNAMES},
|
18
|
+
length: {minimum: 3, if: 'urlname.present?'},
|
19
|
+
format: {with: /\A[:\.\w\-+_\/\?&%;=]*\z/, if: :redirects_to_external?},
|
20
|
+
presence: {if: :redirects_to_external?}
|
19
21
|
|
20
22
|
before_save :set_title, :if => 'title.blank?', :unless => proc { systempage? || redirects_to_external? }
|
21
|
-
after_update
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
after_update :update_descendants_urlnames,
|
24
|
+
if: -> { Config.get(:url_nesting) && (urlname_changed? || visible_changed?) }
|
25
|
+
after_move :update_urlname!,
|
26
|
+
if: -> { Config.get(:url_nesting) },
|
27
|
+
unless: :redirects_to_external?
|
26
28
|
end
|
27
29
|
|
28
30
|
# Returns true if name or urlname has changed.
|
@@ -37,8 +39,8 @@ module Alchemy
|
|
37
39
|
new_urlname = (names << slug).join('/')
|
38
40
|
if urlname != new_urlname
|
39
41
|
legacy_urls.create(urlname: urlname)
|
42
|
+
update_column(:urlname, new_urlname)
|
40
43
|
end
|
41
|
-
update_column(:urlname, new_urlname)
|
42
44
|
end
|
43
45
|
|
44
46
|
# Returns always the last part of a urlname path
|
@@ -46,7 +48,21 @@ module Alchemy
|
|
46
48
|
urlname.to_s.split('/').last
|
47
49
|
end
|
48
50
|
|
49
|
-
|
51
|
+
# Returns an urlname prefixed with http://, if no protocol is given
|
52
|
+
def external_urlname
|
53
|
+
return urlname if urlname =~ /\A(\/|[a-z]+:\/\/)/
|
54
|
+
"http://#{urlname}"
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
def update_descendants_urlnames
|
60
|
+
self.reload
|
61
|
+
descendants.each do |descendant|
|
62
|
+
next if descendant.redirects_to_external?
|
63
|
+
descendant.update_urlname!
|
64
|
+
end
|
65
|
+
end
|
50
66
|
|
51
67
|
# Sets the urlname to a url friendly slug.
|
52
68
|
# Either from name, or if present, from urlname.
|
@@ -80,6 +96,5 @@ module Alchemy
|
|
80
96
|
url_name
|
81
97
|
end
|
82
98
|
end
|
83
|
-
|
84
99
|
end
|
85
100
|
end
|
@@ -1,7 +1,19 @@
|
|
1
1
|
module Alchemy
|
2
|
-
module Page::
|
2
|
+
module Page::PageUsers
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
|
+
def creator
|
6
|
+
Alchemy.user_class.try(:find, creator_id)
|
7
|
+
end
|
8
|
+
|
9
|
+
def updater
|
10
|
+
Alchemy.user_class.try(:find, updater_id)
|
11
|
+
end
|
12
|
+
|
13
|
+
def locker
|
14
|
+
Alchemy.user_class.try(:find, locked_by)
|
15
|
+
end
|
16
|
+
|
5
17
|
# Returns the name of the creator of this page.
|
6
18
|
#
|
7
19
|
# If no creator could be found or associated user model
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<%= link_to_dialog new_admin_element_path(
|
2
|
+
page_id: @page.id,
|
3
|
+
insert_after: local_assigns[:element_before].try(:id)
|
4
|
+
),
|
5
|
+
{
|
6
|
+
title: _t("New Element"),
|
7
|
+
size: '320x125'
|
8
|
+
},
|
9
|
+
{
|
10
|
+
class: "#{local_assigns[:expanded] ? 'expanded ' : ''}insert-element-button",
|
11
|
+
id: local_assigns[:id],
|
12
|
+
title: _t("New Element")
|
13
|
+
} do %>
|
14
|
+
<%= render_icon 'create' %>
|
15
|
+
<label>
|
16
|
+
<%= _t('New Element') %>
|
17
|
+
</label>
|
18
|
+
<% end %>
|
@@ -1,23 +1,24 @@
|
|
1
1
|
<div class="element_editor<%= element.folded ? ' folded' : '' %> <%= defined?(draggable) && !draggable ? 'not-draggable' : 'draggable' %>" id="element_<%= element.id %>" data-element-id="<%= element.id %>">
|
2
|
-
<%=
|
3
|
-
|
4
|
-
|
2
|
+
<%= form_for [:admin, element], remote: true, html: {id: "element_#{element.id}_form"} do |f| %>
|
3
|
+
<%= render 'alchemy/admin/elements/element_head', element: element %>
|
4
|
+
<% unless element.folded? %>
|
5
5
|
<div id="element_<%= element.id %>_errors" class="element_errors" style="display: none"></div>
|
6
6
|
<div id="element_<%= element.id %>_content" class="element_content">
|
7
7
|
<%= render_editor(element) %>
|
8
8
|
</div>
|
9
9
|
<% if element.has_validations? %>
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
<p class="validation_notice">
|
11
|
+
<span class="validation_indicator">*</span> <%= _t('Mandatory') %>
|
12
|
+
</p>
|
13
13
|
<% end %>
|
14
14
|
<% if element.taggable? %>
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
<div class="autocomplete_tag_list">
|
16
|
+
<%= f.label :tag_list %>
|
17
|
+
<%= render 'alchemy/admin/partials/autocomplete_tag_list', f: f %>
|
18
|
+
</div>
|
19
19
|
<% end %>
|
20
|
-
<%= render
|
20
|
+
<%= render 'alchemy/admin/elements/element_foot', element: element, f: f %>
|
21
21
|
<% end %>
|
22
22
|
<% end %>
|
23
|
+
<%= render 'alchemy/admin/elements/add_element_button', element_before: element %>
|
23
24
|
</div>
|
@@ -5,6 +5,9 @@
|
|
5
5
|
</div>
|
6
6
|
<%- else -%>
|
7
7
|
<%= alchemy_form_for [:admin, @element] do |form| %>
|
8
|
+
<% if params[:insert_after].present? %>
|
9
|
+
<%= hidden_field_tag :insert_after, params[:insert_after] %>
|
10
|
+
<% end %>
|
8
11
|
<%= form.hidden_field :page_id %>
|
9
12
|
<%- if @page.can_have_cells? -%>
|
10
13
|
<%= form.input :name,
|
@@ -16,10 +16,10 @@
|
|
16
16
|
|
17
17
|
$element_area = $('#cell_<%= @cell_name %>');
|
18
18
|
|
19
|
-
<%- if @
|
20
|
-
$
|
19
|
+
<%- if @element_before -%>
|
20
|
+
$('#element_<%= @element_before.id %>').after(element_html);
|
21
21
|
<%- else -%>
|
22
|
-
$
|
22
|
+
$('#insert_element_top').after(element_html).removeClass('expanded');
|
23
23
|
<%- end -%>
|
24
24
|
|
25
25
|
if ($element_area.find('.element_editor').length > 0) {
|
@@ -5,22 +5,37 @@
|
|
5
5
|
<% @elements.each do |cell, elements| %>
|
6
6
|
<li>
|
7
7
|
<a href="#cell_<%= cell.name %>">
|
8
|
-
<%= _t(cell.name, :
|
8
|
+
<%= _t(cell.name, scope: 'cell_names') %>
|
9
9
|
</a>
|
10
10
|
</li>
|
11
11
|
<% end %>
|
12
12
|
</ul>
|
13
13
|
<div id="cell_for_other_elements" class="sortable_cell for_other_elements_cell">
|
14
|
-
<%= render
|
14
|
+
<%= render 'add_element_button',
|
15
|
+
expanded: @page.elements.not_trashed.not_in_cell.empty?,
|
16
|
+
id: 'insert_element_top' %>
|
17
|
+
<%= render partial: 'alchemy/admin/elements/element',
|
18
|
+
collection: @page.elements.not_trashed.not_in_cell,
|
19
|
+
locals: {draggable: true} %>
|
15
20
|
</div>
|
16
21
|
<% @elements.each do |cell, elements| -%>
|
17
22
|
<div id="cell_<%= cell.name %>" class="sortable_cell <%= cell.name %>_cell" data-cell-id="<%= cell.id %>">
|
18
|
-
<%= render
|
23
|
+
<%= render 'add_element_button',
|
24
|
+
expanded: elements.empty?,
|
25
|
+
id: 'insert_element_top' %>
|
26
|
+
<%= render partial: 'alchemy/admin/elements/element',
|
27
|
+
collection: elements,
|
28
|
+
locals: {draggable: true} %>
|
19
29
|
</div>
|
20
30
|
<% end %>
|
21
31
|
</div>
|
22
32
|
<% else %>
|
23
33
|
<div class="sortable_cell for_other_elements_cell" id="cell_for_other_elements">
|
24
|
-
<%= render
|
34
|
+
<%= render 'add_element_button',
|
35
|
+
expanded: @elements.empty?,
|
36
|
+
id: 'insert_element_top' %>
|
37
|
+
<%= render partial: 'alchemy/admin/elements/element',
|
38
|
+
collection: @elements,
|
39
|
+
locals: {draggable: true} %>
|
25
40
|
</div>
|
26
41
|
<% end %>
|
@@ -11,6 +11,9 @@
|
|
11
11
|
</div>
|
12
12
|
<div id="paste_element_tab">
|
13
13
|
<%= alchemy_form_for([:admin, @element]) do |f| %>
|
14
|
+
<% if params[:insert_after].present? %>
|
15
|
+
<%= hidden_field_tag :insert_after, params[:insert_after] %>
|
16
|
+
<% end %>
|
14
17
|
<%= f.hidden_field(:page_id) %>
|
15
18
|
<div class="input select">
|
16
19
|
<label for="paste_from_clipboard" class="control-label"><%= _t("Element") %></label>
|
@@ -1,12 +1,16 @@
|
|
1
|
-
|
2
|
-
$(
|
3
|
-
|
4
|
-
$(
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
1
|
+
(function() {
|
2
|
+
var $el = $('#element_<%= @element.id %>');
|
3
|
+
var $parent = $el.parent();
|
4
|
+
$el.hide(200, function() {
|
5
|
+
$(this).remove();
|
6
|
+
Alchemy.growl('<%= j _t("Element trashed") %>');
|
7
|
+
$('#element_area .sortable_cell').sortable('refresh');
|
8
|
+
Alchemy.TrashWindow.refresh();
|
9
|
+
$('#element_trash_button .icon').addClass('full');
|
10
|
+
Alchemy.PreviewWindow.refresh();
|
11
|
+
<%= update_essence_select_elements(@page, @element) -%>
|
12
|
+
if ($parent.find('.element_editor').length === 0) {
|
13
|
+
$('#insert_element_top').addClass('expanded');
|
14
|
+
}
|
15
|
+
});
|
16
|
+
})();
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%= alchemy_form_for [:admin, @page], class: 'edit_page' do |f| %>
|
2
|
+
<%= f.input :page_layout, collection: @page_layouts, label: _t(:page_type), include_blank: false, input_html: {class: 'alchemy_selectbox'} %>
|
3
|
+
<%= f.input :name, autofocus: true %>
|
4
|
+
<% if @page.taggable? %>
|
5
|
+
<div class="input string">
|
6
|
+
<%= f.label :tag_list %>
|
7
|
+
<%= render 'alchemy/admin/partials/autocomplete_tag_list', f: f %>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
10
|
+
<%= f.submit _t(:save) %>
|
11
|
+
<% end %>
|