Commit 7c2827d0 authored by gijs's avatar gijs

D&D reordering should be better

parent 8b4215f3
......@@ -26,7 +26,7 @@
--row-indent: 80px;
--axis-line-offset: 40px;
--axis-line-width: 2px;
--axis-bottom-padding: 1em;
--axis-padding: 1em;
--axis-tag-size: 1.8em;
/**
......@@ -36,7 +36,7 @@
--axis-vertical-line-start: calc(var(--axis-vertical-line-middle) - var(--axis-line-width) * .5);
--axis-vertical-line-end: calc(var(--axis-vertical-line-middle) + var(--axis-line-width) * .5);
--axis-horizontal-line-middle: 1.1em;
--axis-horizontal-line-middle: 2.1em;
--axis-horizontal-line-start: calc(var(--axis-horizontal-line-middle) - var(--axis-line-width) * .5);
--axis-horizontal-line-end: calc(var(--axis-horizontal-line-middle) + var(--axis-line-width) * .5);
......@@ -760,8 +760,8 @@ li.axis { position: relative; }
.score__mainline ol { padding-left: var(--row-indent); }
.score__line {
margin-top: var(--axis-bottom-padding);
margin-bottom: var(--axis-bottom-padding);
padding-top: var(--axis-padding);
padding-bottom: var(--axis-padding);
}
.axis-row {
......@@ -926,7 +926,11 @@ li.axis { position: relative; }
.icon--handle:before {
font-weight: lighter;
content: "\f80e";
content: "\f80e";
display: block;
position: absolute;
left: 15px;
top: .75em;
}
.icon--handle {
......@@ -934,10 +938,11 @@ li.axis { position: relative; }
visibility: hidden;
position: absolute;
font-size: var(--font-size--bigger);
left: -34px;
top: 2px;
width: 50px;
z-index: 2;
left: -45px;
top: 0px;
bottom: 0;
width: 60px;
z-index: 2;
}
.sublines {
......@@ -953,7 +958,7 @@ li.axis { position: relative; }
.sublines__metadata__wrapper {
position: absolute;
top: 3.5em;
top: 4.5em;
bottom: .5em;
left: var(--row-indent);
display: none;
......@@ -1051,23 +1056,7 @@ li + li .alt-symbol { display: none; }
background: var(--row-color);
}
/* is it still used? */
.icon--tag {
text-align: center;
background-color: var(--row-color);
position: sticky;
display: inline-block;
width: 1.5em;
height: 1.5em;
border-radius: .75em;
top: 10px;
float: left;
z-index: 1;
}
[data-alternative="1"] > .metadata > .metadata__wrapper > .tag {
.sublines__metadata[data-alternative="1"] > .tag {
visibility: hidden;
}
......@@ -1470,7 +1459,7 @@ ol::before {
content: " ";
display: block;
position: absolute;
top: 1.2rem;
top: var(--axis-horizontal-line-end);
bottom: 1px;
border-left: 2px solid var(--row-color);
}
......
......@@ -1276,10 +1276,11 @@ window.W = window.W || {};
// Triggered by a subline view beeing relocated
relocateChild: function (event, model, index) {
if (valid_move(model, this.model)) {
model.get("parent").get("sublines").remove(model);
var previous_parent = model.get("parent");
previous_parent.get("sublines").remove(model);
this.model.get("sublines").add(model, { at: index });
this.render();
previous_parent.trigger('change');
this.model.trigger('change');
this.trigger('change');
var alts;
......@@ -1419,6 +1420,7 @@ window.W = window.W || {};
this.$el.attr("data-module", this.model.get("module_"));
this.$el.attr("data-contingent", this.model.get("contingent"));
this.$el.attr("data-id", this.model.get("id"));
this.$el.attr("id", this.model.get("id"));
var sublines = this.model.get("sublines");
......@@ -1427,6 +1429,8 @@ window.W = window.W || {};
var sublinesView = new W.TreeView({ collection: sublines });
this.$el.attr("data-sublines", "true");
this.showChildView('tree', sublinesView);
} else {
this.$el.attr("data-sublines", "false");
}
this.renderAttachmentView();
......@@ -1983,7 +1987,6 @@ window.W = window.W || {};
return true;
},
relocate: function (_, ui) {
/*
* When the sort action is over:
......
......@@ -99,7 +99,7 @@
<form></form>
<div class="sublines__metadata__wrapper">
<div class="sublines__metadata">
<div class="sublines__metadata" data-tag="<%- sublineTag %>" <%= (sublineAlternative != "") ? 'data-alternative="' + sublineAlternative + '"' : '' %>>
<span class="tag" data-tag="<%- sublineTag %>"></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