js_stack 0.6.8 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- //= require js_stack/base/marionette/2.0.3
1
+ //= require js_stack/base/marionette/2.1.0
@@ -1,3 +1,8 @@
1
+
2
+ // internal data structure is compatible with
3
+ // Backbone.Collection ...
4
+ // mind = blown
5
+
1
6
  (function (root, factory) {
2
7
  if (typeof define === 'function' && define.amd) {
3
8
  define(['backbone', 'underscore'], function (Backbone, _) {
@@ -92,6 +97,7 @@
92
97
  },
93
98
 
94
99
  _onChange: function (model, options) {
100
+ if (!model || !options) return; // ignore malformed arguments coming from custom events
95
101
  var already_here = this.get(model);
96
102
 
97
103
  if (this.accepts(model, options.index)) {
@@ -1 +1 @@
1
- //= require js_stack/plugins/backbone/virtualcollection/0.5.0
1
+ //= require js_stack/plugins/backbone/virtualcollection/0.5.1
@@ -16,7 +16,7 @@
16
16
 
17
17
  function Inflections() {
18
18
  this.apply_inflections = __bind(this.apply_inflections, this);
19
-
19
+ this.ordinalize = __bind(this.ordinalize, this);
20
20
  this.titleize = __bind(this.titleize, this);
21
21
  this.humanize = __bind(this.humanize, this);
22
22
  this.underscore = __bind(this.underscore, this);
@@ -229,6 +229,29 @@
229
229
  return match.replace(letter, letter.toUpperCase());
230
230
  });
231
231
  };
232
+
233
+ Inflections.prototype.ordinalize = function(num) {
234
+ var lastDigit, lastTwoDigits, number;
235
+ if (isNaN(num)) {
236
+ return num;
237
+ }
238
+ number = num.toString();
239
+ lastDigit = number.slice(-1);
240
+ lastTwoDigits = number.slice(-2);
241
+ if (lastTwoDigits === '11' || lastTwoDigits === '12' || lastTwoDigits === '13') {
242
+ return "" + number + "th";
243
+ }
244
+ switch (lastDigit) {
245
+ case '1':
246
+ return "" + number + "st";
247
+ case '2':
248
+ return "" + number + "nd";
249
+ case '3':
250
+ return "" + number + "rd";
251
+ default:
252
+ return "" + number + "th";
253
+ }
254
+ };
232
255
 
233
256
  Inflections.prototype.apply_inflections = function(word, rules) {
234
257
  var capture, match, regex, result, rule, _i, _len;
@@ -1,2 +1,5 @@
1
- //= require js_stack/base
2
- //= require js_stack/plugins
1
+ //= require js_stack/base/hamlcoffee
2
+ //= require js_stack/base/jsroutes
3
+ //= require js_stack/base/underscore
4
+ //= require js_stack/base/backbone
5
+ //= require js_stack/base/marionette
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: js_stack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.8
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomasz Pewiński
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-07-23 00:00:00.000000000 Z
12
+ date: 2014-08-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: haml_coffee_assets
@@ -100,7 +100,6 @@ files:
100
100
  - lib/js_stack.rb
101
101
  - lib/js_stack/version.rb
102
102
  - vendor/assets/javascripts/js_stack.js
103
- - vendor/assets/javascripts/js_stack/base.js
104
103
  - vendor/assets/javascripts/js_stack/base/backbone.js
105
104
  - vendor/assets/javascripts/js_stack/base/backbone/1.0.0.js
106
105
  - vendor/assets/javascripts/js_stack/base/backbone/1.1.2.js
@@ -114,10 +113,10 @@ files:
114
113
  - vendor/assets/javascripts/js_stack/base/marionette/1.7.4.js
115
114
  - vendor/assets/javascripts/js_stack/base/marionette/1.8.8.js
116
115
  - vendor/assets/javascripts/js_stack/base/marionette/2.0.3.js
116
+ - vendor/assets/javascripts/js_stack/base/marionette/2.1.0.js
117
117
  - vendor/assets/javascripts/js_stack/base/underscore.js
118
118
  - vendor/assets/javascripts/js_stack/base/underscore/1.5.2.js
119
119
  - vendor/assets/javascripts/js_stack/base/underscore/1.6.0.js
120
- - vendor/assets/javascripts/js_stack/plugins.js
121
120
  - vendor/assets/javascripts/js_stack/plugins/backbone.associations.js
122
121
  - vendor/assets/javascripts/js_stack/plugins/backbone.deepmodel.js
123
122
  - vendor/assets/javascripts/js_stack/plugins/backbone.mutators.js
@@ -141,7 +140,7 @@ files:
141
140
  - vendor/assets/javascripts/js_stack/plugins/backbone/validation/0.8.1.js
142
141
  - vendor/assets/javascripts/js_stack/plugins/backbone/validation/0.9.1.js
143
142
  - vendor/assets/javascripts/js_stack/plugins/backbone/virtualcollection/0.4.15.js
144
- - vendor/assets/javascripts/js_stack/plugins/backbone/virtualcollection/0.5.0.js
143
+ - vendor/assets/javascripts/js_stack/plugins/backbone/virtualcollection/0.5.1.js
145
144
  - vendor/assets/javascripts/js_stack/plugins/cocktail.js
146
145
  - vendor/assets/javascripts/js_stack/plugins/cocktail/0.5.8.js
147
146
  - vendor/assets/javascripts/js_stack/plugins/moment.js
@@ -1,5 +0,0 @@
1
- //= require js_stack/base/hamlcoffee
2
- //= require js_stack/base/jsroutes
3
- //= require js_stack/base/underscore
4
- //= require js_stack/base/backbone
5
- //= require js_stack/base/marionette
@@ -1,7 +0,0 @@
1
- //= require js_stack/plugins/backbone.stickit
2
- //= require js_stack/plugins/backbone.validation
3
- //= require js_stack/plugins/backbone.pageable
4
- //= require js_stack/plugins/backbone.deepmodel
5
- //= require js_stack/plugins/backbone.associations
6
- //= require js_stack/plugins/backbone.virtualcollection
7
- //= require js_stack/plugins/moment