Commit aa58fc86 authored by alexandre's avatar alexandre

Merge remote-tracking branch 'origin/master' into merging-alex-gijs

parents 9f86bfbb 63d75c4f
......@@ -507,16 +507,11 @@ li li li li li li li li li li li li li li form { color: rgb(224, 206, 40); }
.axis-actions {
position: absolute;
z-index: 1;
top: 0;
right: 0;
display: none;
padding-right: 5em;
top: -2px;
}
.axis-title:hover .axis-actions { display: block; }
.axis-title:hover .axis-actions { display: inline-block; }
.axis-title .actant,
.axis-title .adresse {
......@@ -531,9 +526,17 @@ li li li li li li li li li li li li li li form { color: rgb(224, 206, 40); }
right: 0;
}
.axis-inline-title-form { display: inline-block; }
.axis-inline-title-form {
display: inline-block;
position: relative;
top: -5px;
}
.axis-inline-title-form [data-name="close"] { margin-left: 3em; }
.axis-inline-title-form [data-name="close"] {
margin-left: 1em;
margin-right: 2em;
cursor: pointer;
}
li + li > .axis-title #alt_symbole { display: none; }
......
......@@ -74,6 +74,15 @@ window.W = window.W || {};
}
}
function initState() {
return {
'collapsed': {},
'expandLevel': 1
}
};
var state = initState();
/**
* Instantiate with at least a label.
*/
......@@ -496,7 +505,10 @@ window.W = window.W || {};
this.model.unset('alternative_p');
this.model.unset('alternative_mode');
this.editMode = false;
this.collapsed = true;
if (!(this.model.cid in state.collapsed)) {
state.collapsed[this.model.cid] = true;
}
this.listenTo(this.model, 'change', this.render);
},
......@@ -753,18 +765,19 @@ window.W = window.W || {};
// inverts the data-collapsed option
// Uses CSS to toggle visibility
this.collapsed = !this.collapsed;
this.$el.attr("data-collapsed", this.collapsed);
state.collapsed[this.model.cid] = !state.collapsed[this.model.cid];
this.$el.attr("data-collapsed", state.collapsed[this.model.cid]);
},
collapse: function () {
this.collapsed = true;
this.$el.attr("data-collapsed", this.collapsed);
state.collapsed[this.model.cid] = true;
this.$el.attr("data-collapsed", state.collapsed[this.model.cid]);
},
expand: function () {
this.collapsed = false
this.$el.attr("data-collapsed", this.collapsed);
state.collapsed[this.model.cid] = false;
this.$el.attr("data-collapsed", state.collapsed[this.model.cid]);
},
getAltSymbol: function () {
......@@ -839,7 +852,7 @@ window.W = window.W || {};
onRender: function () {
// attribut des attributs html pour styler en css
this.$el.attr("data-collapsed", this.collapsed);
this.$el.attr("data-collapsed", state.collapsed[this.model.cid]);
this.$el.attr("data-module", this.model.get("module_"));
this.$el.attr("data-contingent", this.model.get("contingent"));
......@@ -847,11 +860,9 @@ window.W = window.W || {};
//show mainline nodes if they are present
if (sublines.length) {
var treeView = new W.TreeView({
collection: sublines
});
var sublinesView = new W.TreeView({ collection: sublines });
this.showChildView('tree', treeView);
this.showChildView('tree', sublinesView);
}
}
});
......@@ -998,7 +1009,7 @@ window.W = window.W || {};
},
regions: {
firstRegion: 'ol',
mainline: 'ol',
form: {
el: '#sidebar form',
......@@ -1050,8 +1061,10 @@ window.W = window.W || {};
initialize: function () {
this.hasChanges = false;
this.metaToggled = false;
this.listenTo(this.model, 'change', this.render);
this.listenTo(this.model, 'sync', this.render);
this.mainlineView = null;
this.sliderView = null;
// this.listenTo(this.model, 'change', this.render);
// this.listenTo(this.model, 'sync', this.render);
$(window).on('beforeunload', (function (e) {
if (this.hasChanges) {
......@@ -1061,6 +1074,11 @@ window.W = window.W || {};
}
}
}).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) {
......@@ -1108,7 +1126,8 @@ window.W = window.W || {};
button.prop('disabled', true);
button.text(button.data('label-progress'));
this.model.save({}, {
this.model.save(null, {
silent: true,
success: function () {
button.text(button.data('label'));
},
......@@ -1153,27 +1172,20 @@ window.W = window.W || {};
},
expandUntill: function (level) {
this.getChildView('firstRegion').triggerMethod('expandUntill', level);
this.getChildView('mainline').triggerMethod('expandUntill', level);
},
onRender: function () {
document.title = this.model.get('title');
var mainline = this.model.get("mainline");
this.showChildView('firstRegion', new W.TreeNode({
model: mainline
}));
var mainlineView = new W.TreeNode({ model: this.model.get('mainline') });
this.showChildView('mainline', mainlineView);
var sliderView = new W.SliderView({ depth: this.model.getDepth() });
this.showChildView('slider', sliderView);
var firstRegion = this.getRegion('firstRegion');
var foobar = firstRegion.$el.nestedSortable({
this.getRegion('mainline').$el.nestedSortable({
placeholder: 'placeholder',
forcePlaceholderSize: true,
helper: 'clone',
......@@ -1239,9 +1251,15 @@ window.W = window.W || {};
},
val: function (level) {
state.expandLevel = level;
this.$('[data-selected="true"]').attr('data-selected', false);
this.$('[data-value="' + level + '"]').attr('data-selected', true);
this.trigger('level:change', level);
},
onRender: function () {
this.$('[data-selected="true"]').attr('data-selected', false);
this.$('[data-value="' + state.expandLevel + '"]').attr('data-selected', true);
}
});
......@@ -1299,7 +1317,7 @@ window.W = window.W || {};
childView: W.ListItemView,
initialize: function (options) {
this.listenTo(this.collection, 'sync', this.render);
// this.listenTo(this.collection, 'sync', this.render);
},
});
......@@ -1311,7 +1329,7 @@ window.W = window.W || {};
'click .search': 'search',
},
onSearch: function(event) {
onSearch: function (event) {
this.collection.queryParams.search = this.$el.find('.search-input').val();
this.collection.fetch();
},
......@@ -1325,7 +1343,7 @@ window.W = window.W || {};
W.PaginationView = Backbone.Marionette.View.extend({
template: '#pagination-template',
templateContext: function() {
templateContext: function () {
return {
currentPage: this.collection.state.currentPage,
lastPage: this.collection.state.lastPage,
......@@ -1339,12 +1357,12 @@ window.W = window.W || {};
'click .previous-page': 'previousPage',
},
onNextPage: function(event) {
onNextPage: function (event) {
this.collection.getNextPage();
console.log(this.collection.state)
},
onPreviousPage: function(event) {
onPreviousPage: function (event) {
this.collection.getPreviousPage();
console.log(this.collection.state)
},
......@@ -1388,7 +1406,7 @@ window.W = window.W || {};
regions: {
search: '#search',
list: '#list',
pagination : '#pagination',
pagination: '#pagination',
create: '#create'
},
......
<input type="text" name="axis-inline-title" value="<%- title %>" />
<input type="button" name="submit" value="save" />
<a data-name="close">cancel</a>
\ No newline at end of file
<input type="button" name="submit" value="OK" />
<a data-name="close">Annuler</a>
\ No newline at end of file
......@@ -105,11 +105,11 @@
</span>
<section class="axis-actions">
<button name="edit" title="Modifier cet axe">🖉</button>
<button name="edit" title="Modifier cet axe">éditer</button>
<button name="add" title="Ajoute un sous-axe">+</button>
<button name="delete" title="Supprimer cet axe (et tous ses sous-axes)">x</button>
<% if (sublines.length) { %>
<button name="toggle"></button>
<!-- <button name="toggle"></button> -->
<% } %>
</section>
</div>
......
<!-- Title -->
<label>
<span class="label-text">Titre:</span>
<input type="text" name="title" value="<%= title %>">
<input type="text" name="title" value="<%- title %>">
</label>
<!-- description -->
<label>
<span class="label-text">Présentation: </span>
<textarea name="presentation"><%= presentation %></textarea>
<textarea name="presentation"><%- presentation %></textarea>
</label>
<!-- Setting -->
......@@ -19,24 +19,24 @@
<!-- Performance author -->
<label>
<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>
<!-- Score author -->
<label>
<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>
<!-- score_type = models.PositiveSmallIntegerField(default=1, choices=SCORE_TYPE_CHOICES) -->
<label>
<span class="label-text">Type:</span>
<select name="score_type">
<option value="1" <%= (score_type === 1) ? 'selected' : '' %>>Transcription</option>
<option value="2" <%= (score_type === 2) ? 'selected' : '' %>>Prescription</option>
<option value="3" <%= (score_type === 3) ? 'selected' : '' %>>Traduction</option>
<option value="1" <%- (score_type === 1) ? 'selected' : '' %>>Transcription</option>
<option value="2" <%- (score_type === 2) ? 'selected' : '' %>>Prescription</option>
<option value="3" <%- (score_type === 3) ? 'selected' : '' %>>Traduction</option>
</select>
<!-- <input type="text" name="score_type" value="<%= score_type %>"> -->
<!-- <input type="text" name="score_type" value="<%- score_type %>"> -->
</label>
<!-- effectif = models.CharField(blank=True, max_length=255) -->
......@@ -45,19 +45,19 @@
<!-- Duration -->
<label>
<span class="label-text">Durée:</span>
<input type="text" name="duration" value="<%= duration %>">
<input type="text" name="duration" value="<%- duration %>">
</label>
<!-- Tags -->
<label>
<span class="label-text">Tags: </span>
<input type="text" name="tags" value="<%= tags %>">
<input type="text" name="tags" value="<%- tags %>">
</label>
<!-- Language -->
<label>
<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>
<button data-name="close">Annuler</button>
......
......@@ -98,12 +98,12 @@
<dd class="extended"><%- formatTimestamp(created_at) %></dd>
<dt class="extended">Modifié le</dt>
<dd class="extended"><%- formatTimestamp(updated_at) %></dd>
<dd class="extended"><button class="edit score-edit">Éditer</button></dd>
<dt class="score-meta-expand-toggle"></dt>
</dl>
<button data-name="export">Export / back-up</button>
<button class="edit score-edit">Éditer</button>
<button data-name="export">Export</button>
<form></form>
</header>
......
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