scrivito_resourcebrowser 0.0.3 → 0.0.4

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: 61d54d510c1edf96bced6adb3617648a7135e295
4
- data.tar.gz: 6e9088de1291df9865a3b0c914aa21d5ca73cf30
3
+ metadata.gz: e9b8db9c0c1ec3589c28f0cfb57912fa653c7290
4
+ data.tar.gz: b8090d83c3a11d3017a165a34b91f58c7c199a42
5
5
  SHA512:
6
- metadata.gz: f476f5289b1fe86f5069b3d2083675070beea31e3697919b7dc647830135480edbb2eb60a8ddd382e073b33e15af24a9868c66cc3c3043cd12ccbc5355bb9d4e
7
- data.tar.gz: 28541dfb09b77499ccf095b7c8d5e4a6549a3eaf179d2ff983a3341911c715441019e6beed452e145266772b917191c1665356eb9d697556cd6a866142e299a3
6
+ metadata.gz: 4d61ea74dbde427eb752e6cf15b08d97ffb1b7af685f48546237cca277a0c0f03edc8bd7ff74c6e5013800ab662f4a40085e1e3f8bc28bd60bba119b30c48751
7
+ data.tar.gz: 6a04de77ef1d62f0af2f1d2e40bb2c7aaaae3ee7ecbc3f75855f89be2980344f9506fe8ba921bc7a5389537eea218f5ed8cedf9ed34cd32b1a952d537063b06d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # v0.0.4
2
+ * The filters are now a simple hash instead of a function that returns a hash. This allows to
3
+ extend the filters multiple times. This is useful, when a gem wants to add filters to the ones
4
+ already defined in the application. (Thanks @gertimon)
5
+
1
6
  # v0.0.3
2
7
  * Change the icon to open the details view from a magnifying glass to a pen.
3
8
  * Added option "selectionMode", which can be set to `single` in order to allow only one selected
@@ -1,6 +1,7 @@
1
1
  @Resourcebrowser = do ->
2
2
  thumbnailViewButtonSelector: '.editing-button-view'
3
3
  options: {}
4
+ filters: {}
4
5
 
5
6
  # The resource browser supports operations like +delete+ and +edit+ of resources that require a page
6
7
  # reload, so that all references of the resources get updated.
@@ -50,7 +51,7 @@
50
51
  @_defaultFilter().trigger('click')
51
52
 
52
53
  _selectedFilters: ->
53
- availableFilters = @filters()
54
+ availableFilters = @filters
54
55
  selectedFilters = @options.filters
55
56
  filters = availableFilters
56
57
 
@@ -232,8 +233,11 @@
232
233
  if query?
233
234
  @_getItems().html(@_loadingTemplate())
234
235
 
236
+ query
237
+ .batch_size(@_getBatchSize())
238
+
235
239
  query.size()
236
- .then (total) =>
240
+ .done (total) =>
237
241
  if total > 0
238
242
  @_itemsPlaceholder(total)
239
243
  @_renderItems(query)
@@ -241,11 +245,8 @@
241
245
  @_getItems().empty()
242
246
 
243
247
  _renderItems: (query, index = 0) ->
244
- query
245
- .batch_size(@_getBatchSize())
246
-
247
248
  query.load_batch()
248
- .then (result, next) =>
249
+ .done (result, next) =>
249
250
  objects = result.hits
250
251
  @_replacePlaceholder(objects, index)
251
252
 
@@ -318,8 +319,8 @@
318
319
  @_renderPlaceholder(query)
319
320
 
320
321
  _initializeBindings: ->
321
- $(window).resize ->
322
- $('#editing-resourcebrowser.show').center()
322
+ $(window).resize =>
323
+ @_center(@modal)
323
324
 
324
325
  @modal.on 'keyup', 'input.search-field', (event) =>
325
326
  if event.keyCode == 13
@@ -381,11 +382,21 @@
381
382
  .addClass('editing-resourcebrowser show')
382
383
  .attr('id', 'editing-resourcebrowser')
383
384
  .appendTo($('body'))
384
- .center()
385
385
  .html(content)
386
386
 
