mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-15 05:53:13 +00:00
Fix JS codestyle
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
define([
|
||||
"jquery",
|
||||
"underscore"
|
||||
], function($, _) {
|
||||
], function ($, _) {
|
||||
|
||||
var Error = function (model, fieldId, message) {
|
||||
this.model = model;
|
||||
|
@@ -12,9 +12,9 @@ define([
|
||||
"underscore",
|
||||
"backbone",
|
||||
"apps/admin/fields/errors/errorModel"
|
||||
], function($, _, Backbone, ErrorModel) {
|
||||
], function ($, _, Backbone, ErrorModel) {
|
||||
|
||||
var ErrorManager = function() {
|
||||
var ErrorManager = function () {
|
||||
this.errors = {};
|
||||
_.extend(this, Backbone.Events);
|
||||
};
|
||||
@@ -38,8 +38,8 @@ define([
|
||||
containsModelError: function (model) {
|
||||
return "undefined" !== typeof this.errors[model.get("id")];
|
||||
},
|
||||
addModelFieldError: function(error) {
|
||||
if (! error instanceof Error) {
|
||||
addModelFieldError: function (error) {
|
||||
if (!error instanceof Error) {
|
||||
throw "Item must be an error object";
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ define([
|
||||
|
||||
return this;
|
||||
},
|
||||
removeModelFieldError: function(model, fieldId) {
|
||||
removeModelFieldError: function (model, fieldId) {
|
||||
var modelError = this.getModelError(model);
|
||||
|
||||
if (modelError) {
|
||||
@@ -72,7 +72,7 @@ define([
|
||||
}
|
||||
}
|
||||
},
|
||||
clearModelFieldErrors: function(model, fieldId) {
|
||||
clearModelFieldErrors: function (model, fieldId) {
|
||||
var modelError = this.getModelError(model);
|
||||
|
||||
if (modelError) {
|
||||
@@ -93,7 +93,7 @@ define([
|
||||
|
||||
return false;
|
||||
},
|
||||
getModelFieldError: function(model, fieldId) {
|
||||
getModelFieldError: function (model, fieldId) {
|
||||
var modelError = this.getModelError(model);
|
||||
|
||||
if (modelError) {
|
||||
@@ -102,7 +102,7 @@ define([
|
||||
|
||||
return null;
|
||||
},
|
||||
clearAll: function() {
|
||||
clearAll: function () {
|
||||
this.errors = {};
|
||||
this.trigger("no-error");
|
||||
},
|
||||
@@ -120,8 +120,8 @@ define([
|
||||
},
|
||||
all: function () {
|
||||
var errors = [];
|
||||
_.each(this.errors, function(modelErrors) {
|
||||
_.each(modelErrors.all(), function(error) {
|
||||
_.each(this.errors, function (modelErrors) {
|
||||
_.each(modelErrors.all(), function (error) {
|
||||
errors.push(error);
|
||||
});
|
||||
});
|
||||
|
@@ -10,21 +10,21 @@
|
||||
define([
|
||||
"jquery",
|
||||
"underscore"
|
||||
], function($, _) {
|
||||
var ErrorModel = function(id) {
|
||||
], function ($, _) {
|
||||
var ErrorModel = function (id) {
|
||||
this.id = id;
|
||||
this.errors = {};
|
||||
};
|
||||
|
||||
ErrorModel.prototype = {
|
||||
add: function(id, error) {
|
||||
if (! error instanceof Error) {
|
||||
add: function (id, error) {
|
||||
if (!error instanceof Error) {
|
||||
throw "Item must be an error object";
|
||||
}
|
||||
|
||||
this.errors[id] = error;
|
||||
},
|
||||
get: function(id) {
|
||||
get: function (id) {
|
||||
if (this.has(id)) {
|
||||
return this.errors[id];
|
||||
}
|
||||
@@ -33,12 +33,12 @@ define([
|
||||
has: function (id) {
|
||||
return "undefined" !== typeof this.errors[id];
|
||||
},
|
||||
remove: function(id) {
|
||||
remove: function (id) {
|
||||
if (this.has(id)) {
|
||||
delete this.errors[id];
|
||||
}
|
||||
},
|
||||
count: function() {
|
||||
count: function () {
|
||||
var count = 0;
|
||||
for (var k in this.errors) {
|
||||
if (this.errors.hasOwnProperty(k)) {
|
||||
|
Reference in New Issue
Block a user