alchemy_cms 3.4.2 → 3.5.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (247) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +9 -3
  3. data/.teatro.yml +1 -0
  4. data/.travis.yml +14 -17
  5. data/CHANGELOG.md +44 -6
  6. data/Gemfile +7 -4
  7. data/README.md +60 -10
  8. data/Rakefile +1 -1
  9. data/alchemy_cms.gemspec +5 -8
  10. data/app/assets/javascripts/alchemy/admin.js +2 -0
  11. data/app/assets/javascripts/alchemy/alchemy.dialog.js.coffee +1 -0
  12. data/app/assets/javascripts/alchemy/alchemy.gui.js.coffee +1 -0
  13. data/app/assets/javascripts/alchemy/alchemy.hotkeys.js.coffee +1 -1
  14. data/app/assets/javascripts/alchemy/alchemy.initializer.js.coffee +9 -7
  15. data/app/assets/javascripts/alchemy/alchemy.link_dialog.js.coffee +1 -0
  16. data/app/assets/javascripts/alchemy/alchemy.preview_window.js.coffee +11 -7
  17. data/app/assets/javascripts/alchemy/alchemy.sitemap.js.coffee +1 -1
  18. data/app/assets/javascripts/alchemy/alchemy.tinymce.js.coffee +8 -3
  19. data/app/assets/javascripts/alchemy/alchemy.tooltips.coffee +10 -0
  20. data/app/assets/javascripts/alchemy/alchemy.uploader.js.coffee +104 -73
  21. data/app/assets/stylesheets/alchemy/_defaults.scss +1 -4
  22. data/app/assets/stylesheets/alchemy/_extends.scss +13 -35
  23. data/app/assets/stylesheets/alchemy/_mixins.scss +82 -18
  24. data/app/assets/stylesheets/alchemy/_variables.scss +21 -8
  25. data/app/assets/stylesheets/alchemy/admin.scss +4 -0
  26. data/app/assets/stylesheets/alchemy/archive.scss +8 -12
  27. data/app/assets/stylesheets/alchemy/attachments.scss +39 -0
  28. data/app/assets/stylesheets/alchemy/base.scss +26 -15
  29. data/app/assets/stylesheets/alchemy/buttons.scss +59 -31
  30. data/app/assets/stylesheets/alchemy/dashboard.scss +3 -3
  31. data/app/assets/stylesheets/alchemy/dialogs.scss +10 -8
  32. data/app/assets/stylesheets/alchemy/elements.scss +65 -41
  33. data/app/assets/stylesheets/alchemy/errors.scss +7 -0
  34. data/app/assets/stylesheets/alchemy/flash.scss +1 -1
  35. data/app/assets/stylesheets/alchemy/form_fields.scss +0 -37
  36. data/app/assets/stylesheets/alchemy/forms.scss +18 -27
  37. data/app/assets/stylesheets/alchemy/frame.scss +104 -204
  38. data/app/assets/stylesheets/alchemy/hints.scss +62 -0
  39. data/app/assets/stylesheets/alchemy/icon-font.scss +2 -1
  40. data/app/assets/stylesheets/alchemy/icons.scss +9 -4
  41. data/app/assets/stylesheets/alchemy/image_library.scss +6 -6
  42. data/app/assets/stylesheets/alchemy/jquery-ui.scss +6 -4
  43. data/app/assets/stylesheets/alchemy/lists.scss +0 -1
  44. data/app/assets/stylesheets/alchemy/menubar.scss +3 -4
  45. data/app/assets/stylesheets/alchemy/modules.scss +0 -6
  46. data/app/assets/stylesheets/alchemy/navigation.scss +242 -0
  47. data/app/assets/stylesheets/alchemy/pagination.scss +3 -3
  48. data/app/assets/stylesheets/alchemy/print.scss +1 -0
  49. data/app/assets/stylesheets/alchemy/resource_info.scss +45 -0
  50. data/app/assets/stylesheets/alchemy/search.scss +72 -1
  51. data/app/assets/stylesheets/alchemy/selects.scss +38 -44
  52. data/app/assets/stylesheets/alchemy/sitemap.scss +89 -79
  53. data/app/assets/stylesheets/alchemy/tables.scss +6 -10
  54. data/app/assets/stylesheets/alchemy/toolbar.scss +7 -36
  55. data/app/assets/stylesheets/alchemy/upload.scss +12 -3
  56. data/app/assets/stylesheets/tinymce/skins/alchemy/content.min.css.scss +6 -3
  57. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.svg +58 -170
  58. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.ttf +0 -0
  59. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.woff +0 -0
  60. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.svg +124 -148
  61. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.ttf +0 -0
  62. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.woff +0 -0
  63. data/app/assets/stylesheets/tinymce/skins/alchemy/skin.min.css.scss +426 -144
  64. data/app/controllers/alchemy/admin/attachments_controller.rb +24 -16
  65. data/app/controllers/alchemy/admin/clipboard_controller.rb +1 -1
  66. data/app/controllers/alchemy/admin/essence_files_controller.rb +1 -1
  67. data/app/controllers/alchemy/admin/essence_pictures_controller.rb +9 -8
  68. data/app/controllers/alchemy/admin/layoutpages_controller.rb +1 -0
  69. data/app/controllers/alchemy/admin/pages_controller.rb +2 -2
  70. data/app/controllers/alchemy/admin/resources_controller.rb +2 -2
  71. data/app/controllers/alchemy/admin/tags_controller.rb +1 -1
  72. data/app/controllers/alchemy/api/pages_controller.rb +16 -0
  73. data/app/controllers/alchemy/messages_controller.rb +1 -1
  74. data/app/controllers/concerns/alchemy/admin/uploader_responses.rb +2 -2
  75. data/app/helpers/alchemy/admin/attachments_helper.rb +11 -0
  76. data/app/helpers/alchemy/admin/base_helper.rb +37 -4
  77. data/app/helpers/alchemy/admin/contents_helper.rb +11 -4
  78. data/app/helpers/alchemy/admin/elements_helper.rb +0 -19
  79. data/app/helpers/alchemy/admin/essences_helper.rb +7 -30
  80. data/app/helpers/alchemy/admin/navigation_helper.rb +13 -51
  81. data/app/helpers/alchemy/admin/pages_helper.rb +21 -16
  82. data/app/helpers/alchemy/admin/pictures_helper.rb +9 -0
  83. data/app/helpers/alchemy/deprecated_pages_helper.rb +54 -0
  84. data/app/helpers/alchemy/essences_helper.rb +1 -1
  85. data/app/helpers/alchemy/pages_helper.rb +8 -109
  86. data/app/helpers/alchemy/url_helper.rb +8 -13
  87. data/app/models/alchemy/attachment.rb +7 -4
  88. data/app/models/alchemy/cell.rb +2 -2
  89. data/app/models/alchemy/content.rb +2 -2
  90. data/app/models/alchemy/content/factory.rb +12 -9
  91. data/app/models/alchemy/element.rb +6 -3
  92. data/app/models/alchemy/essence_file.rb +1 -1
  93. data/app/models/alchemy/essence_picture.rb +37 -47
  94. data/app/models/alchemy/essence_picture_view.rb +8 -1
  95. data/app/models/alchemy/folded_page.rb +3 -2
  96. data/app/models/alchemy/legacy_page_url.rb +3 -3
  97. data/app/models/alchemy/page.rb +50 -5
  98. data/app/models/alchemy/page/fixed_attributes.rb +63 -0
  99. data/app/models/alchemy/page/page_elements.rb +10 -7
  100. data/app/models/alchemy/page/page_natures.rb +19 -0
  101. data/app/models/alchemy/picture.rb +1 -0
  102. data/app/models/alchemy/picture/transformations.rb +1 -1
  103. data/app/models/alchemy/picture/url.rb +82 -0
  104. data/app/serializers/alchemy/page_tree_serializer.rb +29 -8
  105. data/app/views/alchemy/_edit_mode.html.erb +2 -0
  106. data/app/views/alchemy/_menubar.html.erb +1 -1
  107. data/app/views/alchemy/_preview_mode_code.html.erb +6 -0
  108. data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +1 -1
  109. data/app/views/alchemy/admin/attachments/_attachment.html.erb +25 -5
  110. data/app/views/alchemy/admin/attachments/_replace_button.html.erb +26 -0
  111. data/app/views/alchemy/admin/attachments/index.html.erb +1 -1
  112. data/app/views/alchemy/admin/attachments/show.html.erb +52 -0
  113. data/app/views/alchemy/admin/elements/_element_header.html.erb +6 -3
  114. data/app/views/alchemy/admin/elements/create.js.erb +0 -2
  115. data/app/views/alchemy/admin/elements/trash.js.erb +0 -1
  116. data/app/views/alchemy/admin/elements/update.js.erb +0 -2
  117. data/app/views/alchemy/admin/essence_pictures/crop.html.erb +1 -4
  118. data/app/views/alchemy/admin/essence_pictures/edit.html.erb +1 -1
  119. data/app/views/alchemy/admin/languages/index.html.erb +1 -0
  120. data/app/views/alchemy/admin/layoutpages/_layoutpage.html.erb +26 -27
  121. data/app/views/alchemy/admin/layoutpages/edit.html.erb +1 -1
  122. data/app/views/alchemy/admin/pages/_form.html.erb +13 -40
  123. data/app/views/alchemy/admin/pages/_locked_page.html.erb +1 -1
  124. data/app/views/alchemy/admin/pages/_page.html.erb +119 -61
  125. data/app/views/alchemy/admin/pages/_page_for_links.html.erb +4 -2
  126. data/app/views/alchemy/admin/pages/_page_infos.html.erb +12 -12
  127. data/app/views/alchemy/admin/pages/_page_status.html.erb +1 -1
  128. data/app/views/alchemy/admin/pages/_publication_fields.html.erb +35 -0
  129. data/app/views/alchemy/admin/pages/edit.html.erb +13 -2
  130. data/app/views/alchemy/admin/pages/index.html.erb +3 -8
  131. data/app/views/alchemy/admin/pages/info.html.erb +15 -2
  132. data/app/views/alchemy/admin/pages/sort.js.erb +1 -1
  133. data/app/views/alchemy/admin/pages/update.js.erb +1 -14
  134. data/app/views/alchemy/admin/partials/_main_navigation_entry.html.erb +12 -8
  135. data/app/views/alchemy/admin/partials/_remote_search_form.html.erb +4 -4
  136. data/app/views/alchemy/admin/partials/_search_form.html.erb +1 -1
  137. data/app/views/alchemy/admin/partials/_sub_navigation.html.erb +9 -6
  138. data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +1 -1
  139. data/app/views/alchemy/admin/pictures/_picture.html.erb +1 -6
  140. data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +1 -6
  141. data/app/views/alchemy/admin/pictures/index.html.erb +1 -1
  142. data/app/views/alchemy/admin/pictures/show.html.erb +1 -6
  143. data/app/views/alchemy/admin/uploader/_button.html.erb +4 -4
  144. data/app/views/alchemy/base/500.html.erb +15 -1
  145. data/app/views/alchemy/essences/_essence_boolean_editor.html.erb +13 -15
  146. data/app/views/alchemy/essences/_essence_boolean_view.html.erb +1 -3
  147. data/app/views/alchemy/essences/_essence_date_editor.html.erb +0 -2
  148. data/app/views/alchemy/essences/_essence_date_view.html.erb +0 -2
  149. data/app/views/alchemy/essences/_essence_file_editor.html.erb +2 -7
  150. data/app/views/alchemy/essences/_essence_file_view.html.erb +1 -3
  151. data/app/views/alchemy/essences/_essence_html_editor.html.erb +0 -2
  152. data/app/views/alchemy/essences/_essence_html_view.html.erb +1 -3
  153. data/app/views/alchemy/essences/_essence_link_editor.html.erb +0 -2
  154. data/app/views/alchemy/essences/_essence_link_view.html.erb +0 -2
  155. data/app/views/alchemy/essences/_essence_picture_editor.html.erb +47 -49
  156. data/app/views/alchemy/essences/_essence_picture_view.html.erb +1 -3
  157. data/app/views/alchemy/essences/_essence_richtext_editor.html.erb +0 -2
  158. data/app/views/alchemy/essences/_essence_richtext_view.html.erb +1 -3
  159. data/app/views/alchemy/essences/_essence_select_editor.html.erb +27 -29
  160. data/app/views/alchemy/essences/_essence_select_view.html.erb +1 -3
  161. data/app/views/alchemy/essences/_essence_text_editor.html.erb +17 -19
  162. data/app/views/alchemy/essences/_essence_text_view.html.erb +0 -2
  163. data/app/views/alchemy/pages/_meta_data.html.erb +9 -0
  164. data/app/views/layouts/alchemy/admin.html.erb +9 -11
  165. data/bin/alchemy +1 -2
  166. data/config/alchemy/config.yml +1 -1
  167. data/config/alchemy/modules.yml +0 -16
  168. data/config/initializers/dragonfly.rb +0 -18
  169. data/config/initializers/mini_profiler.rb +6 -0
  170. data/config/locales/alchemy.de.yml +9 -1
  171. data/config/locales/alchemy.en.yml +7 -1
  172. data/config/locales/alchemy.es.yml +6 -0
  173. data/config/locales/alchemy.fr.yml +2 -0
  174. data/config/locales/alchemy.it.yml +3 -1
  175. data/config/locales/alchemy.nl.yml +2 -0
  176. data/config/locales/alchemy.ru.yml +2 -0
  177. data/config/routes.rb +3 -8
  178. data/db/migrate/20160912223112_add_index_to_alchemy_pages_rgt.rb +9 -0
  179. data/db/migrate/20160927205604_add_foreign_key_indices_and_null_constraints.rb +20 -0
  180. data/db/migrate/20160928080104_add_foreign_keys.rb +27 -0
  181. data/lib/alchemy/admin/locale.rb +4 -3
  182. data/lib/alchemy/engine.rb +2 -4
  183. data/lib/alchemy/errors.rb +9 -2
  184. data/lib/alchemy/forms/builder.rb +8 -0
  185. data/lib/alchemy/modules.rb +20 -19
  186. data/lib/alchemy/permissions.rb +15 -4
  187. data/lib/alchemy/resources_helper.rb +4 -2
  188. data/lib/alchemy/sass_support.rb +9 -0
  189. data/lib/alchemy/seeder.rb +89 -1
  190. data/lib/alchemy/test_support/essence_shared_examples.rb +2 -0
  191. data/lib/alchemy/test_support/factories/attachment_factory.rb +1 -1
  192. data/lib/alchemy/test_support/factories/content_factory.rb +1 -0
  193. data/lib/alchemy/test_support/factories/element_factory.rb +1 -0
  194. data/lib/alchemy/test_support/factories/picture_factory.rb +1 -1
  195. data/lib/alchemy/test_support/fixtures/image.png +0 -0
  196. data/lib/alchemy/tinymce.rb +2 -6
  197. data/lib/alchemy/upgrader.rb +4 -55
  198. data/lib/alchemy/upgrader/tasks/install_dragonfly_config.rb +14 -0
  199. data/lib/alchemy/upgrader/three_point_five.rb +32 -0
  200. data/lib/alchemy/upgrader/three_point_four.rb +2 -8
  201. data/lib/alchemy/upgrader/three_point_one.rb +30 -30
  202. data/lib/alchemy/upgrader/three_point_three.rb +31 -31
  203. data/lib/alchemy/upgrader/three_point_two.rb +25 -25
  204. data/lib/alchemy/upgrader/three_point_zero.rb +59 -59
  205. data/lib/alchemy/version.rb +1 -1
  206. data/lib/rails/generators/alchemy/elements/templates/view.html.erb +1 -1
  207. data/lib/rails/generators/alchemy/elements/templates/view.html.haml +1 -1
  208. data/lib/rails/generators/alchemy/elements/templates/view.html.slim +1 -1
  209. data/lib/rails/generators/alchemy/essence/templates/editor.html.erb +1 -3
  210. data/lib/rails/generators/alchemy/install/files/_article_view.html.erb +1 -1
  211. data/lib/rails/generators/alchemy/install/files/application.html.erb +3 -4
  212. data/lib/rails/generators/alchemy/install/install_generator.rb +4 -0
  213. data/lib/rails/generators/alchemy/install/templates/dragonfly.rb.tt +35 -0
  214. data/lib/rails/generators/alchemy/module/module_generator.rb +1 -1
  215. data/lib/tasks/alchemy/db.rake +6 -0
  216. data/lib/tasks/alchemy/tidy.rake +85 -0
  217. data/lib/tasks/alchemy/upgrade.rake +165 -16
  218. data/vendor/assets/javascripts/clipboard.min.js +7 -0
  219. data/vendor/assets/javascripts/fileupload/jquery.fileupload-process.js +4 -4
  220. data/vendor/assets/javascripts/fileupload/jquery.fileupload-validate.js +2 -2
  221. data/vendor/assets/javascripts/fileupload/jquery.fileupload.js +29 -14
  222. data/vendor/assets/javascripts/fileupload/jquery.iframe-transport.js +2 -2
  223. data/vendor/assets/javascripts/tinymce/langs/es.js +2 -2
  224. data/vendor/assets/javascripts/tinymce/langs/fr.js +1 -1
  225. data/vendor/assets/javascripts/tinymce/langs/it.js +1 -1
  226. data/vendor/assets/javascripts/tinymce/langs/nl.js +3 -3
  227. data/vendor/assets/javascripts/tinymce/tinymce.min.js +15 -12
  228. metadata +44 -88
  229. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/readme.md +0 -1
  230. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.eot +0 -0
  231. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.eot +0 -0
  232. data/app/assets/stylesheets/tinymce/skins/alchemy/img/wline.gif +0 -0
  233. data/app/assets/stylesheets/tinymce/skins/alchemy/skin.ie7.min.css +0 -1
  234. data/app/controllers/alchemy/pictures_controller.rb +0 -97
  235. data/app/views/alchemy/admin/elements/_refresh_editor.js.erb +0 -8
  236. data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.min.js +0 -1
  237. data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.min.js +0 -1
  238. data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.min.js +0 -1
  239. data/vendor/assets/javascripts/tinymce/plugins/code/plugin.min.js +0 -1
  240. data/vendor/assets/javascripts/tinymce/plugins/directionality/plugin.min.js +0 -1
  241. data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.min.js +0 -1
  242. data/vendor/assets/javascripts/tinymce/plugins/hr/plugin.min.js +0 -1
  243. data/vendor/assets/javascripts/tinymce/plugins/link/plugin.min.js +0 -1
  244. data/vendor/assets/javascripts/tinymce/plugins/paste/plugin.min.js +0 -1
  245. data/vendor/assets/javascripts/tinymce/plugins/tabfocus/plugin.min.js +0 -1
  246. data/vendor/assets/javascripts/tinymce/plugins/table/plugin.min.js +0 -1
  247. data/vendor/assets/javascripts/tinymce/themes/modern/theme.min.js +0 -1
@@ -46,27 +46,47 @@ module Alchemy
46
46
  protected
47
47
 
48
48
  def page_hash(page, has_children, level, folded)
49
- {
49
+ p_hash = {
50
50
  id: page.id,
51
51
  name: page.name,
52
- permissions: page_permissions(page, opts[:ability]),
53
52
  public: page.public?,
54
53
  visible: page.visible?,
55
54
  restricted: page.restricted?,
56
- status_titles: page_status_titles(page),
57
55
  page_layout: page.page_layout,
58
56
  slug: page.slug,
59
57
  redirects_to_external: page.redirects_to_external?,
60
- locked: page.locked?,
61
- definition_missing: page.definition.blank?,
62
58
  urlname: page.urlname,
63
- external_urlname: page.external_urlname,
59
+ external_urlname: page.redirects_to_external? ? page.external_urlname : nil,
64
60
  level: level,
65
61
  root: level == 1,
66
- folded: folded,
67
62
  root_or_leaf: level == 1 || !has_children,
68
63
  children: []
69
64
  }
65
+
66
+ if opts[:elements]
67
+ p_hash.update(elements: ActiveModel::ArraySerializer.new(page_elements(page)))
68
+ end
69
+
70
+ if opts[:ability].can?(:index, :alchemy_admin_pages)
71
+ p_hash.merge({
72
+ definition_missing: page.definition.blank?,
73
+ folded: folded,
74
+ locked: page.locked?,
75
+ locked_notice: page.locked? ? Alchemy.t('This page is locked', name: page.locker_name) : nil,
76
+ permissions: page_permissions(page, opts[:ability]),
77
+ status_titles: page_status_titles(page)
78
+ })
79
+ else
80
+ p_hash
81
+ end
82
+ end
83
+
84
+ def page_elements(page)
85
+ if opts[:elements] == 'true'
86
+ page.elements
87
+ else
88
+ page.elements.named(opts[:elements].split(',') || [])
89
+ end
70
90
  end
71
91
 
72
92
  def page_permissions(page, ability)
@@ -75,7 +95,8 @@ module Alchemy
75
95
  configure: ability.can?(:configure, page),
76
96
  copy: ability.can?(:copy, page),
77
97
  destroy: ability.can?(:destroy, page),
78
- create: ability.can?(:create, Alchemy::Page)
98
+ create: ability.can?(:create, Alchemy::Page),
99
+ edit_content: ability.can?(:edit_content, page)
79
100
  }
80
101
  end
81
102
 
@@ -0,0 +1,2 @@
1
+ <%= render 'alchemy/menubar' %>
2
+ <%= render "alchemy/preview_mode_code" %>
@@ -1,4 +1,4 @@
1
- <% if !@preview_mode && can?(:edit_content, @page) %>
1
+ <% if !@preview_mode && @page && can?(:edit_content, @page) %>
2
2
  <div id="alchemy_menubar" style="display: none">
3
3
  <ul>
4
4
  <li><%= link_to Alchemy.t(:to_alchemy), alchemy.admin_dashboard_url %></li>
@@ -0,0 +1,6 @@
1
+ <% if @preview_mode %>
2
+ <script type="text/javascript">
3
+ Alchemy = { locale: "<%= session[:alchemy_locale] %>" };
4
+ </script>
5
+ <%= javascript_include_tag("alchemy/preview") %>
6
+ <% end %>
@@ -1,7 +1,7 @@
1
1
  <div id="overlay_toolbar">
2
2
  <% if can? :create, Alchemy::Attachment %>
3
3
  <%= render 'alchemy/admin/uploader/button',
4
- model_class: Alchemy::Attachment,
4
+ object: Alchemy::Attachment.new,
5
5
  dropzone: '#assign_file_list',
6
6
  file_attribute: 'file',
