scrivito_editors 0.71.2 → 0.90.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/scrivito_editors/binary_editor.js +41 -0
  3. data/app/assets/javascripts/scrivito_editors/date_editor.js +66 -0
  4. data/app/assets/javascripts/scrivito_editors/default_editor.js +43 -0
  5. data/app/assets/javascripts/scrivito_editors/deprecated_data_attrs.js +44 -0
  6. data/app/assets/javascripts/scrivito_editors/enum_editor.js +68 -0
  7. data/app/assets/javascripts/scrivito_editors/filter_context.js +54 -0
  8. data/app/assets/javascripts/scrivito_editors/helpers/file_dropzone.js +33 -0
  9. data/app/assets/javascripts/scrivito_editors/helpers/imgly_assets.js.erb +5 -0
  10. data/app/assets/javascripts/scrivito_editors/helpers/setup_binary_button_container.js +12 -0
  11. data/app/assets/javascripts/scrivito_editors/html_editor.js +15 -0
  12. data/app/assets/javascripts/scrivito_editors/image_drop_editor.js +52 -0
  13. data/app/assets/javascripts/scrivito_editors/image_editor.js +114 -0
  14. data/app/assets/javascripts/scrivito_editors/link_editor.js +88 -0
  15. data/app/assets/javascripts/scrivito_editors/linklist_editor.js +187 -0
  16. data/app/assets/javascripts/scrivito_editors/medium_editor.js +97 -0
  17. data/app/assets/javascripts/scrivito_editors/multienum_editor.js +48 -0
  18. data/app/assets/javascripts/scrivito_editors/permalink_editor.js +124 -0
  19. data/app/assets/javascripts/scrivito_editors/placeholder.js +37 -0
  20. data/app/assets/javascripts/scrivito_editors/redactor_editor.js +155 -0
  21. data/app/assets/javascripts/scrivito_editors/redactor_plugins/scrivito_editors_image_manager.js +41 -0
  22. data/app/assets/javascripts/scrivito_editors/redactor_plugins/scrivito_editors_link_manager.js +56 -0
  23. data/app/assets/javascripts/scrivito_editors/reference_editor.js +60 -0
  24. data/app/assets/javascripts/scrivito_editors/referencelist_editor.js +120 -0
  25. data/app/assets/javascripts/scrivito_editors/reload.js +14 -0
  26. data/app/assets/javascripts/scrivito_editors/slider_editor.js +62 -0
  27. data/app/assets/javascripts/scrivito_editors/string_editor.js +156 -0
  28. data/app/assets/javascripts/scrivito_editors/stringlist_editor.js +22 -0
  29. data/app/assets/javascripts/scrivito_editors.js +3 -0
  30. data/app/assets/stylesheets/scrivito_editors/editors/medium_editor.css +20 -0
  31. data/app/assets/stylesheets/scrivito_editors/editors/{html_editor.css → redactor_editor.css} +0 -0
  32. data/app/assets/stylesheets/scrivito_editors/editors/referencelist_editor.css +4 -0
  33. data/app/assets/stylesheets/scrivito_editors/placeholder.css +14 -3
  34. data/app/helpers/scrivito_editors/scrivito_tag_helper.rb +40 -135
  35. data/lib/scrivito_editors/engine.rb +0 -1
  36. data/vendor/assets/javascripts/medium-editor.js +6445 -0
  37. data/{app → vendor}/assets/javascripts/redactor.js +0 -0
  38. data/{app/assets/javascripts/scrivito_editors → vendor/assets/javascripts}/redactor_plugins/table.js +0 -0
  39. data/vendor/assets/stylesheets/medium-editor-themes/flat.css +58 -0
  40. data/vendor/assets/stylesheets/medium-editor.css +214 -0
  41. metadata +78 -56
  42. data/app/assets/javascripts/scrivito_editors/binary_editor.js.coffee +0 -25
  43. data/app/assets/javascripts/scrivito_editors/date_editor.js.coffee +0 -59
  44. data/app/assets/javascripts/scrivito_editors/enum_editor.js.coffee +0 -41
  45. data/app/assets/javascripts/scrivito_editors/filter_context.js.coffee +0 -26
  46. data/app/assets/javascripts/scrivito_editors/helpers/file_dropzone.js.coffee +0 -16
  47. data/app/assets/javascripts/scrivito_editors/helpers/setup_binary_button_container.js.coffee +0 -6
  48. data/app/assets/javascripts/scrivito_editors/html_editor.js.coffee +0 -138
  49. data/app/assets/javascripts/scrivito_editors/image_drop_editor.js.coffee +0 -19
  50. data/app/assets/javascripts/scrivito_editors/image_editor.js.coffee.erb +0 -96
  51. data/app/assets/javascripts/scrivito_editors/link_editor.js.coffee +0 -141
  52. data/app/assets/javascripts/scrivito_editors/linklist_editor.js.coffee +0 -197
  53. data/app/assets/javascripts/scrivito_editors/multienum_editor.js.coffee +0 -42
  54. data/app/assets/javascripts/scrivito_editors/permalink_editor.js.coffee +0 -111
  55. data/app/assets/javascripts/scrivito_editors/placeholder.js.coffee +0 -22
  56. data/app/assets/javascripts/scrivito_editors/redactor_plugins/scrivito_editors_image_manager.js.coffee +0 -22
  57. data/app/assets/javascripts/scrivito_editors/redactor_plugins/scrivito_editors_link_manager.js.coffee +0 -49
  58. data/app/assets/javascripts/scrivito_editors/reference_editor.js.coffee +0 -33
  59. data/app/assets/javascripts/scrivito_editors/referencelist_editor.js.coffee +0 -113
  60. data/app/assets/javascripts/scrivito_editors/reload.js.coffee +0 -12
  61. data/app/assets/javascripts/scrivito_editors/slider_editor.js.coffee +0 -41
  62. data/app/assets/javascripts/scrivito_editors/string_editor.js.coffee +0 -136
  63. data/app/assets/javascripts/scrivito_editors/stringlist_editor.js.coffee +0 -13
  64. data/app/helpers/scrivito_editors/cms_tag_helper.rb +0 -36
