alchemy_cms 2.6.3 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.simplecov +14 -0
- data/.travis.yml +1 -1
- data/Gemfile +7 -6
- data/README.md +15 -5
- data/alchemy_cms.gemspec +3 -2
- data/app/assets/javascripts/alchemy/alchemy.base.js.coffee +9 -17
- data/app/assets/javascripts/alchemy/alchemy.dirty.js.coffee +70 -0
- data/app/assets/javascripts/alchemy/alchemy.dragndrop.js.coffee +80 -0
- data/app/assets/javascripts/alchemy/alchemy.element_editors.js.coffee +43 -19
- data/app/assets/javascripts/alchemy/alchemy.gui.js.coffee +3 -1
- data/app/assets/javascripts/alchemy/alchemy.js +4 -2
- data/app/assets/javascripts/alchemy/alchemy.onload.js.coffee +1 -1
- data/app/assets/javascripts/alchemy/alchemy.spinner.js.coffee +14 -0
- data/app/assets/javascripts/alchemy/alchemy.tinymce.js.coffee.erb +96 -0
- data/app/assets/javascripts/alchemy/alchemy.translations.js.coffee +22 -0
- data/app/assets/javascripts/alchemy/alchemy.windows.js.coffee +28 -17
- data/app/assets/stylesheets/alchemy/base.scss +6 -0
- data/app/assets/stylesheets/alchemy/elements.scss +2 -28
- data/app/assets/stylesheets/alchemy/errors.scss +1 -1
- data/app/assets/stylesheets/alchemy/menubar.css.scss +2 -0
- data/app/assets/stylesheets/alchemy/sitemap.scss +21 -34
- data/app/assets/stylesheets/alchemy/tables.scss +13 -3
- data/app/controllers/alchemy/admin/attachments_controller.rb +10 -5
- data/app/controllers/alchemy/admin/base_controller.rb +19 -0
- data/app/controllers/alchemy/admin/contents_controller.rb +1 -4
- data/app/controllers/alchemy/admin/dashboard_controller.rb +2 -1
- data/app/controllers/alchemy/admin/elements_controller.rb +1 -1
- data/app/controllers/alchemy/admin/essence_files_controller.rb +1 -1
- data/app/controllers/alchemy/admin/essence_pictures_controller.rb +70 -56
- data/app/controllers/alchemy/admin/pages_controller.rb +37 -114
- data/app/controllers/alchemy/admin/pictures_controller.rb +5 -12
- data/app/controllers/alchemy/admin/resources_controller.rb +3 -1
- data/app/controllers/alchemy/admin/trash_controller.rb +1 -1
- data/app/controllers/alchemy/attachments_controller.rb +1 -1
- data/app/controllers/alchemy/base_controller.rb +3 -15
- data/app/controllers/alchemy/messages_controller.rb +4 -10
- data/app/controllers/alchemy/pages_controller.rb +6 -6
- data/app/controllers/alchemy/passwords_controller.rb +1 -1
- data/app/controllers/alchemy/user_sessions_controller.rb +1 -1
- data/app/helpers/alchemy/admin/base_helper.rb +49 -230
- data/app/helpers/alchemy/admin/contents_helper.rb +5 -1
- data/app/helpers/alchemy/admin/elements_helper.rb +19 -47
- data/app/helpers/alchemy/admin/essences_helper.rb +59 -17
- data/app/helpers/alchemy/admin/navigation_helper.rb +204 -0
- data/app/helpers/alchemy/admin/pages_helper.rb +22 -79
- data/app/helpers/alchemy/admin/pictures_helper.rb +1 -1
- data/app/helpers/alchemy/admin/tags_helper.rb +42 -0
- data/app/helpers/alchemy/base_helper.rb +0 -11
- data/app/helpers/alchemy/elements_helper.rb +48 -25
- data/app/helpers/alchemy/essences_helper.rb +0 -20
- data/app/helpers/alchemy/pages_helper.rb +18 -14
- data/app/helpers/alchemy/url_helper.rb +1 -0
- data/app/mailers/alchemy/messages.rb +4 -6
- data/app/models/alchemy/attachment.rb +3 -0
- data/app/models/alchemy/cell.rb +33 -35
- data/app/models/alchemy/content.rb +20 -111
- data/app/models/alchemy/content/factory.rb +188 -0
- data/app/models/alchemy/element.rb +51 -200
- data/app/models/alchemy/element/definitions.rb +52 -0
- data/app/models/alchemy/element/presenters.rb +87 -0
- data/app/models/alchemy/essence_date.rb +1 -1
- data/app/models/alchemy/essence_file.rb +6 -7
- data/app/models/alchemy/essence_picture.rb +19 -4
- data/app/models/alchemy/message.rb +18 -14
- data/app/models/alchemy/page.rb +120 -214
- data/app/models/alchemy/page/elements.rb +145 -36
- data/app/models/alchemy/page/natures.rb +90 -0
- data/app/models/alchemy/page/scopes.rb +93 -0
- data/app/models/alchemy/page/users.rb +25 -0
- data/app/models/alchemy/picture.rb +15 -0
- data/app/models/alchemy/site.rb +15 -1
- data/app/models/alchemy/site/layout.rb +38 -0
- data/app/models/alchemy/user.rb +13 -3
- data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +7 -7
- data/app/views/alchemy/admin/attachments/_file_to_assign.html.erb +8 -8
- data/app/views/alchemy/admin/attachments/_tag_list.html.erb +1 -16
- data/app/views/alchemy/admin/attachments/destroy.js.erb +1 -4
- data/app/views/alchemy/admin/contents/create.js.erb +1 -1
- data/app/views/alchemy/admin/dashboard/index.html.erb +14 -13
- data/app/views/alchemy/admin/elements/_element_head.html.erb +7 -7
- data/app/views/alchemy/admin/elements/_refresh_editor.js.erb +10 -0
- data/app/views/alchemy/admin/elements/create.js.erb +44 -44
- data/app/views/alchemy/admin/elements/fold.js.erb +22 -26
- data/app/views/alchemy/admin/elements/trash.js.erb +1 -1
- data/app/views/alchemy/admin/elements/update.js.erb +22 -25
- data/app/views/alchemy/admin/essence_files/assign.js.erb +8 -3
- data/app/views/alchemy/admin/essence_pictures/crop.html.erb +14 -12
- data/app/views/alchemy/admin/essence_pictures/edit.html.erb +22 -39
- data/app/views/alchemy/admin/pages/_page.html.erb +73 -80
- data/app/views/alchemy/admin/pages/destroy.js.erb +2 -2
- data/app/views/alchemy/admin/pages/edit.html.erb +21 -18
- data/app/views/alchemy/admin/pages/fold.js.erb +1 -0
- data/app/views/alchemy/admin/pages/info.html.erb +32 -0
- data/app/views/alchemy/admin/partials/_main_navigation_entry.html.erb +11 -13
- data/app/views/alchemy/admin/partials/_remote_search_form.html.erb +20 -20
- data/app/views/alchemy/admin/partials/_sub_navigation.html.erb +8 -0
- data/app/views/alchemy/admin/partials/_toolbar_button.html.erb +25 -0
- data/app/views/alchemy/admin/partials/_upload_form.html.erb +15 -15
- data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +39 -39
- data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +10 -10
- data/app/views/alchemy/admin/pictures/_tag_list.html.erb +1 -16
- data/app/views/alchemy/admin/resources/destroy.js.erb +1 -1
- data/app/views/alchemy/base/500.html.erb +1 -1
- data/app/views/alchemy/base/permission_denied.js.erb +1 -1
- data/app/views/alchemy/base/redirect.js.erb +1 -1
- data/app/views/alchemy/essences/_essence_link_editor.html.erb +1 -1
- data/app/views/alchemy/essences/_essence_picture_editor.html.erb +1 -1
- data/app/views/alchemy/essences/_essence_richtext_editor.html.erb +1 -1
- data/app/views/alchemy/essences/_essence_text_editor.html.erb +1 -1
- data/app/views/alchemy/essences/{_essence_picture_tools.html.erb → shared/_essence_picture_tools.html.erb} +5 -5
- data/app/views/alchemy/essences/{_linkable_essence_tools.html.erb → shared/_linkable_essence_tools.html.erb} +0 -0
- data/app/views/alchemy/messages/contact_form_mail.de.text.erb +12 -0
- data/app/views/alchemy/messages/contact_form_mail.en.text.erb +12 -0
- data/app/views/alchemy/notifications/reset_password_instructions.de.text.erb +1 -1
- data/app/views/alchemy/notifications/reset_password_instructions.en.text.erb +2 -2
- data/app/views/alchemy/pages/sitemap.xml.erb +3 -5
- data/app/views/alchemy/user_sessions/leave.html.erb +1 -1
- data/app/views/layouts/alchemy/admin.html.erb +4 -2
- data/app/views/layouts/alchemy/sitemap.xml.erb +1 -1
- data/bin/alchemy +7 -13
- data/config/alchemy/config.yml +1 -0
- data/config/authorization_rules.rb +2 -3
- data/config/initializers/dragonfly.rb +2 -0
- data/config/locales/alchemy.de.yml +8 -9
- data/config/locales/alchemy.en.yml +7 -4
- data/config/routes.rb +3 -0
- data/db/migrate/{20130214233001_alchemy_two_point_five.rb → 20130827094554_alchemy_two_point_six.rb} +29 -6
- data/lib/alchemy/auth/engine.rb +9 -0
- data/lib/alchemy/capistrano.rb +37 -12
- data/lib/alchemy/config.rb +48 -35
- data/lib/alchemy/engine.rb +35 -6
- data/lib/alchemy/essence.rb +25 -29
- data/lib/alchemy/ferret/search.rb +86 -0
- data/lib/alchemy/{scoped_pagination_url_helper.rb → kaminari/scoped_pagination_url_helper.rb} +0 -0
- data/lib/alchemy/logger.rb +3 -4
- data/lib/alchemy/page_layout.rb +124 -55
- data/lib/alchemy/resource.rb +0 -10
- data/lib/alchemy/resources_helper.rb +0 -5
- data/lib/alchemy/seeder.rb +1 -32
- data/lib/alchemy/shell.rb +6 -1
- data/lib/alchemy/tinymce.rb +41 -32
- data/lib/alchemy/upgrader.rb +3 -1
- data/lib/alchemy/upgrader/two_point_five.rb +15 -8
- data/lib/alchemy/upgrader/two_point_one.rb +10 -10
- data/lib/alchemy/upgrader/two_point_two.rb +96 -51
- data/lib/alchemy/version.rb +1 -1
- data/lib/alchemy_cms.rb +5 -46
- data/lib/rails/generators/alchemy/deploy_script/templates/deploy.rb.tt +1 -1
- data/lib/rails/generators/alchemy/devise/devise_generator.rb +9 -4
- data/lib/rails/generators/alchemy/essence/essence_generator.rb +7 -6
- data/lib/rails/generators/alchemy/essence/templates/editor.html.erb +1 -1
- data/lib/rails/generators/alchemy/scaffold/files/_standard.html.erb +1 -0
- data/lib/rails/generators/alchemy/scaffold/scaffold_generator.rb +1 -0
- data/lib/rails/generators/alchemy/site_layouts/site_layouts_generator.rb +23 -0
- data/lib/rails/generators/alchemy/site_layouts/templates/layout.html.erb +1 -0
- data/lib/rails/generators/alchemy/site_layouts/templates/layout.html.haml +1 -0
- data/lib/rails/generators/alchemy/site_layouts/templates/layout.html.slim +1 -0
- data/lib/rails/templates/alchemy.rb +2 -2
- data/lib/tasks/alchemy/db.rake +3 -1
- data/lib/tasks/alchemy/tidy.rake +82 -0
- data/lib/tasks/alchemy/upgrade.rake +2 -1
- data/spec/controllers/admin/attachments_controller_spec.rb +124 -0
- data/spec/controllers/admin/base_controller_spec.rb +35 -0
- data/spec/controllers/admin/clipboard_controller_spec.rb +1 -1
- data/spec/controllers/admin/contents_controller_spec.rb +17 -26
- data/spec/controllers/admin/dashboard_controller_spec.rb +121 -0
- data/spec/controllers/admin/elements_controller_spec.rb +1 -1
- data/spec/controllers/admin/essence_files_controller_spec.rb +67 -0
- data/spec/controllers/admin/essence_pictures_controller_spec.rb +161 -0
- data/spec/controllers/admin/languages_controller_spec.rb +1 -1
- data/spec/controllers/admin/layoutpages_controller_spec.rb +28 -0
- data/spec/controllers/admin/pages_controller_spec.rb +164 -118
- data/spec/controllers/admin/pictures_controller_spec.rb +89 -0
- data/spec/controllers/admin/trash_controller_spec.rb +21 -31
- data/spec/controllers/admin/users_controller_spec.rb +114 -85
- data/spec/controllers/attachments_controller_spec.rb +6 -2
- data/spec/controllers/base_controller_spec.rb +22 -0
- data/spec/controllers/elements_controller_spec.rb +1 -1
- data/spec/controllers/messages_controller_spec.rb +200 -0
- data/spec/controllers/pictures_controller_spec.rb +1 -1
- data/spec/controllers/user_sessions_controller_spec.rb +7 -6
- data/spec/controllers/users_controller_spec.rb +2 -2
- data/spec/dummy/config/alchemy/cells.yml +2 -0
- data/spec/dummy/config/application.rb +19 -8
- data/spec/dummy/db/migrate/{20130214233001_alchemy_two_point_five.rb → 20130827094554_alchemy_two_point_six.rb} +29 -6
- data/spec/dummy/db/schema.rb +1 -1
- data/spec/fast_specs.rb +15 -0
- data/spec/helpers/admin/base_helper_spec.rb +53 -34
- data/spec/helpers/admin/contents_helper_spec.rb +15 -7
- data/spec/helpers/admin/elements_helper_spec.rb +79 -34
- data/spec/helpers/admin/essences_helper_spec.rb +45 -31
- data/spec/helpers/admin/navigation_helper_spec.rb +204 -0
- data/spec/helpers/admin/pages_helper_spec.rb +25 -15
- data/spec/helpers/admin/tags_helper_spec.rb +62 -2
- data/spec/helpers/elements_helper_spec.rb +202 -138
- data/spec/helpers/pages_helper_spec.rb +48 -0
- data/spec/helpers/url_helper_spec.rb +7 -0
- data/spec/libraries/config_spec.rb +110 -3
- data/spec/libraries/essence_spec.rb +29 -9
- data/spec/libraries/page_layout_spec.rb +134 -0
- data/spec/libraries/resource_spec.rb +3 -16
- data/spec/libraries/resources_helper_spec.rb +4 -8
- data/spec/libraries/shell_spec.rb +1 -0
- data/spec/libraries/tinymce_spec.rb +61 -0
- data/spec/mailers/messages_spec.rb +23 -0
- data/spec/models/attachment_spec.rb +45 -0
- data/spec/models/cell_spec.rb +62 -9
- data/spec/models/content_spec.rb +110 -28
- data/spec/models/element_spec.rb +275 -253
- data/spec/models/essence_date_spec.rb +25 -0
- data/spec/models/essence_file_spec.rb +23 -0
- data/spec/models/essence_html_spec.rb +13 -0
- data/spec/models/essence_picture_spec.rb +16 -0
- data/spec/models/essence_text_spec.rb +29 -0
- data/spec/models/language_spec.rb +34 -0
- data/spec/models/message_spec.rb +43 -0
- data/spec/models/page_spec.rb +726 -567
- data/spec/models/picture_spec.rb +98 -0
- data/spec/models/site_spec.rb +60 -2
- data/spec/models/tag_spec.rb +31 -0
- data/spec/models/user_spec.rb +4 -4
- data/spec/spec_helper.rb +49 -58
- data/spec/support/alchemy/controller_helpers.rb +35 -0
- data/spec/support/alchemy/{specs_helpers.rb → integration_helpers.rb} +4 -8
- data/spec/{factories.rb → support/factories.rb} +11 -1
- data/vendor/assets/javascripts/jquery_plugins/jquery.ui.nestedSortable.js +2 -8
- metadata +166 -106
- data/Guardfile +0 -16
- data/app/assets/javascripts/alchemy/alchemy.dirty.js +0 -93
- data/app/assets/javascripts/alchemy/alchemy.dragndrop.js +0 -122
- data/app/models/alchemy/tree_node.rb +0 -4
- data/app/views/alchemy/admin/pages/_page_infos.html.erb +0 -3
- data/app/views/alchemy/admin/partials/_sub_navigation_tab.html.erb +0 -8
- data/app/views/alchemy/messages/contact_form_mail.text.erb +0 -12
- data/config/initializers/kaminari_config.rb +0 -9
- data/db/migrate/20130221200514_migrate_attachments_to_dragonfly.rb +0 -21
- data/db/migrate/20130312205327_change_alchemy_users_role_to_roles.rb +0 -11
- data/lib/alchemy/auth_engine.rb +0 -7
- data/lib/alchemy/authentication_helpers.rb +0 -9
- data/lib/alchemy/ferret_search.rb +0 -84
- data/lib/extensions/array.rb +0 -25
- data/lib/extensions/hash.rb +0 -34
- data/spec/dummy/db/migrate/20130221200514_migrate_attachments_to_dragonfly.rb +0 -21
- data/spec/dummy/db/migrate/20130312205327_change_alchemy_users_role_to_roles.rb +0 -11
- data/spec/models/page_layout_spec.rb +0 -60
data/app/models/alchemy/site.rb
CHANGED
@@ -11,18 +11,31 @@ module Alchemy
|
|
11
11
|
|
12
12
|
scope :published, where(public: true)
|
13
13
|
|
14
|
+
# concerns
|
15
|
+
include Layout
|
16
|
+
|
14
17
|
# Returns true if this site is the current site
|
15
18
|
def current?
|
16
19
|
self.class.current == self
|
17
20
|
end
|
18
21
|
|
22
|
+
# Returns the path to site's view partial.
|
23
|
+
#
|
24
|
+
# Site view partials live in +app/views/alchemy/site_layouts+
|
25
|
+
#
|
26
|
+
# Please use <tt>rails g alchemy:site_layouts</tt> to generate partials for all your sites.
|
27
|
+
#
|
28
|
+
def to_partial_path
|
29
|
+
"alchemy/site_layouts/#{layout_partial_name}"
|
30
|
+
end
|
31
|
+
|
19
32
|
class << self
|
20
33
|
def current=(v)
|
21
34
|
Thread.current[:alchemy_current_site] = v
|
22
35
|
end
|
23
36
|
|
24
37
|
def current
|
25
|
-
Thread.current[:alchemy_current_site]
|
38
|
+
Thread.current[:alchemy_current_site] || default
|
26
39
|
end
|
27
40
|
|
28
41
|
def default
|
@@ -61,5 +74,6 @@ module Alchemy
|
|
61
74
|
)
|
62
75
|
end
|
63
76
|
end
|
77
|
+
|
64
78
|
end
|
65
79
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Alchemy
|
2
|
+
module Site::Layout
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
SITE_LAYOUTS_FILE = Rails.root.join('config/alchemy/site_layouts.yml')
|
5
|
+
|
6
|
+
module ClassMethods
|
7
|
+
# Returns the site layouts definition defined in +site_layouts.yml+ file
|
8
|
+
#
|
9
|
+
def layout_definitions
|
10
|
+
@layout_definitions ||= read_site_layouts
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
# Reads the site layouts definition file named +site_layouts.yml+ in +config/alchemy/+
|
16
|
+
#
|
17
|
+
# It returns empty Array if no file is present
|
18
|
+
#
|
19
|
+
def read_site_layouts
|
20
|
+
YAML.load_file(SITE_LAYOUTS_FILE) || []
|
21
|
+
rescue Errno::ENOENT
|
22
|
+
[]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# Returns site's layout definition
|
27
|
+
#
|
28
|
+
def layout_definition
|
29
|
+
self.class.layout_definitions.detect { |l| l['name'] == layout_partial_name }
|
30
|
+
end
|
31
|
+
|
32
|
+
# Returns the name for the layout partial
|
33
|
+
#
|
34
|
+
def layout_partial_name
|
35
|
+
name.parameterize.underscore
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/app/models/alchemy/user.rb
CHANGED
@@ -1,10 +1,20 @@
|
|
1
|
+
require 'userstamp'
|
2
|
+
require 'acts-as-taggable-on'
|
3
|
+
|
1
4
|
module Alchemy
|
2
5
|
class User < ActiveRecord::Base
|
3
6
|
|
4
7
|
model_stamper
|
5
8
|
stampable(:stamper_class_name => 'Alchemy::User')
|
6
9
|
|
7
|
-
|
10
|
+
begin
|
11
|
+
devise(*Config.get(:devise_modules))
|
12
|
+
rescue NameError => e
|
13
|
+
abort <<-WARN
|
14
|
+
You enabled the encryptable devise module, but did not have the `devise-encryptable` gem installed!
|
15
|
+
Please add the `devise-encryptable` gem into your Gemfile.
|
16
|
+
WARN
|
17
|
+
end
|
8
18
|
|
9
19
|
acts_as_taggable
|
10
20
|
|
@@ -37,7 +47,7 @@ module Alchemy
|
|
37
47
|
end
|
38
48
|
end
|
39
49
|
|
40
|
-
after_save :deliver_welcome_mail, if: -> { send_credentials }
|
50
|
+
after_save :deliver_welcome_mail, if: -> { send_credentials == '1' }
|
41
51
|
|
42
52
|
scope :admins, where(arel_table[:roles].matches("%admin%")) # not pleased with that approach
|
43
53
|
# mysql regexp word matching would be much nicer, but it's not included in SQLite functions per se.
|
@@ -102,7 +112,7 @@ module Alchemy
|
|
102
112
|
|
103
113
|
# Calls unlock on all locked pages
|
104
114
|
def unlock_pages!
|
105
|
-
pages_locked_by_me.map(&:unlock)
|
115
|
+
pages_locked_by_me.map(&:unlock!)
|
106
116
|
end
|
107
117
|
|
108
118
|
# Returns all pages locked by user.
|
@@ -4,16 +4,16 @@
|
|
4
4
|
<%= link_to_overlay_window(
|
5
5
|
render_icon('upload'),
|
6
6
|
alchemy.new_admin_attachment_path(
|
7
|
-
:
|
8
|
-
:
|
9
|
-
:
|
7
|
+
content_id: @content.blank? ? nil : @content.id,
|
8
|
+
swap: @swap,
|
9
|
+
options: @options.to_json
|
10
10
|
),
|
11
11
|
{
|
12
|
-
:
|
13
|
-
:
|
12
|
+
title: _t(:upload_file),
|
13
|
+
size: '540x550'
|
14
14
|
},
|
15
|
-
:
|
16
|
-
:
|
15
|
+
title: _t(:upload_file),
|
16
|
+
class: 'icon_button'
|
17
17
|
) %>
|
18
18
|
<label><%= _t(:upload_file) %></label>
|
19
19
|
</div>
|
@@ -2,14 +2,14 @@
|
|
2
2
|
<%= link_to(
|
3
3
|
render_icon(file_to_assign.icon_css_class) + file_to_assign.name,
|
4
4
|
{
|
5
|
-
:
|
6
|
-
:
|
7
|
-
:
|
8
|
-
:
|
9
|
-
:
|
5
|
+
controller: 'essence_files',
|
6
|
+
action: 'assign',
|
7
|
+
attachment_id: file_to_assign.id,
|
8
|
+
id: @content.id,
|
9
|
+
options: @options.to_json
|
10
10
|
},
|
11
|
-
:
|
12
|
-
:
|
13
|
-
:
|
11
|
+
remote: true,
|
12
|
+
method: 'put',
|
13
|
+
title: file_to_assign.name
|
14
14
|
) %>
|
15
15
|
</li>
|
@@ -2,22 +2,7 @@
|
|
2
2
|
<h2><%= _t("Filter by tag") %></h2>
|
3
3
|
<%= js_filter_field '#tag_list li' %>
|
4
4
|
<ul>
|
5
|
-
|
6
|
-
<% attachment_tags = filtered_by_tag?(t) ? tag_filter(remove: t) : tag_filter(add: t) %>
|
7
|
-
<%= content_tag 'li', name: t.name, class: p[:tagged_with].try(:split, ',').try(:include?, t.name) ? 'active' : nil do %>
|
8
|
-
<%= link_to(
|
9
|
-
"#{t.name} (#{t.count})",
|
10
|
-
url_for(
|
11
|
-
p.delete_if { |k, v| k == "page" }.merge(
|
12
|
-
action: 'index',
|
13
|
-
tagged_with: attachment_tags
|
14
|
-
)
|
15
|
-
),
|
16
|
-
remote: request.xhr?,
|
17
|
-
class: 'please_wait'
|
18
|
-
) %>
|
19
|
-
<% end %>
|
20
|
-
<% end %>
|
5
|
+
<%= render_tag_list('Alchemy::Attachment', p) %>
|
21
6
|
</ul>
|
22
7
|
<% if p[:tagged_with].present? %>
|
23
8
|
<%= link_to(
|
@@ -1,30 +1,31 @@
|
|
1
1
|
<%= toolbar(
|
2
|
-
:
|
2
|
+
buttons: [
|
3
3
|
{
|
4
|
-
:
|
5
|
-
:
|
6
|
-
:
|
7
|
-
:
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
4
|
+
icon: 'info',
|
5
|
+
label: _t(:info),
|
6
|
+
url: alchemy.dashboard_info_path,
|
7
|
+
title: _t(:info),
|
8
|
+
overlay_options: {
|
9
|
+
title: _t(:info),
|
10
|
+
size: "420x360"
|
11
11
|
},
|
12
|
-
:
|
12
|
+
if_permitted_to: [:info, :alchemy_admin_dashboard],
|
13
|
+
hotkey: 'alt-i'
|
13
14
|
}
|
14
15
|
],
|
15
|
-
:
|
16
|
+
search: false
|
16
17
|
) %>
|
17
18
|
|
18
19
|
<div id="dashboard">
|
19
20
|
<h1>
|
20
21
|
<% if @first_time -%>
|
21
|
-
<%= _t('Welcome, %{name}', :
|
22
|
+
<%= _t('Welcome, %{name}', name: current_user.firstname.blank? ? current_user.login : current_user.firstname) %>
|
22
23
|
<% else -%>
|
23
|
-
<%= _t('Welcome back, %{name}', :
|
24
|
+
<%= _t('Welcome back, %{name}', name: current_user.firstname.blank? ? current_user.login : current_user.firstname) %>
|
24
25
|
<% end -%>
|
25
26
|
</h1>
|
26
27
|
<p>
|
27
|
-
<small><%= _t('Your last login was on %{time}', :
|
28
|
+
<small><%= _t('Your last login was on %{time}', time: l(current_user.last_sign_in_at)) unless current_user.last_sign_in_at.blank? %></small>
|
28
29
|
</p>
|
29
30
|
<div class="column left">
|
30
31
|
<%= render 'locked_pages' %>
|
@@ -11,13 +11,13 @@
|
|
11
11
|
<span class="preview_text_element_name"><%= element.display_name %></span>
|
12
12
|
<span class="preview_text_quote"><%= sanitize(element.preview_text) %></span>
|
13
13
|
</span>
|
14
|
-
<%= render_hint_for(element) %>
|
14
|
+
<%= render_hint_for(element) unless element.trashed? %>
|
15
15
|
<span class="ajax_folder" <%= element.trashed? ? 'style="display: none"'.html_safe : '' %>>
|
16
|
-
<%= link_to
|
17
|
-
|
18
|
-
:
|
19
|
-
:
|
20
|
-
:
|
21
|
-
}
|
16
|
+
<%= link_to '', '#', {
|
17
|
+
'data-element-dirty' => element.id,
|
18
|
+
class: element.folded? ? 'expand_element' : 'fold_element',
|
19
|
+
title: element.folded? ? _t(:show_element_content) : _t(:hide_element_content),
|
20
|
+
id: "element_#{element.id}_folder"
|
21
|
+
} %>
|
22
22
|
</span>
|
23
23
|
</div>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<%- rtfs = element.contents.essence_richtexts -%>
|
2
|
+
(function() {
|
3
|
+
var $element = $('.element_content', '#element_<%= element.id %>');
|
4
|
+
<% rtfs.each do |content| %>
|
5
|
+
tinymce.get('contents_content_<%= content.id %>_body').remove();
|
6
|
+
<% end %>
|
7
|
+
$element.html('<%= escape_javascript render_editor(element) %>');
|
8
|
+
Alchemy.GUI.init($element);
|
9
|
+
Alchemy.Tinymce.addEditor('<%= contents_form_field_ids_string(rtfs) %>');
|
10
|
+
})();
|
@@ -1,48 +1,48 @@
|
|
1
|
-
|
2
|
-
var $
|
3
|
-
var
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
if
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
1
|
+
(function() {
|
2
|
+
var $el;
|
3
|
+
var $element_area;
|
4
|
+
var element_html = '<%= escape_javascript render(:partial => "element", :object => @element, :locals => {:draggable => true}) -%>';
|
5
|
+
|
6
|
+
<%- if @cutted_element_id -%>
|
7
|
+
$('.element_editor[data-element-id="<%= @cutted_element_id %>"]').remove();
|
8
|
+
<%- end -%>
|
9
|
+
|
10
|
+
<%- if @page.can_have_cells? -%>
|
11
|
+
if ($('#cells').length == 0) {
|
12
|
+
Alchemy.buildTabbedCells('<%= _t(:main_content) %>');
|
13
|
+
}
|
14
|
+
Alchemy.selectOrCreateCellTab('<%= @cell_name -%>', '<%= @cell.nil? ? _t(:main_content) : @cell.name_for_label -%>');
|
15
|
+
<%- end -%>
|
16
|
+
|
17
|
+
$element_area = $('#cell_<%= @cell_name -%>');
|
18
|
+
|
19
|
+
<%- if @insert_at_top -%>
|
20
|
+
$element_area.prepend(element_html);
|
21
|
+
<%- else -%>
|
22
|
+
$element_area.append(element_html);
|
23
|
+
<%- end -%>
|
24
|
+
|
25
|
+
if ($element_area.find('.element_editor').length > 0) {
|
26
|
+
Alchemy.SortableElements(<%= @page.id %>, '<%= form_authenticity_token %>', $element_area);
|
27
|
+
} else {
|
28
|
+
$element_area.sortable('refresh');
|
29
|
+
}
|
30
|
+
|
31
|
+
Alchemy.growl('<%= _t(:successfully_added_element) -%>');
|
32
|
+
Alchemy.closeCurrentWindow();
|
33
|
+
<% if (rtfs = @element.contents.essence_richtexts).any? %>
|
34
|
+
Alchemy.Tinymce.addEditor('<%= contents_form_field_ids_string(rtfs) %>');
|
22
35
|
<% end %>
|
36
|
+
Alchemy.PreviewWindow.refresh();
|
37
|
+
Alchemy.ElementEditors.init();
|
23
38
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
$element_area.sortable('refresh');
|
28
|
-
}
|
39
|
+
$el = $('#element_<%= @element.id -%>');
|
40
|
+
$el.trigger('Alchemy.SelectElementEditor');
|
41
|
+
Alchemy.GUI.initElement($el);
|
29
42
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
<% @element.contents.essence_richtexts.each do |content| %>
|
34
|
-
Alchemy.Tinymce.addEditor('<%= content.form_field_id -%>');
|
35
|
-
<% end %>
|
36
|
-
|
37
|
-
Alchemy.PreviewWindow.refresh();
|
38
|
-
Alchemy.ElementEditors.init();
|
39
|
-
|
40
|
-
$el = $('#element_<%= @element.id -%>');
|
41
|
-
$el.trigger('Alchemy.SelectElementEditor');
|
42
|
-
Alchemy.GUI.initElement($el);
|
43
|
-
|
44
|
-
<% if @clipboard.blank? %>
|
45
|
-
$('#clipboard_button .icon.clipboard').removeClass('full');
|
46
|
-
<% end %>
|
43
|
+
<%- if @clipboard.blank? -%>
|
44
|
+
$('#clipboard_button .icon.clipboard').removeClass('full');
|
45
|
+
<%- end -%>
|
47
46
|
|
48
|
-
<%=
|
47
|
+
<%= update_essence_select_elements(@page, @element) -%>
|
48
|
+
})();
|
@@ -1,43 +1,39 @@
|
|
1
|
-
|
1
|
+
<% rtfs = @element.contents.essence_richtexts %>
|
2
2
|
|
3
|
+
(function($) {
|
3
4
|
var $el = $('.element_editor[data-element-id="<%= @element.id %>"]');
|
4
5
|
|
5
|
-
|
6
|
-
for (var i = ids.length - 1; i >= 0; i--) {
|
7
|
-
tinymce.get(ids[i]).remove();
|
8
|
-
};
|
9
|
-
}
|
6
|
+
<% if @error %>
|
10
7
|
|
11
|
-
|
8
|
+
$("#element_<%= @element.id -%> .spinner").replaceWith("<span class='error_icon' title='<%= @error -%>'>!</span>");
|
12
9
|
|
13
|
-
|
10
|
+
<% else %>
|
14
11
|
|
15
|
-
|
12
|
+
$el.replaceWith('<%= escape_javascript render(:partial => "element", :object => @element) -%>');
|
13
|
+
$el = $('#element_<%= @element.id %>');
|
14
|
+
$('#element_area .sortable_cell').sortable('refresh');
|
15
|
+
Alchemy.ElementEditors.reinit($el);
|
16
16
|
|
17
|
-
|
18
|
-
$el = $('#element_<%= @element.id %>');
|
19
|
-
$('#element_area .sortable_cell').sortable('refresh');
|
20
|
-
Alchemy.ElementEditors.reinit($el);
|
17
|
+
<% if @element.folded %>
|
21
18
|
|
22
|
-
|
19
|
+
<% if rtfs.any? %>
|
23
20
|
|
24
|
-
|
25
|
-
removeTinyMCEs(<%=raw @element.rtf_contents.collect(&:form_field_id).to_json %>);
|
26
|
-
<% end %>
|
21
|
+
Alchemy.Tinymce.removeEditor('<%= contents_form_field_ids_string(rtfs) %>');
|
27
22
|
|
28
|
-
|
23
|
+
<% end %>
|
29
24
|
|
30
|
-
|
31
|
-
Alchemy.SelectBox($el);
|
25
|
+
<% else %>
|
32
26
|
|
33
|
-
|
34
|
-
|
35
|
-
<% end %>
|
27
|
+
$el.trigger('Alchemy.SelectElementEditor');
|
28
|
+
Alchemy.SelectBox($el);
|
36
29
|
|
37
|
-
|
30
|
+
<% if rtfs.any? %>
|
31
|
+
Alchemy.Tinymce.addEditor('<%= contents_form_field_ids_string(rtfs) %>');
|
32
|
+
<% end %>
|
38
33
|
|
39
|
-
|
34
|
+
Alchemy.GUI.initElement($el);
|
40
35
|
|
41
|
-
|
36
|
+
<% end %>
|
42
37
|
|
38
|
+
<% end %>
|
43
39
|
})(jQuery);
|
@@ -8,5 +8,5 @@ $('#element_<%= @element.id %>').hide(200, function() {
|
|
8
8
|
<% @element.contents.essence_richtexts.each do |content| %>
|
9
9
|
tinymce.get('contents_content_<%= content.id %>_body').remove();
|
10
10
|
<% end %>
|
11
|
-
<%=
|
11
|
+
<%= update_essence_select_elements(@page, @element) -%>
|
12
12
|
});
|