ende 0.3.11 → 0.3.12
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/lib/assets/javascripts/widgets/viewer/main.js.coffee +37 -14
- data/lib/ende/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0da97c41b5dc3465944322b1ece15ec3be43654c
|
4
|
+
data.tar.gz: a98863c9f0045fd41a98637525489715140fa862
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 044da7f2be4b59eafdcd02a44e7812408664e4e5fc72fe07e774cfed10e80157cde7bcdbc065300b92a29ab8fdc08d0a4f61e8f1ef2e02b6539a7812f2920002
|
7
|
+
data.tar.gz: f077995aab9837b6ab9ca75a69e9e7361bb6412febe1858e04b83da7b0506a6345b6ff67ac1c3f535eb6aed244790163d02f0800c5d838089bca7a96320b9003
|
@@ -177,16 +177,14 @@ define [
|
|
177
177
|
sent_scope = @inflector.singularize scope.resource.toString()
|
178
178
|
current_scope = @inflector.singularize @scope.resource.toString()
|
179
179
|
|
180
|
+
deferred = @sandbox.data.deferred()
|
181
|
+
|
180
182
|
if sent_scope != current_scope
|
181
183
|
throw new TypeError "Invalid scope sent to viewer@#{@identifier} sent: '#{sent_scope}', expected: '#{current_scope}'"
|
182
184
|
|
183
185
|
# For sobsequent usages we must store the scope
|
184
186
|
@scope = scope
|
185
187
|
|
186
|
-
# TODO better hierachical event distribution
|
187
|
-
for { _widget: widget } in @sandbox._children?
|
188
|
-
widget.scope_to? child_scope
|
189
|
-
|
190
188
|
@sandbox.emit "viewer.#{@identifier}.scope_changed", @scope
|
191
189
|
|
192
190
|
# TODO better scope data binding, and updating
|
@@ -196,6 +194,15 @@ define [
|
|
196
194
|
|
197
195
|
@repopulate()
|
198
196
|
|
197
|
+
# TODO rename this method
|
198
|
+
# TODO also move this to an external tag
|
199
|
+
statused: (status) ->
|
200
|
+
if status
|
201
|
+
@status = status
|
202
|
+
@sandbox.emit "viewer.#{@identifier}.status_changed", status
|
203
|
+
else
|
204
|
+
@status
|
205
|
+
|
199
206
|
repopulate: ->
|
200
207
|
unless @fetching?
|
201
208
|
if @load?
|
@@ -209,6 +216,7 @@ define [
|
|
209
216
|
@load = @sandbox.ui.loader @$el.find '.results .items'
|
210
217
|
|
211
218
|
# TODO implement status for viewer widget
|
219
|
+
@statused 'loading'
|
212
220
|
@$el.addClass 'idle'
|
213
221
|
@$el.removeClass 'loading'
|
214
222
|
|
@@ -243,6 +251,7 @@ define [
|
|
243
251
|
|
244
252
|
@fetching.always =>
|
245
253
|
# TODO implement status for viewer widget
|
254
|
+
@statused 'loading'
|
246
255
|
@$el.addClass 'idle'
|
247
256
|
@$el.removeClass 'loading'
|
248
257
|
|
@@ -257,6 +266,7 @@ define [
|
|
257
266
|
@load = @sandbox.ui.loader @$results
|
258
267
|
|
259
268
|
# TODO implement status for viewer widget
|
269
|
+
@statused 'loading'
|
260
270
|
@$el.removeClass 'idle'
|
261
271
|
@$el.addClass 'loading'
|
262
272
|
|
@@ -310,7 +320,7 @@ define [
|
|
310
320
|
|
311
321
|
|
312
322
|
plugins: (options) ->
|
313
|
-
deferreds = []
|
323
|
+
deferreds = [@]
|
314
324
|
|
315
325
|
deferreds.push paginable widget: @ if options.page
|
316
326
|
deferreds.push scrollable widget: @ if options.scroll
|
@@ -426,21 +436,27 @@ define [
|
|
426
436
|
|
427
437
|
@sandbox.on "viewer.#{@identifier}.scope", @scope_to, @
|
428
438
|
|
429
|
-
#
|
439
|
+
# Initalize plugins
|
440
|
+
# TODO think how to implement plugins api
|
430
441
|
loading = @plugins options
|
431
442
|
|
443
|
+
@statused 'idle'
|
432
444
|
@$el.addClass "viewer widget #{@inflector.cssify @identifier} idle clearfix"
|
433
445
|
|
434
|
-
loading.done
|
446
|
+
loading.done (widget) ->
|
447
|
+
widget.require_custom options.resource
|
448
|
+
|
449
|
+
# TODO externalize this code to an extension
|
450
|
+
require_custom: (resource) ->
|
451
|
+
deferred = @sandbox.data.deferred()
|
435
452
|
|
436
|
-
require_custom: (options) ->
|
437
453
|
# Fetch custom templates
|
438
454
|
# TODO better custom templates structure and custom presenter
|
439
455
|
# TODO better segregation of concerns on this code
|
440
456
|
# TODO handle case where custom presenter does not exist!
|
441
457
|
require [
|
442
|
-
"text!./widgets/viewer/templates/default/#{
|
443
|
-
"./widgets/viewer/presenters/#{
|
458
|
+
"text!./widgets/viewer/templates/default/#{resource}.html"
|
459
|
+
"./widgets/viewer/presenters/#{resource}"
|
444
460
|
], (custom_default_template, custom_presenter) =>
|
445
461
|
|
446
462
|
# TODO Better way to preserve widgets handlers
|
@@ -460,12 +476,19 @@ define [
|
|
460
476
|
|
461
477
|
presenter.handlers = handlers
|
462
478
|
|
463
|
-
custom_default_template and templates[
|
464
|
-
@presenter
|
479
|
+
custom_default_template and templates[resource] = custom_default_template
|
480
|
+
@presenter = @sandbox.util.extend custom_presenter, presenter if custom_presenter
|
465
481
|
|
466
|
-
@$results
|
482
|
+
@$results ||= @$el.find '.results .items'
|
467
483
|
|
468
484
|
# Fetch default data
|
469
485
|
@populate handlers
|
470
486
|
|
471
|
-
|
487
|
+
deferred.resolveWith @, [resource]
|
488
|
+
|
489
|
+
, (error) =>
|
490
|
+
# TODO handle other status codes with xhr error
|
491
|
+
@sandbox.logger.error "Error when loading presenter and template for resource '#{resource}':\n\n", error.message + "\n\n", error
|
492
|
+
deferred.rejectWith @, arguments
|
493
|
+
|
494
|
+
deferred
|
data/lib/ende/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ende
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Heitor Salazar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|