scrivito_resourcebrowser 0.0.2 → 0.0.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61d54d510c1edf96bced6adb3617648a7135e295
|
4
|
+
data.tar.gz: 6e9088de1291df9865a3b0c914aa21d5ca73cf30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f476f5289b1fe86f5069b3d2083675070beea31e3697919b7dc647830135480edbb2eb60a8ddd382e073b33e15af24a9868c66cc3c3043cd12ccbc5355bb9d4e
|
7
|
+
data.tar.gz: 28541dfb09b77499ccf095b7c8d5e4a6549a3eaf179d2ff983a3341911c715441019e6beed452e145266772b917191c1665356eb9d697556cd6a866142e299a3
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# v0.0.3
|
2
|
+
* Change the icon to open the details view from a magnifying glass to a pen.
|
3
|
+
* Added option "selectionMode", which can be set to `single` in order to allow only one selected
|
4
|
+
item at a time. Any other value will allow to select an arbitrary number of items.
|
5
|
+
* Added "selected" filter that displays all currently selected items.
|
6
|
+
* Display "missing title" when a custom filter has no title configured.
|
7
|
+
* Added installation and usage section in the README.
|
8
|
+
|
1
9
|
# v0.0.2
|
2
10
|
* Bugfix: An error on assets:precompile was caused by a typo. (Thanks @dcsaszar)
|
3
11
|
|
data/README.md
CHANGED
@@ -11,7 +11,20 @@ application.
|
|
11
11
|
|
12
12
|
## Installation and Usage
|
13
13
|
|
14
|
-
|
14
|
+
If you already use the gem [scrivito_editors](https://github.com/infopark/scrivito_editors) then you
|
15
|
+
don't have to change anything, because it is a dependency that will be installed automatically.
|
16
|
+
|
17
|
+
If you want to use this gem separately, please add it to your `Gemfile`.
|
18
|
+
|
19
|
+
gem 'scrivito_resourcebrowser'
|
20
|
+
|
21
|
+
Then require it in your stylesheet manifest.
|
22
|
+
|
23
|
+
*= require scrivito_resourcebrowser
|
24
|
+
|
25
|
+
And require it in your JavaScript manifest.
|
26
|
+
|
27
|
+
//= require scrivito_resourcebrowser
|
15
28
|
|
16
29
|
|
17
30
|
## Changelog
|
@@ -20,13 +20,24 @@
|
|
20
20
|
.addClass('editing-resourcebrowser-filter-items')
|
21
21
|
|
22
22
|
for name, options of filters
|
23
|
-
title = options.title
|
23
|
+
title = options.title || 'missing title'
|
24
24
|
icon = options.icon || 'editing-icon-generic'
|
25
|
-
query =
|
25
|
+
query = options.query
|
26
26
|
|
27
27
|
@_filterTemplate(title, icon, query)
|
28
|
+
.addClass('filter')
|
28
29
|
.appendTo(list)
|
29
30
|
|
31
|
+
separator = $('<li></li>')
|
32
|
+
.addClass('separator')
|
33
|
+
.appendTo(list)
|
34
|
+
|
35
|
+
title = 'Selected <span class="editing-resourcebrowser-counter selected-total"></span>'
|
36
|
+
icon = 'editing-icon-ok'
|
37
|
+
@_filterTemplate(title, icon)
|
38
|
+
.addClass('selected-filter')
|
39
|
+
.appendTo(list)
|
40
|
+
|
30
41
|
list
|
31
42
|
|
32
43
|
_loadFilter: () ->
|
@@ -69,7 +80,7 @@
|
|
69
80
|
@_getFilterQuery(filter)
|
70
81
|
|
71
82
|
_filterItems: ->
|
72
|
-
@modal.find('
|
83
|
+
@modal.find('ul.editing-resourcebrowser-filter-items li')
|
73
84
|
|
74
85
|
_deactivateAllFilter: ->
|
75
86
|
@_getSearch().val('')
|
@@ -83,10 +94,21 @@
|
|
83
94
|
query = @_getFilterQuery(filter)
|
84
95
|
@_renderPlaceholder(query)
|
85
96
|
|
97
|
+
_triggerSelectedFilter: (filter) ->
|
98
|
+
if @selected.length > 0
|
99
|
+
query = @_prepareQuery(scrivito.obj_where('id', 'equals', @selected))
|
100
|
+
filter.data('query', query)
|
101
|
+
else
|
102
|
+
filter.removeData('query')
|
103
|
+
|
104
|
+
@_triggerFilter(filter)
|
105
|
+
|
86
106
|
_filterTemplate: (title, icon, query) ->
|
87
107
|
filter = $('<li></li>')
|
88
|
-
|
89
|
-
|
108
|
+
|
109
|
+
if query?
|
110
|
+
query = @_prepareQuery(query)
|
111
|
+
filter.data('query', query)
|
90
112
|
|
91
113
|
icon = $('<span></span>')
|
92
114
|
.addClass('editing-icon')
|
@@ -101,8 +123,7 @@
|
|
101
123
|
filter
|
102
124
|
|
103
125
|
_prepareQuery: (query) ->
|
104
|
-
|
105
|
-
scrivito.chainable_search.create_instance(params)
|
126
|
+
query.clone()
|
106
127
|
.order('_last_changed')
|
107
128
|
.reverse_order()
|
108
129
|
.format('resourcebrowser')
|
@@ -136,6 +157,9 @@
|
|
136
157
|
if (item.hasClass('active'))
|
137
158
|
@_removeItem(item)
|
138
159
|
else
|
160
|
+
if @options.selectionMode == 'single'
|
161
|
+
@_deselectAllItems()
|
162
|
+
|
139
163
|
@_addItem(item)
|
140
164
|
|
141
165
|
_addItem: (item) ->
|
@@ -202,21 +226,19 @@
|
|
202
226
|
$(item).html(loading)
|
203
227
|
|
204
228
|
_renderPlaceholder: (query) ->
|
205
|
-
query ||= @_defaultQuery()
|
206
|
-
|
207
|
-
return unless query?
|
208
|
-
|
209
229
|
@_getItems()
|
210
230
|
.empty()
|
211
|
-
.html(@_loadingTemplate())
|
212
231
|
|
213
|
-
query
|
214
|
-
.
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
232
|
+
if query?
|
233
|
+
@_getItems().html(@_loadingTemplate())
|
234
|
+
|
235
|
+
query.size()
|
236
|
+
.then (total) =>
|
237
|
+
if total > 0
|
238
|
+
@_itemsPlaceholder(total)
|
239
|
+
@_renderItems(query)
|
240
|
+
else
|
241
|
+
@_getItems().empty()
|
220
242
|
|
221
243
|
_renderItems: (query, index = 0) ->
|
222
244
|
query
|
@@ -328,6 +350,10 @@
|
|
328
350
|
event.preventDefault()
|
329
351
|
@_triggerFilter($(event.currentTarget))
|
330
352
|
|
353
|
+
@modal.on 'click', 'li.selected-filter', (event) =>
|
354
|
+
event.preventDefault()
|
355
|
+
@_triggerSelectedFilter($(event.currentTarget))
|
356
|
+
|
331
357
|
@modal.on 'click', @thumbnailViewButtonSelector, (event) =>
|
332
358
|
size = $(event.currentTarget).data('size')
|
333
359
|
@_changeThumbnailSize(size)
|
@@ -405,9 +431,9 @@
|
|
405
431
|
@options = options
|
406
432
|
|
407
433
|
@_loadModal(json.content)
|
408
|
-
@_setSelected()
|
409
434
|
@_loadFilter()
|
410
|
-
@
|
435
|
+
@_setSelected()
|
436
|
+
@_renderPlaceholder(@_defaultQuery())
|
411
437
|
@_changeThumbnailSize()
|
412
438
|
|
413
439
|
ResourcebrowserInspector.init(@modal)
|
@@ -417,4 +443,4 @@
|
|
417
443
|
console.error('Resourcebrowser Uploader Error:', error)
|
418
444
|
|
419
445
|
ResourcebrowserUploader.onUploadSuccess = (objs) =>
|
420
|
-
@_renderPlaceholder()
|
446
|
+
@_renderPlaceholder(@_defaultQuery())
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scrivito_resourcebrowser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scrivito
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|