Commit 59340058 authored by alexandre's avatar alexandre

A few cosmetic changes

parent 1ef495d5
......@@ -28,9 +28,7 @@ window.W = window.W || {};
});
/** Starts the URL handling framework */
Backbone.history.start({
pushState: true,
});
Backbone.history.start({ pushState: true });
}
});
})();
......@@ -12,26 +12,36 @@ window.W = window.W || {};
var view = new W.HomeView();
baseView.showChildView('main', view);
},
about: function () {
var baseView = this.getOption('application').getView();
var view = new W.AboutView();
baseView.showChildView('main', view);
},
userList: function () {
var baseView = this.getOption('application').getView();
var view = new W.UserListView();
baseView.showChildView('main', view);
},
userDetail: function () {
var baseView = this.getOption('application').getView();
var view = new W.UserDetailView();
baseView.showChildView('main', view);
},
scoreList: function () {
var baseView = this.getOption('application').getView();
var view = new W.ScoreListView();
baseView.showChildView('main', view);
},
scoreDetail: function (id) {
var baseView = this.getOption('application').getView();
......
......@@ -6,25 +6,27 @@ window.W = window.W || {};
(function(undefined) {
'use strict';
var csrftoken = W.utils.getCookie('csrftoken');
function csrfSafeMethod(method) {
// these HTTP methods do not require CSRF protection
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
Marionette.TemplateCache.prototype.compileTemplate = function compileTemplate(rawTemplate, options) {
return W.extendedTemplate(rawTemplate, options);
}
var csrftoken = W.utils.getCookie('csrftoken');
$.ajaxSetup({
beforeSend: function(xhr, settings) {
if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
if (!W.utils.csrfSafeMethod(settings.type) && !this.crossDomain) {
xhr.setRequestHeader("X-CSRFToken", csrftoken);
}
}
});
// Declares the namespace to Dkango Relational
// Declares the namespace to Django Relational
Backbone.Relational.store.addModelScope(W);
W.config = W.config || {};
W.config.lang = W.utils.getUserLanguage();
......
......@@ -7,8 +7,6 @@ window.W = window.W || {};
'use strict';
W.ScoreRouter = Backbone.Marionette.AppRouter.extend({
// controller: W.ScoreController,
appRoutes: {
'': 'home',
'apropos(/)': 'about',
......
......@@ -17,6 +17,7 @@ window.W.utils = window.W.utils || {};
return lang;
}
W.utils.translate = window.t = function (string) {
if (!(W.config.lang in W.lang)) {
console.log(W.config.lang + " n'est pas une langue defini. On passe au français");
......@@ -33,12 +34,14 @@ window.W.utils = window.W.utils || {};
}
}
W.utils.setCookie = function (key, value) {
var expires = new Date();
expires.setTime(expires.getTime() + (1 * 24 * 60 * 60 * 1000));
document.cookie = key + '=' + value + ';expires=' + expires.toUTCString();
}
W.utils.getCookie = function (name) {
var cookieValue = null;
if (document.cookie && document.cookie !== '') {
......@@ -54,5 +57,11 @@ window.W.utils = window.W.utils || {};
}
return cookieValue;
}
W.utils.csrfSafeMethod = function (method) {
// these HTTP methods do not require CSRF protection
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
}
})();
......@@ -33,10 +33,6 @@ window.W = window.W || {};
}
});
Marionette.TemplateCache.prototype.compileTemplate = function compileTemplate(rawTemplate, options) {
return W.extendedTemplate(rawTemplate, options);
}
var columns = [
{
name: "title",
......
......@@ -5,6 +5,6 @@
<br>
<br>
<section>
<h1><%- t('Partitions mises à jour récemment') %></h1>
<h1><%- t('Sélection de partitions') %></h1>
<div id="latest_updated"></div>
</section>
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