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
@@ -11,8 +11,10 @@ Alchemy.GUI =
11
11
  Alchemy.overlayObserver(scope)
12
12
  Alchemy.Hotkeys(scope)
13
13
  Alchemy.ListFilter(scope)
14
+ Alchemy.Spinner.watch(scope)
14
15
 
15
16
  initElement: ($el) ->
16
17
  Alchemy.ElementDirtyObserver($el)
17
18
  Alchemy.GUI.init($el)
18
- Alchemy.ImageLoader($el);
19
+ Alchemy.ImageLoader($el)
20
+ Alchemy.Spinner.watch($el)
@@ -24,6 +24,7 @@
24
24
  //= require alchemy/alchemy.dirty
25
25
  //= require alchemy/alchemy.dragndrop
26
26
  //= require alchemy/alchemy.element_editors
27
+ //= require alchemy/alchemy.elements_window
27
28
  //= require alchemy/alchemy.growler
28
29
  //= require alchemy/alchemy.gui
29
30
  //= require alchemy/alchemy.hotkeys
@@ -35,10 +36,11 @@
35
36
  //= require alchemy/alchemy.page_sorter
36
37
  //= require alchemy/alchemy.uploader
37
38
  //= require alchemy/alchemy.file_progress
39
+ //= require alchemy/alchemy.preview_window
38
40
  //= require alchemy/alchemy.sitemap
39
41
  //= require alchemy/alchemy.spinner
40
42
  //= require alchemy/alchemy.swf_upload
43
+ //= require alchemy/alchemy.tinymce
44
+ //= require alchemy/alchemy.translations
41
45
  //= require alchemy/alchemy.windows
42
- //= require alchemy/alchemy.preview_window
43
- //= require alchemy/alchemy.elements_window
44
46
  //= require alchemy/alchemy.custom
@@ -25,7 +25,7 @@ $ ->
25
25
  $('select#change_locale').on 'change', (e) ->
26
26
  url = Alchemy.current_url
27
27
  delimiter = if url.match(/\?/) then '&' else '?'
28
- window.location = url + delimiter + 'locale=' + $(this).val()
28
+ window.location.href = "#{url}#{delimiter}locale=#{$(this).val()}"
29
29
 
30
30
  # Attaches the image loader on all images
31
31
  Alchemy.ImageLoader('#main_content')
@@ -10,6 +10,14 @@ Alchemy.Spinner =
10
10
  speed: 1.25
11
11
  hwaccel: true
12
12
 
13
+ tiny: (opts) ->
14
+ defaults = $.extend({}, Alchemy.Spinner.DEFAULTS,
15
+ length: 2
16
+ width: 1
17
+ radius: 1
18
+ )
19
+ new Spinner($.extend(defaults, opts))
20
+
13
21
  small: (opts) ->
14
22
  defaults = $.extend({}, Alchemy.Spinner.DEFAULTS,
15
23
  length: 2
@@ -33,3 +41,9 @@ Alchemy.Spinner =
33
41
  radius: 8
34
42
  )
35
43
  new Spinner($.extend(defaults, opts))
44
+
45
+ watch: (scope) ->
46
+ $('a.spinner', scope).click ->
47
+ spinner = Alchemy.Spinner.tiny()
48
+ spinner.spin(this)
49
+ $(this).css('background': 'none').off('click')
@@ -0,0 +1,96 @@
1
+ # Alchemy Tinymce wrapper
2
+ #
3
+ window.Alchemy.Tinymce =
4
+
5
+ # Holds the default Alchemy TinyMCE configuration
6
+ #
7
+ defaults:
8
+ plugins: "<%= Alchemy::Tinymce.plugins.join(',') %>"
9
+ <% Alchemy::Tinymce.init.each do |k, v| %>
10
+ <%= k %>: <%= v.to_json %>
11
+ <% end %>
12
+ <% if Alchemy::Tinymce.setup %>
13
+ setup: <%= Alchemy::Tinymce.setup %>
14
+ <% end %>
15
+
16
+ # Holds custom tinymce configurations
17
+ #
18
+ # The key has to be a unique selector in the format of: "element_name_content_name"
19
+ #
20
+ # The value has to be a valid tinymce configuration object.
21
+ #
22
+ customConfigs: {}
23
+
24
+ # Returns default config for tinymce editors.
25
+ #
26
+ getDefaultConfig: ->
27
+ config = @defaults
28
+ config.language = Alchemy.locale
29
+ config.mode = "specific_textareas"
30
+ config.editor_selector = "default_tinymce"
31
+ config.init_instance_callback = (inst) ->
32
+ $this = $("##{inst.editorId}")
33
+ parent = $this.parents('.element_editor')
34
+ parent.find('.spinner').remove()
35
+ inst.onChange.add ->
36
+ Alchemy.setElementDirty(parent)
37
+ return config
38
+
39
+ # Returns configuration for given custom tinymce editor selector.
40
+ #
41
+ # It uses the +.getDefaultConfig+ and merges the custom parts.
42
+ #
43
+ getCustomConfig: (editor) ->
44
+ if editor_config = @customConfigs[editor]
45
+ config = $.extend({}, @getDefaultConfig(), editor_config)
46
+ config.mode = 'specific_textareas'
47
+ config.editor_selector = new RegExp("custom_tinymce #{editor}")
48
+ return config
49
+
50
+ # Initializes all default TinyMCE instances
51
+ #
52
+ init: ->
53
+ spinner = Alchemy.Spinner.small()
54
+ $('.tinymce_container').prepend spinner.spin().el
55
+ tinymce.init @getDefaultConfig()
56
+
57
+ # Initializes all tinymce editors with custom configuration.
58
+ #
59
+ # @param editors [Array]
60
+ # - Editor selectors that should be initialized. The selector has to be in format of:
61
+ # "element_name_content_name"
62
+ #
63
+ initCustomEditors: (editors) ->
64
+ return if not editors
65
+ for editor in editors
66
+ if custom_editor_config = @getCustomConfig(editor)
67
+ tinymce.init custom_editor_config
68
+
69
+ # Adds a TinyMCE editor to given dom elements.
70
+ #
71
+ # Checks if element has custom tinymce config and uses this to init editor.
72
+ # Otherwise it uses the default config.
73
+ #
74
+ addEditor: (elements) ->
75
+ self = Alchemy.Tinymce
76
+ $(elements).each ->
77
+ if custom_editor = this.classList[1]
78
+ config = self.getCustomConfig(custom_editor)
79
+ else
80
+ config = self.getDefaultConfig()
81
+ tinymce.init(config)
82
+ tinymce.execCommand('mceAddControl', true, this.id)
83
+
84
+ # Removes the TinyMCE editor from given dom elements.
85
+ #
86
+ removeEditor: (elements) ->
87
+ $(elements).each ->
88
+ tinymce.get(this.id).remove()
89
+
90
+ # Populate custom tinymce configurations
91
+ <% Alchemy::Tinymce.custom_config_contents.each do |content| %>
92
+ Alchemy.Tinymce.customConfigs["<%= content['element'] %>_<%= content['name'] %>"] =
93
+ <% content.fetch('settings', {}).fetch('tinymce', {}).each do |k, v| %>
94
+ <%= k %>: <%= v.to_json %>
95
+ <% end %>
96
+ <% end %>
@@ -0,0 +1,22 @@
1
+ window.Alchemy = {} if typeof(window.Alchemy) is 'undefined'
2
+
3
+ $.extend Alchemy,
4
+
5
+ # Holds translations
6
+ #
7
+ translations:
8
+ page_dirty_notice:
9
+ en: "You have unsaved changes on this page. They will be lost if you continue."
10
+ de: "Sie haben ungesicherte Änderungen auf der Seite. Diese gehen verloren, wenn Sie fortfahren."
11
+ element_dirty_notice:
12
+ en: "This element has unsaved changes. Do you really want to fold it?"
13
+ de: "Dieses Element hat nicht gespeicherte Änderungen. Möchten Sie es wirklich einklappen?"
14
+ warning:
15
+ en: 'Warning!'
16
+ de: 'Achtung!'
17
+ ok:
18
+ en: 'Ok'
19
+ de: 'Ok'
20
+ cancel:
21
+ en: 'Cancel'
22
+ de: 'Abbrechen'
@@ -28,16 +28,24 @@ $.extend Alchemy,
28
28
  # Display a error message for dialogs
29
29
  # Used by Alchemy.openWindow if errors happen
30
30
  AjaxErrorHandler: ($dialog, status, textStatus, errorThrown) ->
31
+ error_type = "warning"
31
32
  $div = $('<div class="with_padding" />')
32
- $errorDiv = $("<div id=\"errorExplanation\" class=\"ajax_status_code_#{status}\" />")
33
33
  $dialog.html $div
34
+ switch status
35
+ when 0
36
+ error_header = "The server does not respond."
37
+ error_body = "Please check server and try again."
38
+ when 403
39
+ error_header = "You are not authorized!"
40
+ error_body = "Please close this window."
41
+ else
42
+ error_header = "#{errorThrown} (#{status})"
43
+ error_body = "Please check log and try again."
44
+ error_type = "error"
45
+ $errorDiv = $("<div id=\"errorExplanation\" class=\"ajax_status_code #{error_type}\" />")
46
+ $errorDiv.append "<h2>#{error_header}</h2>"
47
+ $errorDiv.append "<p>#{error_body}</p>"
34
48
  $div.append $errorDiv
35
- if status is 0
36
- $errorDiv.append "<h2>The server does not respond.</h2>"
37
- $errorDiv.append "<p>Please check server and try again.</p>"
38
- else
39
- $errorDiv.append "<h2>" + errorThrown + " (" + status + ")</h2>"
40
- $errorDiv.append "<p>Please check log and try again.</p>"
41
49
 
42
50
  # Opens a confirm window
43
51
  #
@@ -167,16 +175,19 @@ $.extend Alchemy,
167
175
  url: url
168
176
  success: (data, textStatus, XMLHttpRequest) ->
169
177
  widget = $dialog.dialog("widget")
170
- $dialog.html(data)
171
- $dialog.css(overflow: (if options.overflow then "visible" else "auto"))
172
- widget.css(overflow: (if options.overflow then "visible" else "hidden"))
173
- if options.width is "auto"
174
- widget.css left: (($(window).width() / 2) - ($dialog.width() / 2))
175
- if options.height is "auto"
176
- widget.css top: ($(window).height() - $dialog.dialog("widget").height()) / 2
177
- Alchemy.GUI.init Alchemy.CurrentWindow
178
- if options.image_loader
179
- Alchemy.ImageLoader Alchemy.CurrentWindow, {color: options.image_loader_color}
178
+ if XMLHttpRequest.getResponseHeader('Content-Type').match(/javascript/)
179
+ $dialog.empty()
180
+ else
181
+ $dialog.html(data)
182
+ $dialog.css(overflow: (if options.overflow then "visible" else "auto"))
183
+ widget.css(overflow: (if options.overflow then "visible" else "hidden"))
184
+ if options.width is "auto"
185
+ widget.css left: (($(window).width() / 2) - ($dialog.width() / 2))
186
+ if options.height is "auto"
187
+ widget.css top: ($(window).height() - $dialog.dialog("widget").height()) / 2
188
+ Alchemy.GUI.init Alchemy.CurrentWindow
189
+ if options.image_loader
190
+ Alchemy.ImageLoader Alchemy.CurrentWindow, {color: options.image_loader_color}
180
191
  error: (XMLHttpRequest, textStatus, errorThrown) ->
181
192
  Alchemy.AjaxErrorHandler $dialog, XMLHttpRequest.status, textStatus, errorThrown
182
193
  complete: (jqXHR, textStatus) ->
@@ -91,6 +91,12 @@ ul {
91
91
  }
92
92
  }
93
93
 
94
+ hr {
95
+ border: 0 none;
96
+ border-bottom: 1px solid;
97
+ @include opacity(0.5);
98
+ }
99
+
94
100
  .float_right {
95
101
  float: right;
96
102
  }
@@ -534,19 +534,6 @@ div.essence_file_tools a.edit_file {
534
534
  background: image-url('alchemy/icons.png') -160px -167px;
535
535
  }
536
536
 
537
- td.content_editor_essence_type {
538
- width: 90px;
539
- height: 20px;
540
- }
541
-
542
- table.content_editor_table {
543
- margin-bottom: 8px;
544
- }
545
-
546
- .content_editor_table .thin_border {
547
- width: 210px;
548
- }
549
-
550
537
  a.new_content_link {
551
538
  float: none;
552
539
  margin-bottom: 12px !important;
@@ -563,12 +550,6 @@ div.tinymce_container {
563
550
  }
564
551
  }
565
552
 
566
- div.content_text_editor.text_short {
567
- margin-top: 0;
568
- margin-bottom: 0;
569
- display: inline;
570
- }
571
-
572
553
  input.long,
573
554
  input.text_long {
574
555
  width: 363px;
@@ -580,13 +561,6 @@ select.long {
580
561
  padding: 0;
581
562
  }
582
563
 
583
- div.content_text_editor input.text_short {
584
- border-width: 1px;
585
- width: 50px;
586
- margin-right: 4px;
587
- padding: 2px;
588
- }
589
-
590
564
  #alchemy .ui-dialog-content div.content_editor input.auto_resize {
591
565
  width: 100%;
592
566
  }
@@ -595,7 +569,7 @@ div.content_editor {
595
569
  margin-bottom: 8px;
596
570
  position: relative;
597
571
 
598
- input.thin_border {
572
+ .thin_border, input[type="text"] {
599
573
  width: 100%;
600
574
  }
601
575
 
@@ -619,7 +593,7 @@ div.content_editor {
619
593
  margin-right: 4px;
620
594
  vertical-align: top;
621
595
 
622
- .thin_border {
596
+ .thin_border, input[type="text"] {
623
597
  width: 170px;
624
598
  }
625
599
  }
@@ -7,7 +7,7 @@
7
7
  color: #690001;
8
8
  @extend .rounded-border;
9
9
 
10
- &.ajax_status_code_0 {
10
+ &.ajax_status_code.warning {
11
11
  border-color: #c4c19c;
12
12
  color: #726d23;
13
13
  background-color: #f3f0c1;
@@ -65,6 +65,8 @@
65
65
 
66
66
  * {
67
67
  @include box-sizing;
68
+ margin: 0;
69
+ padding: 0;
68
70
  }
69
71
 
70
72
  &:hover {
@@ -48,7 +48,7 @@ div#sort_panel {
48
48
  .redirect_url {
49
49
  position: absolute;
50
50
  top: 4px;
51
- right: 184px;
51
+ right: 199px;
52
52
  text-align: right;
53
53
  background-color: #fff0c4;
54
54
  line-height: 22px;
@@ -108,13 +108,13 @@ div.sitemap_left_images {
108
108
  div.sitemap_right_tools {
109
109
  height: 22px;
110
110
  background-color: $light-gray;
111
- padding-left: 16px;
111
+ padding-left: 8px;
112
112
  float: right;
113
- width: 100px;
113
+ width: 120px;
114
114
 
115
115
  a {
116
116
  float: left;
117
- width: 21px;
117
+ width: 24px;
118
118
  height: 21px;
119
119
  text-align: center;
120
120
 
@@ -134,8 +134,7 @@ div.sitemap_right_tools {
134
134
  .sitemap_sitetools {
135
135
  padding: 0;
136
136
  float: left;
137
- width: 70px;
138
- margin-left: 8px;
137
+ width: 72px;
139
138
  }
140
139
 
141
140
  div#page_selector_container div.sitemap_right_tools {
@@ -217,7 +216,7 @@ div.page_infos {
217
216
  float: right;
218
217
  height: 20px;
219
218
  padding: 1px;
220
- width: 66px;
219
+ width: 68px;
221
220
  }
222
221
 
223
222
  #sub_navigation span.page_status_and_name span.page_status {
@@ -234,14 +233,13 @@ span.page_status {
234
233
  background-image: image-url('alchemy/icons.png');
235
234
  background-repeat: no-repeat;
236
235
  float: left;
237
- margin: 2px 2px 0 4px;
238
236
 
239
237
  &.restricted {
240
238
  background-position: -258px -39px;
241
239
  }
242
240
 
243
241
  &.not_restricted {
244
- background-position: -290px -39px;
242
+ background-position: -288px -39px;
245
243
  @include opacity(0.3);
246
244
  }
247
245
 
@@ -264,47 +262,36 @@ span.page_status {
264
262
  }
265
263
  }
266
264
 
265
+ #sitemap .page_status {
266
+ margin: 2px 2px 0 4px;
267
+ }
268
+
269
+ .alchemy_overlay .page_status {
270
+ margin: 4px 4px 0 0;
271
+ }
272
+
267
273
  .site_status {
268
274
  float: left;
269
275
  width: 16px;
270
276
  height: 16px;
271
277
  background: image-url('alchemy/icons.png') no-repeat 0 -40px;
272
278
  position: relative;
273
- cursor: help;
279
+
280
+ a {
281
+ display: block;
282
+ height: 100%;
283
+ cursor: help;
284
+ }
274
285
  }
275
286
 
276
287
  .locked .site_status {
277
288
  background-position: -32px -40px;
278
289
  }
279
290
 
280
- .tooltip {
281
- @extend %tooltip;
282
- right: auto;
283
- left: -12px;
284
- top: 24px;
285
- min-width: 240px;
286
-
287
- &:before {
288
- right: auto;
289
- left: 12px;
290
- }
291
-
292
- p, h3 {
293
- font-size: 11px;
294
- margin: 0;
295
- padding: 0;
296
- }
297
-
298
- h3 { margin-top: 0.5em }
299
- }
300
-
301
291
  #sitemap.sorting {
302
292
  .site_status { cursor: move }
303
- .tooltip { display: none }
304
293
  }
305
294
 
306
- .site_status:hover .tooltip { display: block }
307
-
308
295
  #sub_navigation span.page_status_and_name span.site_status {
309
296
  float: none;
310
297
  @include inline-block;