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.
Files changed (246) hide show
  1. checksums.yaml +4 -4
  2. data/.simplecov +14 -0
  3. data/.travis.yml +1 -1
  4. data/Gemfile +7 -6
  5. data/README.md +15 -5
  6. data/alchemy_cms.gemspec +3 -2
  7. data/app/assets/javascripts/alchemy/alchemy.base.js.coffee +9 -17
  8. data/app/assets/javascripts/alchemy/alchemy.dirty.js.coffee +70 -0
  9. data/app/assets/javascripts/alchemy/alchemy.dragndrop.js.coffee +80 -0
  10. data/app/assets/javascripts/alchemy/alchemy.element_editors.js.coffee +43 -19
  11. data/app/assets/javascripts/alchemy/alchemy.gui.js.coffee +3 -1
  12. data/app/assets/javascripts/alchemy/alchemy.js +4 -2
  13. data/app/assets/javascripts/alchemy/alchemy.onload.js.coffee +1 -1
  14. data/app/assets/javascripts/alchemy/alchemy.spinner.js.coffee +14 -0
  15. data/app/assets/javascripts/alchemy/alchemy.tinymce.js.coffee.erb +96 -0
  16. data/app/assets/javascripts/alchemy/alchemy.translations.js.coffee +22 -0
  17. data/app/assets/javascripts/alchemy/alchemy.windows.js.coffee +28 -17
  18. data/app/assets/stylesheets/alchemy/base.scss +6 -0
  19. data/app/assets/stylesheets/alchemy/elements.scss +2 -28
  20. data/app/assets/stylesheets/alchemy/errors.scss +1 -1
  21. data/app/assets/stylesheets/alchemy/menubar.css.scss +2 -0
  22. data/app/assets/stylesheets/alchemy/sitemap.scss +21 -34
  23. data/app/assets/stylesheets/alchemy/tables.scss +13 -3
  24. data/app/controllers/alchemy/admin/attachments_controller.rb +10 -5
  25. data/app/controllers/alchemy/admin/base_controller.rb +19 -0
  26. data/app/controllers/alchemy/admin/contents_controller.rb +1 -4
  27. data/app/controllers/alchemy/admin/dashboard_controller.rb +2 -1
  28. data/app/controllers/alchemy/admin/elements_controller.rb +1 -1
  29. data/app/controllers/alchemy/admin/essence_files_controller.rb +1 -1
  30. data/app/controllers/alchemy/admin/essence_pictures_controller.rb +70 -56
  31. data/app/controllers/alchemy/admin/pages_controller.rb +37 -114
  32. data/app/controllers/alchemy/admin/pictures_controller.rb +5 -12
  33. data/app/controllers/alchemy/admin/resources_controller.rb +3 -1
  34. data/app/controllers/alchemy/admin/trash_controller.rb +1 -1
  35. data/app/controllers/alchemy/attachments_controller.rb +1 -1
  36. data/app/controllers/alchemy/base_controller.rb +3 -15
  37. data/app/controllers/alchemy/messages_controller.rb +4 -10
  38. data/app/controllers/alchemy/pages_controller.rb +6 -6
  39. data/app/controllers/alchemy/passwords_controller.rb +1 -1
  40. data/app/controllers/alchemy/user_sessions_controller.rb +1 -1
  41. data/app/helpers/alchemy/admin/base_helper.rb +49 -230
  42. data/app/helpers/alchemy/admin/contents_helper.rb +5 -1
  43. data/app/helpers/alchemy/admin/elements_helper.rb +19 -47
  44. data/app/helpers/alchemy/admin/essences_helper.rb +59 -17
  45. data/app/helpers/alchemy/admin/navigation_helper.rb +204 -0
  46. data/app/helpers/alchemy/admin/pages_helper.rb +22 -79
  47. data/app/helpers/alchemy/admin/pictures_helper.rb +1 -1
  48. data/app/helpers/alchemy/admin/tags_helper.rb +42 -0
  49. data/app/helpers/alchemy/base_helper.rb +0 -11
  50. data/app/helpers/alchemy/elements_helper.rb +48 -25
  51. data/app/helpers/alchemy/essences_helper.rb +0 -20
  52. data/app/helpers/alchemy/pages_helper.rb +18 -14
  53. data/app/helpers/alchemy/url_helper.rb +1 -0
  54. data/app/mailers/alchemy/messages.rb +4 -6
  55. data/app/models/alchemy/attachment.rb +3 -0
  56. data/app/models/alchemy/cell.rb +33 -35
  57. data/app/models/alchemy/content.rb +20 -111
  58. data/app/models/alchemy/content/factory.rb +188 -0
  59. data/app/models/alchemy/element.rb +51 -200
  60. data/app/models/alchemy/element/definitions.rb +52 -0
  61. data/app/models/alchemy/element/presenters.rb +87 -0
  62. data/app/models/alchemy/essence_date.rb +1 -1
  63. data/app/models/alchemy/essence_file.rb +6 -7
  64. data/app/models/alchemy/essence_picture.rb +19 -4
  65. data/app/models/alchemy/message.rb +18 -14
  66. data/app/models/alchemy/page.rb +120 -214
  67. data/app/models/alchemy/page/elements.rb +145 -36
  68. data/app/models/alchemy/page/natures.rb +90 -0
  69. data/app/models/alchemy/page/scopes.rb +93 -0
  70. data/app/models/alchemy/page/users.rb +25 -0
  71. data/app/models/alchemy/picture.rb +15 -0
  72. data/app/models/alchemy/site.rb +15 -1
  73. data/app/models/alchemy/site/layout.rb +38 -0
  74. data/app/models/alchemy/user.rb +13 -3
  75. data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +7 -7
  76. data/app/views/alchemy/admin/attachments/_file_to_assign.html.erb +8 -8
  77. data/app/views/alchemy/admin/attachments/_tag_list.html.erb +1 -16
  78. data/app/views/alchemy/admin/attachments/destroy.js.erb +1 -4
  79. data/app/views/alchemy/admin/contents/create.js.erb +1 -1
  80. data/app/views/alchemy/admin/dashboard/index.html.erb +14 -13
  81. data/app/views/alchemy/admin/elements/_element_head.html.erb +7 -7
  82. data/app/views/alchemy/admin/elements/_refresh_editor.js.erb +10 -0
  83. data/app/views/alchemy/admin/elements/create.js.erb +44 -44
  84. data/app/views/alchemy/admin/elements/fold.js.erb +22 -26
  85. data/app/views/alchemy/admin/elements/trash.js.erb +1 -1
  86. data/app/views/alchemy/admin/elements/update.js.erb +22 -25
  87. data/app/views/alchemy/admin/essence_files/assign.js.erb +8 -3
  88. data/app/views/alchemy/admin/essence_pictures/crop.html.erb +14 -12
  89. data/app/views/alchemy/admin/essence_pictures/edit.html.erb +22 -39
  90. data/app/views/alchemy/admin/pages/_page.html.erb +73 -80
  91. data/app/views/alchemy/admin/pages/destroy.js.erb +2 -2
  92. data/app/views/alchemy/admin/pages/edit.html.erb +21 -18
  93. data/app/views/alchemy/admin/pages/fold.js.erb +1 -0
  94. data/app/views/alchemy/admin/pages/info.html.erb +32 -0
  95. data/app/views/alchemy/admin/partials/_main_navigation_entry.html.erb +11 -13
  96. data/app/views/alchemy/admin/partials/_remote_search_form.html.erb +20 -20
  97. data/app/views/alchemy/admin/partials/_sub_navigation.html.erb +8 -0
  98. data/app/views/alchemy/admin/partials/_toolbar_button.html.erb +25 -0
  99. data/app/views/alchemy/admin/partials/_upload_form.html.erb +15 -15
  100. data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +39 -39
  101. data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +10 -10
  102. data/app/views/alchemy/admin/pictures/_tag_list.html.erb +1 -16
  103. data/app/views/alchemy/admin/resources/destroy.js.erb +1 -1
  104. data/app/views/alchemy/base/500.html.erb +1 -1
  105. data/app/views/alchemy/base/permission_denied.js.erb +1 -1
  106. data/app/views/alchemy/base/redirect.js.erb +1 -1
  107. data/app/views/alchemy/essences/_essence_link_editor.html.erb +1 -1
  108. data/app/views/alchemy/essences/_essence_picture_editor.html.erb +1 -1
  109. data/app/views/alchemy/essences/_essence_richtext_editor.html.erb +1 -1
  110. data/app/views/alchemy/essences/_essence_text_editor.html.erb +1 -1
  111. data/app/views/alchemy/essences/{_essence_picture_tools.html.erb → shared/_essence_picture_tools.html.erb} +5 -5
  112. data/app/views/alchemy/essences/{_linkable_essence_tools.html.erb → shared/_linkable_essence_tools.html.erb} +0 -0
  113. data/app/views/alchemy/messages/contact_form_mail.de.text.erb +12 -0
  114. data/app/views/alchemy/messages/contact_form_mail.en.text.erb +12 -0
  115. data/app/views/alchemy/notifications/reset_password_instructions.de.text.erb +1 -1
  116. data/app/views/alchemy/notifications/reset_password_instructions.en.text.erb +2 -2
  117. data/app/views/alchemy/pages/sitemap.xml.erb +3 -5
  118. data/app/views/alchemy/user_sessions/leave.html.erb +1 -1
  119. data/app/views/layouts/alchemy/admin.html.erb +4 -2
  120. data/app/views/layouts/alchemy/sitemap.xml.erb +1 -1
  121. data/bin/alchemy +7 -13
  122. data/config/alchemy/config.yml +1 -0
  123. data/config/authorization_rules.rb +2 -3
  124. data/config/initializers/dragonfly.rb +2 -0
  125. data/config/locales/alchemy.de.yml +8 -9
  126. data/config/locales/alchemy.en.yml +7 -4
  127. data/config/routes.rb +3 -0
  128. data/db/migrate/{20130214233001_alchemy_two_point_five.rb → 20130827094554_alchemy_two_point_six.rb} +29 -6
  129. data/lib/alchemy/auth/engine.rb +9 -0
  130. data/lib/alchemy/capistrano.rb +37 -12
  131. data/lib/alchemy/config.rb +48 -35
  132. data/lib/alchemy/engine.rb +35 -6
  133. data/lib/alchemy/essence.rb +25 -29
  134. data/lib/alchemy/ferret/search.rb +86 -0
  135. data/lib/alchemy/{scoped_pagination_url_helper.rb → kaminari/scoped_pagination_url_helper.rb} +0 -0
  136. data/lib/alchemy/logger.rb +3 -4
  137. data/lib/alchemy/page_layout.rb +124 -55
  138. data/lib/alchemy/resource.rb +0 -10
  139. data/lib/alchemy/resources_helper.rb +0 -5
  140. data/lib/alchemy/seeder.rb +1 -32
  141. data/lib/alchemy/shell.rb +6 -1
  142. data/lib/alchemy/tinymce.rb +41 -32
  143. data/lib/alchemy/upgrader.rb +3 -1
  144. data/lib/alchemy/upgrader/two_point_five.rb +15 -8
  145. data/lib/alchemy/upgrader/two_point_one.rb +10 -10
  146. data/lib/alchemy/upgrader/two_point_two.rb +96 -51
  147. data/lib/alchemy/version.rb +1 -1
  148. data/lib/alchemy_cms.rb +5 -46
  149. data/lib/rails/generators/alchemy/deploy_script/templates/deploy.rb.tt +1 -1
  150. data/lib/rails/generators/alchemy/devise/devise_generator.rb +9 -4
  151. data/lib/rails/generators/alchemy/essence/essence_generator.rb +7 -6
  152. data/lib/rails/generators/alchemy/essence/templates/editor.html.erb +1 -1
  153. data/lib/rails/generators/alchemy/scaffold/files/_standard.html.erb +1 -0
  154. data/lib/rails/generators/alchemy/scaffold/scaffold_generator.rb +1 -0
  155. data/lib/rails/generators/alchemy/site_layouts/site_layouts_generator.rb +23 -0
  156. data/lib/rails/generators/alchemy/site_layouts/templates/layout.html.erb +1 -0
  157. data/lib/rails/generators/alchemy/site_layouts/templates/layout.html.haml +1 -0
  158. data/lib/rails/generators/alchemy/site_layouts/templates/layout.html.slim +1 -0
  159. data/lib/rails/templates/alchemy.rb +2 -2
  160. data/lib/tasks/alchemy/db.rake +3 -1
  161. data/lib/tasks/alchemy/tidy.rake +82 -0
  162. data/lib/tasks/alchemy/upgrade.rake +2 -1
  163. data/spec/controllers/admin/attachments_controller_spec.rb +124 -0
  164. data/spec/controllers/admin/base_controller_spec.rb +35 -0
  165. data/spec/controllers/admin/clipboard_controller_spec.rb +1 -1
  166. data/spec/controllers/admin/contents_controller_spec.rb +17 -26
  167. data/spec/controllers/admin/dashboard_controller_spec.rb +121 -0
  168. data/spec/controllers/admin/elements_controller_spec.rb +1 -1
  169. data/spec/controllers/admin/essence_files_controller_spec.rb +67 -0
  170. data/spec/controllers/admin/essence_pictures_controller_spec.rb +161 -0
  171. data/spec/controllers/admin/languages_controller_spec.rb +1 -1
  172. data/spec/controllers/admin/layoutpages_controller_spec.rb +28 -0
  173. data/spec/controllers/admin/pages_controller_spec.rb +164 -118
  174. data/spec/controllers/admin/pictures_controller_spec.rb +89 -0
  175. data/spec/controllers/admin/trash_controller_spec.rb +21 -31
  176. data/spec/controllers/admin/users_controller_spec.rb +114 -85
  177. data/spec/controllers/attachments_controller_spec.rb +6 -2
  178. data/spec/controllers/base_controller_spec.rb +22 -0
  179. data/spec/controllers/elements_controller_spec.rb +1 -1
  180. data/spec/controllers/messages_controller_spec.rb +200 -0
  181. data/spec/controllers/pictures_controller_spec.rb +1 -1
  182. data/spec/controllers/user_sessions_controller_spec.rb +7 -6
  183. data/spec/controllers/users_controller_spec.rb +2 -2
  184. data/spec/dummy/config/alchemy/cells.yml +2 -0
  185. data/spec/dummy/config/application.rb +19 -8
  186. data/spec/dummy/db/migrate/{20130214233001_alchemy_two_point_five.rb → 20130827094554_alchemy_two_point_six.rb} +29 -6
  187. data/spec/dummy/db/schema.rb +1 -1
  188. data/spec/fast_specs.rb +15 -0
  189. data/spec/helpers/admin/base_helper_spec.rb +53 -34
  190. data/spec/helpers/admin/contents_helper_spec.rb +15 -7
  191. data/spec/helpers/admin/elements_helper_spec.rb +79 -34
  192. data/spec/helpers/admin/essences_helper_spec.rb +45 -31
  193. data/spec/helpers/admin/navigation_helper_spec.rb +204 -0
  194. data/spec/helpers/admin/pages_helper_spec.rb +25 -15
  195. data/spec/helpers/admin/tags_helper_spec.rb +62 -2
  196. data/spec/helpers/elements_helper_spec.rb +202 -138
  197. data/spec/helpers/pages_helper_spec.rb +48 -0
  198. data/spec/helpers/url_helper_spec.rb +7 -0
  199. data/spec/libraries/config_spec.rb +110 -3
  200. data/spec/libraries/essence_spec.rb +29 -9
  201. data/spec/libraries/page_layout_spec.rb +134 -0
  202. data/spec/libraries/resource_spec.rb +3 -16
  203. data/spec/libraries/resources_helper_spec.rb +4 -8
  204. data/spec/libraries/shell_spec.rb +1 -0
  205. data/spec/libraries/tinymce_spec.rb +61 -0
  206. data/spec/mailers/messages_spec.rb +23 -0
  207. data/spec/models/attachment_spec.rb +45 -0
  208. data/spec/models/cell_spec.rb +62 -9
  209. data/spec/models/content_spec.rb +110 -28
  210. data/spec/models/element_spec.rb +275 -253
  211. data/spec/models/essence_date_spec.rb +25 -0
  212. data/spec/models/essence_file_spec.rb +23 -0
  213. data/spec/models/essence_html_spec.rb +13 -0
  214. data/spec/models/essence_picture_spec.rb +16 -0
  215. data/spec/models/essence_text_spec.rb +29 -0
  216. data/spec/models/language_spec.rb +34 -0
  217. data/spec/models/message_spec.rb +43 -0
  218. data/spec/models/page_spec.rb +726 -567
  219. data/spec/models/picture_spec.rb +98 -0
  220. data/spec/models/site_spec.rb +60 -2
  221. data/spec/models/tag_spec.rb +31 -0
  222. data/spec/models/user_spec.rb +4 -4
  223. data/spec/spec_helper.rb +49 -58
  224. data/spec/support/alchemy/controller_helpers.rb +35 -0
  225. data/spec/support/alchemy/{specs_helpers.rb → integration_helpers.rb} +4 -8
  226. data/spec/{factories.rb → support/factories.rb} +11 -1
  227. data/vendor/assets/javascripts/jquery_plugins/jquery.ui.nestedSortable.js +2 -8
  228. metadata +166 -106
  229. data/Guardfile +0 -16
  230. data/app/assets/javascripts/alchemy/alchemy.dirty.js +0 -93
  231. data/app/assets/javascripts/alchemy/alchemy.dragndrop.js +0 -122
  232. data/app/models/alchemy/tree_node.rb +0 -4
  233. data/app/views/alchemy/admin/pages/_page_infos.html.erb +0 -3
  234. data/app/views/alchemy/admin/partials/_sub_navigation_tab.html.erb +0 -8
  235. data/app/views/alchemy/messages/contact_form_mail.text.erb +0 -12
  236. data/config/initializers/kaminari_config.rb +0 -9
  237. data/db/migrate/20130221200514_migrate_attachments_to_dragonfly.rb +0 -21
  238. data/db/migrate/20130312205327_change_alchemy_users_role_to_roles.rb +0 -11
  239. data/lib/alchemy/auth_engine.rb +0 -7
  240. data/lib/alchemy/authentication_helpers.rb +0 -9
  241. data/lib/alchemy/ferret_search.rb +0 -84
  242. data/lib/extensions/array.rb +0 -25
  243. data/lib/extensions/hash.rb +0 -34
  244. data/spec/dummy/db/migrate/20130221200514_migrate_attachments_to_dragonfly.rb +0 -21
  245. data/spec/dummy/db/migrate/20130312205327_change_alchemy_users_role_to_roles.rb +0 -11
  246. data/spec/models/page_layout_spec.rb +0 -60
@@ -1,25 +1,22 @@
1
- var $el = $('#element_<%= @element.id %>');
2
- <% if @element_validated %>
3
-
4
- $('div.element_handle span.icon', $el).removeClass('element_<%= @element.public? ? "draft" : "public" %>').addClass('element_<%= @element.public? ? "public" : "draft" %>');
5
- $('.element_heading .preview_text_element_name', $el).html('<%= @element.display_name %>');
6
- $('.element_heading .preview_text_quote', $el).html('<%= escape_javascript(@element.preview_text) %>');
7
- $('div.content_editor').removeClass('validation_failed');
8
- $("#element_<%= @element.id %>_errors").hide();
9
- Alchemy.setElementSaved($el);
10
- Alchemy.growl('<%= _t(:element_saved) %>');
11
- Alchemy.PreviewWindow.refresh();
12
-
13
- <%=raw update_elements_with_essence_selects(@page, @element) %>
14
-
15
- <% else %>
16
-
17
- Alchemy.growl('<%= escape_javascript(@notice) %>', 'warn');
18
- $('#element_<%= @element.id %>_errors').html('<%= @error_message %><ul><li><%= @element.essence_error_messages.join("</li><li>").html_safe %></li></ul>');
19
- $("#element_<%= @element.id %>_errors").show();
20
- $('div.content_editor').removeClass('validation_failed');
21
- $('<%= @element.contents_with_errors.map { |content| "#" + content_dom_id(content) }.join(", ") %>').addClass('validation_failed');
22
- Alchemy.ElementEditors.scrollToElement('#element_<%= @element.id %>');
23
- Alchemy.Buttons.enable($el);
24
-
25
- <% end %>
1
+ (function() {
2
+ var $el = $('#element_<%= @element.id %>');
3
+ <%- if @element_validated -%>
4
+ $('div.element_handle span.icon', $el).removeClass('element_<%= @element.public? ? "draft" : "public" %>').addClass('element_<%= @element.public? ? "public" : "draft" %>');
5
+ $('.element_heading .preview_text_element_name', $el).html('<%= @element.display_name %>');
6
+ $('.element_heading .preview_text_quote', $el).html('<%= escape_javascript(@element.preview_text) %>');
7
+ $('div.content_editor').removeClass('validation_failed');
8
+ $("#element_<%= @element.id %>_errors").hide();
9
+ Alchemy.setElementSaved($el);
10
+ Alchemy.growl('<%= _t(:element_saved) %>');
11
+ Alchemy.PreviewWindow.refresh();
12
+ <%= update_essence_select_elements(@page, @element) -%>
13
+ <%- else -%>
14
+ Alchemy.growl('<%= escape_javascript(@notice) %>', 'warn');
15
+ $('#element_<%= @element.id %>_errors').html('<%= escape_javascript(@error_message) %><ul><li><%= escape_javascript(@element.essence_error_messages.join("</li><li>").html_safe) %></li></ul>');
16
+ $("#element_<%= @element.id %>_errors").show();
17
+ $('div.content_editor').removeClass('validation_failed');
18
+ $('<%= @element.contents_with_errors.map { |content| "#" + content_dom_id(content) }.join(", ") %>').addClass('validation_failed');
19
+ Alchemy.ElementEditors.scrollToElement('#element_<%= @element.id %>');
20
+ Alchemy.Buttons.enable($el);
21
+ <%- end -%>
22
+ })();
@@ -1,10 +1,15 @@
1
1
  (function($) {
2
-
3
2
  var $el = $('#element_<%= @content.element.id %>');
4
- $('#<%= content_dom_id(@content) %>').replaceWith('<%= escape_javascript(render(:partial => "alchemy/essences/essence_file_editor", :formats => [:html], :locals => {:content => @content, :options => @options})) %>');
3
+ $('#<%= content_dom_id(@content) %>').replaceWith('<%= escape_javascript(
4
+ render partial: "alchemy/essences/essence_file_editor",
5
+ formats: [:html],
6
+ locals: {
7
+ content: @content,
8
+ options: @options
9
+ }
10
+ ) %>');
5
11
  Alchemy.closeCurrentWindow();
6
12
  Alchemy.reloadPreview();
7
13
  Alchemy.setElementDirty($el);
8
14
  Alchemy.overlayObserver($el);
9
-
10
15
  })(jQuery);
