Commit 26b3f445 authored by alexandre's avatar alexandre

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

parents 459cf729 290d3732
......@@ -176,6 +176,12 @@ button, submit, reset {
margin-top: .15em;
}
select:disabled, input:disabled {
color: var(--button-color-disabled) !important;
border-color: var(--button-color-disabled) !important;
opacity: .75;
}
button:hover, submit:hover, reset:hover { background: var(--background-color-button); }
button:active, submit:active, reset:active {
......@@ -900,7 +906,7 @@ li.axis { position: relative; }
.line__body {
position: relative;
border-radius: 5px;
padding: .35em .5em .15em .5em;
padding: .25em .5em .25em .5em;
}
.line__body[data-aspect] {
......@@ -1069,7 +1075,8 @@ li + li .alt-symbol { display: none; }
background: var(--row-color);
}
.sublines__metadata[data-alternative="1"] > .tag {
.sublines__metadata[data-alternative="1"] > .tag,
.sublines__metadata[data-show-tag="false"] > .tag {
visibility: hidden;
}
......@@ -1376,13 +1383,17 @@ li + li .alt-symbol { display: none; }
========================================================================== */
.axis-edit-form {
position: relative;
border-width: 2px;
position: absolute;
top: 3.5em;
border-width: 3px;
border-style: solid;
background: var(--background-color);
box-shadow: 8px 8px 1px var(--background-color);
margin-bottom: 1em;
margin-top: .75em;
padding: .5em;
min-width: 550px;
z-index: 3;
}
/* subaxis colors, according to the level of nesting */
......
......@@ -11,6 +11,7 @@ W.lang.en = {
"Annuler": "Cancel",
"aspect": "aspect",
"au moins": "at least",
"aucun": "none",
"Auteur de la partition": "Score author",
// "Auteur de la perfomance": "",
"Auteur de la performance": "Performance author",
......@@ -53,7 +54,9 @@ W.lang.en = {
"La notation W": "The W notation",
"Le choix de W": "The W selection",
"Mise": "Set",
"Modifiée le": "Modified on",
"Modifiée le": "Modified at",
"Mode Téléversement": "Upload mode",
"Mode URL": "URL Mode",
"OK": "OK",
"Ok": "Ok",
"Partager avec": "Share with",
......@@ -63,6 +66,7 @@ W.lang.en = {
"performeur": "performer",
"performeurs": "performers",
"performeur(s)": "performer(s)",
"Pièce-jointe": "Attachment",
"Prescription": "Prescription",
"Présentation": "Presentation",
"Créée le": "Created at",
......@@ -89,5 +93,6 @@ W.lang.en = {
"Type": "Type",
"Type de partition": "Score type",
"Un logiciel pour noter l’action performée, développé par W": "A software for scoring performed action, developed by W",
"URL": "URL",
"Welcome": "Bienvenue",
}
......@@ -694,9 +694,9 @@ window.W = window.W || {};
events: {
'render': 'onRender',
'keydown': 'keydown',
'click @ui.extraFields legend': 'toggleExtraFields',
'click @ui.submit': 'submit',
'change [name="aspect"]': 'toggleAspect',
'click @ui.submit': 'submit'
},
triggers: {
......@@ -704,6 +704,18 @@ window.W = window.W || {};
'click @ui.link': 'form:makeLink'
},
keydown: function (e) {
if (e.keyCode == 27) {
e.preventDefault();
this.trigger('form:close');
}
if (e.keyCode == 13 && e.target.tagName != 'TEXTAREA') {
e.preventDefault();
this.submit();
}
},
templateContext: function () {
return {
aspectChoices: ["duratif", "itératif", "sémelfactif"],
......@@ -758,8 +770,6 @@ window.W = window.W || {};
},
onRender: function () {
this.toggleAspect();
this.renderAlternative();
this.renderBoucle();
this.renderAttachment(this.model.get('attachment'));
......@@ -802,15 +812,6 @@ window.W = window.W || {};
});
},
/**
* Check whether the aspect checkbox is checked, dis- / enable subfields
*/
toggleAspect: function (e) {
if (e) e.stopImmediatePropagation();
var active = this.isChecked('aspect');
this.field('aspect-value').prop('disabled', !active);
},
/**
* Return input field with name
*/
......@@ -849,8 +850,10 @@ window.W = window.W || {};
},
submit: function (e) {
e.stopImmediatePropagation();
e.preventDefault();
if (e) {
e.stopImmediatePropagation();
e.preventDefault();
}
// Todo: merge boucle and alternative into one value / datatype:
// null | [number, number]
......@@ -866,7 +869,7 @@ window.W = window.W || {};
'contingent': this.isChecked('contingent'),
'boucle': this.getChildView('boucle').value(),
'alternative': this.getChildView('alternative').value(),
'aspect': (this.isChecked('aspect')) ? this.fieldVal('aspect-value') : null,
'aspect': this.fieldVal('aspect-value'),
'commandement': this.fieldVal('commandement'),
'destination': this.fieldVal('destination'),
'code': this.fieldVal('code'),
......@@ -948,7 +951,7 @@ window.W = window.W || {};
alternativeChoices: ["inclusive", "exclusive"],
tagChoices: tags,
hasIndications: this.hasIndications(),
showTag: this.showTag(),
showTag: (this.showTag()) ? 'true' : 'false',
rangeType: rangeType,
isLink: (this.link) ? true : false,
hasSublines: hasSublines,
......@@ -1156,21 +1159,15 @@ window.W = window.W || {};
* in exclusive alternative.
*/
showTag: function () {
var parent = this.model.get('parent');
if (parent) {
var parent_alternative = parent.get('alternative');
var sublineCount = parent.get('sublines').models.length;
var sublines = this.model.get('sublines');
if ((parent_alternative
&& parent_alternative.type === rangeType.exact
&& parent_alternative.value === 1)
|| (sublineCount === 1)) {
if (sublines && sublines.length > 1) {
var alternative = this.model.get('alternative');
if (alternative && alternative.type === rangeType.exact) {
return false;
}
else {
return true;
}
return true;
}
return false;
......@@ -1215,6 +1212,14 @@ window.W = window.W || {};
this.model.addSubLine();
}
// The line wasn't alternative. Set all children to contingent
if (!this.model.get('alternative')) {
var sublines = this.model.get('sublines');
for(var i=0;i < sublines.length; i++) {
sublines.at(i).set('contingent', true)
}
}
this.expand();
}
......@@ -1315,7 +1320,9 @@ window.W = window.W || {};
var r = confirm("Vous êtes sur le point de supprimer l’axe " + this.model.get('title') + " et tous ses sous-axes. Continuer?");
if (r) {
this.trigger('change');
this.model.get('parent').get('sublines').remove([this.model]);
var parent = this.model.get('parent');
parent.get('sublines').remove([this.model]);
parent.trigger('change');
// As models have id's Backbone tries to make a servercall to remove the item.
// this.model.destroy();
}
......@@ -1666,8 +1673,10 @@ window.W = window.W || {};
},
submit: function (e) {
e.stopImmediatePropagation();
e.preventDefault();
if (e) {
e.stopImmediatePropagation();
e.preventDefault();
}
// Cast tag value into a list
var tags = this.fieldVal('tags').trim();
......
<label><span class="label-text"><%- t('Titre') %></span><input type="text" name="title" ></label>
<label class="inline"><span class="label-text"><%- t('Pièce-jointe') %></span><input type="file" name="file" ></label>
<button class="inline">Switch to file link</button>
\ No newline at end of file
<label>
<span class="label-text"><%- t('Pièce-jointe') %></span>
<input type="text" name="title" placeholder="<%- t('Titre') %>" ></label>
</label>
<label>
<span class="label-text"></span>
<input type="file" name="file" class="inline">
<button class="inline"><%- t('Mode URL') %></button>
</label>
\ No newline at end of file
<label><span class="label-text"><%- t('Titre') %></span><input type="text" name="title" ></label>
<label class="inline"><span class="label-text"><%- t('Pièce-jointe') %></span><input type="text" name="url" ></label>
<button class="inline">Switch to file upload</button>
<label>
<span class="label-text"><%- t('Pièce-jointe') %></span>
<input type="text" name="title" placeholder="<%- t('Titre') %>" >
</label>
<label class="inline">
<span class="label-text"></span>
<input type="text" name="url" placeholder="<%- t('URL') %>">
<button class="inline"><%- t('Mode Téléversement') %></button>
</label>
\ No newline at end of file
<label>
<span class="label-text"><%- t('Titre') %></span>
<input type="text" name="title" value="<%- title %>" />
</label>
<label class="inline">
<span class="label-text"><%- t('Pièce-jointe') %></span>
<a href="<%- attachment %>">Link</a>
</label>
<button class="inline">supprimer</delete>
\ No newline at end of file
<input type="text" name="title" value="<%- title %>" />
<button class="inline">supprimer</button>
</label>
\ No newline at end of file
......@@ -25,7 +25,8 @@
<label><span class="label-text js-help" data-href="#terme"><%- t('Terme') %></span>
<input type="text" name="terme" value="<%- terme %>">
</label>
</fieldset>
<fieldset>
<!-- boucle [subview] -->
<section data-name="boucle"></section>
......@@ -33,13 +34,11 @@
<section data-name="alternative"></section>
<!-- aspect -->
<section class="fieldgroup toggable">
<label class="inline">
<input type="checkbox" name="aspect" <% if (aspect) { %>checked<% } %>>
<%- t('aspect') %>
</label>
<section class="fieldgroup">
<label class="inline">
<span class="label-text"><%- t('aspect') %></span>
<select name="aspect-value">
<option value="" <% if (!aspect) { %>selected<% } %>><%- t('aucun') %></option>
<% _.each(aspectChoices, function(a) {%>
<option value="<%= a %>" <% if (aspect==a) { %>selected<% } %>><%= a %></option>
<% }); %>
......@@ -58,10 +57,12 @@
<input type="checkbox" name="module" <% if (module_) { %>checked<% } %>>
<%- t('axe modulé') %>
</label>
</fieldset>
<fieldset>
<!-- attachments -->
<section data-name="attachment"></section>
</fieldset>
<fieldset>
<!-- actant -->
<label><span class="label-text"><%- t('Actant') %></span>
<input type="text" name="actant" value="<%- actant %>">
......
......@@ -99,8 +99,8 @@
<form></form>
<div class="sublines__metadata__wrapper">
<div class="sublines__metadata" data-tag="<%- sublineTag %>" <%= (sublineAlternative != "") ? 'data-alternative="' + sublineAlternative + '"' : '' %>>
<span class="tag" data-tag="<%- sublineTag %>"></span>
<div class="sublines__metadata" data-show-tag="<%- showTag %>" data-tag="<%- sublineTag %>" <%= (sublineAlternative != "") ? 'data-alternative="' + sublineAlternative + '"' : '' %>>
<span class="tag" data-tag="<%- sublineTag %>" data-show-tag="<%- showTag %>"></span>
<% if (sublineAlternative != "") { %>
<span class="alternative"><%- sublineAlternative %></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