387
+ @_center(@modal)
388
+
387
389
  @_initializeBindings()
388
390
 
391
+ _center: (domElement) ->
392
+ if domElement
393
+ domElement = $(domElement)
394
+ domElement.css(
395
+ marginLeft: -domElement.innerWidth() / 2
396
+ marginTop: -domElement.innerHeight() / 2
397
+ left: '50%'
398
+ )
399
+
389
400
  _loadingTemplate: ->
390
401
  icon = $('<i></i>')
391
402
  .addClass('editing-icon editing-icon-refresh')
@@ -411,9 +422,6 @@
411
422
  .filter("[data-size='#{size}']")
412
423
  .addClass('active')
413
424
 
414
- filters: ->
415
- {}
416
-
417
425
  close: ->
418
426
  (@options.onClose || $.noop)()
419
427
 
@@ -443,4 +451,4 @@
443
451
  console.error('Resourcebrowser Uploader Error:', error)
444
452
 
445
453
  ResourcebrowserUploader.onUploadSuccess = (objs) =>
446
- @_renderPlaceholder(@_defaultQuery())
454
+ @_renderPlaceholder(@_activeQuery())
@@ -28,19 +28,14 @@
28
28
  undefined
29
29
 
30
30
  _processQueue: (queue, createdObjs, promise) ->
31
- promise.then (data) =>
32
- @onUploadSuccess(data)
33
-
34
31
  file = queue.pop()
35
32
 
36
33
  if file?
37
- @_createResource(file).then (obj) =>
38
- @_updateProgress(file, '100%')
39
- createdObjs.push(obj)
40
- .always =>
41
- @_processQueue(queue, createdObjs, promise)
42
-
43
- return promise
34
+ @_createResource(file)
35
+ .done (obj) =>
36
+ @_updateProgress(file, '100%')
37
+ createdObjs.push(obj)
38
+ @_processQueue(queue, createdObjs, promise)
44
39
  else
45
40
  return promise.resolve(createdObjs)
46
41
 
@@ -93,6 +88,8 @@
93
88
  @_addProgressWrapper()
94
89
 
95
90
  promise = $.Deferred()
91
+ .done (data) =>
92
+ @onUploadSuccess(data)
96
93
 
97
94
  queue = for file in files
98
95
  @_addProgress(file)
@@ -1,5 +1,4 @@
1
1
  module ScrivitoResourcebrowser
2
2
  class Engine < ::Rails::Engine
3
- isolate_namespace ScrivitoResourcebrowser
4
3
  end
5
4
  end
@@ -1,3 +1,3 @@
1
1
  module ScrivitoResourcebrowser
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
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.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scrivito
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-04 00:00:00.000000000 Z
11
+ date: 2014-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description: Scrivito Resource Browser
70
84
  email:
71
85
  - info@infopark.de
@@ -85,7 +99,6 @@ files:
85
99
  - app/assets/stylesheets/scrivito_resourcebrowser/resourcebrowser.css
86
100
  - app/controllers/scrivito_resourcebrowser/resourcebrowser_controller.rb
87
101
  - app/views/layouts/scrivito_resourcebrowser/inspector.html.erb
88
- - app/views/scrivito_resourcebrowser/application.html.erb
89
102
  - app/views/scrivito_resourcebrowser/obj/details.html
90
103
  - app/views/scrivito_resourcebrowser/resourcebrowser/_buttons.html.erb
91
104
  - app/views/scrivito_resourcebrowser/resourcebrowser/_header.html.erb
@@ -115,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
128
  version: '1.8'
116
129
  requirements: []
117
130
  rubyforge_project:
118
- rubygems_version: 2.2.2
131
+ rubygems_version: 2.4.1
119
132
  signing_key:
120
133
  specification_version: 4
121
134
  summary: Scrivito Resource Browser
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>ScrivitoResourcebrowser</title>
5
- <%= stylesheet_link_tag "scrivito_resourcebrowser/application", media: "all" %>
6
- <%= javascript_include_tag "scrivito_resourcebrowser/application" %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
-
11
- <%= yield %>
12
-
13
- </body>
14
- </html>