7
7
  in_dialog: true,
@@ -3,16 +3,16 @@
3
3
  <%= render_icon attachment.icon_css_class %>
4
4
  </td>
5
5
  <td class="name">
6
- <% if can?(:show, attachment) && %w(audio image video flash pdf text).include?(attachment.icon_css_class) %>
6
+ <% if can?(:show, attachment) %>
7
7
  <%= link_to_dialog(
8
8
  attachment.name,
9
9
  alchemy.admin_attachment_path(attachment),
10
10
  {
11
11
  title: attachment.name,
12
- size: "fullscreen"
12
+ size: attachment_preview_size(attachment)
13
13
  },
14
14
  {
15
- title: Alchemy.t('View File')
15
+ title: Alchemy.t('Attachment Preview')
16
16
  }
17
17
  ) %>
18
18
  <% else %>
@@ -24,14 +24,34 @@
24
24
  <td class="file_size"><%= number_to_human_size(attachment.file_size) %></td>
25
25
  <td class="date"><%= l(attachment.created_at, format: :default) %></td>
26
26
  <td class="tools long">
27
+ <% if can?(:show, attachment) %>
28
+ <%= link_to_dialog(
29
+ render_icon(:info),
30
+ alchemy.admin_attachment_path(attachment),
31
+ {
32
+ title: attachment.name,
33
+ size: attachment_preview_size(attachment)
34
+ },
35
+ {
36
+ title: Alchemy.t('Attachment Preview')
37
+ }
38
+ ) %>
39
+ <% end %>
27
40
  <% if can?(:download, attachment) %>
