Commit e52c1a77 authored by alexandre's avatar alexandre

Merge branch 'master' of gitlab.constantvzw.org:osp/work.w

parents cb113190 35ea5e0f
......@@ -5,7 +5,7 @@ window.W = window.W || {};
;
(function(undefined) {
'use strict';
W.edit_mode = true;
W.TreeNode = Backbone.Marionette.View.extend({
tagName: 'li',
......@@ -25,6 +25,7 @@ window.W = window.W || {};
},
events: {
'click .effaceAxe': 'effaceAxe',
'blur .axis-title-edit': 'editTitle',
'click .edit': 'editLine',
'click .toggle': 'toggleLine',
......@@ -52,6 +53,10 @@ window.W = window.W || {};
}
},
effaceAxe: function(e){
this.model.destroy();
},
editTitle: function(e) {
var val = $(e.target).text();
console.log(val);
......@@ -279,7 +284,7 @@ window.W = window.W || {};
return false;
}
}
//}else if(){
//}else if(){
}else{
alert("Les éléments de la boucle ne sont pas numériques. Pour effectuer une boucle indéterminée, mettre 0 dans les deux champs.");
......@@ -419,7 +424,16 @@ window.W = window.W || {};
W.ScoreView = Backbone.Marionette.View.extend({
template: '#score-template',
//template: '#score-template',
getTemplate: function(){
console.log(this.model);
if (W.edit_mode){
console.log("template edit");
return '#score-template';
} else {
return '#score-template-vue';
}
},
regions: {
firstRegion: 'ol'
......@@ -430,7 +444,23 @@ window.W = window.W || {};
},
events: {
'blur #title' : 'editTextProperty',
'blur #stage_set': 'editTextProperty'
'blur #stage_set': 'editTextProperty',
'click .mode': 'setEdit',
'click .mode_vue': 'setEditVue'
//'click .deplieTout': 'deplieTout',
},
setEdit: function(e){
console.log("edit");
W.edit_mode = true;
this.render();
},
setEditVue: function(e){
console.log("vue");
W.edit_mode = false;
this.render();
},
deplieTout: function(e){
},
editTextProperty: function(e) {
console.log('íci');
......
......@@ -36,11 +36,20 @@
<h1 contenteditable="true" id="title"><%- title %></h1>
<div contenteditable="true" id="stage_set" ><%= stage_set %></div>
<button class="save">Enregistrer</button>
<button class="deplieTout">Tout déplier</button>
<button class="mode">Édition</button> <button class="mode_vue">Vue</button>
</header>
<ol></ol>
</script>
<script id="score-template-vue" type="text/template">
<header>
<span class="axis-title-edit"><%- title %></span>
<div id="stage_set" ><%= stage_set %></div>
</header>
<ol></ol>
</script>
<script id="node-template" type="text/template">
<div class="axis-title" tabindex="0">
<span class="handle"></span>
......@@ -85,6 +94,8 @@
<button class="add">Ajouter</button>
<button class="toggle">(Dé)plier</button>
<button class="effaceAxe">Effacer</button>
</span>
<div class="boucle-infos" class="invis">
boucle de
......@@ -185,6 +196,11 @@
{
$(this).parent().parent().hide();
});
$('.deplieTout').click(function(){
$('li').attr('data-toggled',false);
});
});
</script>
......
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