@@ -1,6 +1,6 @@
1
1
  <div id="jscropper">
2
2
  <% if @no_image_notice %>
3
- <%= render_message do %>
3
+ <%= render_message :warn do %>
4
4
  <%= @no_image_notice %>
5
5
  <% end %>
6
6
  <% else %>
@@ -9,27 +9,28 @@
9
9
  <% end %>
10
10
  <div class="thumbnail_background">
11
11
  <%= image_tag(
12
- show_alchemy_picture_path(@essence_picture.picture, :size => '800x600', :format => :png),
13
- :id => 'imageToCrop'
12
+ show_alchemy_picture_path(@picture, size: '800x600', format: 'png'),
13
+ id: 'imageToCrop'
14
14
  ) %>
15
15
  </div>
16
16
  <%= form_for(
17
17
  @essence_picture,
18
- :url => alchemy.admin_essence_picture_path(@essence_picture, :options => @options),
19
- :id => 'image_cropper_form',
20
- :remote => true
18
+ url: alchemy.admin_essence_picture_path(@essence_picture, options: @options.to_json),
19
+ id: 'image_cropper_form',
20
+ remote: true
21
21
  ) do |f| %>
22
22
  <%= f.hidden_field :crop_from %>
23
23
  <%= f.hidden_field :crop_size %>