28
41
  <%= link_to(
29
42
  "",
30
43
  alchemy.download_admin_attachment_path(attachment),
31
44
  title: Alchemy.t("download_file", filename: attachment.file_name),
32
- class: "icon file_download"
45
+ class: "icon file_download",
46
+ target: "_blank"
33
47
  ) %>
34
48
  <% end %>
49
+ <% if can?(:edit, attachment) %>
50
+ <%= render 'alchemy/admin/attachments/replace_button',
51
+ redirect_url: alchemy.admin_attachments_path,
52
+ object: attachment,
53
+ file_attribute: 'file' %>
54
+ <% end %>
35
55
  <% if can?(:destroy, attachment) %>
36
56
  <%= link_to_confirm_dialog(
37
57
  "",
@@ -53,7 +73,7 @@
53
73
  alchemy.edit_admin_attachment_path(attachment, q: params[:q], page: params[:page]),
54
74
  {
55
75
  title: Alchemy.t(:rename_file),
56
- size: '380x250'
76
+ size: '500x250'
57
77
  },
58
78
  class: 'icon file_edit',
59
79
  title: Alchemy.t(:rename_file)
@@ -0,0 +1,26 @@
1
+ <%= form_for [:admin, object], html: {multipart: true, class: 'upload-button'} do |f| %>
2
+ <%= f.file_field file_attribute,
3
+ class: 'fileupload--field',
4
+ name: "#{f.object_name}[#{file_attribute}]",
5
+ id: "replace_#{dom_id(object)}" %>
6
+ <%= label_tag "replace_#{dom_id(object)}", title: Alchemy.t(:replace_file) do %>
7
+ <%= render_icon :file_change %>
8
+ <% end %>
9
+ <% end %>
10
+
11
+ <% file_types = local_assigns[:file_types].presence ||
12
+ configuration(:uploader)['allowed_filetypes'][object.class.model_name.collection] || ['*'] %>
13
+
14
+ <script type='text/javascript'>
15
+ $(function() {
16
+ var options = {
17
+ selector: '#replace_<%= dom_id(object) %>',
18
+ file_types: '<%= file_types.join("|") %>',
19
+ complete: function() {
20
+ Alchemy.pleaseWaitOverlay();
21
+ window.location.href = '<%= redirect_url.html_safe %>';
22
+ }
23
+ };
24
+ Alchemy.Uploader(options);
25
+ });
26
+ </script>
@@ -3,7 +3,7 @@
3
3
  <% if can? :create, Alchemy::Attachment %>
4
4
  <%= render 'alchemy/admin/uploader/button',
5
5
  redirect_url: alchemy.admin_attachments_path,
6
- model_class: Alchemy::Attachment,
6
+ object: Alchemy::Attachment.new,
7
7
  file_attribute: 'file' %>
8
8
  <% end %>
9
9
  </div>
@@ -1,3 +1,55 @@
1
+ <div class="resource_info">
2
+ <div class="value">
3
+ <label>
4
+ <%= render_icon @attachment.icon_css_class %>
5
+ </label>
6
+ <p><%= @attachment.file_name %></p>
7
+ </div>
8
+ <div class="value with-icon">
9
+ <label><%= Alchemy::Attachment.human_attribute_name(:url) %></label>
10
+ <p><%= alchemy.show_attachment_url(@attachment) %></p>
11
+ <a data-clipboard-text="<%= alchemy.show_attachment_url(@attachment) %>" class="icon_button--right">
12
+ <%= render_icon('clipboard full') %>
13
+ </a>
14
+ </div>
15
+ <div class="value with-icon">
16
+ <label><%= Alchemy::Attachment.human_attribute_name(:download_url) %></label>
17
+ <p><%= alchemy.download_attachment_url(@attachment) %></p>
18
+ <a data-clipboard-text="<%= alchemy.download_attachment_url(@attachment) %>" class="icon_button--right">
19
+ <%= render_icon('clipboard full') %>
20
+ </a>
21
+ </div>
22
+ </div>
23
+
24
+ <% case @attachment.icon_css_class %>
25
+ <% when "image" %>
26
+ <div class="attachment_preview_container image-preview">
27
+ <%= image_tag(alchemy.show_attachment_path(@attachment), class: "full_width") %>
28
+ </div>
29
+ <% when "audio" %>
30
+ <div class="attachment_preview_container player-preview">
31
+ <%= audio_tag(alchemy.show_attachment_path(@attachment), preload: "none", controls: true, class: "full_width") %>
32
+ </div>
33
+ <% when "video" %>
34
+ <div class="attachment_preview_container player-preview">
35
+ <%= video_tag(alchemy.show_attachment_path(@attachment), preload: "metadata", controls: true, class: "full_width") %>
36
+ </div>
37
+ <% when "archive", "file" %>
38
+ <% else %>
1
39
  <iframe src="<%= alchemy.show_attachment_path(@attachment) %>" frameborder=0 class="full-iframe">
2
40
  Your browser does not support frames.
3
41
  </iframe>
42
+ <% end %>
43
+
44
+ <script type="text/javascript">
45
+ $(function() {
46
+ var clipboard = new Clipboard('.icon_button--right');
47
+ clipboard.on('success', function(e) {
48
+ Alchemy.growl('<%= Alchemy.t("Copied to clipboard") %>');
49
+ e.clearSelection();
50
+ });
51
+ Alchemy.currentDialog().dialog.on('DialogClose.Alchemy', function() {
52
+ clipboard.destroy();
53
+ });
54
+ });
55
+ </script>
@@ -1,10 +1,13 @@
1
- <div class="element-header">
1
+ <div class="element-header<%= ' has-hint' if element.has_hint? %>">
2
2
  <span class="element-handle">
3
3
  <%= render_icon(:element) %>
4
4
  <% if element.definition.blank? %>
5
- <span class="warning icon" title="<%= Alchemy.t(:element_definition_missing) %>"></span>
5
+ <%= hint_with_tooltip(
6
+ Alchemy.t(:element_definition_missing),
7
+ class: 'warning icon'
8
+ ) %>
6
9
  <% else %>
7
- <%= render_icon("element_#{element.public? ? 'public' : 'draft'}") %>
10
+ <%= render_icon("element_#{element.public? ? 'public' : 'draft'}") %>
8
11
  <% end %>
9
12
  </span>
10
13
  <span class="element-title">
@@ -46,6 +46,4 @@
46
46
  <%- if @clipboard.blank? -%>
47
47
  $('#clipboard_button .icon.clipboard').removeClass('full');
48
48
  <%- end -%>
49
-
50
- <%= update_essence_select_elements(@page, @element) -%>
51
49
  })();
