sudojs-rails 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -17,7 +17,7 @@ namespace :sudojs do
17
17
  'es5-sham.js' => 'https://raw.github.com/taskrabbit/sudojs/master/lib/es5-shim/es5-sham.js'
18
18
  }
19
19
 
20
- vendor_dir = "vendor/assets/javascripts/application"
20
+ vendor_dir = "vendor/assets/javascripts/sudojs"
21
21
 
22
22
  require 'open-uri'
23
23
  files.each do |local,remote|
@@ -1,3 +1,3 @@
1
1
  module Sudojs
2
- VERSION = '0.3.5'
2
+ VERSION = '0.3.6'
3
3
  end
@@ -1665,23 +1665,40 @@ sudo.delegates.Change = function(data) {
1665
1665
  };
1666
1666
  // Delegates inherit from Model
1667
1667
  sudo.delegates.Change.prototype = Object.create(sudo.Model.prototype);
1668
+ // ###addFilter
1669
+ // Place an entry into this object's hash of filters
1670
+ //
1671
+ // `param` {string} `key`
1672
+ // `param` {string} `val`
1673
+ // `returns` {object} this
1674
+ sudo.delegates.Change.prototype.addFilter = function addFilter(key, val) {
1675
+ this.get('filters')[key] = val;
1676
+ return this;
1677
+ },
1678
+ // ###filter
1668
1679
  // Change records are delivered here and filtered, calling any matching
1669
1680
  // methods specified in `this.get('filters').
1670
1681
  //
1671
1682
  // `returns` {Object} a call to the specified _delegator_ method, passing
1672
1683
  // a hash containing:
1673
1684
  // 1. the `type` of Change
1674
- // 2. the value located at the key/path
1675
- // 3. the `oldValue` of the key if present
1676
- sudo.delegates.Change.prototype.filter = function(change) {
1677
- var filters = this.data.filters, name = change.name, obj = {};
1685
+ // 2. the `name` of the changed property
1686
+ // 3. the value located at the key/path
1687
+ // 4. the `oldValue` of the key if present
1688
+ sudo.delegates.Change.prototype.filter = function filter(change) {
1689
+ var filters = this.data.filters, name = change.name,
1690
+ type = change.type, obj = {};
1678
1691
  // does my delegator care about this?
1679
1692
  if(name in filters && filters.hasOwnProperty(name)) {
1680
1693
  // assemble the object to return to the method
1681
- obj.type = change.type;
1682
- obj.value = name.indexOf('.') === -1 ? change.object[change.name] :
1683
- sudo.getPath(name, change.object);
1694
+ obj.type = type;
1695
+ obj.name = name;
1684
1696
  obj.oldValue = change.oldValue;
1697
+ // delete operations will not have any value so no need to look
1698
+ if(type !== 'deleted') {
1699
+ obj.value = name.indexOf('.') === -1 ? change.object[change.name] :
1700
+ sudo.getPath(name, change.object);
1701
+ }
1685
1702
  return this.delegator[filters[name]].call(this.delegator, obj);
1686
1703
  }
1687
1704
  };
@@ -1729,7 +1746,7 @@ sudo.delegates.Data.prototype.filter = function(obj) {
1729
1746
  // `private`
1730
1747
  sudo.delegates.Data.prototype.role = 'data';
1731
1748
 
1732
- sudo.version = "0.9.3";
1749
+ sudo.version = "0.9.4";
1733
1750
  window.sudo = sudo;
1734
1751
  if(typeof window._ === "undefined") window._ = sudo;
1735
- }).call(this, this);
1752
+ }).call(this, this);
@@ -811,7 +811,7 @@ sudo.extensions.observable = {
811
811
  return this.deliverChangeRecords();
812
812
  }
813
813
  };
814
- sudo.version = "0.9.3";
814
+ sudo.version = "0.9.4";
815
815
  window.sudo = sudo;
816
816
  if(typeof window._ === "undefined") window._ = sudo;
817
817
  }).call(this, this);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sudojs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-11 00:00:00.000000000 Z
12
+ date: 2013-03-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -78,7 +78,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
78
78
  version: '0'
79
79
  segments:
80
80
  - 0
81
- hash: 3794480762350784030
81
+ hash: -973221170454478308
82
82
  required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
@@ -87,10 +87,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  version: '0'
88
88
  segments:
89
89
  - 0
90
- hash: 3794480762350784030
90
+ hash: -973221170454478308
91
91
  requirements: []
92
92
  rubyforge_project:
93
- rubygems_version: 1.8.24
93
+ rubygems_version: 1.8.25
94
94
  signing_key:
95
95
  specification_version: 3
96
96
  summary: Install and use sudo.js quickly and easily with rails 3.2+.