New representation for terms hierarchy dropdown. Fixes new tem cancel. Corrects some css color for hover.

This commit is contained in:
Mateus Machado Luna 2018-08-15 12:19:49 -03:00
parent 608630f2bc
commit e2826fc6ed
9 changed files with 72 additions and 84 deletions

View File

@ -128,7 +128,7 @@ export default {
} }
</script> </script>
<style lang="scss"> <style lang="scss" scoped>
@import "../../scss/_variables.scss"; @import "../../scss/_variables.scss";
// Term Item // Term Item
@ -157,12 +157,6 @@ export default {
} }
} }
.children-icon {
color: $blue2;
position: absolute;
left: -21px;
}
.term-name { .term-name {
text-overflow: ellipsis; text-overflow: ellipsis;
overflow-x: hidden; overflow-x: hidden;
@ -186,16 +180,6 @@ export default {
font-weight: bold; font-weight: bold;
color: $danger; color: $danger;
} }
.children-dropdown {
margin-left: auto;
color: $blue4;
cursor: pointer;
padding-right: 1rem;
white-space: nowrap;
overflow: hidden;
display: flex;
align-items: center;
}
.controls { .controls {
visibility: hidden; visibility: hidden;
opacity: 0.0; opacity: 0.0;
@ -215,7 +199,7 @@ export default {
} }
} }
} }
.controls.is-disabled a, .children-dropdown.is-disabled { .controls.is-disabled a {
color: $gray4 !important; color: $gray4 !important;
cursor: not-allowed !important; cursor: not-allowed !important;
user-select: none; user-select: none;

View File

@ -14,52 +14,51 @@
class="icon children-icon"> class="icon children-icon">
<i class="mdi mdi-24px mdi-subdirectory-arrow-right"/> <i class="mdi mdi-24px mdi-subdirectory-arrow-right"/>
</span> </span>
<span class="children-dropdown icon">
<i
:class="{
'mdi-menu-right': !showChildren,
'mdi-menu-down': showChildren,
'is-disabled': isEditingTerm }"
class="mdi mdi-36px"
v-if="term.total_children > 0"
@click.prevent="toggleShowChildren()"/>
</span>
<span <span
class="term-name" class="term-name"
:class="{'is-danger': formWithErrors == term.id }"> :class="{'is-danger': formWithErrors == term.id }">
{{ term.name }} {{ term.name }}
</span> </span>
<span <span
v-if="term.id != undefined" v-if="term.id == 'new'"
class="label-details"> class="label-details">
<span <span class="not-saved" >
class="not-saved"
v-if="term.id == 'new'">
{{ $i18n.get('info_not_saved') }} {{ $i18n.get('info_not_saved') }}
</span> </span>
</span> </span>
<span <span
class="children-dropdown" class="children-counter"
:class="{'is-disabled': isEditingTerm}" v-if="term.total_children > 0">
v-if="term.total_children > 0"
@click.prevent="toggleShowChildren()">
<span class="icon">
<i
:class="{
'mdi-menu-right': !showChildren,
'mdi-menu-down': showChildren }"
class="mdi mdi-24px"/>
</span>
<span>{{ term.total_children + ' ' + $i18n.get('label_children_terms') }}</span> <span>{{ term.total_children + ' ' + $i18n.get('label_children_terms') }}</span>
</span> </span>
<span <span
class="controls" class="controls"
:class="{'is-disabled': isEditingTerm}"> :class="{'is-disabled': isEditingTerm}">
<a @click="addNewChildTerm(term, index)"> <a @click="addNewChildTerm(term, index)">
<b-icon <span class="icon">
size="is-small" <i class="mdi mdi-18px mdi-plus-circle"/>
icon="plus-circle"/> </span>
</a> </a>
<a <a
@click.prevent="editTerm()"> @click.prevent="editTerm()">
<b-icon <span class="icon">
size="is-small" <i class="mdi mdi-18px mdi-pencil"/>
icon="pencil"/> </span>
</a> </a>
<a @click.prevent="tryToRemoveTerm()"> <a @click.prevent="tryToRemoveTerm()">
<b-icon <span class="icon">
size="is-small" <i class="mdi mdi-18px mdi-delete"/>
icon="delete"/> </span>
</a> </a>
</span> </span>
</div> </div>
@ -251,13 +250,13 @@ export default {
} }
</script> </script>
<style lang="scss"> <style lang="scss" scoped>
@import "../../scss/_variables.scss"; @import "../../scss/_variables.scss";
// Term Item // Term Item
.term-item { .term-item {
font-size: 14px; font-size: 14px;
padding: 0 0 0 1.75rem; padding: 0 0 0 2.75rem;
min-height: 40px; min-height: 40px;
display: flex; display: flex;
position: relative; position: relative;
@ -285,7 +284,12 @@ export default {
position: absolute; position: absolute;
left: -21px; left: -21px;
} }
.children-dropdown {
color: $blue4;
position: absolute;
left: 5px;
cursor: pointer;
}
.term-name { .term-name {
text-overflow: ellipsis; text-overflow: ellipsis;
overflow-x: hidden; overflow-x: hidden;
@ -302,30 +306,29 @@ export default {
.label-details { .label-details {
font-weight: normal; font-weight: normal;
color: $gray3; color: $gray3;
margin-left: 1rem;
margin-right: auto; margin-right: auto;
} }
.children-counter {
margin-left: 1rem;
margin-right: auto;
color: $gray4;
padding-right: 1rem;
white-space: nowrap;
overflow: hidden;
}
.not-saved { .not-saved {
font-style: italic; font-style: italic;
font-weight: bold; font-weight: bold;
color: $danger; color: $danger;
} }
.children-dropdown {
margin-left: auto;
color: $blue4;
cursor: pointer;
padding-right: 1rem;
white-space: nowrap;
overflow: hidden;
display: flex;
align-items: center;
}
.controls { .controls {
visibility: hidden; visibility: hidden;
opacity: 0.0; opacity: 0.0;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
background-color: $gray2; background-color: $gray2;
padding: 0.76rem 0.875rem; padding: 0.5rem 0.875rem;
a { a {
display: flex; display: flex;

View File

@ -227,12 +227,32 @@ export default {
this.$termsListBus.onEditTerm(newTerm); this.$termsListBus.onEditTerm(newTerm);
}, },
onTermEditionFinished($event) { onTermEditionFinished($event) {
this.$termsListBus.onTermEditionSaved($event); this.$termsListBus.onTermEditionSaved($event);
}, },
onTermEditionCanceled($event) { onTermEditionCanceled($event) {
let term = $event; let term = $event;
if (term.id == 'new') {
for (let i = 0; i < this.localTerms.length; i++) {
if (this.localTerms[i].id == term.id) {
this.localTerms.splice(i, 1);
break;
} else {
let canceledParent = t.find(this.localTerms[i], [], (node) => { return node.id == term.parent });
if (canceledParent != undefined) {
for (let j = 0; j < canceledParent['children'].length; j++){
if (canceledParent['children'][j].id == term.id) {
canceledParent['children'].splice(j, 1);
break;
}
}
break;
}
}
}
} else {
let originalTerm; let originalTerm;
for (let aTerm of this.termsList) { for (let aTerm of this.termsList) {
if (aTerm.id == term.id) if (aTerm.id == term.id)
@ -262,25 +282,6 @@ export default {
} }
} }
} }
} else {
if (term.id == 'new') {
for (let i = 0; i < this.localTerms.length; i++) {
if (this.localTerms[i].id == term.id) {
this.localTerms.splice(i, 1);
break;
} else {
let canceledParent = t.find(this.localTerms[i], [], (node) => { return node.id == term.parent });
if (canceledParent != undefined) {
for (let j = 0; j < canceledParent['children'].length; j++){
if (canceledParent['children'][j].id == term.id) {
canceledParent['children'].splice(j, i);
break;
}
}
break;
}
}
}
} }
} }
this.$termsListBus.onTermEditionCanceled(term); this.$termsListBus.onTermEditionCanceled(term);

View File

@ -194,7 +194,7 @@ export default {
} }
.menu-text-import { .menu-text-import {
position: relative; position: relative;
top: -2px; top: -3px;
left: -6px; left: -6px;
} }
} }

View File

@ -28,7 +28,7 @@
label { margin-bottom: 0; } label { margin-bottom: 0; }
&.control { font-size: 13px !important; } &.control { font-size: 13px !important; }
.b-checkbox { width: 100% }; .b-checkbox { width: 100% };
&:hover { background-color: $gray1; } &:hover { background-color: $gray2; }
.is-small { color: $gray4; } .is-small { color: $gray4; }
&.is-active { background-color: $turquoise2; } &.is-active { background-color: $turquoise2; }

View File

@ -5,7 +5,7 @@
background-color: $gray1; background-color: $gray1;
&:hover { &:hover {
background-color: $gray1; background-color: $gray2;
} }
&::before, &::after { &::before, &::after {
background-color: $secondary; background-color: $secondary;

View File

@ -11,7 +11,7 @@
margin-bottom: 0px !important; margin-bottom: 0px !important;
color: $tainacan-input-color; color: $tainacan-input-color;
option:checked, option:hover { option:checked, option:hover {
background-color: $gray1 !important; background-color: $gray2 !important;
} }
&:focus, &:active { &:focus, &:active {
box-shadow: none !important; box-shadow: none !important;

View File

@ -8,7 +8,7 @@
overflow: hidden; overflow: hidden;
&:hover, &:hover .tag { &:hover, &:hover .tag {
background-color: $gray1; background-color: $gray2;
} }
.tag { .tag {

View File

@ -113,7 +113,7 @@ a:hover {
color: $blue5; color: $blue5;
option:checked, option:hover { option:checked, option:hover {
background-color: $gray1 !important; background-color: $gray2 !important;
} }
} }
.tainacan-table { .tainacan-table {