@@ -8,5 +8,4 @@ $('#element_<%= @element.id %>').hide(200, function() {
8
8
  <% @element.richtext_contents_ids.each do |id| %>
9
9
  tinymce.get('tinymce_<%= id %>').remove();
10
10
  <% end %>
11
- <%= update_essence_select_elements(@page, @element) -%>
12
11
  });
@@ -11,7 +11,6 @@
11
11
  Alchemy.PreviewWindow.refresh(function() {
12
12
  Alchemy.ElementEditors.selectElementInPreview(<%= @element.id %>);
13
13
  });
14
- <%= update_essence_select_elements(@page, @element) -%>
15
14
 
16
15
  <%- else -%>
17
16
 
@@ -22,5 +21,4 @@
22
21
  Alchemy.Buttons.enable($el);
23
22
 
24
23
  <%- end -%>
25
-
26
24
  })();
@@ -8,10 +8,7 @@
8
8
  <%= simple_format Alchemy.t(:explain_cropping) %>
9
9
  <% end %>
10
10
  <div class="thumbnail_background">
11
- <%= image_tag(
12
- show_alchemy_picture_path(@picture, size: '800x600', format: 'png'),
13
- id: 'imageToCrop'
14
- ) %>
11
+ <%= image_tag @picture.url(size: '800x600', flatten: true), id: 'imageToCrop' %>
15
12
  </div>
