Commit 92f54670 authored by gijs's avatar gijs

Integration of layout-proposal

parent 6506c3e5
This diff is collapsed.
......@@ -491,6 +491,8 @@ window.W = window.W || {};
W.Attachment = Backbone.Marionette.View.extend({
template: '#attachment-template',
className: 'attachment--view',
triggers: {
'click .btn-close': 'attachment:close'
}
......@@ -741,6 +743,9 @@ window.W = window.W || {};
template: '#node-template-vue',
templateContext: function () {
var hasAttachment = (this.model.get('attachment')) ? true : false,
hasSublines = (this.model.get('sublines') && this.model.get('sublines').length > 0) ? true : false;
return {
aspectChoices: ["duratif", "itératif", "sémelfactif"],
alternativeChoices: ["inclusive", "exclusive"],
......@@ -749,13 +754,15 @@ window.W = window.W || {};
hasIndications: this.hasIndications(),
showTag: this.showTag(),
rangeType: rangeType,
hasSublines: (this.model.get('sublines') && this.model.get('sublines').length > 0)
hasSublines: hasSublines,
hasAttachment: hasAttachment,
attachmentTitle: (hasAttachment) ? this.model.get('attachment').get('title') : ''
}
},
ui: {
'title': '.axis-title',
'titleSpan': '.axis-title-edit'
'title': '.axis-row',
'titleSpan': '.axis-title'
},
regions: {
......@@ -775,7 +782,7 @@ window.W = window.W || {};
},
attachment: {
el: '.attachment-view',
el: '.attachment--view',
replaceElement: true
}
},
......@@ -787,7 +794,7 @@ window.W = window.W || {};
'click [name="edit"]': 'toggleForm',
'click [name="add"]': 'addLine',
'click [name="delete"]': 'delete',
'click .btn-attachment': 'showAttachment',
'click .attachment--btn': 'showAttachment',
'change #tag': 'editSiblings',
'relocate': 'relocate',
'relocateChild': 'relocateChild'
......@@ -899,7 +906,7 @@ window.W = window.W || {};
},
/**
* Hide tag when it's the root tag or when the parent is
* Hide tag when it's the root axis or when the parent is
* in exclusive alternative.
*/
showTag: function () {
......@@ -1235,6 +1242,13 @@ window.W = window.W || {};
'change': 'change'
},
attributes: function () {
return {
'data-tag': this.collection.first().get('tag')
}
},
onExpandUntill: function (level) {
this.children.each(function (child) {
child.triggerMethod('expandUntill', level);
......@@ -1561,31 +1575,31 @@ window.W = window.W || {};
var permissionView = new W.PermissionView({ collection: permissions });
this.showChildView('permissions', permissionView);
this.getRegion('mainline').$el.nestedSortable({
placeholder: 'placeholder',
forcePlaceholderSize: true,
helper: 'clone',
handle: '.icon--handle',
isTree: true,
items: 'li',
toleranceElement: '> div',
protectRoot: true,
rootID: 'foo',
isAllowed: function (placeholder, placeholderParent, currentItem) {
return true;
},
relocate: function (event, ui) {
/*
* When the sort action is over:
* 1. trigger an event "relocate" on the item beeing sorted, along with its index
* 2. listen and catch event "relocate" on the view that is responsible for the item
* 3. trigger an event "relocateChild" on the parent element, along with the index, and the item model
* 4. listen and catch event "relocateChild" on the view that is responsible for the parent item
* 5. console.log that
*/
ui.item.trigger("relocate", ui);
},
});
// this.getRegion('mainline').$el.nestedSortable({
// placeholder: 'placeholder',
// forcePlaceholderSize: true,
// helper: 'clone',
// handle: '.icon--handle',
// isTree: true,
// items: 'li',
// toleranceElement: '> section',
// protectRoot: true,
// rootID: 'foo',
// isAllowed: function (placeholder, placeholderParent, currentItem) {
// return true;
// },
// relocate: function (event, ui) {
// /*
// * When the sort action is over:
// * 1. trigger an event "relocate" on the item beeing sorted, along with its index
// * 2. listen and catch event "relocate" on the view that is responsible for the item
// * 3. trigger an event "relocateChild" on the parent element, along with the index, and the item model
// * 4. listen and catch event "relocateChild" on the view that is responsible for the parent item
// * 5. console.log that
// */
// ui.item.trigger("relocate", ui);
// },
// });
},
onBeforeDestroy: function () {
......
<div class="axis-title axis-title-view" tabindex="0">
<div class="header">
<span class="icon icon--handle"></span>
<span class="alt-symbol">
<%= altSymbol %>
</span>
<% if (condition) { %>
<span class="icon icon--condition condition">
<span class="full"><% if (imperative) { %>! <% } %><%- condition %></span>
</span>
<% } %>
<header class="axis-row">
<section class="axis-row--header">
<span class="icon icon--handle"></span>
<span class="alt-symbol"><%= altSymbol %></span>
</div>
</section>
<!-- More visible aleternative, bullet: &#8729; -->
<span class="axis-title-edit">
<section class="axis-row--body">
<% if (actant) { %>
<span class="actant">
<%- actant %>:
</span>
<%- actant %></span>
<% } %>
<%- title %><!-- <% if (!hasSublines) { %>.<% } %> -->
<span class="axis-title">
<%- title %><!-- <% if (!hasSublines) { %>.<% } %> --></span>
<% if (adresse) { %>
<span class="adresse">
@<%- adresse %>
</span>
<% } %>
<% if (adresse) { %>
<span class="adresse">
<%- adresse %></span>
<% } %>
<% if (aspect) { %>
<span id="aspect_vue">
<% if (aspect == 'duratif') { %> <span class="icon icon--dur"></span> <% } %>
<% if (aspect == 'sémelfactif') { %> <span class="icon icon--semel"></span> <% } %>
<% if (aspect == 'itératif') { %> <span class="icon icon--iter"></span> <% } %>
</span>
<% } %>
</span>
<% if (aspect) { %>
<span class="aspect">
<% if (aspect == 'duratif') { %> <span class="icon icon--dur"></span> <% } %>
<% if (aspect == 'sémelfactif') { %> <span class="icon icon--semel"></span> <% } %>
<% if (aspect == 'itératif') { %> <span class="icon icon--iter"></span> <% } %></span>
<% } %>
<span class="axis-inline-title-form"></span>
<span class="axis-inline-title-form"></span>
<% if (hasIndications) { %>
<span class="indications">
......@@ -73,7 +56,12 @@
</span>
<% } %>
<span class="options">
</section>
<section class="axis-row--tail">
<% if (condition) { %>
<span class="condition"><% if (imperative) { %>! <% } %><%- condition %></span>
<% } %>
<% if (boucle) { %>
<span id="boucle" class="option">
<span class="icon icon--repeat"></span>
......@@ -92,23 +80,18 @@
<% if (terme) { %>
<span class="icon icon--stop"></span> <%- terme.substring(0,50) %>
<% if(terme.length > 50) { %>
...<span class="full"><%- terme %></span>
<% } %>
<% } %>
</span>
...<span class="full"><%- terme %></span><% } %><% } %></span>
<!-- <span id="alternative">
<% if (alternative) { %>
<%- alternative %>
<% } %>
</span> -->
</span>
<% if (attachment) { %>
<section class="attachment">
<a class="btn-attachment" href="#attachment">📎</a>
<div class="attachment-view"></div>
<%- alternative %><% } %></span> -->
<% if (attachment) { %>
<section class="attachment">
<a class="attachment--btn" href="#attachment">[<%- attachmentTitle %>]</a>
<div class="attachment--view"></div>
</section>
<% } %>
</section>
<% } %>
<section class="axis-actions">
<section class="axis-row--actions">
<button name="edit" title="Modifier cet axe"><%- t('é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>
......@@ -116,23 +99,10 @@
<!-- <button name="toggle"></button> -->
<% } %>
</section>
</div>
</header>
<form></form>
<% if (sublines.length) { %>
<% if (showTag) { %>
<% if (tag === "|") { %>
<span class="icon icon--tag icon--ul"></span>
<% } else if (tag === "//") { %>
<span class="icon icon--tag icon--par"></span>
<% } else if (tag === "≥") { %>
<span class="icon icon--tag icon--cum"></span>
<% } else if (tag === "||") { %>
<span class="icon icon--tag icon--mys"></span>
<% } else { %>
<span class="icon icon--tag icon--ol"></span>
<% } %>
<% } %>
<ol></ol>
<% } %>
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