scrivito_editors 0.0.16 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +2 -31
- data/app/assets/javascripts/scrivito_editors/image_editor.js.coffee +15 -16
- data/app/assets/javascripts/scrivito_editors/link_editor.js.coffee +8 -8
- data/app/assets/javascripts/scrivito_editors/linklist_editor.js.coffee +9 -9
- data/app/assets/javascripts/scrivito_editors/reference_editor.js.coffee +7 -7
- data/app/assets/javascripts/scrivito_editors/referencelist_editor.js.coffee +9 -10
- data/app/assets/javascripts/scrivito_editors_core.js +1 -1
- data/app/assets/stylesheets/scrivito_editors.css +1 -1
- data/app/assets/stylesheets/scrivito_editors/buttons.css +1 -1
- data/app/assets/stylesheets/scrivito_editors/editors/linklist_editor.css +1 -1
- data/lib/scrivito_editors/engine.rb +3 -2
- data/lib/scrivito_editors/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d1fad0bd2f61f1a4ca7360163cdd9786be89c6f
|
4
|
+
data.tar.gz: ccb27b9ef5d94ab65350b3bfcd7d42256c994d2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7eb183eada8a9582448bfaaa1d8b6243f5f049eb3fbcb8898d6276262ce612bc3f05bd72024b44b29009d2699e740b2f4a1ccf7a0cab507c1e751a4f65af6c9f
|
7
|
+
data.tar.gz: fa1887e7d224be0f6d8335f4cfeac040782b2ea035689cfa22b2ce09b85a8dd7e5672a6a7b6b4a09a2f8e047cd40223849acc906ca2047b5b3357c5b37b6eca6
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# v0.1.0
|
2
|
+
* Changed dependency to `scrivito_content_browser` due to gem renaming
|
3
|
+
* Removed deprecated content browser API calls, use new API
|
4
|
+
* See your app's JS console for hints and deprecation warnings
|
5
|
+
|
1
6
|
# v0.0.16
|
2
7
|
* Bugfix: added a missing constant in text editor
|
3
8
|
* Introduced `ScrivitoTagHelper` for upcoming Scrivito SDK releases
|
data/README.md
CHANGED
@@ -1,14 +1,11 @@
|
|
1
1
|
# Scrivito Editors
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/scrivito_editors.png)](http://badge.fury.io/rb/scrivito_editors)
|
4
|
-
[![Code Climate](https://codeclimate.com/github/infopark/scrivito_editors.png)](https://codeclimate.com/github/infopark/scrivito_editors)
|
5
|
-
[![Dependency Status](https://gemnasium.com/infopark/scrivito_editors.png)](https://gemnasium.com/infopark/scrivito_editors)
|
6
|
-
[![Build Status](https://travis-ci.org/infopark/scrivito_editors.png)](https://travis-ci.org/infopark/scrivito_editors)
|
7
4
|
|
8
5
|
The [Scrivito](http://scrivito.com) Editors gem is a collection of useful standard
|
9
6
|
JavaScript editors based on the Scrivito SDK. The editors allow to edit all CMS
|
10
7
|
attributes in place and provide helper for the property view of pages and
|
11
|
-
widgets. A
|
8
|
+
widgets. A content browser comes with the gem, to add, update and delete
|
12
9
|
resources.
|
13
10
|
|
14
11
|
## Installation and Usage
|
@@ -19,33 +16,7 @@ Please visit our Documentation to get the
|
|
19
16
|
|
20
17
|
## Changelog
|
21
18
|
|
22
|
-
|
23
|
-
details.
|
24
|
-
|
25
|
-
|
26
|
-
## Contributing
|
27
|
-
|
28
|
-
We would be very happy and thankful if you open new issues in order to further improve Scrivito
|
29
|
-
Editors. If you want to go a step further and extend the functionality or fix a problem, you can
|
30
|
-
do so any time by following the steps below.
|
31
|
-
|
32
|
-
1. Fork and clone the
|
33
|
-
[Scrivito Editors GitHub repository](https://github.com/infopark/scrivito_editors).
|
34
|
-
|
35
|
-
git clone git@github.com:_username_/scrivito_editors.git
|
36
|
-
cd scrivito_editors
|
37
|
-
|
38
|
-
2. We suggest using [rbenv](https://github.com/sstephenson/rbenv/) for managing your local Ruby
|
39
|
-
version. Make sure to use at least Ruby version 2.0.
|
40
|
-
|
41
|
-
ruby --version
|
42
|
-
|
43
|
-
3. Create your feature branch and create a pull request for the `develop` branch. Please take a
|
44
|
-
look at the already existing generators and rake tasks to get an impression of our coding style
|
45
|
-
and the general architecture.
|
46
|
-
|
47
|
-
4. We are using the [GitHub Styleguides](https://github.com/styleguide) and would prefer if you
|
48
|
-
could stick to it.
|
19
|
+
{include:file:CHANGELOG.md}
|
49
20
|
|
50
21
|
|
51
22
|
## License
|
@@ -1,20 +1,4 @@
|
|
1
1
|
$ ->
|
2
|
-
# Integrates an image drag & drop editor.
|
3
|
-
|
4
|
-
scrivito.on 'load', ->
|
5
|
-
if scrivito.in_editable_view()
|
6
|
-
# Activate the image editor for all supported field types.
|
7
|
-
activateForFieldType('linklist')
|
8
|
-
activateForFieldType('reference')
|
9
|
-
|
10
|
-
# Activate the image editor if it is explicitely selected.
|
11
|
-
activateForSelector('[data-editor~="image"]')
|
12
|
-
|
13
|
-
# Disable DnD for all elements by default to prevent the user
|
14
|
-
# from accidentally opening an image in browser.
|
15
|
-
$('body').on 'dragover', -> false
|
16
|
-
$('body').on 'drop', -> false
|
17
|
-
|
18
2
|
statusIndicatorClass = 'image-editor-dragover'
|
19
3
|
|
20
4
|
activateForFieldType = (fieldType) ->
|
@@ -70,3 +54,18 @@ $ ->
|
|
70
54
|
blob: file
|
71
55
|
_path: path
|
72
56
|
_obj_class: 'Image'
|
57
|
+
|
58
|
+
# Integrates an image drag & drop editor.
|
59
|
+
scrivito.on 'load', ->
|
60
|
+
if scrivito.in_editable_view()
|
61
|
+
# Activate the image editor for all supported field types.
|
62
|
+
activateForFieldType('linklist')
|
63
|
+
activateForFieldType('reference')
|
64
|
+
|
65
|
+
# Activate the image editor if it is explicitely selected.
|
66
|
+
activateForSelector('[data-editor~="image"]')
|
67
|
+
|
68
|
+
# Disable DnD for all elements by default to prevent the user
|
69
|
+
# from accidentally opening an image in browser.
|
70
|
+
$('body').on 'dragover', -> false
|
71
|
+
$('body').on 'drop', -> false
|
@@ -13,12 +13,12 @@ $ ->
|
|
13
13
|
<input type=\"text\" name=\"title\" value=\"#{title}\" placeholder=\"Title\" />
|
14
14
|
<input type=\"text\" name=\"url\" value=\"#{url}\" placeholder=\"Url\" class=\"editing-url\" />
|
15
15
|
<div class=\"actions\">
|
16
|
-
<a href=\"#\" class=\"editing-button
|
16
|
+
<a href=\"#\" class=\"editing-button content-browser-open editing-green\">
|
17
17
|
<i class=\"editing-icon editing-icon-search\" />
|
18
18
|
</a>
|
19
19
|
</div></li></ul>")
|
20
20
|
|
21
|
-
|
21
|
+
contentBrowserButtonTemplate = ->
|
22
22
|
icon = $('<i></i>')
|
23
23
|
.addClass('editing-icon')
|
24
24
|
.addClass('editing-icon-plus')
|
@@ -43,22 +43,22 @@ $ ->
|
|
43
43
|
cmsField.trigger('save.scrivito_editors')
|
44
44
|
|
45
45
|
# Run when clicking the '...' button inside a li.
|
46
|
-
|
46
|
+
onOpenContentBrowser = (event) ->
|
47
47
|
event.preventDefault()
|
48
48
|
|
49
49
|
linkItem = $(event.currentTarget).closest('li')
|
50
50
|
cmsField = getCmsField(linkItem)
|
51
51
|
filters = cmsField.data('filters') || cmsField.data('filter')
|
52
52
|
|
53
|
-
|
53
|
+
scrivito.content_browser.open
|
54
54
|
selection: []
|
55
55
|
filters: filters
|
56
56
|
selectionMode: 'single'
|
57
|
-
|
58
|
-
|
57
|
+
.done (selection) =>
|
58
|
+
onContentBrowserSaveLinkItem(selection, linkItem)
|
59
59
|
|
60
60
|
# Resource browser callback for saving a single link.
|
61
|
-
|
61
|
+
onContentBrowserSaveLinkItem = (selection, linkItem) ->
|
62
62
|
url = buildUrl(selection[0])
|
63
63
|
linkItem.find('[name=url]').val(url)
|
64
64
|
|
@@ -117,7 +117,7 @@ $ ->
|
|
117
117
|
transformLinks(linkElements)
|
118
118
|
|
119
119
|
linkElements.on 'blur', 'li input', onBlur
|
120
|
-
linkElements.on 'click', 'a.
|
120
|
+
linkElements.on 'click', 'a.content-browser-open', onOpenContentBrowser
|
121
121
|
|
122
122
|
# Initialize link editor and setup event callbacks.
|
123
123
|
scrivito.on 'content', (root) ->
|
@@ -12,7 +12,7 @@ $ ->
|
|
12
12
|
$("<input type=\"text\" name=\"title\" value=\"#{title}\" placeholder=\"Title\" />
|
13
13
|
<input type=\"text\" name=\"url\" value=\"#{url}\" placeholder=\"Url\" class=\"editing-url\" />
|
14
14
|
<div class=\"actions\">
|
15
|
-
<a href=\"#\" class=\"editing-button
|
15
|
+
<a href=\"#\" class=\"editing-button content-browser-open editing-green\">
|
16
16
|
<i class=\"editing-icon editing-icon-search\" />
|
17
17
|
</a>
|
18
18
|
<a href=\"#\" class=\"editing-button editing-red delete\">
|
@@ -20,7 +20,7 @@ $ ->
|
|
20
20
|
</a>
|
21
21
|
</div>")
|
22
22
|
|
23
|
-
|
23
|
+
contentBrowserButtonTemplate = ->
|
24
24
|
icon = $('<i></i>')
|
25
25
|
.addClass('editing-icon')
|
26
26
|
.addClass('editing-icon-plus')
|
@@ -48,22 +48,22 @@ $ ->
|
|
48
48
|
storeLastSaved(cmsField, value)
|
49
49
|
|
50
50
|
# Run when clicking the '...' button inside a li.
|
51
|
-
|
51
|
+
onOpenContentBrowser = (event) ->
|
52
52
|
event.preventDefault()
|
53
53
|
|
54
54
|
linkItem = $(event.currentTarget).closest('li')
|
55
55
|
cmsField = getCmsField(linkItem)
|
56
56
|
filters = cmsField.data('filters') || cmsField.data('filter')
|
57
57
|
|
58
|
-
|
58
|
+
scrivito.content_browser.open
|
59
59
|
selection: []
|
60
60
|
filters: filters
|
61
61
|
selectionMode: 'single'
|
62
|
-
|
63
|
-
|
62
|
+
.done (selection) =>
|
63
|
+
onContentBrowserSaveLinkItem(selection, linkItem)
|
64
64
|
|
65
65
|
# Resource browser callback for saving a single link.
|
66
|
-
|
66
|
+
onContentBrowserSaveLinkItem = (selection, linkItem) ->
|
67
67
|
url = buildUrl(selection[0])
|
68
68
|
linkItem.find('[name=url]').val(url)
|
69
69
|
|
@@ -123,7 +123,7 @@ $ ->
|
|
123
123
|
|
124
124
|
# Turns the server side generated linklist data into the linklist editor using a template.
|
125
125
|
transformLinks = (cmsFields) ->
|
126
|
-
cmsFields.append(
|
126
|
+
cmsFields.append(contentBrowserButtonTemplate)
|
127
127
|
|
128
128
|
items = cmsFields.find('li')
|
129
129
|
|
@@ -162,7 +162,7 @@ $ ->
|
|
162
162
|
linklistElements.on 'blur', 'li input', onBlur
|
163
163
|
linklistElements.on 'click', 'li a.delete', removeLink
|
164
164
|
linklistElements.on 'click', 'button.add-link', addLink
|
165
|
-
linklistElements.on 'click', 'a.
|
165
|
+
linklistElements.on 'click', 'a.content-browser-open', onOpenContentBrowser
|
166
166
|
|
167
167
|
linklistElements.find('ul').sortable
|
168
168
|
update: (event) ->
|
@@ -1,5 +1,5 @@
|
|
1
1
|
$ ->
|
2
|
-
# Integrates a
|
2
|
+
# Integrates a content browser based editor for reference CMS attributes.
|
3
3
|
|
4
4
|
scrivito.on 'load', ->
|
5
5
|
if scrivito.in_editable_view()
|
@@ -10,17 +10,17 @@ $ ->
|
|
10
10
|
selected = [cmsField.scrivito('content')].filter (element) -> element
|
11
11
|
filters = cmsField.data('filters') || cmsField.data('filter')
|
12
12
|
|
13
|
-
# Open
|
14
|
-
|
13
|
+
# Open content browser with current reference selected.
|
14
|
+
scrivito.content_browser.open
|
15
15
|
selection: selected
|
16
16
|
filters: filters
|
17
17
|
selectionMode: 'single'
|
18
18
|
|
19
|
-
|
20
|
-
|
19
|
+
.done (selection) =>
|
20
|
+
onContentBrowserSave(selection, cmsField)
|
21
21
|
|
22
|
-
# Save single reference when
|
23
|
-
|
22
|
+
# Save single reference when content browser calls "save".
|
23
|
+
onContentBrowserSave = (selection, cmsField) ->
|
24
24
|
value = selection[0] || null
|
25
25
|
|
26
26
|
cmsField.scrivito('save', value)
|
@@ -10,7 +10,7 @@ $ ->
|
|
10
10
|
</a>
|
11
11
|
</div>")
|
12
12
|
|
13
|
-
|
13
|
+
contentBrowserButtonTemplate = ->
|
14
14
|
icon = $('<i></i>')
|
15
15
|
.addClass('editing-icon')
|
16
16
|
.addClass('editing-icon-plus')
|
@@ -18,7 +18,7 @@ $ ->
|
|
18
18
|
button = $('<button></button>')
|
19
19
|
.addClass('editing-button')
|
20
20
|
.addClass('editing-green')
|
21
|
-
.addClass('
|
21
|
+
.addClass('content-browser-open')
|
22
22
|
.html(icon)
|
23
23
|
|
24
24
|
button
|
@@ -38,20 +38,19 @@ $ ->
|
|
38
38
|
cmsField.trigger('save.scrivito_editors')
|
39
39
|
cmsField.trigger('scrivito_reload')
|
40
40
|
|
41
|
-
# Run when clicking the
|
42
|
-
|
41
|
+
# Run when clicking the content browser button.
|
42
|
+
onContentBrowserOpen = (event) ->
|
43
43
|
event.preventDefault()
|
44
44
|
|
45
45
|
cmsField = getCmsField($(event.currentTarget))
|
46
46
|
filters = cmsField.data('filters') || cmsField.data('filter')
|
47
47
|
ids = getIds(cmsField)
|
48
48
|
|
49
|
-
|
49
|
+
scrivito.content_browser.open
|
50
50
|
selection: ids
|
51
51
|
filters: filters
|
52
|
-
|
53
|
-
|
54
|
-
save(selection, cmsField)
|
52
|
+
.done (selection) =>
|
53
|
+
save(selection, cmsField)
|
55
54
|
|
56
55
|
# Collects all reference ids for a given referencelist.
|
57
56
|
getIds = (cmsField) ->
|
@@ -75,7 +74,7 @@ $ ->
|
|
75
74
|
|
76
75
|
# Turns the server side generated referencelist data into the reference editor using a template.
|
77
76
|
transform = (elements) ->
|
78
|
-
elements.append(
|
77
|
+
elements.append(contentBrowserButtonTemplate)
|
79
78
|
|
80
79
|
items = elements.find('li')
|
81
80
|
|
@@ -103,7 +102,7 @@ $ ->
|
|
103
102
|
storeLastSaved(element, ids)
|
104
103
|
|
105
104
|
elements.on 'click', 'li a.delete', remove
|
106
|
-
elements.on 'click', 'button.
|
105
|
+
elements.on 'click', 'button.content-browser-open', onContentBrowserOpen
|
107
106
|
|
108
107
|
elements.find('ul').sortable
|
109
108
|
update: (event) ->
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/*
|
2
2
|
Defines various button styles used throughout the inplace editing GUI. Button styles are not
|
3
3
|
bound to one particular inplace editing feature, but are shared accross the menubar, the
|
4
|
-
|
4
|
+
content browser or on edit views.
|
5
5
|
*/
|
6
6
|
|
7
7
|
.editing-button {
|
@@ -44,7 +44,7 @@
|
|
44
44
|
float: right;
|
45
45
|
}
|
46
46
|
|
47
|
-
[data-scrivito-field-type="linklist"] ul li .actions .editing-button.
|
47
|
+
[data-scrivito-field-type="linklist"] ul li .actions .editing-button.content-browser-open {
|
48
48
|
}
|
49
49
|
|
50
50
|
[data-scrivito-display-mode="editing"] [data-scrivito-field-type="linklist"] ul li {
|
@@ -1,12 +1,13 @@
|
|
1
1
|
require 'jquery-ui-rails'
|
2
|
-
require '
|
2
|
+
require 'scrivito_content_browser'
|
3
3
|
|
4
4
|
module ScrivitoEditors
|
5
5
|
class Engine < ::Rails::Engine
|
6
6
|
isolate_namespace ScrivitoEditors
|
7
7
|
|
8
|
-
initializer "scrivito_editors.
|
8
|
+
initializer "scrivito_editors.scrivito_tag_helper" do
|
9
9
|
ActionView::Base.send :include, CmsTagHelper
|
10
|
+
ActionView::Base.send :include, ScrivitoTagHelper
|
10
11
|
end
|
11
12
|
end
|
12
13
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scrivito_editors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scrivito
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: scrivito_content_browser
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|