16
13
  <%= form_for(
17
14
  @essence_picture,
@@ -6,7 +6,7 @@
6
6
  <%= f.input :alt_tag %>
7
7
  <%- if @options[:sizes].present? -%>
8
8
  <%= f.input :render_size,
9
- collection: [[Alchemy.t('Layout default'), @options[:image_size]]] + @options[:sizes].to_a,
9
+ collection: [[Alchemy.t('Layout default'), @options[:size]]] + @options[:sizes].to_a,
10
10
  include_blank: false,
11
11
  input_html: {class: 'alchemy_selectbox'} %>
12
12
  <%- end -%>
@@ -14,6 +14,7 @@
14
14
  },
15
15
  if_permitted_to: [:create, Alchemy::Language] %>
16
16
  </div>
17
+ <%= render 'alchemy/admin/partials/search_form' %>
17
18
  <% end %>
18
19
 
19
20
  <div id="archive_all" class="resources-table-wrapper">
@@ -2,26 +2,27 @@
2
2
  <div class="sitemap_page<%= layoutpage.locked? ? ' locked' : '' %>">
3
3
  <div class="sitemap_left_images">
4
4
  <% if layoutpage.definition.blank? %>
5
- <span class="inline warning icon" title="<%= Alchemy.t(:page_definition_missing) %>"></span>
5
+ <%= page_layout_missing_warning %>
6
6
  <% else %>
7
7
  <%= render_icon(:page) %>
8
8
  <% end %>
9
9
  </div>
10
10
  <div class="sitemap_right_tools">
11
- <%- if can?(:configure, layoutpage) -%>
12
- <%= link_to_dialog(
13
- render_icon('configure_page'),
14
- alchemy.edit_admin_layoutpage_path(layoutpage),
15
- {
16
- title: Alchemy.t(:edit_page_properties),
17
- size: '410x170'
18
- },
19
- class: 'sitemap_tool',
20
- title: Alchemy.t(:edit_page_properties)
21
- ) -%>
22
- <%- end -%>
23
- <span class="sitemap_sitetools">
24
- <%- if can?(:copy, layoutpage) -%>
11
+ <%- if can?(:configure, layoutpage) -%>
12
+ <div class="button_with_label sitemap_tool">
13
+ <%= link_to_dialog(
14
+ render_icon('configure_page'),
15
+ alchemy.edit_admin_layoutpage_path(layoutpage),
16
+ {
17
+ title: Alchemy.t(:edit_page_properties),
18
+ size: '410x170'
19
+ }
20
+ ) -%>
21
+ <label class="center"><%= Alchemy.t(:edit_page_properties) %></label>
22
+ </div>
23
+ <%- end -%>
24
+ <%- if can?(:copy, layoutpage) -%>
25
+ <div class="button_with_label sitemap_tool">
25
26
  <%= link_to(
26
27
  render_icon("copy_page"),
27
28
  alchemy.insert_admin_clipboard_path(
@@ -29,12 +30,13 @@
29
30
  remarkable_id: layoutpage.id
30
31
  ),
31
32
  remote: true,
32
- method: 'post',
33
- class: "sitemap_tool",
34
- title: Alchemy.t(:copy_page)
33
+ method: 'post'
35
34
  ) %>
36
- <%- end -%>
37
- <%- if can?(:destroy, layoutpage) -%>
35
+ <label class="center"><%= Alchemy.t(:copy_page) %></label>
36
+ </div>
37
+ <%- end -%>
38
+ <%- if can?(:destroy, layoutpage) -%>
39
+ <div class="button_with_label sitemap_tool">
38
40
  <%= link_to_confirm_dialog(
39
41
  render_icon('delete_page'),
40
42
  Alchemy.t(:confirm_to_delete_page),
@@ -42,14 +44,11 @@
42
44
  controller: 'pages',
43
45
  action: 'destroy',
44
46
  id: layoutpage.id
45
- ),
46
- {
47
- class: "sitemap_tool",
48
- title: Alchemy.t(:delete_page)
49
- }
47
+ )
50
48
  ) -%>
