mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Ember.ObjectController (and Ember.ArrayController) will be deprecated in Ember 1.11 (and removed from core in Ember 2.0). The reasoning is detailed in the Ember 2.0 RFC. This PR does the following: * Updates templates/controllers/views to explicitly reference model properties (instead of relying on proxying behavior). * Clearly delineate where certain properties are being set or retrieved from (for example it was not clear exactly where `scratch` and `titleScratch` were stored). * Remove usage of `Ember.ObjectController`. * Add JSCS rule to prevent future PR's from adding regressions.
32 lines
978 B
JavaScript
32 lines
978 B
JavaScript
var assert = require('assert');
|
|
|
|
module.exports = function () {};
|
|
|
|
module.exports.prototype = {
|
|
configure: function (disallowObjectController) {
|
|
assert(
|
|
typeof disallowObjectController === 'boolean',
|
|
'disallowObjectController option requires boolean value'
|
|
);
|
|
assert(
|
|
disallowObjectController === true,
|
|
'disallowObjectController option requires true value or should be removed'
|
|
);
|
|
},
|
|
|
|
getOptionName: function () {
|
|
return 'disallowObjectController';
|
|
},
|
|
|
|
check: function (file, errors) {
|
|
var lines = file.getLines();
|
|
|
|
lines.forEach(function (line, index) {
|
|
var location = line.indexOf(/ObjectController.extend/);
|
|
|
|
if (location !== -1) {
|
|
errors.add('Ember.ObjectController is deprecated, please use Ember.Controller and access model properties directly.', index + 1, location + 1);
|
|
}
|
|
});
|
|
}
|
|
};
|