...
 
Commits (4)
...@@ -176,6 +176,12 @@ button, submit, reset { ...@@ -176,6 +176,12 @@ button, submit, reset {
margin-top: .15em; 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:hover, submit:hover, reset:hover { background: var(--background-color-button); }
button:active, submit:active, reset:active { button:active, submit:active, reset:active {
...@@ -900,7 +906,7 @@ li.axis { position: relative; } ...@@ -900,7 +906,7 @@ li.axis { position: relative; }
.line__body { .line__body {
position: relative; position: relative;
border-radius: 5px; border-radius: 5px;
padding: .35em .5em .15em .5em; padding: .25em .5em .25em .5em;
} }
.line__body[data-aspect] { .line__body[data-aspect] {
...@@ -1069,7 +1075,8 @@ li + li .alt-symbol { display: none; } ...@@ -1069,7 +1075,8 @@ li + li .alt-symbol { display: none; }
background: var(--row-color); 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; visibility: hidden;
} }
...@@ -1376,13 +1383,17 @@ li + li .alt-symbol { display: none; } ...@@ -1376,13 +1383,17 @@ li + li .alt-symbol { display: none; }
========================================================================== */ ========================================================================== */
.axis-edit-form { .axis-edit-form {
position: relative; position: absolute;
border-width: 2px; top: 3.5em;
border-width: 3px;
border-style: solid; border-style: solid;
background: var(--background-color); background: var(--background-color);
box-shadow: 8px 8px 1px var(--background-color);
margin-bottom: 1em; margin-bottom: 1em;
margin-top: .75em; margin-top: .75em;
padding: .5em; padding: .5em;
min-width: 550px;
z-index: 3;
} }
/* subaxis colors, according to the level of nesting */ /* subaxis colors, according to the level of nesting */
......
...@@ -694,9 +694,9 @@ window.W = window.W || {}; ...@@ -694,9 +694,9 @@ window.W = window.W || {};
events: { events: {
'render': 'onRender', 'render': 'onRender',
'keydown': 'keydown',
'click @ui.extraFields legend': 'toggleExtraFields', 'click @ui.extraFields legend': 'toggleExtraFields',
'click @ui.submit': 'submit', 'click @ui.submit': 'submit'
'change [name="aspect"]': 'toggleAspect',
}, },
triggers: { triggers: {
...@@ -704,6 +704,18 @@ window.W = window.W || {}; ...@@ -704,6 +704,18 @@ window.W = window.W || {};
'click @ui.link': 'form:makeLink' '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 () { templateContext: function () {
return { return {
aspectChoices: ["duratif", "itératif", "sémelfactif"], aspectChoices: ["duratif", "itératif", "sémelfactif"],
...@@ -758,8 +770,6 @@ window.W = window.W || {}; ...@@ -758,8 +770,6 @@ window.W = window.W || {};
}, },
onRender: function () { onRender: function () {
this.toggleAspect();
this.renderAlternative(); this.renderAlternative();
this.renderBoucle(); this.renderBoucle();
this.renderAttachment(this.model.get('attachment')); this.renderAttachment(this.model.get('attachment'));
...@@ -802,15 +812,6 @@ window.W = window.W || {}; ...@@ -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 * Return input field with name
*/ */
...@@ -849,8 +850,10 @@ window.W = window.W || {}; ...@@ -849,8 +850,10 @@ window.W = window.W || {};
}, },
submit: function (e) { submit: function (e) {
e.stopImmediatePropagation(); if (e) {
e.preventDefault(); e.stopImmediatePropagation();
e.preventDefault();
}
// Todo: merge boucle and alternative into one value / datatype: // Todo: merge boucle and alternative into one value / datatype:
// null | [number, number] // null | [number, number]
...@@ -866,7 +869,7 @@ window.W = window.W || {}; ...@@ -866,7 +869,7 @@ window.W = window.W || {};
'contingent': this.isChecked('contingent'), 'contingent': this.isChecked('contingent'),
'boucle': this.getChildView('boucle').value(), 'boucle': this.getChildView('boucle').value(),
'alternative': this.getChildView('alternative').value(), 'alternative': this.getChildView('alternative').value(),
'aspect': (this.isChecked('aspect')) ? this.fieldVal('aspect-value') : null, 'aspect': this.fieldVal('aspect-value'),
'commandement': this.fieldVal('commandement'), 'commandement': this.fieldVal('commandement'),
'destination': this.fieldVal('destination'), 'destination': this.fieldVal('destination'),
'code': this.fieldVal('code'), 'code': this.fieldVal('code'),
...@@ -948,7 +951,7 @@ window.W = window.W || {}; ...@@ -948,7 +951,7 @@ window.W = window.W || {};
alternativeChoices: ["inclusive", "exclusive"], alternativeChoices: ["inclusive", "exclusive"],
tagChoices: tags, tagChoices: tags,
hasIndications: this.hasIndications(), hasIndications: this.hasIndications(),
showTag: this.showTag(), showTag: (this.showTag()) ? 'true' : 'false',
rangeType: rangeType, rangeType: rangeType,
isLink: (this.link) ? true : false, isLink: (this.link) ? true : false,
hasSublines: hasSublines, hasSublines: hasSublines,
...@@ -1156,21 +1159,15 @@ window.W = window.W || {}; ...@@ -1156,21 +1159,15 @@ window.W = window.W || {};
* in exclusive alternative. * in exclusive alternative.
*/ */
showTag: function () { showTag: function () {
var parent = this.model.get('parent'); var sublines = this.model.get('sublines');
if (parent) {
var parent_alternative = parent.get('alternative');
var sublineCount = parent.get('sublines').models.length;
if ((parent_alternative if (sublines && sublines.length > 1) {
&& parent_alternative.type === rangeType.exact var alternative = this.model.get('alternative');
&& parent_alternative.value === 1) if (alternative && alternative.type === rangeType.exact) {
|| (sublineCount === 1)) {
return false; return false;
} }
else {
return true; return true;
}
} }
return false; return false;
...@@ -1215,6 +1212,14 @@ window.W = window.W || {}; ...@@ -1215,6 +1212,14 @@ window.W = window.W || {};
this.model.addSubLine(); 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(); this.expand();
} }
...@@ -1315,7 +1320,9 @@ window.W = window.W || {}; ...@@ -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?"); var r = confirm("Vous êtes sur le point de supprimer l’axe " + this.model.get('title') + " et tous ses sous-axes. Continuer?");
if (r) { if (r) {
this.trigger('change'); 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. // As models have id's Backbone tries to make a servercall to remove the item.
// this.model.destroy(); // this.model.destroy();
} }
...@@ -1666,8 +1673,10 @@ window.W = window.W || {}; ...@@ -1666,8 +1673,10 @@ window.W = window.W || {};
}, },
submit: function (e) { submit: function (e) {
e.stopImmediatePropagation(); if (e) {
e.preventDefault(); e.stopImmediatePropagation();
e.preventDefault();
}
// Cast tag value into a list // Cast tag value into a list
var tags = this.fieldVal('tags').trim(); var tags = this.fieldVal('tags').trim();
......
<label><span class="label-text"><%- t('Titre') %></span><input type="text" name="title" ></label> <label>
<label class="inline"><span class="label-text"><%- t('Pièce-jointe') %></span><input type="file" name="file" ></label> <span class="label-text"><%- t('Pièce-jointe') %></span>
<button class="inline">Switch to file link</button> <input type="text" name="title" placeholder="<%- t('Titre') %>" ></label>
\ No newline at end of file </label>
<label>
<span class="label-text"></span>
<input type="file" name="file" class="inline">
<button class="inline"><%- t('Switch to link to external file') </button>
</label>
\ No newline at end of file
<label><span class="label-text"><%- t('Titre') %></span><input type="text" name="title" ></label> <label>
<label class="inline"><span class="label-text"><%- t('Pièce-jointe') %></span><input type="text" name="url" ></label> <span class="label-text"><%- t('Pièce-jointe') %></span>
<button class="inline">Switch to file upload</button> <input type="text" name="title" placeholder="<%- t('Titre') %>" >
</label>
<label class="inline">
<span class="label-text"></span>
<input type="text" name="url" placeholder="URL">
<button class="inline"><%- t('Switch to file upload') %></button>
</label>
<label> <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> <span class="label-text"><%- t('Pièce-jointe') %></span>
<a href="<%- attachment %>">Link</a> <input type="text" name="title" value="<%- title %>" />
</label> <button class="inline">supprimer</button>
<button class="inline">supprimer</delete> </label>
\ No newline at end of file \ No newline at end of file
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
<label><span class="label-text js-help" data-href="#terme"><%- t('Terme') %></span> <label><span class="label-text js-help" data-href="#terme"><%- t('Terme') %></span>
<input type="text" name="terme" value="<%- terme %>"> <input type="text" name="terme" value="<%- terme %>">
</label> </label>
</fieldset>
<fieldset>
<!-- boucle [subview] --> <!-- boucle [subview] -->
<section data-name="boucle"></section> <section data-name="boucle"></section>
...@@ -33,13 +34,11 @@ ...@@ -33,13 +34,11 @@
<section data-name="alternative"></section> <section data-name="alternative"></section>
<!-- aspect --> <!-- aspect -->
<section class="fieldgroup toggable"> <section class="fieldgroup">
<label class="inline">
<input type="checkbox" name="aspect" <% if (aspect) { %>checked<% } %>>
<%- t('aspect') %>
</label>
<label class="inline"> <label class="inline">
<span class="label-text"><%- t('aspect') %></span>
<select name="aspect-value"> <select name="aspect-value">
<option value="" <% if (!aspect) { %>selected<% } %>><%- t('aucun') %></option>
<% _.each(aspectChoices, function(a) {%> <% _.each(aspectChoices, function(a) {%>
<option value="<%= a %>" <% if (aspect==a) { %>selected<% } %>><%= a %></option> <option value="<%= a %>" <% if (aspect==a) { %>selected<% } %>><%= a %></option>
<% }); %> <% }); %>
...@@ -58,10 +57,12 @@ ...@@ -58,10 +57,12 @@
<input type="checkbox" name="module" <% if (module_) { %>checked<% } %>> <input type="checkbox" name="module" <% if (module_) { %>checked<% } %>>
<%- t('axe modulé') %> <%- t('axe modulé') %>
</label> </label>
</fieldset>
<fieldset>
<!-- attachments --> <!-- attachments -->
<section data-name="attachment"></section> <section data-name="attachment"></section>
</fieldset>
<fieldset>
<!-- actant --> <!-- actant -->
<label><span class="label-text"><%- t('Actant') %></span> <label><span class="label-text"><%- t('Actant') %></span>
<input type="text" name="actant" value="<%- actant %>"> <input type="text" name="actant" value="<%- actant %>">
......
...@@ -99,8 +99,8 @@ ...@@ -99,8 +99,8 @@
<form></form> <form></form>
<div class="sublines__metadata__wrapper"> <div class="sublines__metadata__wrapper">
<div class="sublines__metadata" data-tag="<%- sublineTag %>" <%= (sublineAlternative != "") ? 'data-alternative="' + sublineAlternative + '"' : '' %>> <div class="sublines__metadata" data-show-tag="<%- showTag %>" data-tag="<%- sublineTag %>" <%= (sublineAlternative != "") ? 'data-alternative="' + sublineAlternative + '"' : '' %>>
<span class="tag" data-tag="<%- sublineTag %>"></span> <span class="tag" data-tag="<%- sublineTag %>" data-show-tag="<%- showTag %>"></span>
<% if (sublineAlternative != "") { %> <% if (sublineAlternative != "") { %>
<span class="alternative"><%- sublineAlternative %></span> <span class="alternative"><%- sublineAlternative %></span>
<% } %> <% } %>
......