51
- <%- end -%>
52
- </span>
49
+ <label class="left"><%= Alchemy.t(:delete_page) %></label>
50
+ </div>
51
+ <%- end -%>
53
52
  </div>
54
53
  <div class="sitemap_sitename">
55
54
  <%= link_to(
@@ -1,7 +1,7 @@
1
1
  <%= alchemy_form_for [:admin, @page], class: 'edit_page' do |f| %>
2
2
  <%= f.input :page_layout,
3
3
  collection: @page_layouts,
4
- label: @page.definition.blank? ? (%(<span class="inline warning icon" title="#{ Alchemy.t(:page_definition_missing) }"></span>&nbsp;) + Alchemy.t(:page_type)).html_safe : Alchemy.t(:page_type),
4
+ label: page_layout_label(@page),
5
5
  include_blank: false,
6
6
  input_html: {class: 'alchemy_selectbox'} %>
7
7
  <%= f.input :name, autofocus: true %>
@@ -4,74 +4,47 @@
4
4
  label: page_layout_label(@page),
5
5
  include_blank: false,
6
6
  input_html: {class: 'alchemy_selectbox'} %>
7
+
7
8
  <div class="input check_boxes">
8
9
  <label class="control-label"><%= Alchemy.t(:page_status) %></label>
9
10
  <div class="control_group">
10
- <label class="checkbox">
11
- <%= check_box_tag :page_public, nil, @page.public?, name: nil,
12
- data: {date_format: I18n.t(:datetimepicker, scope: 'time.formats')} %>
13
- <%= f.object.class.human_attribute_name :public %>
14
- </label>
15
- <%= content_tag :div, class: [
16
- @page.public_on.present? || @page.public_until.present? ? nil : 'hidden',
17
- 'page-publication-date-fields',
18
- 'input-row'
19
- ] do %>
20
- <div class="input-column">
21
- <label><%= Alchemy.t(:from) %></label>
22
- <%= alchemy_datepicker @page, :public_on, type: :datetime %>
23
- </div>
24
- <div class="input-column">
25
- <label><%= Alchemy.t(:until) %></label>
26
- <%= alchemy_datepicker @page, :public_until, type: :datetime %>
27
- </div>
11
+ <%= render 'alchemy/admin/pages/publication_fields' %>
12
+ <%= page_status_checkbox(@page, :visible) %>
13
+ <%= page_status_checkbox(@page, :restricted) %>
14
+ <% if configuration(:sitemap)['show_flag'] %>
15
+ <%= page_status_checkbox(@page, :sitemap) %>
28
16
  <% end %>
29
- <label class="checkbox">
30
- <%= f.check_box :visible %>
31
- <%= f.object.class.human_attribute_name :visible %>
32
- </label>
33
- <label class="checkbox">
34
- <%= f.check_box :restricted %>
35
- <%= f.object.class.human_attribute_name :restricted %>
36
- </label>
37
- <% if configuration(:sitemap)['show_flag'] %>
38
- <label class="checkbox">
39
- <%= f.check_box :sitemap %>
40
- <%= f.object.class.human_attribute_name :sitemap %>
41
- </label>
42
- <% end %>
43
17
  </div>
44
18
  </div>
19
+
45
20
  <h2><%= Alchemy.t(:names) %></h2>
46
21
  <%= f.input :name, autofocus: true %>
47
22
  <%= f.input :urlname, as: 'string', input_html: {value: @page.slug} %>
48
23
  <%= f.input :title,
49
24
  input_html: {'data-alchemy-char-counter' => 60} %>
25
+
50
26
  <h2><%= Alchemy.t(:meta_data) %></h2>
51
27
  <div class="input check_boxes">
52
28
  <label class="control-label"><%= Alchemy.t(:search_engines) %></label>
53
29
  <div class="control_group">
54
- <label class="checkbox">
55
- <%= f.check_box :robot_index %>
56
- <%= f.object.class.human_attribute_name :robot_index %>
57
- </label>
58
- <label class="checkbox">
59
- <%= f.check_box :robot_follow %>
60
- <%= f.object.class.human_attribute_name :robot_follow %>
61
- </label>
30
+ <%= page_status_checkbox(@page, :robot_index) %>
31
+ <%= page_status_checkbox(@page, :robot_follow) %>
62
32
  </div>
63
33
  </div>
34
+
64
35
  <%= f.input :meta_description,
65
36
  as: 'text',
66
37
  input_html: {'data-alchemy-char-counter' => 160} %>
67
38
  <%= f.input :meta_keywords,
68
39
  as: 'text',
69
40
  hint: Alchemy.t('pages.update.comma_seperated') %>
41
+
70
42
  <% if @page.taggable? %>
71
43
  <div class="input string">
72
44
  <%= f.label :tag_list %>
73
45
  <%= render 'alchemy/admin/partials/autocomplete_tag_list', f: f %>
74
46
  </div>
75
47
  <% end %>
48
+
76
49
  <%= f.submit Alchemy.t(:save) %>
77
50
  <% end %>