extended-spine-di
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "extended-spine-di", | ||
"description": "Some extensions for spine framework with dependency injection", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"author": { | ||
@@ -25,3 +25,3 @@ "name": "David Kudera", | ||
"dependencies": { | ||
"extended-spine": "~1.0.0", | ||
"extended-spine": "~1.0.3", | ||
"dependency-injection": "~1.6.1" | ||
@@ -28,0 +28,0 @@ }, |
@@ -48,2 +48,5 @@ # extended-spine-di | ||
* 1.0.2 | ||
+ Bug with inheritance | ||
* 1.0.1 | ||
@@ -50,0 +53,0 @@ + Typo in tests |
@@ -204,3 +204,3 @@ /** Generated by SimQ **/ | ||
(function() { | ||
var Controller, Spine, isMobile, | ||
var $, Controller, Spine, isMobile, | ||
__hasProp = {}.hasOwnProperty, | ||
@@ -213,7 +213,7 @@ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | ||
$ = null; | ||
Controller = (function(_super) { | ||
__extends(Controller, _super); | ||
Controller.jQuery = null; | ||
function Controller(el) { | ||
@@ -223,3 +223,3 @@ if (el == null) { | ||
} | ||
if (!this.el && el instanceof Controller.jQuery) { | ||
if (!this.el && el instanceof $) { | ||
this.el = el; | ||
@@ -235,4 +235,4 @@ } | ||
} | ||
Controller.jQuery = jQuery; | ||
Controller.jQuery.fn.hasAttr = function(name) { | ||
$ = jQuery; | ||
$.fn.hasAttr = function(name) { | ||
var attr; | ||
@@ -242,7 +242,7 @@ attr = $(this).attr(name); | ||
}; | ||
Controller.jQuery.fn.getController = function() { | ||
return Controller.jQuery(this).data('controller'); | ||
$.fn.getController = function() { | ||
return $(this).data('controller'); | ||
}; | ||
if (scope !== false) { | ||
return Controller.refresh(scope); | ||
return this.refresh(scope); | ||
} | ||
@@ -257,3 +257,3 @@ }; | ||
if (parent_prototype.events) { | ||
events = Controller.jQuery.extend({}, parent_prototype.events, events); | ||
events = $.extend({}, parent_prototype.events, events); | ||
} | ||
@@ -293,7 +293,8 @@ context = parent_prototype; | ||
Controller.findElementsWithController = function(scope) { | ||
var result; | ||
var result, | ||
_this = this; | ||
if (scope == null) { | ||
scope = 'html'; | ||
} | ||
scope = Controller.jQuery(scope); | ||
scope = $(scope); | ||
result = []; | ||
@@ -304,3 +305,3 @@ if (scope.hasAttr('data-controller')) { | ||
scope.find('*[data-controller]').each(function(i, el) { | ||
el = Controller.jQuery(el); | ||
el = $(el); | ||
return result.push(el); | ||
@@ -316,7 +317,7 @@ }); | ||
} | ||
_ref = Controller.findElementsWithController(scope); | ||
_ref = this.findElementsWithController(scope); | ||
_results = []; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
el = _ref[_i]; | ||
_results.push(Controller.register(el.attr('data-controller'), el)); | ||
_results.push(this.register(el.attr('data-controller'), el)); | ||
} | ||
@@ -331,3 +332,3 @@ return _results; | ||
} | ||
_ref = Controller.findElementsWithController(scope); | ||
_ref = this.findElementsWithController(scope); | ||
_results = []; | ||
@@ -351,3 +352,3 @@ for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
if (el !== null) { | ||
el = Controller.jQuery(el); | ||
el = $(el); | ||
} | ||
@@ -364,3 +365,3 @@ computer = el.hasAttr('data-computer'); | ||
} | ||
return Controller.createController(path, el); | ||
return this.createController(path, el); | ||
}; | ||
@@ -801,10 +802,28 @@ | ||
Model.first = function() { | ||
Model.slice = function(begin, end) { | ||
if (begin == null) { | ||
begin = 0; | ||
} | ||
return this.cloneArray(this.records.slice(begin, end)); | ||
}; | ||
Model.first = function(end) { | ||
var _ref; | ||
return (_ref = this.records[0]) != null ? _ref.clone() : void 0; | ||
if (end == null) { | ||
end = 1; | ||
} | ||
if (end > 1) { | ||
return this.cloneArray(this.records.slice(0, end)); | ||
} else { | ||
return (_ref = this.records[0]) != null ? _ref.clone() : void 0; | ||
} | ||
}; | ||
Model.last = function() { | ||
Model.last = function(begin) { | ||
var _ref; | ||
return (_ref = this.records[this.records.length - 1]) != null ? _ref.clone() : void 0; | ||
if (typeof begin === 'number') { | ||
return this.cloneArray(this.records.slice(-begin)); | ||
} else { | ||
return (_ref = this.records[this.records.length - 1]) != null ? _ref.clone() : void 0; | ||
} | ||
}; | ||
@@ -1469,3 +1488,3 @@ | ||
Spine.version = '1.2.1'; | ||
Spine.version = '1.2.2'; | ||
@@ -1861,3 +1880,3 @@ Spine.isArray = isArray; | ||
describe('Controller', function() { | ||
return describe('#createController()', function() { | ||
describe('#createController()', function() { | ||
return it('should create controller with autowired services', function() { | ||
@@ -1870,2 +1889,9 @@ var c; | ||
}); | ||
return describe('#register()', function() { | ||
return it('should register controller with autowired services', function() { | ||
var c; | ||
c = Controller.register('/app/controllers/Controller', $('#test div')); | ||
return expect(c.myArray).to.be.eql(['hello', 'word']); | ||
}); | ||
}); | ||
}); | ||
@@ -1872,0 +1898,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
161384
2122
55
Updatedextended-spine@~1.0.3