scrivito_editors 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -5
- data/README.md +1 -1
- data/Rakefile +0 -5
- data/app/assets/javascripts/scrivito_editors.js +1 -0
- data/app/assets/javascripts/scrivito_editors/linklist_editor.js.coffee +9 -9
- data/app/assets/javascripts/scrivito_editors/reference_editor.js.coffee +6 -6
- data/app/assets/javascripts/scrivito_editors/referencelist_editor.js.coffee +7 -7
- data/app/assets/stylesheets/scrivito_editors.css +1 -0
- data/app/assets/stylesheets/scrivito_editors/buttons.css +1 -1
- data/lib/scrivito_editors/engine.rb +1 -0
- data/lib/scrivito_editors/version.rb +1 -1
- metadata +6 -82
- data/app/assets/javascripts/mediabrowser/inspector.js.coffee +0 -65
- data/app/assets/javascripts/mediabrowser/mediabrowser.js.coffee +0 -420
- data/app/assets/javascripts/mediabrowser/uploader.js.coffee +0 -132
- data/app/assets/stylesheets/scrivito_editors/mediabrowser.css +0 -1010
- data/app/controllers/scrivito_editors/mediabrowser_controller.rb +0 -36
- data/app/views/layouts/scrivito_editors/mediabrowser/inspector.html.erb +0 -11
- data/app/views/scrivito_editors/mediabrowser/_buttons.html.erb +0 -16
- data/app/views/scrivito_editors/mediabrowser/_header.html.erb +0 -25
- data/app/views/scrivito_editors/mediabrowser/modal.html.erb +0 -12
- data/app/views/scrivito_editors/obj/details.html +0 -5
- data/config/initializers/mediabrowser.rb +0 -13
- data/config/routes.rb +0 -5
- data/spec/dummy/README.rdoc +0 -28
- data/spec/dummy/Rakefile +0 -6
- data/spec/dummy/app/assets/javascripts/application.js +0 -13
- data/spec/dummy/app/assets/stylesheets/application.css +0 -13
- data/spec/dummy/app/controllers/application_controller.rb +0 -5
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/dummy/bin/bundle +0 -3
- data/spec/dummy/bin/rails +0 -4
- data/spec/dummy/bin/rake +0 -4
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/config/application.rb +0 -23
- data/spec/dummy/config/boot.rb +0 -5
- data/spec/dummy/config/database.yml +0 -25
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -29
- data/spec/dummy/config/environments/production.rb +0 -80
- data/spec/dummy/config/environments/test.rb +0 -36
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/dummy/config/initializers/inflections.rb +0 -16
- data/spec/dummy/config/initializers/mime_types.rb +0 -5
- data/spec/dummy/config/initializers/secret_token.rb +0 -12
- data/spec/dummy/config/initializers/session_store.rb +0 -3
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/en.yml +0 -23
- data/spec/dummy/config/routes.rb +0 -4
- data/spec/dummy/public/404.html +0 -58
- data/spec/dummy/public/422.html +0 -58
- data/spec/dummy/public/500.html +0 -57
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/spec_helper.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c08476ab0a102e46e91e58ad43e617a3ee6ff3b2
|
4
|
+
data.tar.gz: f07ebb84641bd5244c695d25010c3fda9ce99501
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ee789cbf8672495e67bb72537fc83a63c648695e73ba22d30144cb19f290b815c4d883743aa7a1507d2dfc4f493769f3b6673df0dcb7fd939fbdcb9eb2a5ae4
|
7
|
+
data.tar.gz: b7b13acf7da281ef64b8def0ca6ade7916f3fa50f7aa7ddb0da10655ad6e637cb5e8d3d5e625860b42037bc7ae96692e2ade5d56c38c36f3e7ae5f108e57697b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
# v0.0.10
|
2
|
+
* Extracted resource browser into separate gem.
|
3
|
+
|
1
4
|
# v0.0.9
|
2
5
|
* Bugfix: It is now possible to have multiple string and text editors active at the same time.
|
3
6
|
|
@@ -8,7 +11,7 @@
|
|
8
11
|
* Linklist and referencelist editors now better handle all aspects of the inplace editing process
|
9
12
|
for these two attributes. The "add" button no longer has to be rendered by the application code.
|
10
13
|
The styling of both editors was also improved to make it more user friendly.
|
11
|
-
*
|
14
|
+
* Resourcebrowser: Thumbnails only display an image, if the object defines a `image?` method, that
|
12
15
|
returns `true`, otherwise a generic icon is rendered.
|
13
16
|
* Bugfix: The string and text editor now also save correctly, when highlighting and editing the
|
14
17
|
content without triggering a `click` event.
|
@@ -22,7 +25,7 @@
|
|
22
25
|
inserting the carrot at the correct position and better multiline support for preformatted text
|
23
26
|
fields. (Thanks @dcsaszar)
|
24
27
|
* Bugfix: Using renamed `obj_class_name` method from the new Scrivito SDK instead of `obj_class`.
|
25
|
-
* Changed the behavior when an item is clicked in the
|
28
|
+
* Changed the behavior when an item is clicked in the resource browser. Instead of opening the
|
26
29
|
inspector, the item is now selected or deselected. A small magnifying glass in the upper right
|
27
30
|
corner of the thumbnail now allows to open the inspector for the item.
|
28
31
|
* Rename the fallback inspector view to `details.html`, to be consistent to the new Scrivito SDK.
|
@@ -30,10 +33,10 @@
|
|
30
33
|
# v0.0.5
|
31
34
|
* The template used in the inspector is no longer configurable and always corresponds to the
|
32
35
|
details view used by the Scrivito SDK.
|
33
|
-
* Bugfix: The
|
36
|
+
* Bugfix: The resource browser did not use a correct start index to render multiple thumbnails.
|
34
37
|
|
35
38
|
# v0.0.4
|
36
|
-
* Bugfix:
|
39
|
+
* Bugfix: Resourcebrowser buttons now also work in Chrome browser.
|
37
40
|
|
38
41
|
# v0.0.3
|
39
42
|
* Updated redactor to version 9.2.1 and removed all custom settings.
|
@@ -46,6 +49,6 @@
|
|
46
49
|
# v0.0.1
|
47
50
|
* Updated html editor seperator height from 29px to 27px.
|
48
51
|
* Updated the README to describe the new gem.
|
49
|
-
* Added editing icons used in some of the editors and the
|
52
|
+
* Added editing icons used in some of the editors and the resource browser.
|
50
53
|
* Removed the saving animation for editors to not disturb the in-place editing
|
51
54
|
experience.
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
The [Scrivito](http://scrivito.com) Editors gem is a collection of useful standard
|
9
9
|
JavaScript editors based on the Scrivito SDK. The editors allow to edit all CMS
|
10
10
|
attributes in place and provide helper for the property view of pages and
|
11
|
-
widgets. A
|
11
|
+
widgets. A resource browser is also part of the gem, to add, update and delete
|
12
12
|
resources.
|
13
13
|
|
14
14
|
## Installation and Usage
|
data/Rakefile
CHANGED
@@ -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 resourcebrowser-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
|
+
resourcebrowserButtonTemplate = ->
|
24
24
|
icon = $('<i></i>')
|
25
25
|
.addClass('editing-icon')
|
26
26
|
.addClass('editing-icon-plus')
|
@@ -47,21 +47,21 @@ $ ->
|
|
47
47
|
storeLastSaved(cmsField, value)
|
48
48
|
|
49
49
|
# Run when clicking the '...' button inside a li.
|
50
|
-
|
50
|
+
onOpenResourcebrowser = (event) ->
|
51
51
|
event.preventDefault()
|
52
52
|
|
53
53
|
linkItem = $(event.currentTarget).closest('li')
|
54
54
|
cmsField = getCmsField(linkItem)
|
55
55
|
filters = cmsField.data('filters') || cmsField.data('filter')
|
56
56
|
|
57
|
-
|
57
|
+
Resourcebrowser.open
|
58
58
|
selection: []
|
59
59
|
filters: filters
|
60
60
|
onSave: (selection) =>
|
61
|
-
|
61
|
+
onResourcebrowserSaveLinkItem(selection, linkItem)
|
62
62
|
|
63
|
-
#
|
64
|
-
|
63
|
+
# Resource browser callback for saving a single link.
|
64
|
+
onResourcebrowserSaveLinkItem = (selection, linkItem) ->
|
65
65
|
url = buildUrl(selection[0])
|
66
66
|
linkItem.find('[name=url]').val(url)
|
67
67
|
|
@@ -121,7 +121,7 @@ $ ->
|
|
121
121
|
|
122
122
|
# Turns the server side generated linklist data into the linklist editor using a template.
|
123
123
|
transformLinks = (cmsFields) ->
|
124
|
-
cmsFields.append(
|
124
|
+
cmsFields.append(resourcebrowserButtonTemplate)
|
125
125
|
|
126
126
|
items = cmsFields.find('li')
|
127
127
|
|
@@ -160,7 +160,7 @@ $ ->
|
|
160
160
|
linklistElements.on 'blur', 'li input', onBlur
|
161
161
|
linklistElements.on 'click', 'li a.delete', removeLink
|
162
162
|
linklistElements.on 'click', 'button.add-link', addLink
|
163
|
-
linklistElements.on 'click', 'a.
|
163
|
+
linklistElements.on 'click', 'a.resourcebrowser-open', onOpenResourcebrowser
|
164
164
|
|
165
165
|
linklistElements.find('ul').sortable
|
166
166
|
update: (event) ->
|
@@ -1,5 +1,5 @@
|
|
1
1
|
$ ->
|
2
|
-
# Integrates a
|
2
|
+
# Integrates a resource browser based editor for reference CMS attributes.
|
3
3
|
|
4
4
|
scrivito.on 'editing', ->
|
5
5
|
$('body').on 'click', '[data-scrivito-field-type="reference"]:not([data-editor]), [data-editor="reference"]', (event) ->
|
@@ -9,16 +9,16 @@ $ ->
|
|
9
9
|
selected = [cmsField.scrivito('content')].filter (element) -> element
|
10
10
|
filters = cmsField.data('filters') || cmsField.data('filter')
|
11
11
|
|
12
|
-
# Open
|
13
|
-
|
12
|
+
# Open resource browser with current reference selected.
|
13
|
+
Resourcebrowser.open
|
14
14
|
selection: selected
|
15
15
|
filters: filters
|
16
16
|
|
17
17
|
onSave: (selection) =>
|
18
|
-
|
18
|
+
onResourcebrowserSave(selection, cmsField)
|
19
19
|
|
20
|
-
# Save single reference when
|
21
|
-
|
20
|
+
# Save single reference when resource browser calls "save".
|
21
|
+
onResourcebrowserSave = (selection, cmsField) ->
|
22
22
|
value = selection[0] || null
|
23
23
|
|
24
24
|
cmsField.scrivito('save', value)
|
@@ -10,7 +10,7 @@ $ ->
|
|
10
10
|
</a>
|
11
11
|
</div>")
|
12
12
|
|
13
|
-
|
13
|
+
resourcebrowserButtonTemplate = ->
|
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('resourcebrowser-open')
|
22
22
|
.html(icon)
|
23
23
|
|
24
24
|
button
|
@@ -37,15 +37,15 @@ $ ->
|
|
37
37
|
storeLastSaved(cmsField, ids)
|
38
38
|
cmsField.trigger('scrivito_reload')
|
39
39
|
|
40
|
-
# Run when clicking the
|
41
|
-
|
40
|
+
# Run when clicking the resource browser button.
|
41
|
+
onResourcebrowserOpen = (event) ->
|
42
42
|
event.preventDefault()
|
43
43
|
|
44
44
|
cmsField = getCmsField($(event.currentTarget))
|
45
45
|
filters = cmsField.data('filters') || cmsField.data('filter')
|
46
46
|
ids = getIds(cmsField)
|
47
47
|
|
48
|
-
|
48
|
+
Resourcebrowser.open
|
49
49
|
selection: ids
|
50
50
|
filters: filters
|
51
51
|
|
@@ -74,7 +74,7 @@ $ ->
|
|
74
74
|
|
75
75
|
# Turns the server side generated referencelist data into the reference editor using a template.
|
76
76
|
transform = (elements) ->
|
77
|
-
elements.append(
|
77
|
+
elements.append(resourcebrowserButtonTemplate)
|
78
78
|
|
79
79
|
items = elements.find('li')
|
80
80
|
|
@@ -101,7 +101,7 @@ $ ->
|
|
101
101
|
storeLastSaved(element, ids)
|
102
102
|
|
103
103
|
elements.on 'click', 'li a.delete', remove
|
104
|
-
elements.on 'click', 'button.
|
104
|
+
elements.on 'click', 'button.resourcebrowser-open', onResourcebrowserOpen
|
105
105
|
|
106
106
|
elements.find('ul').sortable
|
107
107
|
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
|
+
resource browser or on edit views.
|
5
5
|
*/
|
6
6
|
|
7
7
|
.editing-button {
|
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.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scrivito
|
@@ -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_resourcebrowser
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -67,13 +67,13 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: jquery-ui-rails
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
|
-
type: :
|
76
|
+
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: pry
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -109,9 +109,6 @@ files:
|
|
109
109
|
- app/assets/fonts/editing_icons-webfont.ttf
|
110
110
|
- app/assets/fonts/editing_icons-webfont.woff
|
111
111
|
- app/assets/javascripts/jquery_additions/jquery_center.js.coffee
|
112
|
-
- app/assets/javascripts/mediabrowser/inspector.js.coffee
|
113
|
-
- app/assets/javascripts/mediabrowser/mediabrowser.js.coffee
|
114
|
-
- app/assets/javascripts/mediabrowser/uploader.js.coffee
|
115
112
|
- app/assets/javascripts/scrivito_editors.js
|
116
113
|
- app/assets/javascripts/scrivito_editors/date_editor.js.coffee
|
117
114
|
- app/assets/javascripts/scrivito_editors/enum_editor.js.coffee
|
@@ -130,52 +127,11 @@ files:
|
|
130
127
|
- app/assets/stylesheets/scrivito_editors/editors/referencelist_editor.css
|
131
128
|
- app/assets/stylesheets/scrivito_editors/editors/text_editor.css
|
132
129
|
- app/assets/stylesheets/scrivito_editors/icons.css.erb
|
133
|
-
- app/assets/stylesheets/scrivito_editors/mediabrowser.css
|
134
130
|
- app/assets/stylesheets/scrivito_editors/placeholder.css
|
135
131
|
- app/assets/stylesheets/scrivito_editors/widget_preview.css
|
136
|
-
- app/controllers/scrivito_editors/mediabrowser_controller.rb
|
137
|
-
- app/views/layouts/scrivito_editors/mediabrowser/inspector.html.erb
|
138
|
-
- app/views/scrivito_editors/mediabrowser/_buttons.html.erb
|
139
|
-
- app/views/scrivito_editors/mediabrowser/_header.html.erb
|
140
|
-
- app/views/scrivito_editors/mediabrowser/modal.html.erb
|
141
|
-
- app/views/scrivito_editors/obj/details.html
|
142
|
-
- config/initializers/mediabrowser.rb
|
143
|
-
- config/routes.rb
|
144
132
|
- lib/scrivito_editors.rb
|
145
133
|
- lib/scrivito_editors/engine.rb
|
146
134
|
- lib/scrivito_editors/version.rb
|
147
|
-
- spec/dummy/README.rdoc
|
148
|
-
- spec/dummy/Rakefile
|
149
|
-
- spec/dummy/app/assets/javascripts/application.js
|
150
|
-
- spec/dummy/app/assets/stylesheets/application.css
|
151
|
-
- spec/dummy/app/controllers/application_controller.rb
|
152
|
-
- spec/dummy/app/helpers/application_helper.rb
|
153
|
-
- spec/dummy/app/views/layouts/application.html.erb
|
154
|
-
- spec/dummy/bin/bundle
|
155
|
-
- spec/dummy/bin/rails
|
156
|
-
- spec/dummy/bin/rake
|
157
|
-
- spec/dummy/config.ru
|
158
|
-
- spec/dummy/config/application.rb
|
159
|
-
- spec/dummy/config/boot.rb
|
160
|
-
- spec/dummy/config/database.yml
|
161
|
-
- spec/dummy/config/environment.rb
|
162
|
-
- spec/dummy/config/environments/development.rb
|
163
|
-
- spec/dummy/config/environments/production.rb
|
164
|
-
- spec/dummy/config/environments/test.rb
|
165
|
-
- spec/dummy/config/initializers/backtrace_silencers.rb
|
166
|
-
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
167
|
-
- spec/dummy/config/initializers/inflections.rb
|
168
|
-
- spec/dummy/config/initializers/mime_types.rb
|
169
|
-
- spec/dummy/config/initializers/secret_token.rb
|
170
|
-
- spec/dummy/config/initializers/session_store.rb
|
171
|
-
- spec/dummy/config/initializers/wrap_parameters.rb
|
172
|
-
- spec/dummy/config/locales/en.yml
|
173
|
-
- spec/dummy/config/routes.rb
|
174
|
-
- spec/dummy/public/404.html
|
175
|
-
- spec/dummy/public/422.html
|
176
|
-
- spec/dummy/public/500.html
|
177
|
-
- spec/dummy/public/favicon.ico
|
178
|
-
- spec/spec_helper.rb
|
179
135
|
- vendor/assets/fonts/redactor-font.eot
|
180
136
|
- vendor/assets/javascripts/jquery-ui-timepicker-addon.min.js
|
181
137
|
- vendor/assets/javascripts/redactor.js
|
@@ -205,36 +161,4 @@ rubygems_version: 2.2.2
|
|
205
161
|
signing_key:
|
206
162
|
specification_version: 4
|
207
163
|
summary: Scrivito Editors
|
208
|
-
test_files:
|
209
|
-
- spec/dummy/app/assets/javascripts/application.js
|
210
|
-
- spec/dummy/app/assets/stylesheets/application.css
|
211
|
-
- spec/dummy/app/controllers/application_controller.rb
|
212
|
-
- spec/dummy/app/helpers/application_helper.rb
|
213
|
-
- spec/dummy/app/views/layouts/application.html.erb
|
214
|
-
- spec/dummy/bin/bundle
|
215
|
-
- spec/dummy/bin/rails
|
216
|
-
- spec/dummy/bin/rake
|
217
|
-
- spec/dummy/config/application.rb
|
218
|
-
- spec/dummy/config/boot.rb
|
219
|
-
- spec/dummy/config/database.yml
|
220
|
-
- spec/dummy/config/environment.rb
|
221
|
-
- spec/dummy/config/environments/development.rb
|
222
|
-
- spec/dummy/config/environments/production.rb
|
223
|
-
- spec/dummy/config/environments/test.rb
|
224
|
-
- spec/dummy/config/initializers/backtrace_silencers.rb
|
225
|
-
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
226
|
-
- spec/dummy/config/initializers/inflections.rb
|
227
|
-
- spec/dummy/config/initializers/mime_types.rb
|
228
|
-
- spec/dummy/config/initializers/secret_token.rb
|
229
|
-
- spec/dummy/config/initializers/session_store.rb
|
230
|
-
- spec/dummy/config/initializers/wrap_parameters.rb
|
231
|
-
- spec/dummy/config/locales/en.yml
|
232
|
-
- spec/dummy/config/routes.rb
|
233
|
-
- spec/dummy/config.ru
|
234
|
-
- spec/dummy/public/404.html
|
235
|
-
- spec/dummy/public/422.html
|
236
|
-
- spec/dummy/public/500.html
|
237
|
-
- spec/dummy/public/favicon.ico
|
238
|
-
- spec/dummy/Rakefile
|
239
|
-
- spec/dummy/README.rdoc
|
240
|
-
- spec/spec_helper.rb
|
164
|
+
test_files: []
|
@@ -1,65 +0,0 @@
|
|
1
|
-
@MediabrowserInspector = do ->
|
2
|
-
inspectorSelector: '.editing-mediabrowser-inspector'
|
3
|
-
contentSelector: '.inspector-content'
|
4
|
-
inspector: undefined
|
5
|
-
objectId: undefined
|
6
|
-
|
7
|
-
_initializeBindings: ->
|
8
|
-
@modal.on 'click', 'li.mediabrowser-item', (event) =>
|
9
|
-
@_onInspect(event)
|
10
|
-
|
11
|
-
@inspector = @modal.find(@inspectorSelector)
|
12
|
-
@inspector.hide()
|
13
|
-
|
14
|
-
_onInspect: (event) ->
|
15
|
-
if $(event.target).hasClass('editing-mediabrowser-inspect')
|
16
|
-
currentTarget = $(event.currentTarget)
|
17
|
-
id = currentTarget.data('id')
|
18
|
-
|
19
|
-
if id
|
20
|
-
@open(id)
|
21
|
-
@_highlightItem(currentTarget)
|
22
|
-
|
23
|
-
_renderLoading: ->
|
24
|
-
@inspector.html(@_loadingTemplate())
|
25
|
-
|
26
|
-
_loadingTemplate: ->
|
27
|
-
icon = $('<i></i>')
|
28
|
-
.addClass('editing-icon editing-icon-refresh')
|
29
|
-
|
30
|
-
$('<div></div>')
|
31
|
-
.addClass('editing-mediabrowser-loading')
|
32
|
-
.html(icon)
|
33
|
-
|
34
|
-
_highlightItem: (element) ->
|
35
|
-
@modal.find('li.mediabrowser-item.active').removeClass('active')
|
36
|
-
element.addClass('active')
|
37
|
-
|
38
|
-
init: (modal) ->
|
39
|
-
@modal = modal
|
40
|
-
@_initializeBindings()
|
41
|
-
|
42
|
-
# Opens the inspector section in the mediabrowser for the given object ID and displays its edit
|
43
|
-
# view.
|
44
|
-
open: (objectId) ->
|
45
|
-
@objectId = objectId
|
46
|
-
|
47
|
-
@inspector.show()
|
48
|
-
@_renderLoading()
|
49
|
-
|
50
|
-
$.ajax
|
51
|
-
url: '/mediabrowser/inspector'
|
52
|
-
dataType: 'json'
|
53
|
-
data:
|
54
|
-
id: @objectId
|
55
|
-
success: (json) =>
|
56
|
-
@inspector.html(json.content)
|
57
|
-
scrivito.trigger('new_content', @inspector)
|
58
|
-
|
59
|
-
error: =>
|
60
|
-
@inspector.empty()
|
61
|
-
|
62
|
-
# Closes the inspector section of the mediabrowser.
|
63
|
-
close: ->
|
64
|
-
@inspector.empty()
|
65
|
-
@inspector.hide()
|