Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions webapps/src/main/webapp/skin/css/tasks.less
Original file line number Diff line number Diff line change
Expand Up @@ -2858,9 +2858,15 @@
//border: 1px solid #476A9C;
animation: beginDrag 1s ease forwards;
}

.active-chip {
box-shadow: -1px 1px #838383,
-2px 2px #9b9b9b,
-3px 3px #a0a0a0,
-4px 4px #c5c5c5,
-5px 5px #d7d7d7
}
.labelsActionMenu {
max-width: 180px !important;
//max-width: 180px !important;
min-width: 160px !important;
.label-edit-name{
max-width: 136px;
Expand All @@ -2885,20 +2891,24 @@
}
}
.v-list-item {
padding-right: 30px !important;
padding-left: 30px !important;
min-height: 30px!important;
.uiIcon {
font-size: 16px;
}
.noColorLabel {
border: 1px solid @borderColor;
cursor: pointer;
width: 265px;
max-width: 265px;
}
.projectColorPicker {
width: 144px;
max-width: 144px;
width: 265px;
max-width: 265px;
.projectColorCell {
width: 20px;
height: 20px;
width: 40px;
height: 40px;
min-width: 20px;
min-height: 20px;
margin: 2px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,9 @@
</div>
<v-divider class="py-3" />
<div class="projectLabelsName mt-3 mb-3">
<v-label
for="labels">
{{ $t('label.labels') }}
</v-label>
<project-labels
:project="project"
@add-label="addLabelOnCreate"
@edit-label-on-create="editLabelBeforeCreate" />
@set-labels="setLabelsOnCreate"/>
</div>
</v-form>
</template>
Expand Down Expand Up @@ -166,12 +161,8 @@ export default {
});
},
methods: {
addLabelOnCreate(label){
this.labelsToAdd.push(label);
},
editLabelBeforeCreate(label){
const objIndex = this.labelsToAdd.findIndex((obj => obj.name === label.name));
this.labelsToAdd[objIndex].name = label.text;
setLabelsOnCreate(labels) {
this.labelsToAdd = labels;
},
open(project) {
if (project && project.id){
Expand Down Expand Up @@ -219,6 +210,7 @@ export default {
description: '',
id: '',
};
this.labelsToAdd = [];
window.setTimeout(() => {
document.dispatchEvent(new CustomEvent('loadAllProjectLabels', {
detail: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,179 +15,60 @@
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-->
<template>
<div :id="`label-${item.id}`" @click.stop>
<v-menu
:attach="`#label-${item.id}`"
v-model="displayActionMenu"
transition="slide-x-reverse-transition"
content-class="labelsActionMenu"
:close-on-content-click="false"
:close-on-click="true"
offset-y>
<template #activator="{ on }">
<v-chip
v-if="item === Object(item)"
:id="`label-${item.id}`"
v-bind="attrs"
:input-value="selected"
class="pr-1 font-weight-bold"
label
:color="`${item.color} lighten-3`"
:outlined="!item.color"
primary
small>
<span>
<v-chip
v-for="(item,i) in items" :key="i"
:id="`label-${item.id}`"
:input-value="selected"
class="ma-1 pr-1 font-weight-bold"
:class="{ 'active-chip' : item.active }"
label
:color="`${item.color} lighten-3`"
:outlined="!item.color"
primary
small>
<span class="pr-2">
{{ item.text }}
</span>
<v-icon
x-small
class="pr-0"
v-on="on"
@click="closeLabelsList">
edit
</v-icon>
<v-icon
x-small
class="pr-0"
@click="parent.selectItem(item);removeLabel()">
close
</v-icon>
</v-chip>
</template>
<v-list class="pa-0" dense>
<v-list-item class="px-2 ">
<v-list-item-content>
<v-text-field
ref="autoFocusInput1"
v-model="item.text"
type="text"
class="font-weight-bold text-color mb-1 labels-edit-name"
@blur="cancel($event)"
autofocus
outlined
dense>
<i
dark
class="uiIconTick success--text clickable label-btn ma-1"
slot="append"
@click="editLabel()">
</i>
<i
dark
class="uiIconClose error--text clickable label-btn ma-1"
slot="append"
@click="cancel($event)">
</i>
</v-text-field>
</v-list-item-content>
</v-list-item>

<v-list-item class="px-2 noColorLabel">
<v-list-item-title class="noColorLabel caption text-center text&#45;&#45;secondary">
<span @click="item.color='';editLabel()">{{ $t('label.noColor') }}</span>
</v-list-item-title>
</v-list-item>
<v-list-item>
<v-list-item-title class="subtitle-2 row projectColorPicker mx-auto my-2">
<span
v-for="(color, i) in labelColors"
:key="i"
:class="[ color.class , color.class === item.color ? 'isSelected' : '']"
class="projectColorCell"
@click="item.color=color.class;editLabel()"></span>
</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
</div>
<v-icon
v-if="item.project"
x-small
class="pr-0"
v-on="on"
@click="openEditActionMenu(item)">
edit
</v-icon>
<v-icon
x-small
class="pr-0"
@click="removeLabel(item, i)">
close
</v-icon>
</v-chip>
</span>
</template>

<script>
export default {
props: {
item: {
type: Object,
default: () => {
return {};
}
},
parent: {
type: Object,
default: () => {
return {};
}
},
},
data() {
return {
displayActionMenu: false,
labelColors: [
{ class: 'asparagus' },
{ class: 'munsell_blue' },
{ class: 'navy_blue' },
{ class: 'purple' },
{ class: 'red' },
{ class: 'brown' },
{ class: 'laurel_green' },
{ class: 'sky_blue' },
{ class: 'blue_gray' },
{ class: 'light_purple' },
{ class: 'hot_pink' },
{ class: 'light_brown' },
{ class: 'moss_green' },
{ class: 'powder_blue' },
{ class: 'light_blue' },
{ class: 'pink' },
{ class: 'Orange' },
{ class: 'gray' },
{ class: 'green' },
{ class: 'baby_blue' },
{ class: 'light_gray' },
{ class: 'beige' },
{ class: 'yellow' },
{ class: 'plum' },
],
};
items: [],
},
methods: {
editLabel() {
if ( this.item.project ) {
this.item.name=this.item.text;
this.$taskDrawerApi.editLabel(this.item).then( (editedLabel) => {
this.item=editedLabel;
this.item.text = this.item.name;
this.displayActionMenu= false;
this.$root.$emit('show-alert', {
type: 'success',
message: this.$t('alert.success.label.updated')
});
}).catch(e => {
console.error('Error when adding labels', e);
this.$root.$emit('show-alert', {
type: 'error',
message: this.$t('alert.error')
});
});
} else {
this.$emit('edit-label-on-create', this.item);
this.item.name=this.item.text;
this.displayActionMenu= false;
}
},
cancel(event) {
window.setTimeout(() => {
this.item.text = this.item.name;
this.displayActionMenu=false;
event.stopPropagation();
}, 100);
removeLabel(item, index) {
this.$emit('remove-label', item, index);
},
removeLabel() {
this.displayActionMenu= false;
this.$emit('remove-label', this.item);
openEditActionMenu(item) {
this.$emit('open-edit-label-action-menu', true, item);
},
closeLabelsList() {
document.dispatchEvent(new CustomEvent('closeLabelsList'));
resetActiveItem(item) {
this.items.forEach(item => {
item.active = false;
});
if (item) {
item.active = true;
}
this.$forceUpdate();
}
}
},
};
</script>
Loading