24
24
  <%= hidden_field_tag :content_id, @content.id %>
25
25
  <%= link_to(render_icon('delete-small') + _t('Reset Imagemask'), '#', {
26
- :onclick => 'Alchemy.ImageCropper.reset()',
27
- :class => 'button with_icon'
26
+ onclick: 'Alchemy.ImageCropper.reset()',
27
+ class: 'button with_icon'
28
28
  }) %>
29
- <%= f.button _t(:apply), :class => 'button' %>
29
+ <%= f.button _t(:apply), class: 'button' %>
30
30
  <% end %>
31
- <% end %>
32
31
  </div>
32
+ <% end %>
33
+ <% if @initial_box && @default_box %>
33
34
  <script type="text/javascript">
34
35
  Alchemy.ImageLoader('#jscropper .thumbnail_background');
35
36
  $('#imageToCrop').load(function() {
@@ -39,7 +40,8 @@
39
40
  <%= @size_y %>,
40
41
  [<%= @default_box[:x1] %>, <%= @default_box[:y1] %>, <%= @default_box[:x2] %>, <%= @default_box[:y2] %>],
41
42
  <%= @ratio %>,
42
- [<%= @essence_picture.picture.image_file_width %>, <%= @essence_picture.picture.image_file_height %>]
43
+ [<%= @picture.image_file_width %>, <%= @picture.image_file_height %>]
43
44
  );
44
45
  });