@@ -1,147 +1,52 @@
1
1
  module ScrivitoEditors
2
- # This module includes helpers that render the HTML for specfic CMS
3
- # attributes and their JS editors. These special methods are needed
4
- # because the editors need additional information that is not provided
5
- # by the Scrivito SDK's ++scrivito_tag++ method.
6
2
  module ScrivitoTagHelper
7
-
8
- # Allows you to edit a CMS ++enum++ attribute using a dropdown
9
- #
10
- # @param [Obj, Widgegt] object
11
- # @param [String, Symbol] attribute_name
12
- # @param [Hash] options passed to the ++scrivito_tag++ helper
13
3
  def scrivito_edit_enum(object, attribute_name, options = {})
14
- values = _values_for(object, attribute_name)
15
- values |= [object[attribute_name].to_s]
16
-
17
- options.reverse_merge!({
18
- data: {
19
- values: values,
20
- min: values.min,
21
- max: values.max,
22
- }
23
- })
24
-
25
- scrivito_tag(:div, object, attribute_name, options)
4
+ raise %{
5
+ The "scrivito_edit_enum" view helper has been removed.
6
+ Please use the "scrivito_tag" helper instead.
7
+ "scrivito_tag" now activates the enum editor by default for all enum attributes.
8
+ }
26
9
  end
27
10
 
28
- # Allows you to edit a CMS ++multienum++ attribute using a multi-select.
29
- #
30
- # @param [Obj, Widget] object
31
- # @param [String, Symbol] attribute_name
32
- # @param [Hash] options passed to the ++scrivito_tag++ helper
33
11
  def scrivito_edit_multienum(object, attribute_name, options = {})
34
- values = _values_for(object, attribute_name)
35
-
36
- options.reverse_merge!({
37
- multiple: true,
38
- data: {
39
- values: values,
40
- }
41
- })
42
-
43
- scrivito_tag(:div, object, attribute_name, options) do |tag|
44
- (object[attribute_name] || []).join(', ')
45
- end
12
+ raise %{
13
+ The "scrivito_edit_multienum" view helper has been removed.
14
+ Please use the "scrivito_tag" helper instead.
15
+ "scrivito_tag" now activates the multienum editor by default for all multienum attributes.
16
+ }
46
17
  end
47
18
 
48
- # Allows you to edit a CMS ++reference++ attribute using the resource
49
- # browser.
50
- #
51
- # @param [Obj, Widget] object
52
- # @param [String, Symbol] attribute_name
53
- # @param [Hash] options passed to the ++scrivito_tag++ helper
54
19
  def scrivito_edit_reference(object, attribute_name, options = {})
