Commit 8a2a853d authored by Nicolas's avatar Nicolas

première vue nettoyée

parent 0cbfa759
......@@ -109,6 +109,9 @@ li li {
.invis_root, .invis{
display: none;
}
.view_tag{
font-size: 24px;
}
.trigger_infos{
background: white;
border: 0;
......
......@@ -5,11 +5,19 @@ window.W = window.W || {};
;
(function(undefined) {
'use strict';
W.edit_mode = true;
W.edit_mode = false;
W.TreeNode = Backbone.Marionette.View.extend({
tagName: 'li',
template: '#node-template',
getTemplate: function(){
console.log(this.model);
if (W.edit_mode){
console.log("template edit");
return '#node-template';
} else {
return '#node-template-vue';
}
},
templateContext: {
'aspectChoices': ["duratif", "itératif", "sémelfactif"],
......@@ -359,6 +367,7 @@ window.W = window.W || {};
},
onRender: function() {
if(W.edit_mode){
console.log("rendering");
//console.log(this.model.get('title'));
if(this.model.get('contingent')){
......@@ -408,6 +417,16 @@ window.W = window.W || {};
});
this.showChildView('tree', treeView);
}
}else{
var sublines = this.model.get('sublines');
console.log("mode lecture");
if (sublines.length) {
var treeView = new W.TreeView({
collection: sublines
});
this.showChildView('tree', treeView);
}
}
},
initialize: function() {
......
......@@ -33,13 +33,13 @@
<script id="score-template" type="text/template">
<header>
<div class="home"><a href="../">index</a></div>
<div class="home"><a href="../../">index</a></div>
<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>
<div class="choix_mode">
<button class="mode">Édition</button> <button class="mode_vue">Vue</button>
<button class="mode_vue">Vue</button>
</div>
</header>
<ol></ol>
......@@ -51,7 +51,7 @@
<div id="stage_set" ><%= stage_set %></div>
<button class="deplieTout">Tout déplier</button>
<div class="choix_mode">
<button class="mode">Édition</button> <button class="mode_vue">Vue</button>
<button class="mode">Édition</button>
</div> </header>
<ol></ol>
</script>
......@@ -168,7 +168,99 @@
<ol></ol>
<% } %>
</script>
<script id="node-template-vue" type="text/template">
<div class="axis-title" tabindex="0">
<span class="tag view_tag"><% if (tag) { %><%= tag %><% } else { %>><% }%></span>
<span id="alt_symbole">
<% if (alternative_symbole) { %><%= alternative_symbole %><% } else { %><% }%>
</span>
<span class="axis-title-edit"><%- title %></span>
<span class="trigger_infos">(i)</span>
<!-- autre possibilité avec placeholder
<input type="text" id="boucle" value="" placeholder="placeholder" />
-->
<span class="options">
<span id="terme">
<% if (terme && !(terme == 'terme')) { %><%= terme %><% } else { %><% }%>
</span>
<span id="boucle">
<% if (boucle) { %><%= boucle %><% } else { %><% }%>
</span>
<span id="alternative">
<% if (alternative) { %><%= alternative %><% } else { %><% }%>
</span>
<span id="condition" class="invis">
<% if (condition) { %><%= condition %><% } else { %><% }%>
</span>
<span id="imperative_env" class="invis">
<% if (imperative) { %>impérative<% } %>
</span>
<!--- comme dans les champs d'impression -->
<!--- les conditions sont au niveau des Sous-axes donc ne doit pas apparaitre dans le menu déroulant -->
<button class="toggle">(Dé)plier</button>
</span>
<div class="boucle-infos" class="invis">
boucle de
<input type="text" value="<% if (boucle_n) { %><%= boucle_n %><% } else { %> <% }%>" id="boucle_n" name="boucle_n" />
à
<input type="text" value="<% if (boucle_p) { %><%= boucle_p %><% } else { %> <% }%>" id="boucle_p" name="boucle_p" />
fois
<input type="button" id="boucle_ok" value="ok" />
<input type="button" id="boucle_x" value="effacer" />
</div>
<div class="alt-infos" class="invis">
entre
<input type="text" value="<% if (alternative_n) { %><%= alternative_n %><% } else { %> <% }%>" id="alt_n" name="alt_n" />
et
<input type="text" value="<% if (alternative_p) { %><%= alternative_p %><% } else { %> <% }%>" id="alt_p" name="alt_p" />
axes
<!--- tout vient de la notation de l'alternative n et p ensuite demander si condition impérative? -->
<select id="alt_mode">
<% _.each(alternativeChoices, function(alternativeChoice) {%>
<option value="<%= alternativeChoice %>" <% if (alternative_mode==alternativeChoice) { %>selected<% } %>><%= alternativeChoice %></option>
<% }); %>
</select>
<input type="button" id="alt_ok" value="ok" />
<input type="button" id="alt_x" value="effacer" />
</div>
<div class="axis-infos">
Axe:
<div>
<input type="checkbox" name="contingent" id="contingent" value="1" <% if (contingent) { %>checked<% } %> tabindex="0"> contingent
</div>
<div>
<input type="checkbox" name="module_" id="module_" value="1" <% if (module_) { %>checked<% } %>> modulé
</div>
<div>
Aspect: <% if (aspect) { %><%= aspect %><% } %>
</div>
<!-- <div>Pièce jointe</div> -->
<div>
<div>Indications</div>
<% if (indications) { %><%= indications %><% } %>
</div>
<div>
<input type="button" class="axis-fermer-infos" value="fermer" />
</div>
</div>
</div>
<% if (sublines.length) { %>
<ol></ol>
<% } %>
</script>
<script id="slider-template" type="text/template">
<input type="range" min="1" max="5" step="1" value="5">
</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