coolerator.vision 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{coolerator.vision}
8
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Corey Innis"]
12
- s.date = %q{2009-11-12}
12
+ s.date = %q{2009-11-13}
13
13
  s.description = %q{A Rails plugin}
14
14
  s.email = %q{corey@coolerator.net}
15
15
  s.extra_rdoc_files = [
@@ -5,31 +5,37 @@
5
5
  scoped : {},
6
6
 
7
7
  get : function get(scope) {
8
- return $.merge(this.global, this.scoped[scope] || []);
8
+ return $.merge($.makeArray(this.global), $.makeArray(this.scoped[scope]));
9
9
  }
10
10
  },
11
11
 
12
12
  Filter : function Filter() {
13
- var config = $.merge(arguments, ['*'])[0];
13
+ var scope = ['*'];
14
+ var filter = this;
14
15
 
15
- if('object' === typeof(config)) {
16
- var scope = config.scope || '*';
17
- var filter = {
18
- before : (config.before || function no_op() {}),
19
- after : (config.after || function no_op() {})
20
- };
21
- }
22
- else {
23
- var scope = config;
24
- var filter = this;
25
- }
16
+ if(arguments.length) {
17
+ var first = arguments[0];
26
18
 
27
- if(scope === '*') {
28
- Coolerator.Filters.global.push(filter);
29
- }
30
- else {
31
- Coolerator.Filters.scoped[scope] = $.merge(Coolerator.Filters.scoped[scope] || [], [filter]);
19
+ if('object' === typeof first) {
20
+ scope = $.isArray(first.scope) ? first.scope : [first.scope || '*'];
21
+ filter = {
22
+ before : (first.before || function no_op() {}),
23
+ after : (first.after || function no_op() {})
24
+ };
25
+ }
26
+ else {
27
+ scope = arguments;
28
+ }
32
29
  }
30
+
31
+ $.each(scope, function(i, selector) {
32
+ if(selector === '*') {
33
+ Coolerator.Filters.global.push(filter);
34
+ }
35
+ else {
36
+ Coolerator.Filters.scoped[selector || '*'] = $.merge(Coolerator.Filters.scoped[selector || '*'] || [], [filter]);
37
+ }
38
+ });
33
39
  }
34
40
  });
35
41
 
@@ -46,27 +46,32 @@
46
46
  };
47
47
 
48
48
  function filter() {
49
+ function attach(form) {
50
+ form.bind('submit', function(e) {
51
+ return self.form.handle.call(e.target, $.extend(e, { listener : self }));
52
+ });
53
+ }
54
+
49
55
  Coolerator.Filter({
50
56
  before : function before(view) {
51
57
  $.each(view, function(name, partial) {
52
58
  var match = partial.match_for(selectors.form);
53
59
 
54
60
  if(match) {
55
- match.bind('submit', function(e) {
56
- return self.form.handle.call(e.target, $.extend(e, { listener : self }));
57
- });
61
+ attach(match);
58
62
  }
59
63
  });
60
64
  }
61
65
  });
66
+
67
+ $(function() {
68
+ attach($(selectors.form));
69
+ });
62
70
  }
63
71
 
64
72
  function subscribe() {
65
73
  Coolerator.Registrar.subscribe(self, function(registrar) {
66
74
  with(registrar) {
67
- use(this.link.handle)
68
- .on('click', selectors.link);
69
-
70
75
  on('click', selectors.link)
71
76
  .use(this.link.handle);
72
77
 
@@ -182,7 +187,6 @@
182
187
  }
183
188
  },
184
189
 
185
- // TODO: rename this as 'responder'
186
190
  responder : {
187
191
  success : function success(source, response, status, options) {
188
192
  // this : Coolerator.Remote
@@ -205,7 +209,7 @@
205
209
  },
206
210
 
207
211
  complete : function complete(source, request, status) {
208
- console.info('TODO: response.complete', source, request, status);
212
+ // TODO
209
213
  }
210
214
  },
211
215
 
@@ -33,8 +33,6 @@
33
33
  cache : {},
34
34
 
35
35
  extend : function extend(extension) {
36
- // NOTE: if we have a matching method herein, rewrite the incoming
37
- // to wrap it with 'super' ... with({ super : function() {} })...
38
36
  var self = this;
39
37
 
40
38
  $.each(extension.instance.methods, function(name, fn) {
@@ -49,7 +47,9 @@
49
47
  });
50
48
 
51
49
  $.extend(true, this.instance, extension.instance);
52
- extension.collection && $.extend(true, this, extension.collection.methods, extension.collection.configuration);
50
+ if(extension.collection) {
51
+ $.extend(true, this, extension.collection.methods, extension.collection.configuration);
52
+ }
53
53
  },
54
54
 
55
55
  subscribe : function subscribe(callback) {
@@ -83,24 +83,6 @@
83
83
  }
84
84
 
85
85
  return result;
86
- },
87
-
88
- // instance : {
89
- // content : function content(builder, attributes) {
90
- // var html_attributes = attributes.classifier ? { 'class' : attributes.classifier } : {};
91
- //
92
- // with(builder) {
93
- // div(html_attributes);
94
- // }
95
- // },
96
- //
97
- // methods : {
98
- // initialize : function initialize() {
99
- // if(this.content) {
100
- // this.html(this.content);
101
- // }
102
- // }
103
- // }
104
- // }
86
+ }
105
87
  });
106
88
  })(jQuery);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coolerator.vision
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corey Innis
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-12 00:00:00 -05:00
12
+ date: 2009-11-13 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency