mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 04:23:19 +00:00
Fix JS codestyle
This commit is contained in:
@@ -15,31 +15,31 @@ define([
|
||||
"bootstrap",
|
||||
"apps/admin/fields/views/alert",
|
||||
"models/field"
|
||||
], function($, _, Backbone, i18n, bootstrap, AlertView, FieldModel) {
|
||||
], function ($, _, Backbone, i18n, bootstrap, AlertView, FieldModel) {
|
||||
var CreateView = Backbone.View.extend({
|
||||
tagName: "div",
|
||||
events: {
|
||||
"click .btn-submit-field": "createAction",
|
||||
"click .btn-add-field": "toggleCreateFormAction",
|
||||
"click .btn-cancel-field": "toggleCreateFormAction",
|
||||
"keyup input": "onKeyupInput"
|
||||
"keyup input": "onKeyupInput"
|
||||
},
|
||||
render: function() {
|
||||
render: function () {
|
||||
var template = _.template($("#create_template").html());
|
||||
|
||||
this.$el.html(template);
|
||||
|
||||
$("#new-source", this.$el).autocomplete({
|
||||
minLength: 2,
|
||||
source: function(request, response) {
|
||||
source: function (request, response) {
|
||||
$.ajax({
|
||||
url: "/admin/fields/tags/search",
|
||||
dataType: "json",
|
||||
data: {
|
||||
term: request.term
|
||||
},
|
||||
success: function(data) {
|
||||
response($.map(data, function(item) {
|
||||
success: function (data) {
|
||||
response($.map(data, function (item) {
|
||||
return {
|
||||
label: item.label,
|
||||
value: item.value
|
||||
@@ -59,7 +59,7 @@ define([
|
||||
.find(".help-block")
|
||||
.empty();
|
||||
},
|
||||
createAction: function(event) {
|
||||
createAction: function (event) {
|
||||
var self = this;
|
||||
var formErrors = 0;
|
||||
|
||||
@@ -81,7 +81,7 @@ define([
|
||||
}
|
||||
|
||||
// check for duplicate field name
|
||||
if ("undefined" !== typeof AdminFieldApp.fieldsCollection.find(function(model){
|
||||
if ("undefined" !== typeof AdminFieldApp.fieldsCollection.find(function (model) {
|
||||
return model.get("name").toLowerCase() === fieldNameValue.toLowerCase();
|
||||
})) {
|
||||
fieldName
|
||||
@@ -118,7 +118,7 @@ define([
|
||||
formErrors++;
|
||||
}
|
||||
|
||||
if (formErrors > 0 ) {
|
||||
if (formErrors > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -126,15 +126,15 @@ define([
|
||||
"sbas-id": AdminFieldApp.sbas_id,
|
||||
"name": fieldNameValue,
|
||||
"tag": fieldTagValue,
|
||||
"label_en" : $("#new-label_en", this.$el).val(),
|
||||
"label_fr" : $("#new-label_fr", this.$el).val(),
|
||||
"label_de" : $("#new-label_de", this.$el).val(),
|
||||
"label_nl" : $("#new-label_nl", this.$el).val(),
|
||||
"label_en": $("#new-label_en", this.$el).val(),
|
||||
"label_fr": $("#new-label_fr", this.$el).val(),
|
||||
"label_de": $("#new-label_de", this.$el).val(),
|
||||
"label_nl": $("#new-label_nl", this.$el).val(),
|
||||
"multi": $("#new-multivalued", this.$el).is(":checked")
|
||||
});
|
||||
|
||||
field.save(null, {
|
||||
success: function(field, response, options) {
|
||||
success: function (field, response, options) {
|
||||
AdminFieldApp.fieldsCollection.add(field);
|
||||
_.last(AdminFieldApp.fieldListView.itemViews).clickAction().animate();
|
||||
|
||||
@@ -144,7 +144,7 @@ define([
|
||||
})
|
||||
}).render();
|
||||
},
|
||||
error: function(xhr, textStatus, errorThrown) {
|
||||
error: function (xhr, textStatus, errorThrown) {
|
||||
new AlertView({
|
||||
alert: "error", message: '' !== xhr.responseText ? xhr.responseText : i18n.t("something_wrong")}
|
||||
).render();
|
||||
@@ -155,7 +155,7 @@ define([
|
||||
|
||||
return this;
|
||||
},
|
||||
toggleCreateFormAction: function(event) {
|
||||
toggleCreateFormAction: function (event) {
|
||||
var fieldBlock = $(".add-field-block", this.$el);
|
||||
var addBtn = $(".btn-add-field", this.$el);
|
||||
|
||||
|
Reference in New Issue
Block a user