scrivito_editors 0.65.2 → 0.66.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bffe1f32ebdd4464332854c6f67d013f00446684
4
- data.tar.gz: 90441a854af2de652b9632e9e7ffcf395b45b864
3
+ metadata.gz: bc477c2e6090499886b031af001f3a130d319324
4
+ data.tar.gz: f32c5368bd71c2afb30aa774141ffbabaa426677
5
5
  SHA512:
6
- metadata.gz: dfdb048fb70e226ca98480e5aff620266a7c512edd0e53b7e1ac3af94e4d287e61c797c4efc561c2d3e63a7f3b98a768987b80d7366aa9cf113ef25a76a9e293
7
- data.tar.gz: 397fb96b61ef6912e37205d73c16fb308b53beb6e504bcf7d5a05aee3a4d07d0192756cad69392c7c44f61e08ef89e62703c6ef9d7dd08ff8bfa0372e965fb47
6
+ metadata.gz: d1f507b5b3e64343e7966928a5dcf18e5535c9d4e37a861bc1668893896b406ecff961f56afca57321c6f64ad83702dd78d00a8e60abfbb0035f59057e9c9cdd
7
+ data.tar.gz: 84351750e70d266d2cca66fa927d2cf77968c28dbf3eee0462dd2c06e9051b288e5dfcad19bd472ecb877c4b1ad6c2c54cecd07cd4a1505b64fa70936fd6238d
@@ -0,0 +1,26 @@
1
+ $ ->
2
+ # Merge data-filter-context-* into data('filterContext') for relevant CMS attributes.
3
+ # Editors will then be able to pass data('filterContext') to content_browser.open()
4
+
5
+ extendDeepData = (data, prefix) ->
6
+ for own key, value of data when key.search(prefix) == 0
7
+ path = key.match(///([A-Z]|^#{prefix})[^A-Z]*///g)
8
+ if path[0] == prefix
9
+ value = {"#{name.toLowerCase()}": value} for name in path[1..].reverse()
10
+ $.extend(true, data, "#{prefix}": value)
11
+
12
+ mergeFilterContexts = ->
13
+ cmsFields = $("""
14
+ [data-scrivito-field-type][data-filter-context],
15
+ [data-scrivito-field-type^="html"],
16
+ [data-scrivito-field-type^="link"],
17
+ [data-scrivito-field-type^="reference"]
18
+ """)
19
+
20
+ cmsFields.each ->
21
+ cmsField = $(@)
22
+ data = cmsField.data()
23
+ extendDeepData(data, 'filterContext')
24
+
25
+ scrivito.on 'content', ->
26
+ mergeFilterContexts() if scrivito.in_editable_view()
@@ -15,7 +15,5 @@ save = (field, file) ->
15
15
  field.scrivito('save', value).then -> field.scrivito('reload')
16
16
 
17
17
  createImage = (blob) ->
18
- name = blob.name.replace(/[^a-z0-9_.$\-]/ig, '-')
19
- _path = "_resources/#{Math.floor(Math.random() * 1000)}/#{name}"
20
18
  _obj_class = 'Image'
21
- scrivito.create_obj {blob, _path, _obj_class}
19
+ scrivito.create_obj {blob, _obj_class}
@@ -49,13 +49,15 @@ $ ->
49
49
 
50
50
  linkItem = $(event.currentTarget).closest('li')
51
51
  cmsField = getCmsField(linkItem)
52
- filters = cmsField.data('filters') || cmsField.data('filter')
52
+ filters = cmsField.data('filters')
53
+ filterContext = cmsField.data('filterContext')
53
54
  id = linkItem.data('id')
54
55
  selection = if id then [id] else []
55
56
 
56
57
  scrivito.content_browser.open
57
58
  selection: selection
58
59
  filters: filters
60
+ filter_context: filterContext
59
61
  selection_mode: 'single'
60
62
  .done (selection) =>
61
63
  onContentBrowserSaveLinkItem(selection, linkItem)
@@ -55,13 +55,15 @@ $ ->
55
55
 
56
56
  linkItem = $(event.currentTarget).closest('li')
57
57
  cmsField = getCmsField(linkItem)
58
- filters = cmsField.data('filters') || cmsField.data('filter')
58
+ filters = cmsField.data('filters')
59
+ filterContext = cmsField.data('filterContext')
59
60
  id = linkItem.data('id')
60
61
  selection = if id then [id] else []
61
62
 
62
63
  scrivito.content_browser.open
63
64
  selection: selection
64
65
  filters: filters
66
+ filter_context: filterContext
65
67
  selection_mode: 'single'
66
68
  .done (selection) =>
67
69
  onContentBrowserSaveLinkItem(selection, linkItem)
@@ -6,7 +6,11 @@ $ ->
6
6
  @modal.addCallback 'image', self.browse
7
7
 
8
8
  browse: ->
9
+ filterContext = $.extend {_image: true}, @$element.data('filterContext')
10
+
9
11
  scrivito.content_browser.open
12
+ filter: @$element.data('filter')
13
+ filter_context: filterContext
10
14
  selection_mode: 'single'
11
15
  .done (selection) =>
12
16
  id = selection[0]
@@ -27,6 +27,8 @@ $ ->
27
27
 
28
28
  browse: ->
29
29
  scrivito.content_browser.open
30
+ filter: @$element.data('filter')
31
+ filter_context: @$element.data('filterContext')
30
32
  selection: self.getObjIds()
31
33
  selection_mode: 'single'
32
34
  .done (selection) =>
@@ -8,12 +8,14 @@ $ ->
8
8
 
9
9
  cmsField = $(event.currentTarget)
10
10
  selected = [cmsField.scrivito('content')].filter (element) -> element
11
- filters = cmsField.data('filters') || cmsField.data('filter')
11
+ filters = cmsField.data('filters')
12
+ filterContext = $.extend {_image: cmsField.is('img')}, cmsField.data('filterContext')
12
13
 
13
14
  # Open content browser with current reference selected.
14
15
  scrivito.content_browser.open
15
- selection: selected
16
16
  filters: filters
17
+ filter_context: filterContext
18
+ selection: selected
17
19
  selection_mode: 'single'
18
20
 
19
21
  .done (selection) =>
@@ -43,10 +43,12 @@ $ ->
43
43
  event.preventDefault()
44
44
 
45
45
  cmsField = getCmsField($(event.currentTarget))
46
- filters = cmsField.data('filters') || cmsField.data('filter')
46
+ filters = cmsField.data('filters')
47
+ filterContext = cmsField.data('filterContext')
47
48
 
48
49
  scrivito.content_browser.open
49
50
  filters: filters
51
+ filter_context: filterContext
50
52
  .done (selection) =>
51
53
  ids = getIds(cmsField).concat(selection)
52
54
  save(ids, cmsField)
@@ -126,12 +126,7 @@ module ScrivitoEditors
126
126
  private
127
127
 
128
128
  def _values_for(object, attribute_name)
129
- if object.obj_class
130
- # pre migration fallback
131
- object.obj_class.attributes[attribute_name].try(:values) || []
132
- else
133
- object.attribute_definitions[attribute_name].try(:values) || []
134
- end
129
+ object.attribute_definitions[attribute_name].try(:values) || []
135
130
  end
136
131
 
137
132
  def _edit_link_li(link)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrivito_editors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.65.2
4
+ version: 0.66.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scrivito
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: coffee-script-source
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.9.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 1.9.1
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: jquery-ui-rails
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,28 +72,28 @@ dependencies:
58
72
  requirements:
59
73
  - - '='
60
74
  - !ruby/object:Gem::Version
61
- version: 0.65.2
75
+ version: 0.66.0.rc1
62
76
  type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - '='
67
81
  - !ruby/object:Gem::Version
68
- version: 0.65.2
82
+ version: 0.66.0.rc1
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: scrivito_sdk
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - '='
74
88
  - !ruby/object:Gem::Version
75
- version: 0.65.2
89
+ version: 0.66.0.rc1
76
90
  type: :runtime
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - '='
81
95
  - !ruby/object:Gem::Version
82
- version: 0.65.2
96
+ version: 0.66.0.rc1
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: pry
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -129,7 +143,6 @@ executables: []
129
143
  extensions: []
130
144
  extra_rdoc_files: []
131
145
  files:
132
- - CHANGELOG.md
133
146
  - LICENSE
134
147
  - README.md
135
148
  - Rakefile
@@ -142,6 +155,7 @@ files:
142
155
  - app/assets/javascripts/scrivito_editors/binary_editor.js.coffee
143
156
  - app/assets/javascripts/scrivito_editors/date_editor.js.coffee
144
157
  - app/assets/javascripts/scrivito_editors/enum_editor.js.coffee
158
+ - app/assets/javascripts/scrivito_editors/filter_context.js.coffee
145
159
  - app/assets/javascripts/scrivito_editors/helpers/file_dropzone.js.coffee
146
160
  - app/assets/javascripts/scrivito_editors/html_editor.js.coffee
147
161
  - app/assets/javascripts/scrivito_editors/image_editor.js.coffee
@@ -1,150 +0,0 @@
1
- # v0.50.0
2
- * When using the HTML editor, you can now insert an image by browsing.
3
- * When using the HTML editor, you can now browse content when inserting a link.
4
-
5
- # v0.42.0
6
- * Resolved: Link and linklist editors remember selected item when re-opening the content browser.
7
- * Resolved: Link editor works on empty links, too.
8
- * Resolved: Internal links with fragments no longer lose the fragment when re-editing.
9
-
10
- # v0.41.0
11
- * Link and linklist editors initially show description for editor (for internal links).
12
-
13
- # v0.40.0
14
- * Updated HTML editor to Redactor 10.0.6
15
- * Introduced API for Redactor options, e. g.
16
- `scrivito.editors.html_editor.redactor.options = { buttonSource: true }`
17
- * Resolved: Markup will now stay unchanged when the editor is closed without editing.
18
- * Resolved: Cursor will now appear at the point of clicking, if possible. Otherwise at the end.
19
- * Resolved: Link editor shows current selection when opening the content browser.
20
-
21
- # v0.30.1
22
- * Resolved issue: Date editor keeps time when editing
23
- * Resolved issue: Date editor saves without NaN errors in Safari and Firefox
24
- * Resolved issue: text editor on Chrome keeps line breaks when leaving the editor
25
-
26
- # v0.30.0
27
- * Compatibility with https://rubygems.org/gems/scrivito 0.30.0
28
- * Scrivito editors no longer provide icon font support. We recommend to use screenshots or an
29
- open font CSS library when migrating thumbnail views to the SDK's `scrivito_thumbnail` helper.
30
-
31
- # v0.1.0
32
- * Changed dependency to `scrivito_content_browser` due to gem renaming
33
- * Removed deprecated content browser API calls, use new API
34
- * See your app's JS console for hints and deprecation warnings
35
-
36
- # v0.0.16
37
- * Bugfix: added a missing constant in text editor
38
- * Introduced `ScrivitoTagHelper` for upcoming Scrivito SDK releases
39
- (`CmsTagHelper` is still available for compatibility with older releases)
40
-
41
- # v0.0.15
42
- * Reduce unwanted `nbsp` in HTML editor
43
- * Resolved issues in string and text editor
44
- * Experimental feature: double clicking editable link texts follow the link
45
-
46
- # v0.0.14
47
- * Added the `CmsTagHelper` module containing methods that are needed to render the html for
48
- certain editors.
49
- You can now safely delete `editing_helper.rb` generated by Scrivito Kickstarter.
50
- Kickstarter will still generate this file, while we are in the process of providing you
51
- with alternative ways to get you going without the need for Kickstarter.
52
- (Keep an eye on https://github.com/infopark/scrivito_example and upcoming Scrivito SDK releases)
53
- * Tuned Redactor settings to make the HTML editor less intrusive
54
- * Corrected the `jquery-rails` gem version dependency
55
- * Solved various editor related issues
56
-
57
- # v0.0.13
58
- * Added `autosave` option to the string editor to prevent that on every input the content is saved
59
- to the CMS. This is useful when setting a permalink for example, where intermediate strings
60
- would trigger an error. When `data-autosave` is set to `false`, then only `enter` and the `blur`
61
- event will save the string to the CMS.
62
- * Added editor for new attribute type `link`. It lets you set the title and url of the link,
63
- similar to how a linklist is edited. It can also handle an empty url, which effectively deletes
64
- the link.
65
- * Allow to select multiple editors on one cms field. You can now use
66
- `data-editor="reference image"` for example, to activate both editors.
67
- * Added image upload editor, that allows to drag & drop an image on an existing image. This
68
- functionality was moved out of the Scrivito SDK.
69
- * Updated Redactor to version 9.2.5.
70
- * Removed unused `jQuery.center` addon.
71
- * We separated the jQuery addons from the core editors functionality, which allows to only require
72
- one, but not the other. Use `//= require 'scrivito_editors'` to require both,
73
- `//= require 'scrivito_editors_core'` to only include the editor but not the addons and use
74
- `//= require 'scrivito_addons'` if you only want the addons. (Thanks @cedrics)
75
-
76
- # v0.0.12
77
- * Rails no longer supports the `vendor` directory, so we moved the assets into the standard asset
78
- folder, so that they are integrated into the asset pipeline automatically.
79
- * Integrate new Scrivito SDK JavaScript events.
80
- * Editing `enum` and `multienum` fields no longer triggers a page or widget reload.
81
-
82
- # v0.0.11
83
- * Added "Close" button to the HTML editor, to have an additional option to close the editor,
84
- besides hitting "Esc".
85
- * The new Scrivito SDK feature to serialize save requests allows editors to automatically save the
86
- content on every input instead of every 3 seconds. The `string`, `text` and `html` editor now
87
- all make use of this feature.
88
- * The "Esc" key on `string`, `text` and `html` editors now just destroys the editor, without
89
- resetting to any old content.
90
- * All editors now trigger a `save.scrivito_editors` event, when the content was successfully
91
- saved in the CMS.
92
- * `string` and `text` editors now only save, if the content has changed, as it is already
93
- the case for the `html` editor.
94
- * `referencelist` and `linklist` editors now make use of the new single selection mode option of
95
- the resource browser.
96
-
97
- # v0.0.10
98
- * Extracted resource browser into separate gem.
99
-
100
- # v0.0.9
101
- * Bugfix: It is now possible to have multiple string and text editors active at the same time.
102
-
103
- # v0.0.8
104
- * Use Twitter Bootstrap styling for enum and multienum select fields.
105
-
106
- # v0.0.7
107
- * Linklist and referencelist editors now better handle all aspects of the inplace editing process
108
- for these two attributes. The "add" button no longer has to be rendered by the application code.
109
- The styling of both editors was also improved to make it more user friendly.
110
- * Resourcebrowser: Thumbnails only display an image, if the object defines a `image?` method, that
111
- returns `true`, otherwise a generic icon is rendered.
112
- * Bugfix: The string and text editor now also save correctly, when highlighting and editing the
113
- content without triggering a `click` event.
114
- * Bugfix: The placeholder now also works for attributes, that have been cleared without triggering
115
- a reload of the page afterwards. (Thanks @gertimon)
116
- * Bugfix: The default placeholder text for empty CMS attributes only used the name of the first
117
- attribute on the page, instead of the correct field name for each CMS attribute.
118
-
119
- # v0.0.6
120
- * Rewrite of string and text editor to better support pasting HTML, correctly handling quotes,
121
- inserting the carrot at the correct position and better multiline support for preformatted text
122
- fields. (Thanks @dcsaszar)
123
- * Bugfix: Using renamed `obj_class_name` method from the new Scrivito SDK instead of `obj_class`.
124
- * Changed the behavior when an item is clicked in the resource browser. Instead of opening the
125
- inspector, the item is now selected or deselected. A small magnifying glass in the upper right
126
- corner of the thumbnail now allows to open the inspector for the item.
127
- * Rename the fallback inspector view to `details.html`, to be consistent to the new Scrivito SDK.
128
-
129
- # v0.0.5
130
- * The template used in the inspector is no longer configurable and always corresponds to the
131
- details view used by the Scrivito SDK.
132
- * Bugfix: The resource browser did not use a correct start index to render multiple thumbnails.
133
-
134
- # v0.0.4
135
- * Bugfix: Resourcebrowser buttons now also work in Chrome browser.
136
-
137
- # v0.0.3
138
- * Updated redactor to version 9.2.1 and removed all custom settings.
139
- * Added option `data-reload` to the string editor to configure if a reload event should
140
- be triggered or not after saving the changes. (Thanks @apepper)
141
-
142
- # v0.0.2
143
- * Added placeholder text to empty CMS attributes.
144
-
145
- # v0.0.1
146
- * Updated html editor seperator height from 29px to 27px.
147
- * Updated the README to describe the new gem.
148
- * Added editing icons used in some of the editors and the resource browser.
149
- * Removed the saving animation for editors to not disturb the in-place editing
150
- experience.