Commit c88677ec authored by gijs's avatar gijs
Browse files

Safari syntax bugs

parent cf6dca69
......@@ -133,9 +133,9 @@ window.W = window.W || {};
},
addSubLine: function () {
const sublines = this.get('sublines');
const title = "Sous axe " + (sublines.length + 1);
const tag = (sublines.length > 0) ? sublines[0] : W.tags[0];
var sublines = this.get('sublines');
var title = "Sous axe " + (sublines.length + 1);
var tag = (sublines.length > 0) ? sublines[0] : W.tags[0];
sublines.add({ title: title, tag: tag });
},
......
......@@ -3,7 +3,7 @@ window.W = window.W || {};
;
(function(undefined) {
(function (undefined) {
'use strict';
W.ScoreRouter = Backbone.Marionette.AppRouter.extend({
......@@ -14,7 +14,7 @@ window.W = window.W || {};
':id(/)': 'scoreDetail',
},
initialize(options) {
initialize: function (options) {
this.controller = new W.ScoreController(options);
},
});
......
......@@ -64,8 +64,6 @@ window.W = window.W || {};
W.RangeField = Backbone.Marionette.View.extend({
label: '',
value: null, // @Fixme ?
className: 'fieldgroup',
tagName: 'section',
......@@ -90,7 +88,7 @@ window.W = window.W || {};
template: '#rangefield-template',
templateContext: function () {
const val = this.getOption('value');
var val = this.getOption('value');
return {
label: this.getOption('label'),
......@@ -115,7 +113,7 @@ window.W = window.W || {};
e.stopImmediatePropagation();
}
const disabled = !this.enabled();
var disabled = !this.enabled();
this.ui.typeSelect.prop('disabled', disabled);
this.ui.minimal.prop('disabled', disabled);
......@@ -129,7 +127,7 @@ window.W = window.W || {};
e.stopImmediatePropagation();
}
const type = this.ui.typeSelect.val();
var type = this.ui.typeSelect.val();
this.$('.type-fields').addClass('hidden');
this.$('[data-range-type="' + type + '"]').removeClass('hidden');
},
......@@ -142,8 +140,8 @@ window.W = window.W || {};
e.stopImmediatePropagation();
}
const min = parseInt(this.ui.rangeMin.val());
const max = parseInt(this.ui.rangeMax.val());
var min = parseInt(this.ui.rangeMin.val());
var max = parseInt(this.ui.rangeMax.val());
if (max < min) {
this.ui.rangeMin.val(max);
......@@ -158,8 +156,8 @@ window.W = window.W || {};
e.stopImmediatePropagation();
}
const min = parseInt(this.ui.rangeMin.val());
const max = parseInt(this.ui.rangeMax.val());
var min = parseInt(this.ui.rangeMin.val());
var max = parseInt(this.ui.rangeMax.val());
if (min > max) {
this.ui.rangeMax.val(min);
......@@ -185,8 +183,8 @@ window.W = window.W || {};
value: parseInt(this.ui.minimal.val())
};
case rangeType.range:
const min = parseInt(this.ui.rangeMin.val());
const max = parseInt(this.ui.rangeMax.val());
var min = parseInt(this.ui.rangeMin.val());
var max = parseInt(this.ui.rangeMax.val());
return {
type: rangeType.range,
......@@ -258,12 +256,12 @@ window.W = window.W || {};
onRender: function () {
this.toggleAspect();
const boucleField = new W.BoucleField({
var boucleField = new W.BoucleField({
label: 'boucle',
value: this.model.get('boucle')
});
const alternativeField = new W.AlternativeField({
var alternativeField = new W.AlternativeField({
label: 'alternative',
value: this.model.get('alternative')
});
......@@ -281,7 +279,7 @@ window.W = window.W || {};
*/
toggleAspect: function (e) {
if (e) e.stopImmediatePropagation();
const active = this.isChecked('aspect');
var active = this.isChecked('aspect');
this.field('aspect-value').prop('disabled', !active);
},
......@@ -298,13 +296,13 @@ window.W = window.W || {};
* All other fields are trimmed.
*/
fieldVal: function (name) {
const field = this.field(name);
var field = this.field(name);
if (!field) {
consoles.warn("Can't find field " + name);
} else {
if (!field.prop('disabled')) {
const value = field.val();
var value = field.val();
if (field.attr('type') == 'number') {
return parseInt(value);
} else if (value) {
......@@ -328,7 +326,7 @@ window.W = window.W || {};
// Todo: merge boucle and alternative into one value / datatype:
// null | [number, number]
const data = {
var data = {
'actant': this.fieldVal('actant'),
'adresse': this.fieldVal('adresse'),
'condition': this.fieldVal('condition'),
......@@ -391,7 +389,7 @@ window.W = window.W || {};
// Todo: merge boucle and alternative into one value / datatype:
// null | [number, number]
const data = this.ui.title.val().trim();
var data = this.ui.title.val().trim();
this.trigger('inlinetitleform:submit', data);
}
......@@ -492,10 +490,10 @@ window.W = window.W || {};
* temporary
*/
getBoucle: function () {
const boucle = this.model.get('boucle');
const boucle_check = this.model.get('boucle_check');
const boucle_n = this.model.get('boucle_n');
const boucle_p = this.model.get('boucle_p');
var boucle = this.model.get('boucle');
var boucle_check = this.model.get('boucle_check');
var boucle_n = this.model.get('boucle_n');
var boucle_p = this.model.get('boucle_p');
// console.log('boucle check', this.model.get('boucle_check'), 'n', boucle_n, 'p', boucle_p);
......@@ -524,9 +522,9 @@ window.W = window.W || {};
* temporary
*/
getAlternative: function () {
const alternative = this.model.get('alternative');
const alternative_n = this.model.get('alternative_n');
const alternative_p = this.model.get('alternative_p');
var alternative = this.model.get('alternative');
var alternative_n = this.model.get('alternative_n');
var alternative_p = this.model.get('alternative_p');
if (typeof alternative === 'object') {
return alternative;
......@@ -592,7 +590,7 @@ window.W = window.W || {};
e.stopImmediatePropagation();
}
let form = this.getChildView('form');
var form = this.getChildView('form');
if (form) {
this.getRegion('form').reset();
......@@ -603,15 +601,15 @@ window.W = window.W || {};
},
update: function (data) {
const model = this.model;
const changes = model.changedAttributes(data);
var model = this.model;
var changes = model.changedAttributes(data);
if (changes) {
model.set(data);
if (data.alternative) {
const alt = data.alternative;
let minimal = 2;
var alt = data.alternative;
var minimal = 2;
if (alt.type == rangeType.range) {
minimal = alt.value[1];
......@@ -619,7 +617,7 @@ window.W = window.W || {};
minimal = alt.value + 1;
}
const sublines = this.model.get('sublines');
var sublines = this.model.get('sublines');
while (sublines.length < minimal) {
this.model.addSubLine();
......@@ -644,7 +642,7 @@ window.W = window.W || {};
},
showInlineForm: function () {
const form = new W.NodeInlineTitleForm({ model: this.model });
var form = new W.NodeInlineTitleForm({ model: this.model });
this.showChildView('inlineTitleForm', form);
this.ui.titleSpan.hide();
},
......@@ -655,7 +653,7 @@ window.W = window.W || {};
},
updateTitle: function (title) {
const changes = this.model.changedAttributes({ 'title': title });
var changes = this.model.changedAttributes({ 'title': title });
if (changes) {
this.model.set('title', title);
......@@ -753,10 +751,10 @@ window.W = window.W || {};
},
getAltSymbol: function () {
const parent = this.model.get("parent");
var parent = this.model.get("parent");
if (parent) {
const alternative = parent.get("alternative");
var alternative = parent.get("alternative");
var altSymbol = "";
if (alternative) {
......@@ -913,13 +911,13 @@ window.W = window.W || {};
* All other fields are trimmed.
*/
fieldVal: function (name) {
const field = this.field(name);
var field = this.field(name);
if (!field) {
consoles.warn("Can't find field " + name);
} else {
if (!field.prop('disabled')) {
const value = field.val();
var value = field.val();
if (field.attr('type') == 'number') {
return parseInt(value);
} else if (value) {
......@@ -934,7 +932,7 @@ window.W = window.W || {};
},
onRender: function () {
const effectifField = new W.EffectifField({
var effectifField = new W.EffectifField({
label: 'effectif',
value: this.model.get('effectif')
});
......@@ -956,7 +954,7 @@ window.W = window.W || {};
console.log(this.getChildView('effectif').value());
const data = {
var data = {
title: this.fieldVal('title'),
score_type: parseInt(this.fieldVal('score_type')),
score_author: this.fieldVal('score_author'),
......@@ -1035,7 +1033,7 @@ window.W = window.W || {};
e.stopImmediatePropagation();
}
let form = this.getChildView('form');
var form = this.getChildView('form');
if (form) {
this.getRegion('form').reset();
......@@ -1205,13 +1203,13 @@ window.W = window.W || {};
};
},
onClick(view, e) {
onClick: function (view, e) {
e.preventDefault();
e.stopImmediatePropagation();
this.val(parseInt($(e.target).attr('data-value')));
},
val(level) {
val: function (level) {
this.$('[data-selected="true"]').attr('data-selected', false);
this.$('[data-value="' + level + '"]').attr('data-selected', true);
this.trigger('level:change', level);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment