Commit 4c232eca authored by gijs's avatar gijs
Browse files

Fixes issue where quotes where not allowed in score title, scores should be displayed faster

parent f5011573
...@@ -1050,8 +1050,8 @@ window.W = window.W || {}; ...@@ -1050,8 +1050,8 @@ window.W = window.W || {};
initialize: function () { initialize: function () {
this.hasChanges = false; this.hasChanges = false;
this.metaToggled = false; this.metaToggled = false;
this.listenTo(this.model, 'change', this.render); // this.listenTo(this.model, 'change', this.render);
this.listenTo(this.model, 'sync', this.render); // this.listenTo(this.model, 'sync', this.render);
$(window).on('beforeunload', (function (e) { $(window).on('beforeunload', (function (e) {
if (this.hasChanges) { if (this.hasChanges) {
...@@ -1061,6 +1061,11 @@ window.W = window.W || {}; ...@@ -1061,6 +1061,11 @@ window.W = window.W || {};
} }
} }
}).bind(this)); }).bind(this));
this.listenToOnce(this.model, 'sync', (function () {
this.listenTo(this.model, 'change', this.render);
this.listenTo(this.model, 'sync', this.render);
}).bind(this));
}, },
toggleForm: function (e) { toggleForm: function (e) {
...@@ -1311,7 +1316,7 @@ window.W = window.W || {}; ...@@ -1311,7 +1316,7 @@ window.W = window.W || {};
'click .search': 'search', 'click .search': 'search',
}, },
onSearch: function(event) { onSearch: function (event) {
this.collection.queryParams.search = this.$el.find('.search-input').val(); this.collection.queryParams.search = this.$el.find('.search-input').val();
this.collection.fetch(); this.collection.fetch();
}, },
...@@ -1325,7 +1330,7 @@ window.W = window.W || {}; ...@@ -1325,7 +1330,7 @@ window.W = window.W || {};
W.PaginationView = Backbone.Marionette.View.extend({ W.PaginationView = Backbone.Marionette.View.extend({
template: '#pagination-template', template: '#pagination-template',
templateContext: function() { templateContext: function () {
return { return {
currentPage: this.collection.state.currentPage, currentPage: this.collection.state.currentPage,
lastPage: this.collection.state.lastPage, lastPage: this.collection.state.lastPage,
...@@ -1339,12 +1344,12 @@ window.W = window.W || {}; ...@@ -1339,12 +1344,12 @@ window.W = window.W || {};
'click .previous-page': 'previousPage', 'click .previous-page': 'previousPage',
}, },
onNextPage: function(event) { onNextPage: function (event) {
this.collection.getNextPage(); this.collection.getNextPage();
console.log(this.collection.state) console.log(this.collection.state)
}, },
onPreviousPage: function(event) { onPreviousPage: function (event) {
this.collection.getPreviousPage(); this.collection.getPreviousPage();
console.log(this.collection.state) console.log(this.collection.state)
}, },
...@@ -1386,7 +1391,7 @@ window.W = window.W || {}; ...@@ -1386,7 +1391,7 @@ window.W = window.W || {};
regions: { regions: {
search: '#search', search: '#search',
list: '#list', list: '#list',
pagination : '#pagination', pagination: '#pagination',
create: '#create' create: '#create'
}, },
...@@ -1404,9 +1409,9 @@ window.W = window.W || {}; ...@@ -1404,9 +1409,9 @@ window.W = window.W || {};
order: -1 order: -1
}, },
// queryParams: { // queryParams: {
// search: "Ménagerie" // search: "Ménagerie"
// } // }
}); });
var myListView = new W.ListView({ var myListView = new W.ListView({
......
<!-- Title --> <!-- Title -->
<label> <label>
<span class="label-text">Titre:</span> <span class="label-text">Titre:</span>
<input type="text" name="title" value="<%= title %>"> <input type="text" name="title" value="<%- title %>">
</label> </label>
<!-- description --> <!-- description -->
<label> <label>
<span class="label-text">Présentation: </span> <span class="label-text">Présentation: </span>
<textarea name="presentation"><%= presentation %></textarea> <textarea name="presentation"><%- presentation %></textarea>
</label> </label>
<!-- Setting --> <!-- Setting -->
...@@ -19,24 +19,24 @@ ...@@ -19,24 +19,24 @@
<!-- Performance author --> <!-- Performance author -->
<label> <label>
<span class="label-text">Auteur de la perfomance:</span> <span class="label-text">Auteur de la perfomance:</span>
<input type="text" name="performance_author" value="<%= performance_author %>" <%= (score_type === 2) ? 'disabled' : '' %>> <input type="text" name="performance_author" value="<%- performance_author %>" <%- (score_type === 2) ? 'disabled' : '' %>>
</label> </label>
<!-- Score author --> <!-- Score author -->
<label> <label>
<span class="label-text">Auteur de la partition:</span> <span class="label-text">Auteur de la partition:</span>
<input type="text" name="score_author" value="<%= score_author %>"> <input type="text" name="score_author" value="<%- score_author %>">
</label> </label>
<!-- score_type = models.PositiveSmallIntegerField(default=1, choices=SCORE_TYPE_CHOICES) --> <!-- score_type = models.PositiveSmallIntegerField(default=1, choices=SCORE_TYPE_CHOICES) -->
<label> <label>
<span class="label-text">Type:</span> <span class="label-text">Type:</span>
<select name="score_type"> <select name="score_type">
<option value="1" <%= (score_type === 1) ? 'selected' : '' %>>Transcription</option> <option value="1" <%- (score_type === 1) ? 'selected' : '' %>>Transcription</option>
<option value="2" <%= (score_type === 2) ? 'selected' : '' %>>Prescription</option> <option value="2" <%- (score_type === 2) ? 'selected' : '' %>>Prescription</option>
<option value="3" <%= (score_type === 3) ? 'selected' : '' %>>Traduction</option> <option value="3" <%- (score_type === 3) ? 'selected' : '' %>>Traduction</option>
</select> </select>
<!-- <input type="text" name="score_type" value="<%= score_type %>"> --> <!-- <input type="text" name="score_type" value="<%- score_type %>"> -->
</label> </label>
<!-- effectif = models.CharField(blank=True, max_length=255) --> <!-- effectif = models.CharField(blank=True, max_length=255) -->
...@@ -45,19 +45,19 @@ ...@@ -45,19 +45,19 @@
<!-- Duration --> <!-- Duration -->
<label> <label>
<span class="label-text">Durée:</span> <span class="label-text">Durée:</span>
<input type="text" name="duration" value="<%= duration %>"> <input type="text" name="duration" value="<%- duration %>">
</label> </label>
<!-- Tags --> <!-- Tags -->
<label> <label>
<span class="label-text">Tags: </span> <span class="label-text">Tags: </span>
<input type="text" name="tags" value="<%= tags %>"> <input type="text" name="tags" value="<%- tags %>">
</label> </label>
<!-- Language --> <!-- Language -->
<label> <label>
<span class="label-text">Langue: </span> <span class="label-text">Langue: </span>
<input type="text" name="language" value="<%= (language) ? language : getUserLanguage() %>"> <input type="text" name="language" value="<%- (language) ? language : getUserLanguage() %>">
</label> </label>
<button data-name="close">Annuler</button> <button data-name="close">Annuler</button>
......
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