55
- reference = object[attribute_name]
56
-
57
- scrivito_tag(:div, object, attribute_name, options) do
58
- if reference
59
- reference.description_for_editor
60
- end
61
- end
62
- end
63
-
64
- # Allows you to edit a CMS ++referencelist++ attribute using the resource
65
- # browser.
66
- #
67
- # @param [Obj, Widget] object
68
- # @param [String, Symbol] attribute_name
69
- # @param [Hash] options passed to the ++scrivito_tag++ helper
70
- def scrivito_edit_referencelist(object, attribute_name, options = {})
71
- reference_list = object[attribute_name]
72
-
73
- scrivito_tag(:div, object, attribute_name, options) do
74
- if reference_list.present?
75
- content_tag(:ul) do
76
- html = ''.html_safe
77
-
78
- reference_list.each do |reference|
79
- html << content_tag(:li, data: { name: reference.name, id: reference.id }) do
80
- content_tag(:span, reference.description_for_editor, class: 'list-content')
81
- end
82
- end
83
-
84
- html
85
- end
86
- end
87
- end
88
- end
89
-
90
- # Allows you to edit a CMS ++linklist++ attribute
91
- #
92
- # @param [Obj, Widget] object
93
- # @param [String, Symbol] attribute_name
94
- # @param [Hash] options passed to the ++scrivito_tag++ helper
95
- def scrivito_edit_linklist(object, attribute_name, options = {})
96
- linklist = object[attribute_name]
97
-
98
- scrivito_tag(:div, object, attribute_name, options) do
99
- if linklist
100
- content_tag(:ul) do
101
- html = ''.html_safe
102
-
103
- linklist.each do |link|
104
- html << _edit_link_li(link)
105
- end
106
-
107
- html
108
- end
109
- end
110
- end
111
- end
112
-
113
- # Allows you to edit a CMS ++link++ attribute
114
- #
115
- # @param [Obj, Widget] object
116
- # @param [String, Symbol] attribute_name
117
- # @param [Hash] options passed to the ++scrivito_tag++ helper
118
- def scrivito_edit_link(object, attribute_name, options = {})
119
- link = object[attribute_name]
120
-
121
- scrivito_tag(:div, object, attribute_name, options) do
122
- content_tag(:ul) { _edit_link_li(link || Scrivito::Link.new(url: "")) }
123
- end
124
- end
125
-
126
- private
127
-
128
- def _values_for(object, attribute_name)
129
- object.attribute_definitions[attribute_name].try(:values) || []
130
- end
131
-
132
- def _edit_link_li(link)
133
- query = link.query.present? ? "?#{link.query}" : ""
134
- fragment = link.fragment.present? ? "##{link.fragment}" : ""
135
- url = link.internal? ? scrivito_path(link).sub(/\?.*/, "#{query}#{fragment}") : link.url
136
- description = link.internal? ? link.obj.description_for_editor : link.url
137
- data = { description: description, title: link.title, url: url }
138
- data[:id] = link.obj.id if link.internal?
139
-
140
- content_tag(:li, data: data) do
141
- content_tag(:span, class: 'list-content') do
142
- "#{link.title} #{link_to(description, url, target: :_blank)}".html_safe
143
- end
144
- end
20
+ raise %{
21
+ The "scrivito_edit_reference" view helper has been removed.
22
+ Please use the "scrivito_tag" helper instead.
23
+ "scrivito_tag" now activates the reference editor by default for all reference attributes.
24
+ }
25
+ end
26
+
27
+ def scrivito_edit_referencelist(object, attribute_name, html_options = {}, editing_options = {})
28
+ raise %{
29
+ The "scrivito_edit_referencelist" view helper has been removed.
30
+ Please use the "scrivito_tag" helper instead.
31
+ "scrivito_tag" now activates the referencelist editor by default for all referencelist
32
+ attributes.
33
+ }
34
+ end
35
+
36
+ def scrivito_edit_link(object, attribute_name, html_options = {}, editing_options = {})
37
+ raise %{
38
+ The "scrivito_edit_link" view helper has been removed.
39
+ Please use the "scrivito_tag" helper instead.
40
+ "scrivito_tag" now activates the link editor by default for all link attributes.
41
+ }
42
+ end
43
+
44
+ def scrivito_edit_linklist(object, attribute_name, html_options = {}, editing_options = {})
45
+ raise %{
46
+ The "scrivito_edit_linklist" view helper has been removed.
47
+ Please use the "scrivito_tag" helper instead.
48
+ "scrivito_tag" now activates the linklist editor by default for all linklist attributes.
49
+ }
145
50
  end
146
51
  end
147
52
  end
@@ -6,7 +6,6 @@ module ScrivitoEditors
6
6
  isolate_namespace ScrivitoEditors
7
7
 
8
8
  initializer "scrivito_editors.scrivito_tag_helper" do
9
- ActionView::Base.send :include, CmsTagHelper
10
9
  ActionView::Base.send :include, ScrivitoTagHelper
11
10
  end
12
11