Commit 35ea5e0f authored by Nicolas's avatar Nicolas

vues conditionnelles

un début
parent 13464399
......@@ -5,7 +5,7 @@ window.W = window.W || {};
;
(function(undefined) {
'use strict';
W.edit_mode = true;
W.TreeNode = Backbone.Marionette.View.extend({
tagName: 'li',
......@@ -284,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.");
......@@ -424,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'
......@@ -436,8 +445,20 @@ window.W = window.W || {};
events: {
'blur #title' : '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){
},
......
......@@ -17,10 +17,19 @@
<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>
......
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