45
- </script>
46
+ </script>
47
+ <% end %>
@@ -1,84 +1,67 @@
1
1
  <%= form_for(
2
2
  @essence_picture,
3
- :url => alchemy.admin_essence_picture_path(@essence_picture, :options => @options),
4
- :remote => true
3
+ url: alchemy.admin_essence_picture_path(@essence_picture, options: @options.to_json),
4
+ remote: true
5
5
  ) do |f| %>
6
6
  <table>
7
7
  <tr>
8
8
  <td class="label"><%= f.label "caption" %></td>
9
9
  <td class="input">
10
10
  <%- if @options[:caption_as_textarea] == 'true' -%>
11
- <%= f.text_area "caption", :class => 'thin_border' %>
11
+ <%= f.text_area "caption", class: 'thin_border' %>
12
12
  <%- else -%>
13
- <%= f.text_field "caption", :class => 'thin_border' %>
13
+ <%= f.text_field "caption", class: 'thin_border' %>
14
14
  <%- end -%>
15
15
  </td>
16
16
  </tr>
17
17
  <tr>
18
18
  <td class="label"><%= f.label "title" %></td>
19
- <td class="input"><%= f.text_field "title", :class => 'thin_border' %></td>
19
+ <td class="input"><%= f.text_field "title", class: 'thin_border' %></td>
20
20
  </tr>
21
21
  <tr>
22
22
  <td class="label"><%= f.label "alt_tag" %></td>
23
- <td class="input"><%= f.text_field "alt_tag", :class => 'thin_border' %></td>
23
+ <td class="input"><%= f.text_field "alt_tag", class: 'thin_border' %></td>
24
24
  </tr>
25
- <%# Have to use a Hash here, because Rails has a Hash.to_params bug with nested Arrays!!!! %>
26
- <%- if @options[:sizes].is_a?(HashWithIndifferentAccess) -%>
25
+ <%- if @options[:sizes].present? -%>
27
26
  <tr>
28
27
  <td class="label"><%= f.label "render_size" %></td>
29
28
  <td class="select">
30
- <%= f.select(
31
- "render_size",
32
- options_for_select(
33
- [[_t('Layout default'), @options[:image_size]]] + @options[:sizes].sort,
34
- @essence_picture.render_size
35
- ), :class => 'alchemy_selectbox'
29
+ <%= f.select(:render_size,
30
+ [[_t('Layout default'), @options[:image_size]]] + @options[:sizes].to_a,
31
+ {}, {class: 'alchemy_selectbox'}
36
32
  ) %>
37
33
  </td>
38
34
  </tr>
39
- <%- elsif @options[:sizes] && !@options[:sizes].is_a?(HashWithIndifferentAccess) -%>
40
- <tr>
41
- <td colspan="2">
42
- <%= warning("Did not passed a Hash as sizes option", "Sizes Selector Error. Please provide a Hash.") %>
43
- </td>
44
- </tr>
45
35
  <%- end -%>
46
- <%- if @options[:image_float_selector] == 'true' -%>
36
+ <%- if @options[:image_float_selector] -%>
47
37
  <tr>
48
38
  <td class="label"><%= f.label "css_class" %></td>
49
39
  <td class="select">
50
- <%= f.select(
51
- "css_class",
52
- [[_t("Layout default"), ""], [_t(:above), "no_float"], [_t(:left), "left"], [_t(:right), "right"]],
53
- {},
54
- {:class => 'alchemy_selectbox'}
40
+ <%= f.select(:css_class, [
41
+ [_t("Layout default"), ""],
42
+ [_t(:above), "no_float"],
43
+ [_t(:left), "left"],
44
+ [_t(:right), "right"]
45
+ ], {}, {class: 'alchemy_selectbox'}
55
46
  ) %>
56
47
  </td>
57
48
  </tr>
58
- <%# Have to use a Hash here, because Rails has a Hash.to_params bug with nested Arrays!!!! %>
59
- <%- elsif @options[:css_classes].is_a?(HashWithIndifferentAccess) -%>
49
+ <%- elsif @options[:css_classes].present? -%>
60
50
  <tr>
61
51
  <td class="label"><%= f.label "css_class" %></td>
62
52
  <td class="select">
63
- <%= f.select(
64
- "css_class",
65
- options_for_select([[_t('None'), '']] + @options[:css_classes].sort, @essence_picture.css_class),
53
+ <%= f.select(:css_class,
54
+ [[_t('None'), '']] + @options[:css_classes].to_a,
66
55
  {},
67
- {:class => 'alchemy_selectbox'}
56
+ {class: 'alchemy_selectbox'}
68
57
  ) %>
69
58
  </td>
70
59
  </tr>
71
- <%- elsif @options[:css_classes] && !@options[:css_classes].is_a?(HashWithIndifferentAccess) -%>
72
- <tr>
73
- <td colspan="2">
74
- <%= warning("Did not passed a Hash as css_classes option", "CSS Class Selector Error. Please provide a Hash.") %>
75
- </td>
76
- </tr>
77
60
  <%- end -%>
78
61
  <tr>
79
62
  <td colspan="2" class="submit">
80
63
  <%= hidden_field_tag 'content_id', @content.id %>
81
- <%= f.button _t(:apply), :class => 'button' %>
64
+ <%= f.button _t(:apply), class: 'button' %>
82
65
  </td>
83
66
  </tr>
84
67
  </table>
@@ -1,91 +1,85 @@
1
- <li id="page_<%= page.id %>" class="page_level_<%= "#{page.level} #{page.page_layout}" %>" data-slug="<%= page.slug %>" data-restricted="<%= page.restricted? %>" data-visible="<%= page.visible? %>" data-external="<%= page.redirects_to_external? %>">
1
+ <li id="page_<%= page.id %>" class="page_level_<%= "#{page.level} #{page.page_layout}" %>">
2
2
  <div class="sitemap_page<%= page.locked ? ' locked' : '' %>" name="<%= page.name %>">
3
3
  <div class="sitemap_left_images">
4
- <%= sitemapFolderLink(page) unless page.children.blank? || @sorting %>
5
- <div class="site_status <%= @sorting && page.level > 1 ? 'handle' : nil %>">
6
- <div class="tooltip">
7
- <h3><%= _t(:page_type) %>:</h3>
8
- <p><%= page.layout_display_name %></p>
9
- <h3><%= _t(:page_status) %>:</h3>
10
- <p><%= combined_page_status(page) %></p>
11
- <h3><%= _t(:created_at) %>:</h3>
12
- <p><%= l(page.created_at) %></p>
13
- <h3><%= _t(:created_by) %>:</h3>
14
- <p><%= page.creator %></p>
15
- <h3><%= _t(:updated_at) %>:</h3>
16
- <p><%= l(page.updated_at) %></p>
17
- <h3><%= _t(:updated_by) %>:</h3>
18
- <p><%= page.updater %></p>
19
- <%- if page.locked? -%>
20
- <h3><%= _t(:currently_edited_by) %>:</h3>
21
- <p><%= page.current_editor %></p>
22
- <%- end -%>
23
- </div>
24
- </div>
4
+ <%= sitemap_folder_link(page) unless page.level == 1 || page.children.blank? || @sorting %>
5
+ <div class="site_status <%= @sorting && page.level > 1 ? 'handle' : nil %>"></div>
25
6
  </div>
26
7
  <div class="sitemap_right_tools">
27
8
  <%- unless @sorting -%>
28
- <%- permitted_to?(:configure, :alchemy_admin_pages) do -%>
29
- <%= link_to_overlay_window(
30
- render_icon('configure_page'),
31
- alchemy.configure_admin_page_path(page),
32
- {
33
- :title => _t(:edit_page_properties),
34
- :size => page.redirects_to_external? ? '410x270' : '410x655'
35
- },
36
- :class => '',
37
- :title => _t(:edit_page_properties)
38
- ) -%>
39
- <%- end -%>
40
- <%- permitted_to?([:new, :destroy, :copy], :alchemy_admin_pages) do -%>
41
- <span class="sitemap_sitetools">
42
- <%- permitted_to?(:copy, :alchemy_admin_pages) do -%>
43
- <%= link_to(
44
- render_icon("copy_page"),
45
- alchemy.insert_admin_clipboard_path(
46
- :remarkable_type => page.class.name.demodulize.underscore.pluralize,
47
- :remarkable_id => page.id
48
- ),
49
- :remote => true,
50
- :method => :post,
51
- :class => "",
52
- :title => _t(:copy_page)
53
- ) %>
9
+ <%- permitted_to?(:info, :alchemy_admin_pages) do -%>
10
+ <%= link_to_overlay_window(
11
+ render_icon('info'),
12
+ alchemy.info_admin_page_path(page),
13
+ {
14
+ title: _t(:page_infos),
15
+ size: '460x320'
16
+ },
17
+ {
18
+ title: _t(:page_infos)
19
+ }
20
+ ) %>
54
21
  <%- end -%>
55
- <%- permitted_to?(:destroy, :alchemy_admin_pages) do -%>
56
- <%= link_to_confirmation_window(
57
- render_icon('delete_page'),
58
- _t(:confirm_to_delete_page),
59
- url_for(
60
- :controller => 'pages',
61
- :action => 'destroy',
62
- :id => page.id
63
- ),
64
- {
65
- :class => "",
66
- :title => _t(:delete_page)
67
- }
68
- ) -%>
22
+ <%- permitted_to?(:configure, :alchemy_admin_pages) do -%>
23
+ <%= link_to_overlay_window(
24
+ render_icon('configure_page'),
25
+ alchemy.configure_admin_page_path(page),
26
+ {
27
+ :title => _t(:edit_page_properties),
28
+ :size => page.redirects_to_external? ? '410x270' : '410x655'
29
+ },
30
+ :title => _t(:edit_page_properties)
31
+ ) -%>
69
32
  <%- end -%>
70
- <%- permitted_to?(:new, :alchemy_admin_pages) do -%>
71
- <%= link_to_overlay_window(
72
- render_icon('add_page'),
73
- alchemy.new_admin_page_path(:parent_id => page.id),
74
- {
75
- :title => _t(:create_page),
76
- :size => '340x150',
77
- :overflow => true
78
- },
79
- :class => '',
80
- :title => _t(:create_page)
81
- ) -%>
33
+ <%- permitted_to?([:new, :destroy, :copy], :alchemy_admin_pages) do -%>
34
+ <span class="sitemap_sitetools">
35
+ <%- permitted_to?(:copy, :alchemy_admin_pages) do -%>
36
+ <%= link_to(
37
+ render_icon("copy_page"),
38
+ alchemy.insert_admin_clipboard_path(
39
+ :remarkable_type => page.class.name.demodulize.underscore.pluralize,
40
+ :remarkable_id => page.id
41
+ ),
42
+ :remote => true,
43
+ :method => :post,
44
+ :title => _t(:copy_page)
45
+ ) %>
46
+ <%- end -%>
47
+ <%- permitted_to?(:destroy, :alchemy_admin_pages) do -%>
48
+ <%= link_to_confirmation_window(
49
+ render_icon('delete_page'),
50
+ _t(:confirm_to_delete_page),
51
+ url_for(
52
+ :controller => 'pages',
53
+ :action => 'destroy',
54
+ :id => page.id
55
+ ),
56
+ {
57
+ :title => _t(:delete_page)
58
+ }
59
+ ) -%>
60
+ <%- end -%>
61
+ <%- permitted_to?(:new, :alchemy_admin_pages) do -%>
62
+ <%= link_to_overlay_window(
63
+ render_icon('add_page'),
64
+ alchemy.new_admin_page_path(:parent_id => page.id),
65
+ {
66
+ :title => _t(:create_page),
67
+ :size => '340x150',
68
+ :overflow => true
69
+ },
70
+ {
71
+ :title => _t(:create_page)
72
+ }
73
+ ) -%>
74
+ <%- end -%>
75
+ </span>
82
76
  <%- end -%>
83
- </span>
84
- <%- end -%>
85
77
  <%- end -%>
86
78
  </div>
87
79
  <div class="page_infos" id="page_<%= page.id %>_infos">
88
- <%= render :partial => 'page_infos', :locals => {:page => page} %>
80
+ <span class="page_status <%= page.public ? 'public' : 'not_public' %>" title="<%= page.status_title(:public) %>"></span>
81
+ <span class="page_status <%= page.visible ? 'visible' : 'not_visible' %>" title="<%= page.status_title(:visible) %>"></span>
82
+ <span class="page_status <%= page.restricted ? 'restricted' : 'not_restricted' %>" title="<%= page.status_title(:restricted) %>"></span>
89
83
  </div>
90
84
  <div class="sitemap_sitename">
91
85
  <%- if page.redirects_to_external? -%>
@@ -95,14 +89,13 @@
95
89
  <%= h page.urlname %>
96
90
  </span>
97
91
  <%- else -%>
98
- <%- cycle_class = cycle('even', 'odd') -%>
99
92
  <%= link_to_unless(
100
93
  @sorting,
101
94
  page.name,
102
95
  alchemy.edit_admin_page_path(page),
103
96
  :title => _t(:edit_page),
104
- :class => "sitemap_pagename_link #{cycle_class}"
105
- ) { content_tag('span', page.name, :class => "sitemap_pagename_link #{cycle_class}") } -%>
97
+ :class => "sitemap_pagename_link"
98
+ ) { content_tag('span', page.name, :class => "sitemap_pagename_link") } -%>
106
99
  <%- end -%>
107
100
  </div>
108
101
  </div>
@@ -2,7 +2,7 @@ $('#locked_page_<%= @page_id -%>').remove();
2
2
 
3
3
  <% if @layoutpage %>
4
4
 
5
- window.location.replace('<%= alchemy.admin_layoutpages_path -%>');
5
+ window.location.href = '<%= alchemy.admin_layoutpages_path -%>';
6
6
 
7
7
  <% elsif @page_root %>
8
8
 
@@ -12,7 +12,7 @@ Alchemy.overlayObserver('#sitemap');
12
12
 
13
13
  <% else %>
14
14
 
15
- window.location.replace('<%= alchemy.admin_pages_path -%>');
15
+ window.location.href = '<%= alchemy.admin_pages_path -%>';
16
16
 
17
17
  <% end %>
18
18
 
@@ -42,6 +42,22 @@
42
42
  <% end %>
43
43
  </div>
44
44
  <% end %>
45
+ <div class="button_with_label">
46
+ <%= link_to_overlay_window(
47
+ render_icon('info'),
48
+ alchemy.info_admin_page_path(@page),
49
+ {
50
+ title: _t(:page_infos),
51
+ size: '460x320'
52
+ },
53
+ {
54
+ class: 'icon_button',
55
+ title: _t(:page_infos),
56
+ 'data-alchemy-hotkey' => 'alt-i'
57
+ }
58
+ ) %>
59
+ <label><%= _t(:page_infos) %></label>
60
+ </div>
45
61
  <div class="button_with_label">
46
62
  <%= link_to_overlay_window(
47
63
  render_icon('settings'),
@@ -92,7 +108,6 @@
92
108
  <% end %>
93
109
 
94
110
  <% content_for :javascripts do %>
95
- <%= tinymce_javascript_tags %>
96
111
  <script type="text/javascript" charset="utf-8">
97
112
 
98
113
  Alchemy.openPreviewWindow = function() {
@@ -150,16 +165,10 @@
150
165
  Alchemy.SortableElements(<%= @page.id %>, '<%= form_authenticity_token %>');
151
166
  Alchemy.ElementEditors.init();
152
167
  Alchemy.SelectBox('.element_editor');
153
- Alchemy.Tinymce.init(function() {
154
- Alchemy.ElementDirtyObserver('#element_area');
155
- });
156
- if (Alchemy.Tinymce.customInits) {
157
- for (var i = Alchemy.Tinymce.customInits.length - 1; i >= 0; i--) {
158
- Alchemy.Tinymce.customInits[i].call();
159
- }
160
- }
168
+ Alchemy.Tinymce.init();
169
+ Alchemy.Tinymce.initCustomEditors(<%= raw @page.custom_tinymce_contents_selectors.to_json %>);
161
170
  jQuery('#cells').tabs().tabs('paging', { follow: true, followOnSelect: true } );
162
-
171
+ Alchemy.ElementDirtyObserver('#element_area');
163
172
  if (window.location.hash) {
164
173
  $(window.location.hash).trigger('Alchemy.SelectElementEditor');
165
174
  }
@@ -167,18 +176,12 @@
167
176
  }
168
177
 
169
178
  jQuery(function($) {
170
- var texts = {
171
- title: '<%= _t("Warning!") %>',
172
- message: '<%= _t(:element_dirty_page_leave_warning) %>',
173
- okLabel: '<%= _t("Yes") %>',
174
- cancelLabel: '<%= _t("No") %>'
175
- };
176
179
  $('#unlock_page_form, #visit_page_form, #publish_page_form').on('submit', function(event) {
177
- var not_dirty = Alchemy.checkPageDirtyness(this, texts);
180
+ var not_dirty = Alchemy.checkPageDirtyness(this);
178
181
  if (!not_dirty) Alchemy.pleaseWaitOverlay(false);
179
182
  return not_dirty;
180
183
  });
181
- Alchemy.PageLeaveObserver(texts);
184
+ Alchemy.PageLeaveObserver();
182
185
  Alchemy.openElementsWindow();
183
186
  Alchemy.openPreviewWindow();
184
187