ende 0.3.9 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6484128775e47a3c893ca8454a64e110431cf421
4
- data.tar.gz: 00e2ff9044f4a2da967b0f436a6c9561c378c133
3
+ metadata.gz: ca61eeee757b0fd079334ea1ec7d77db468fa657
4
+ data.tar.gz: fb597842cbf0a8f65adb036a3dc5006897715aac
5
5
  SHA512:
6
- metadata.gz: 366d7ecc1756256b4c410806aa5d7f376dbfe9b66e5212e3ca054844e59fe717e4b0fadf1710dc2dda8c9296eaf59b170de9510f624605d6441618a9bbde9545
7
- data.tar.gz: 68d107aaa1cf9e3dfc1f687c3760e7e593f03a0671296bbd34447b4e964d2fdb508de89a6e82fa6e18d75240d06d7f6effb50b4526de73554625816364eccf88
6
+ metadata.gz: 196c7c1d796ae8273fc8a171e0eb9bbd202a239fd7d6551571e52551a7597f3a3c29463bed5f8568426c72963cab0bcdc913a918d0984f7fe8c3eede4e5694f6
7
+ data.tar.gz: 5bd4e5d9e4f4b1d6d31642eab8193d6d4ef22aa3683517e1a4efe45f447175a652b221a87552a2ad64d96b92f83144b0df7277d6085978bf9e34b6887b5ad72b
@@ -1,12 +1,14 @@
1
1
  # = require lunr/lunr
2
2
 
3
+ 'use strict';
4
+
3
5
  # TODO reconstruir usando https://github.com/javve/list.js
4
6
  define ['./states/index', './presenter'], (templates, presenter) ->
5
7
 
6
8
  # TODO move lunar and lunr to an extension
7
9
  luna =
8
10
  index : null
9
- store : Map()
11
+ store : new Map()
10
12
  fields: ['name', 'description']
11
13
  sandbox:
12
14
  search:
@@ -21,7 +21,8 @@ define ->
21
21
  @$el.addClass ['tray', 'widget'].concat(names).join(' ')
22
22
 
23
23
  @identifier = options.identifier
24
- # TODO find a way to build the id beased on content
24
+
25
+ # TODO find a way to build the id based on content
25
26
  if identifier?
26
27
  @identifier = identifier
27
28
  @$el.attr 'id', identifier
@@ -31,6 +32,7 @@ define ->
31
32
  add: (name, options) ->
32
33
 
33
34
  # TODO add widgets as childrens of the tray widget sandbox
35
+ # TODO remove jquery dependency, and use documentFragment to build widgets
34
36
  element = jQuery '<div class="widget"></div>'
35
37
  options.el = element
36
38
  @$el.append element
@@ -163,7 +163,16 @@ define [
163
163
  @sandbox.emit "viewer.#{@identifier}.selected", item.model
164
164
 
165
165
  scope_to: (scope, child_scope) ->
166
- throw new TypeError "Invalid scope sent to viewer@#{@identifier} sent: #{scope.resource.toString()}, expected: #{@scope.resource.toString()}" if scope.resource.toString() != @scope.resource.toString()
166
+ # Singuralize in order to accept association scopes, since
167
+ # association scopes return almost the same kind as of it's
168
+ # singularized version
169
+ sent_scope = @inflector.singularize scope.resource.toString()
170
+ current_scope = @inflector.singularize @scope.resource.toString()
171
+
172
+ if sent_scope != current_scope
173
+ throw new TypeError "Invalid scope sent to viewer@#{@identifier} sent: '#{sent_scope}', expected: '#{current_scope}'"
174
+
175
+ # For sobsequent usages we must store the scope
167
176
  @scope = scope
168
177
 
169
178
  # TODO better hierachical event distribution
@@ -397,22 +406,23 @@ define [
397
406
  # TODO import core extensions in another place
398
407
  @resource = @sandbox.resource options.resource
399
408
  @scope = model = @resource
400
- cssify = @sandbox.util.inflector.cssify
409
+
410
+ {sandbox: {util: {@inflector}}} = @
401
411
 
402
412
  @sandbox.on "viewer.#{@identifier}.scope", @scope_to, @
403
413
 
404
414
  # Iniitalize plugins
405
415
  loading = @plugins options
406
416
 
407
- @$el.addClass "viewer widget #{cssify @identifier} idle clearfix"
417
+ @$el.addClass "viewer widget #{@inflector.cssify @identifier} idle clearfix"
408
418
 
409
- loading.done =>
410
- @require_custom options
419
+ loading.done => @require_custom options
411
420
 
412
421
  require_custom: (options) ->
413
422
  # Fetch custom templates
414
423
  # TODO better custom templates structure and custom presenter
415
424
  # TODO better segregation of concerns on this code
425
+ # TODO handle case where custom presenter does not exist!
416
426
  require [
417
427
  "text!./widgets/viewer/templates/default/#{options.resource}.html"
418
428
  "./widgets/viewer/presenters/#{options.resource}"
data/lib/ende/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ende
2
- VERSION = "0.3.9"
2
+ VERSION = "0.3.10"
3
3
  end
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.9
4
+ version: 0.3.10
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-02-22 00:00:00.000000000 Z
11
+ date: 2014-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler