Task Detail View (#37)

This commit is contained in:
konrad 2019-11-24 13:16:24 +00:00
parent e00f0046b5
commit 4e5d14d969
39 changed files with 2228 additions and 503 deletions

View file

@ -15,7 +15,8 @@
"v-tooltip": "^2.0.0-rc.33", "v-tooltip": "^2.0.0-rc.33",
"verte": "^0.0.12", "verte": "^0.0.12",
"vue": "^2.5.17", "vue": "^2.5.17",
"vue-drag-resize": "^1.3.2" "vue-drag-resize": "^1.3.2",
"vue-easymde": "^1.0.1"
}, },
"devDependencies": { "devDependencies": {
"@fortawesome/fontawesome-svg-core": "^1", "@fortawesome/fontawesome-svg-core": "^1",

View file

@ -0,0 +1,92 @@
<template>
<!-- TODO: Fix the icons -->
<vue-easymde v-model="text" :configs="config" @change="bubble"/>
</template>
<script>
import VueEasymde from 'vue-easymde'
export default {
name: 'easymde',
components: {
VueEasymde
},
props: {
value: '',
},
data() {
return {
text: '',
config: {
autoDownloadFontAwesome: false,
spellChecker: false,
toolbar: [
'heading-1',
'heading-2',
'heading-3',
'heading-smaller',
'heading-bigger',
'|',
'bold',
'italic',
'strikethrough',
'code',
'quote',
'unordered-list',
'ordered-list',
'|',
'clean-block',
'link',
'image',
'table',
'horizontal-rule',
'|',
'preview',
'side-by-side',
'fullscreen',
'guide',
// {
// name: 'bold',
// title: 'Bold',
// iconElement: '<span>test</span>' // This relies on an extra thing added in node_modules/easymde/src/js/easymde.js:145
// },
]
},
}
},
watch: {
value(newVal) {
this.text = newVal
},
text() {
this.bubble()
}
},
methods: {
bubble() {
this.$emit('input', this.text)
this.$emit('change')
}
},
}
</script>
<style lang="scss">
@import '~easymde/dist/easymde.min.css';
.CodeMirror {
padding: 0;
}
.CodeMirror-scroll {
padding: .5em;
}
.editor-toolbar {
background: #ffffff;
}
pre.CodeMirror-line{
margin-bottom: 0 !important;
}
</style>

View file

@ -0,0 +1,48 @@
<template>
<div class="user">
<img :src="gravatar()" class="avatar" alt="" v-tooltip="user.username"/>
<span v-if="showUsername" class="username">{{ user.username }}</span>
</div>
</template>
<script>
export default {
name: 'user',
props: {
user: {
required: true,
type: Object,
},
showUsername: {
required: false,
type: Boolean,
default: true,
},
avatarSize: {
required: false,
type: Number,
default: 50,
}
},
methods: {
gravatar() {
return 'https://www.gravatar.com/avatar/' + this.user.avatarUrl + '?s=' + this.avatarSize
}
}
}
</script>
<style lang="scss" scoped>
.user {
margin: .5em;
img {
-webkit-border-radius: 100%;
-moz-border-radius: 100%;
border-radius: 100%;
vertical-align: middle;
margin-right: .5em;
}
}
</style>

View file

@ -23,7 +23,7 @@
<div class="column"> <div class="column">
<div class="tasks" v-if="this.list.tasks && this.list.tasks.length > 0" :class="{'short': isTaskEdit}"> <div class="tasks" v-if="this.list.tasks && this.list.tasks.length > 0" :class="{'short': isTaskEdit}">
<div class="task" v-for="l in list.tasks" :key="l.id"> <div class="task" v-for="l in list.tasks" :key="l.id">
<label :for="l.id"> <span>
<div class="fancycheckbox"> <div class="fancycheckbox">
<input @change="markAsDone" type="checkbox" :id="l.id" :checked="l.done" style="display: none;"> <input @change="markAsDone" type="checkbox" :id="l.id" :checked="l.done" style="display: none;">
<label :for="l.id" class="check"> <label :for="l.id" class="check">
@ -33,26 +33,16 @@
</svg> </svg>
</label> </label>
</div> </div>
<span class="tasktext" :class="{ 'done': l.done}"> <router-link :to="{ name: 'taskDetailView', params: { id: l.id } }" class="tasktext" :class="{ 'done': l.done}">
{{l.text}} {{l.text}}
<span class="tag" v-for="label in l.labels" :style="{'background': label.hex_color, 'color': label.textColor}" :key="label.id"> <span class="tag" v-for="label in l.labels" :style="{'background': label.hex_color, 'color': label.textColor}" :key="label.id">
<span>{{ label.title }}</span> <span>{{ label.title }}</span>
</span> </span>
<img :src="gravatar(a)" :alt="a.username" v-for="a in l.assignees" class="avatar" :key="l.id + 'assignee' + a.id"/> <img :src="gravatar(a)" :alt="a.username" v-for="(a, i) in l.assignees" class="avatar" :key="l.id + 'assignee' + a.id + i"/>
<i v-if="l.dueDate > 0" :class="{'overdue': (l.dueDate <= new Date())}"> - Due on {{new Date(l.dueDate).toLocaleString()}}</i> <i v-if="l.dueDate > 0" :class="{'overdue': (l.dueDate <= new Date())}"> - Due on {{new Date(l.dueDate).toLocaleString()}}</i>
<span v-if="l.priority >= priorities.HIGH" class="high-priority" :class="{'not-so-high': l.priority === priorities.HIGH}"> <priority-label :priority="l.priority"/>
<span class="icon"> </router-link>
<icon icon="exclamation"/> </span>
</span>
<template v-if="l.priority === priorities.HIGH">High</template>
<template v-if="l.priority === priorities.URGENT">Urgent</template>
<template v-if="l.priority === priorities.DO_NOW">DO NOW</template>
<span class="icon" v-if="l.priority === priorities.DO_NOW">
<icon icon="exclamation"/>
</span>
</span>
</span>
</label>
<div @click="editTask(l.id)" class="icon settings"> <div @click="editTask(l.id)" class="icon settings">
<icon icon="pencil-alt"/> <icon icon="pencil-alt"/>
</div> </div>
@ -90,7 +80,7 @@
import ListModel from '../../models/list' import ListModel from '../../models/list'
import EditTask from './edit-task' import EditTask from './edit-task'
import TaskModel from '../../models/task' import TaskModel from '../../models/task'
import priorities from '../../models/priorities' import PriorityLabel from './reusable/priorityLabel'
export default { export default {
data() { data() {
@ -102,10 +92,10 @@
isTaskEdit: false, isTaskEdit: false,
taskEditTask: TaskModel, taskEditTask: TaskModel,
newTaskText: '', newTaskText: '',
priorities: {},
} }
}, },
components: { components: {
PriorityLabel,
EditTask, EditTask,
}, },
props: { props: {
@ -122,7 +112,6 @@
created() { created() {
this.listService = new ListService() this.listService = new ListService()
this.taskService = new TaskService() this.taskService = new TaskService()
this.priorities = priorities
this.taskEditTask = null this.taskEditTask = null
this.isTaskEdit = false this.isTaskEdit = false
}, },

View file

@ -22,17 +22,7 @@
<span class="tasktext"> <span class="tasktext">
{{l.text}} {{l.text}}
<i v-if="l.dueDate > 0" :class="{'overdue': (new Date(l.dueDate * 1000) <= new Date())}"> - Due on {{formatUnixDate(l.dueDate)}}</i> <i v-if="l.dueDate > 0" :class="{'overdue': (new Date(l.dueDate * 1000) <= new Date())}"> - Due on {{formatUnixDate(l.dueDate)}}</i>
<span v-if="l.priority >= priorities.HIGH" class="high-priority" :class="{'not-so-high': l.priority === priorities.HIGH}"> <priority-label :priority="l.priority"/>
<span class="icon">
<icon icon="exclamation"/>
</span>
<template v-if="l.priority === priorities.HIGH">High</template>
<template v-if="l.priority === priorities.URGENT">Urgent</template>
<template v-if="l.priority === priorities.DO_NOW">DO NOW</template>
<span class="icon" v-if="l.priority === priorities.DO_NOW">
<icon icon="exclamation"/>
</span>
</span>
</span> </span>
</label> </label>
</div> </div>
@ -43,16 +33,18 @@
import router from '../../router' import router from '../../router'
import message from '../../message' import message from '../../message'
import TaskService from '../../services/task' import TaskService from '../../services/task'
import priorities from '../../models/priorities' import PriorityLabel from './reusable/priorityLabel'
export default { export default {
name: "ShowTasks", name: "ShowTasks",
components: {
PriorityLabel
},
data() { data() {
return { return {
tasks: [], tasks: [],
hasUndoneTasks: false, hasUndoneTasks: false,
taskService: TaskService, taskService: TaskService,
priorities: priorities,
} }
}, },
props: { props: {

View file

@ -0,0 +1,381 @@
<template>
<div class="loader-container" :class="{ 'is-loading': taskService.loading}">
<div class="task-view">
<div class="heading">
<h1 class="title task-id">
#{{ task.id }}
</h1>
<div class="is-done" v-if="task.done">Done</div>
<input type="text" v-model="task.text" @change="saveTask()" class="input title" @keyup.enter="saveTask()"/>
</div>
<h6 class="subtitle">
{{ namespace.name }} >
<router-link :to="{ name: 'showList', params: { id: list.id } }">
{{ list.title }}
</router-link>
</h6>
<!-- Content and buttons -->
<div class="columns">
<!-- Content -->
<div class="column">
<div class="columns details">
<div class="column assignees" v-if="activeFields.assignees">
<!-- Assignees -->
<div class="detail-title">
<icon icon="users"/>
Assignees
</div>
<edit-assignees
:task-i-d="task.id"
:list-i-d="task.listID"
:initial-assignees="task.assignees"
ref="assignees"
/>
</div>
<div class="column" v-if="activeFields.priority">
<!-- Priority -->
<div class="detail-title">
<icon :icon="['far', 'star']"/>
Priority
</div>
<priority-select v-model="task.priority" @change="saveTask" ref="priority"/>
</div>
<div class="column" v-if="activeFields.dueDate">
<!-- Due Date -->
<div class="detail-title">
<icon icon="calendar"/>
Due Date
</div>
<div class="date-input">
<flat-pickr
:class="{ 'disabled': taskService.loading}"
class="input"
:disabled="taskService.loading"
v-model="task.dueDate"
:config="flatPickerConfig"
@on-close="saveTask"
placeholder="Click here to set a due date"
ref="dueDate"
>
</flat-pickr>
<a v-if="task.dueDate" @click="() => {task.dueDate = null;saveTask()}">
<span class="icon is-small">
<icon icon="times"></icon>
</span>
</a>
</div>
</div>
<div class="column" v-if="activeFields.percentDone">
<!-- Percent Done -->
<div class="detail-title">
<icon icon="percent"/>
Percent Done
</div>
<percent-done-select v-model="task.percentDone" @change="saveTask" ref="percentDone"/>
</div>
<div class="column" v-if="activeFields.startDate">
<!-- Start Date -->
<div class="detail-title">
<icon icon="calendar-week"/>
Start Date
</div>
<div class="date-input">
<flat-pickr
:class="{ 'disabled': taskService.loading}"
class="input"
:disabled="taskService.loading"
v-model="task.startDate"
:config="flatPickerConfig"
@on-close="saveTask"
placeholder="Click here to set a start date"
ref="startDate"
>
</flat-pickr>
<a v-if="task.startDate" @click="() => {task.startDate = null;saveTask()}">
<span class="icon is-small">
<icon icon="times"></icon>
</span>
</a>
</div>
</div>
<div class="column" v-if="activeFields.endDate">
<!-- End Date -->
<div class="detail-title">
<icon icon="calendar-week"/>
End Date
</div>
<div class="date-input">
<flat-pickr
:class="{ 'disabled': taskService.loading}"
class="input"
:disabled="taskService.loading"
v-model="task.endDate"
:config="flatPickerConfig"
@on-close="saveTask"
placeholder="Click here to set an end date"
ref="endDate"
>
</flat-pickr>
<a v-if="task.endDate" @click="() => {task.endDate = null;saveTask()}">
<span class="icon is-small">
<icon icon="times"></icon>
</span>
</a>
</div>
</div>
<div class="column" v-if="activeFields.reminders">
<!-- Reminders -->
<div class="detail-title">
<icon icon="history"/>
Reminders
</div>
<reminders v-model="task.reminderDates" @change="saveTask" ref="reminders"/>
</div>
<div class="column" v-if="activeFields.repeatAfter">
<!-- Repeat after -->
<div class="detail-title">
<icon :icon="['far', 'clock']"/>
Repeat
</div>
<repeat-after v-model="task.repeatAfter" @change="saveTask" ref="repeatAfter"/>
</div>
</div>
<!-- Labels -->
<div class="labels-list details" v-if="activeFields.labels">
<div class="detail-title">
<span class="icon is-grey">
<icon icon="tags"/>
</span>
Labels
</div>
<edit-labels :task-i-d="taskID" :start-labels="task.labels" ref="labels"/>
</div>
<!-- Description -->
<div class="details content" :class="{ 'has-top-border': activeFields.labels }">
<h3>
<span class="icon is-grey">
<icon icon="align-left"/>
</span>
Description
</h3>
<!-- We're using a normal textarea until the problem with the icons is resolved in easymde -->
<!-- <easymde v-model="task.description" @change="saveTask"/>-->
<textarea class="textarea" v-model="task.description" @change="saveTask" rows="6" placeholder="Click here to enter a description..."></textarea>
</div>
<!-- Attachments -->
<div class="content attachments has-top-border" v-if="activeFields.attachments">
<attachments
:task-i-d="taskID"
:initial-attachments="task.attachments"
ref="attachments"
/>
</div>
<!-- Related Tasks -->
<div class="content details has-top-border" v-if="activeFields.relatedTasks">
<h3>
<span class="icon is-grey">
<icon icon="tasks"/>
</span>
Related Tasks
</h3>
<related-tasks
:task-i-d="taskID"
:initial-related-tasks="task.related_tasks"
:show-no-relations-notice="true"
ref="relatedTasks"
/>
</div>
</div>
<div class="column is-one-fifth action-buttons">
<a class="button" @click="setFieldActive('assignees')">
<span class="icon is-small"><icon icon="users"/></span>
Assign this task to a user
</a>
<a class="button" @click="setFieldActive('labels')">
<span class="icon is-small"><icon icon="tags"/></span>
Add labels
</a>
<a class="button" @click="setFieldActive('attachments')">
<span class="icon is-small"><icon icon="paperclip"/></span>
Add attachments
</a>
<a class="button" @click="setFieldActive('relatedTasks')">
<span class="icon is-small"><icon icon="tasks"/></span>
Add task relations
</a>
<a class="button" @click="setFieldActive('priority')">
<span class="icon is-small"><icon :icon="['far', 'star']"/></span>
Set Priority
</a>
<a class="button" @click="setFieldActive('dueDate')">
<span class="icon is-small"><icon icon="calendar"/></span>
Set Due Date
</a>
<a class="button" @click="setFieldActive('percentDone')">
<span class="icon is-small"><icon icon="percent"/></span>
Set Percent Done
</a>
<a class="button" @click="setFieldActive('startDate')">
<span class="icon is-small"><icon icon="calendar-week"/></span>
Set a Start Date
</a>
<a class="button" @click="setFieldActive('endDate')">
<span class="icon is-small"><icon icon="calendar-week"/></span>
Set an End Date
</a>
<a class="button" @click="setFieldActive('reminders')">
<span class="icon is-small"><icon icon="history"/></span>
Set Reminders
</a>
<a class="button" @click="setFieldActive('repeatAfter')">
<span class="icon is-small"><icon :icon="['far', 'clock']"/></span>
Set a repeating interval
</a>
</div>
</div>
<!-- Created / Updated [by] -->
</div>
</div>
</template>
<script>
import message from '../../message'
import TaskService from '../../services/task'
import TaskModel from '../../models/task'
import relationKinds from '../../models/relationKinds'
import ListModel from '../../models/list'
import NamespaceModel from '../../models/namespace'
import PriorityLabel from './reusable/priorityLabel'
import priorites from '../../models/priorities'
import flatPickr from 'vue-flatpickr-component'
import 'flatpickr/dist/flatpickr.css'
import PrioritySelect from './reusable/prioritySelect'
import PercentDoneSelect from './reusable/percentDoneSelect'
import Easymde from '../global/easymde'
import EditLabels from './reusable/editLabels'
import EditAssignees from './reusable/editAssignees'
import Attachments from './reusable/attachments'
import RelatedTasks from './reusable/relatedTasks'
import RepeatAfter from './reusable/repeatAfter'
import Reminders from './reusable/reminders'
export default {
name: 'TaskDetailView',
components: {
Reminders,
RepeatAfter,
RelatedTasks,
Attachments,
EditAssignees,
EditLabels,
Easymde,
PercentDoneSelect,
PrioritySelect,
PriorityLabel,
flatPickr,
},
data() {
return {
taskID: Number(this.$route.params.id),
taskService: TaskService,
task: TaskModel,
relationKinds: relationKinds,
list: ListModel,
namespace: NamespaceModel,
priorities: priorites,
flatPickerConfig: {
altFormat: 'j M Y H:i',
altInput: true,
dateFormat: 'Y-m-d H:i',
enableTime: true,
time_24hr: true,
},
activeFields: {
assignees: false,
priority: false,
dueDate: false,
percentDone: false,
startDate: false,
endDate: false,
reminders: false,
repeatAfter: false,
labels: false,
attachments: false,
relatedTasks: false,
},
}
},
watch: {
'$route': 'loadTask'
},
created() {
this.taskService = new TaskService()
this.task = new TaskModel()
},
mounted() {
this.loadTask()
},
methods: {
loadTask() {
this.taskID = Number(this.$route.params.id)
this.taskService.get({id: this.taskID})
.then(r => {
this.$set(this, 'task', r)
this.setListAndNamespaceTitleFromParent()
// Set all active fields based on values in the model
this.activeFields.assignees = this.task.assignees.length > 0
this.activeFields.priority = this.task.priority !== priorites.UNSET
this.activeFields.dueDate = this.task.dueDate !== null
this.activeFields.percentDone = this.task.percentDone > 0
this.activeFields.startDate = this.task.startDate !== null
this.activeFields.endDate = this.task.endDate !== null
this.activeFields.reminders = this.task.reminderDates.length > 1
this.activeFields.repeatAfter = this.task.repeatAfter.amount > 0
this.activeFields.labels = this.task.labels.length > 0
this.activeFields.attachments = this.task.attachments.length > 0
this.activeFields.relatedTasks = Object.keys(this.task.related_tasks).length > 0
})
.catch(e => {
message.error(e, this)
})
},
saveTask() {
this.taskService.update(this.task)
.then(r => {
this.$set(this, 'task', r)
message.success({message: 'The task was saved successfully.'}, this)
})
.catch(e => {
message.error(e, this)
})
},
setListAndNamespaceTitleFromParent() {
// FIXME: Throw this away once we have vuex
this.$parent.namespaces.forEach(n => {
n.lists.forEach(l => {
if (l.id === this.task.listID) {
this.list = l
this.namespace = n
return
}
})
})
},
setFieldActive(fieldName) {
this.activeFields[fieldName] = true
this.$nextTick(() => this.$refs[fieldName].$el.focus())
},
},
}
</script>

View file

@ -17,23 +17,7 @@
</div> </div>
<b>Reminder Dates</b> <b>Reminder Dates</b>
<div class="reminder-input" <reminders v-model="taskEditTask.reminderDates"/>
:class="{ 'overdue': (r < nowUnix && index !== (taskEditTask.reminderDates.length - 1))}"
v-for="(r, index) in taskEditTask.reminderDates" :key="index">
<flat-pickr
:class="{ 'disabled': taskService.loading}"
:disabled="taskService.loading"
:v-model="taskEditTask.reminderDates"
:config="flatPickerConfig"
:id="'taskreminderdate' + index"
:value="r"
:data-index="index"
placeholder="Add a new reminder...">
</flat-pickr>
<a v-if="index !== (taskEditTask.reminderDates.length - 1)" @click="removeReminderByIndex(index)">
<icon icon="times"></icon>
</a>
</div>
<div class="field"> <div class="field">
<label class="label" for="taskduedate">Due Date</label> <label class="label" for="taskduedate">Due Date</label>
@ -80,58 +64,20 @@
<div class="field"> <div class="field">
<label class="label" for="">Repeat after</label> <label class="label" for="">Repeat after</label>
<div class="control repeat-after-input columns"> <repeat-after v-model="taskEditTask.repeatAfter"/>
<div class="column">
<input class="input" placeholder="Specify an amount..." v-model="taskEditTask.repeatAfter.amount"/>
</div>
<div class="column is-3">
<div class="select">
<select v-model="taskEditTask.repeatAfter.type">
<option value="hours">Hours</option>
<option value="days">Days</option>
<option value="weeks">Weeks</option>
<option value="months">Months</option>
<option value="years">Years</option>
</select>
</div>
</div>
</div>
</div> </div>
<div class="field"> <div class="field">
<label class="label" for="">Priority</label> <label class="label" for="">Priority</label>
<div class="control priority-select"> <div class="control priority-select">
<div class="select"> <priority-select v-model="taskEditTask.priority"/>
<select v-model="taskEditTask.priority">
<option :value="priorities.UNSET">Unset</option>
<option :value="priorities.LOW">Low</option>
<option :value="priorities.MEDIUM">Medium</option>
<option :value="priorities.HIGH">High</option>
<option :value="priorities.URGENT">Urgent</option>
<option :value="priorities.DO_NOW">DO NOW</option>
</select>
</div>
</div> </div>
</div> </div>
<div class="field"> <div class="field">
<label class="label">Percent Done</label> <label class="label">Percent Done</label>
<div class="control"> <div class="control">
<div class="select"> <percent-done-select v-model="taskEditTask.percentDone"/>
<select v-model.number="taskEditTask.percentDone">
<option value="0">0%</option>
<option value="0.1">10%</option>
<option value="0.2">20%</option>
<option value="0.3">30%</option>
<option value="0.4">40%</option>
<option value="0.5">50%</option>
<option value="0.6">60%</option>
<option value="0.7">70%</option>
<option value="0.8">80%</option>
<option value="0.9">90%</option>
<option value="1">100%</option>
</select>
</div>
</div> </div>
</div> </div>
@ -163,128 +109,22 @@
<div class="field has-addons"> <div class="field has-addons">
<div class="control is-expanded"> <div class="control is-expanded">
<multiselect <edit-assignees :task-i-d="taskEditTask.id" :list-i-d="taskEditTask.listID" :initial-assignees="taskEditTask.assignees"/>
v-model="newAssignee"
:options="foundUsers"
:multiple="false"
:searchable="true"
:loading="listUserService.loading"
:internal-search="true"
@search-change="findUser"
placeholder="Type to search"
label="username"
track-by="id">
<template slot="clear" slot-scope="props">
<div class="multiselect__clear" v-if="newAssignee !== null && newAssignee.id !== 0"
@mousedown.prevent.stop="clearAllFoundUsers(props.search)"></div>
</template>
<span slot="noResult">Oops! No user found. Consider changing the search query.</span>
</multiselect>
</div>
<div class="control">
<a @click="addAssignee" class="button is-primary fullheight">
<span class="icon is-small">
<icon icon="plus"/>
</span>
</a>
</div> </div>
</div> </div>
<div class="field"> <div class="field">
<label class="label">Labels</label> <label class="label">Labels</label>
<div class="control"> <div class="control">
<multiselect <edit-labels :task-i-d="taskEditTask.id" :start-labels="taskEditTask.labels"/>
:multiple="true"
:close-on-select="false"
:clear-on-select="true"
:options-limit="300"
:hide-selected="true"
v-model="taskEditTask.labels"
:options="foundLabels"
:searchable="true"
:loading="labelService.loading || labelTaskService.loading"
:internal-search="true"
@search-change="findLabel"
@select="addLabel"
placeholder="Type to search"
label="title"
track-by="id"
:taggable="true"
@tag="createAndAddLabel"
tag-placeholder="Add this as new label"
>
<template slot="tag" slot-scope="{ option, remove }">
<span class="tag"
:style="{'background': option.hex_color, 'color': option.textColor}">
<span>{{ option.title }}</span>
<a class="delete is-small" @click="removeLabel(option)"></a>
</span>
</template>
<template slot="clear" slot-scope="props">
<div class="multiselect__clear" v-if="taskEditTask.labels.length"
@mousedown.prevent.stop="clearAllLabels(props.search)"></div>
</template>
</multiselect>
</div> </div>
</div> </div>
<div class="field" v-for="(rts, kind ) in task.related_tasks" :key="kind" v-if="rts.length > 0"> <related-tasks
<label class="label">{{ relationKinds[kind] }}</label> class="is-narrow"
<div class="tasks noborder"> :task-i-d="task.id"
<div class="task" v-for="t in rts" :key="t.id"> :initial-related-tasks="task.related_tasks"
<label> />
<span class="tasktext" :class="{ 'done': t.done}">
{{t.text}}
</span>
</label>
<a class="remove" @click="removeTaskRelation({relation_kind: kind, other_task_id: t.id})">
<icon icon="trash-alt"/>
</a>
</div>
</div>
</div>
<div class="field">
<label class="label">New Task Relation</label>
<div class="field">
<div class="control is-expanded">
<multiselect
v-model="newTaskRelationTask"
:options="foundTasks"
:multiple="false"
:searchable="true"
:loading="taskService.loading"
:internal-search="true"
@search-change="findTasks"
placeholder="Type to search"
label="text"
track-by="id">
<template slot="clear" slot-scope="props">
<div class="multiselect__clear"
v-if="newTaskRelationTask !== null && newTaskRelationTask.id !== 0"
@mousedown.prevent.stop="clearAllFoundTasks(props.search)"></div>
</template>
<span slot="noResult">No task found. Consider changing the search query.</span>
</multiselect>
</div>
</div>
<div class="field has-addons">
<div class="control is-expanded">
<div class="select is-fullwidth">
<select v-model="newTaskRelationKind">
<option value="unset">Select a kind of relation</option>
<option v-for="(label, rk) in relationKinds" :key="rk" :value="rk">
{{ label }}
</option>
</select>
</div>
</div>
<div class="control">
<a class="button is-primary" @click="addTaskRelation()">Add task Relation</a>
</div>
</div>
</div>
<button type="submit" class="button is-success is-fullwidth" :class="{ 'is-loading': taskService.loading}"> <button type="submit" class="button is-success is-fullwidth" :class="{ 'is-loading': taskService.loading}">
Save Save
@ -298,23 +138,20 @@
import flatPickr from 'vue-flatpickr-component' import flatPickr from 'vue-flatpickr-component'
import 'flatpickr/dist/flatpickr.css' import 'flatpickr/dist/flatpickr.css'
import multiselect from 'vue-multiselect' import multiselect from 'vue-multiselect'
import {differenceWith} from 'lodash'
import verte from 'verte' import verte from 'verte'
import 'verte/dist/verte.css' import 'verte/dist/verte.css'
import ListService from '../../services/list' import ListService from '../../services/list'
import TaskService from '../../services/task' import TaskService from '../../services/task'
import TaskModel from '../../models/task' import TaskModel from '../../models/task'
import UserModel from '../../models/user'
import ListUserService from '../../services/listUsers'
import priorities from '../../models/priorities' import priorities from '../../models/priorities'
import LabelTaskService from '../../services/labelTask' import PrioritySelect from './reusable/prioritySelect'
import LabelService from '../../services/label' import PercentDoneSelect from './reusable/percentDoneSelect'
import LabelTaskModel from '../../models/labelTask' import EditLabels from './reusable/editLabels'
import LabelModel from '../../models/label' import EditAssignees from './reusable/editAssignees'
import relationKinds from '../../models/relationKinds' import RelatedTasks from './reusable/relatedTasks'
import TaskRelationModel from '../../models/taskRelation' import RepeatAfter from './reusable/repeatAfter'
import TaskRelationService from '../../services/taskRelation' import Reminders from './reusable/reminders'
export default { export default {
name: 'edit-task', name: 'edit-task',
@ -329,8 +166,6 @@
newTask: TaskModel, newTask: TaskModel,
isTaskEdit: false, isTaskEdit: false,
taskEditTask: TaskModel, taskEditTask: TaskModel,
lastReminder: 0,
nowUnix: new Date(),
flatPickerConfig: { flatPickerConfig: {
altFormat: 'j M Y H:i', altFormat: 'j M Y H:i',
altInput: true, altInput: true,
@ -339,24 +174,16 @@
onOpen: this.updateLastReminderDate, onOpen: this.updateLastReminderDate,
onClose: this.addReminderDate, onClose: this.addReminderDate,
}, },
newAssignee: UserModel,
listUserService: ListUserService,
foundUsers: [],
foundTasks: [],
relationKinds: relationKinds,
newTaskRelationTask: TaskModel,
newTaskRelationKind: 'unset',
taskRelationService: TaskRelationService,
labelService: LabelService,
labelTaskService: LabelTaskService,
foundLabels: [],
labelTimeout: null,
} }
}, },
components: { components: {
Reminders,
RepeatAfter,
RelatedTasks,
EditAssignees,
EditLabels,
PercentDoneSelect,
PrioritySelect,
flatPickr, flatPickr,
multiselect, multiselect,
verte, verte,
@ -376,12 +203,6 @@
this.listService = new ListService() this.listService = new ListService()
this.taskService = new TaskService() this.taskService = new TaskService()
this.newTask = new TaskModel() this.newTask = new TaskModel()
this.listUserService = new ListUserService()
this.newAssignee = new UserModel()
this.labelService = new LabelService()
this.labelTaskService = new LabelTaskService()
this.taskRelationService = new TaskRelationService()
this.newTaskRelationTask = new TaskModel()
this.taskEditTask = this.task this.taskEditTask = this.task
}, },
methods: { methods: {
@ -395,179 +216,6 @@
message.error(e, this) message.error(e, this)
}) })
}, },
updateLastReminderDate(selectedDates) {
this.lastReminder = +new Date(selectedDates[0])
},
addReminderDate(selectedDates, dateStr, instance) {
let newDate = +new Date(selectedDates[0])
// Don't update if nothing changed
if (newDate === this.lastReminder) {
return
}
let index = parseInt(instance.input.dataset.index)
this.taskEditTask.reminderDates[index] = newDate
let lastIndex = this.taskEditTask.reminderDates.length - 1
// put a new null at the end if we changed something
if (lastIndex === index && !isNaN(newDate)) {
this.taskEditTask.reminderDates.push(null)
}
},
removeReminderByIndex(index) {
this.taskEditTask.reminderDates.splice(index, 1)
// Reset the last to 0 to have the "add reminder" button
this.taskEditTask.reminderDates[this.taskEditTask.reminderDates.length - 1] = null
},
addAssignee() {
this.taskEditTask.assignees.push(this.newAssignee)
},
deleteAssigneeByIndex(index) {
this.taskEditTask.assignees.splice(index, 1)
},
findUser(query) {
if (query === '') {
this.clearAllFoundUsers()
return
}
this.listUserService.getAll({listID: this.$route.params.id}, {s: query})
.then(response => {
// Filter the results to not include users who are already assigned
this.$set(this, 'foundUsers', differenceWith(response, this.taskEditTask.assignees, (first, second) => {
return first.id === second.id
}))
})
.catch(e => {
message.error(e, this)
})
},
clearAllFoundUsers() {
this.$set(this, 'foundUsers', [])
},
findLabel(query) {
if (query === '') {
this.clearAllLabels()
return
}
if (this.labelTimeout !== null) {
clearTimeout(this.labelTimeout)
}
// Delay the search 300ms to not send a request on every keystroke
this.labelTimeout = setTimeout(() => {
this.labelService.getAll({}, {s: query})
.then(response => {
this.$set(this, 'foundLabels', differenceWith(response, this.taskEditTask.labels, (first, second) => {
return first.id === second.id
}))
this.labelTimeout = null
})
.catch(e => {
message.error(e, this)
})
}, 300)
},
clearAllLabels() {
this.$set(this, 'foundLabels', [])
},
addLabel(label) {
let labelTask = new LabelTaskModel({taskID: this.taskEditTask.id, label_id: label.id})
this.labelTaskService.create(labelTask)
.then(() => {
message.success({message: 'The label was successfully added.'}, this)
})
.catch(e => {
message.error(e, this)
})
},
removeLabel(label) {
let labelTask = new LabelTaskModel({taskID: this.taskEditTask.id, label_id: label.id})
this.labelTaskService.delete(labelTask)
.then(() => {
// Remove the label from the list
for (const l in this.taskEditTask.labels) {
if (this.taskEditTask.labels[l].id === label.id) {
this.taskEditTask.labels.splice(l, 1)
}
}
message.success({message: 'The label was successfully removed.'}, this)
})
.catch(e => {
message.error(e, this)
})
},
createAndAddLabel(title) {
let newLabel = new LabelModel({title: title})
this.labelService.create(newLabel)
.then(r => {
this.addLabel(r)
this.taskEditTask.labels.push(r)
})
.catch(e => {
message.error(e, this)
})
},
findTasks(query) {
if (query === '') {
this.clearAllFoundTasks()
return
}
this.taskService.getAll({}, {s: query})
.then(response => {
this.$set(this, 'foundTasks', response)
})
.catch(e => {
message.error(e, this)
})
},
clearAllFoundTasks() {
this.$set(this, 'foundTasks', [])
},
addTaskRelation() {
let rel = new TaskRelationModel({
task_id: this.taskEditTask.id,
other_task_id: this.newTaskRelationTask.id,
relation_kind: this.newTaskRelationKind,
})
this.taskRelationService.create(rel)
.then(() => {
if (!this.taskEditTask.related_tasks[this.newTaskRelationKind]) {
this.$set(this.taskEditTask.related_tasks, this.newTaskRelationKind, [])
}
this.taskEditTask.related_tasks[this.newTaskRelationKind].push(this.newTaskRelationTask)
this.newTaskRelationKind = 'unset'
this.newTaskRelationTask = new TaskModel()
message.success({message: 'The task relation was created successfully'}, this)
})
.catch(e => {
message.error(e, this)
})
},
removeTaskRelation(relation) {
let rel = new TaskRelationModel({
relation_kind: relation.relation_kind,
task_id: this.taskEditTask.id,
other_task_id: relation.other_task_id,
})
this.taskRelationService.delete(rel)
.then(r => {
Object.keys(this.taskEditTask.related_tasks).forEach(relationKind => {
for (const t in this.taskEditTask.related_tasks[relationKind]) {
if (this.taskEditTask.related_tasks[relationKind][t].id === relation.other_task_id && relationKind === relation.relation_kind) {
this.taskEditTask.related_tasks[relationKind].splice(t, 1)
}
}
})
message.success(r, this)
})
.catch(e => {
message.error(e, this)
})
},
}, },
} }
</script> </script>

View file

@ -51,17 +51,7 @@
'has-not-so-high-priority': t.priority === priorities.HIGH, 'has-not-so-high-priority': t.priority === priorities.HIGH,
'has-super-high-priority': t.priority === priorities.DO_NOW 'has-super-high-priority': t.priority === priorities.DO_NOW
}">{{t.text}}</span> }">{{t.text}}</span>
<span v-if="t.priority >= priorities.HIGH" class="high-priority" :class="{'not-so-high': t.priority === priorities.HIGH}"> <priority-label :priority="t.priority"/>
<span class="icon">
<icon icon="exclamation"/>
</span>
<template v-if="t.priority === priorities.HIGH">High</template>
<template v-if="t.priority === priorities.URGENT">Urgent</template>
<template v-if="t.priority === priorities.DO_NOW">DO NOW</template>
<span class="icon" v-if="t.priority === priorities.DO_NOW">
<icon icon="exclamation"/>
</span>
</span>
<!-- using the key here forces vue to use the updated version model and not the response returned by the api --> <!-- using the key here forces vue to use the updated version model and not the response returned by the api -->
<a @click="editTask(theTasks[k])" class="edit-toggle"> <a @click="editTask(theTasks[k])" class="edit-toggle">
<icon icon="pen"/> <icon icon="pen"/>
@ -143,10 +133,12 @@
import TaskModel from '../../models/task' import TaskModel from '../../models/task'
import ListModel from '../../models/list' import ListModel from '../../models/list'
import priorities from '../../models/priorities' import priorities from '../../models/priorities'
import PriorityLabel from "./reusable/priorityLabel";
export default { export default {
name: 'GanttChart', name: 'GanttChart',
components: { components: {
PriorityLabel,
EditTask, EditTask,
VueDragResize, VueDragResize,
}, },

View file

@ -0,0 +1,192 @@
<template>
<div class="attachments">
<h3>
<span class="icon is-grey">
<icon icon="paperclip"/>
</span>
Attachments
<a
class="button is-primary is-outlined is-small noshadow"
@click="$refs.files.click()"
:disabled="attachmentService.loading">
<span class="icon is-small"><icon icon="cloud-upload-alt"/></span>
Upload attachment
</a>
</h3>
<input type="file" id="files" ref="files" multiple @change="uploadNewAttachment()" :disabled="attachmentService.loading"/>
<progress v-if="attachmentService.uploadProgress > 0" class="progress is-primary" :value="attachmentService.uploadProgress" max="100">{{ attachmentService.uploadProgress }}%</progress>
<table>
<tr>
<th>Name</th>
<th>Size</th>
<th>Type</th>
<th>Date</th>
<th>Action</th>
</tr>
<tr class="attachment" v-for="a in attachments" :key="a.id">
<td>
{{ a.file.name }}
</td>
<td>{{ a.file.getHumanSize() }}</td>
<td>{{ a.file.mime }}</td>
<!-- FIXME: This needs a better solution-->
<td>{{ new Date(a.created) }}</td>
<td>
<div class="buttons has-addons">
<a class="button is-primary noshadow" @click="downloadAttachment(a)" v-tooltip="'Download this attachment'">
<span class="icon">
<icon icon="cloud-download-alt"/>
</span>
</a>
<a class="button is-danger noshadow" v-tooltip="'Delete this attachment'" @click="() => {attachmentToDelete = a; showDeleteModal = true}">
<span class="icon">
<icon icon="trash-alt"/>
</span>
</a>
</div>
</td>
</tr>
</table>
<!-- Dropzone -->
<div class="dropzone" :class="{ 'hidden': !showDropzone }">
<div class="drop-hint">
<div class="icon">
<icon icon="cloud-upload-alt"/>
</div>
<div class="hint">
Drop files here to upload
</div>
</div>
</div>
<!-- Delete modal -->
<modal
v-if="showDeleteModal"
@close="showDeleteModal = false"
v-on:submit="deleteAttachment()">
<span slot="header">Delete attachment</span>
<p slot="text">Are you sure you want to delete the attachment {{ attachmentToDelete.file.name }}?<br/>
<b>This CANNOT BE UNDONE!</b></p>
</modal>
</div>
</template>
<script>
import AttachmentService from '../../../services/attachment'
import AttachmentModel from '../../../models/attachment'
import message from '../../../message'
export default {
name: 'attachments',
data() {
return {
attachments: [],
attachmentService: AttachmentService,
showDropzone: false,
showDeleteModal: false,
attachmentToDelete: AttachmentModel,
}
},
props: {
taskID: {
required: true,
type: Number,
},
initialAttachments: {
type: Array,
}
},
created() {
this.attachmentService = new AttachmentService()
this.attachments = this.initialAttachments
},
mounted() {
document.addEventListener('dragenter', e => {
e.stopPropagation()
e.preventDefault()
this.showDropzone = true
});
window.addEventListener('dragleave', e => {
e.stopPropagation()
e.preventDefault()
this.showDropzone = false
});
document.addEventListener('dragover', e => {
e.stopPropagation()
e.preventDefault()
this.showDropzone = true
});
document.addEventListener('drop', e => {
e.stopPropagation()
e.preventDefault()
let files = e.dataTransfer.files
this.uploadFiles(files)
this.showDropzone = false
})
},
watch: {
initialAttachments(newVal) {
this.attachments = newVal
},
},
methods: {
downloadAttachment(attachment) {
this.attachmentService.download(attachment)
},
uploadNewAttachment() {
if(this.$refs.files.files.length === 0) {
return
}
this.uploadFiles(this.$refs.files.files)
},
uploadFiles(files) {
const attachmentModel = new AttachmentModel({task_id: this.taskID})
this.attachmentService.create(attachmentModel, files)
.then(r => {
if(r.success !== null) {
r.success.forEach(a => {
message.success({message: 'Successfully uploaded ' + a.file.name}, this)
this.attachments.push(a)
})
}
if(r.errors !== null) {
r.errors.forEach(m => {
message.error(m, this)
})
}
})
.catch(e => {
message.error(e, this)
})
},
deleteAttachment() {
this.attachmentService.delete(this.attachmentToDelete)
.then(r => {
// Remove the file from the list
for (const a in this.attachments) {
if (this.attachments[a].id === this.attachmentToDelete.id) {
this.attachments.splice(a, 1)
}
}
message.success(r, this)
})
.catch(e => {
message.error(e, this)
})
.finally(() => {
this.showDeleteModal = false
})
},
},
}
</script>

View file

@ -0,0 +1,135 @@
<template>
<multiselect
:multiple="true"
:close-on-select="false"
:clear-on-select="true"
:options-limit="300"
:hide-selected="true"
v-model="assignees"
:options="foundUsers"
:searchable="true"
:loading="listUserService.loading"
:internal-search="true"
@search-change="findUser"
@select="addAssignee"
placeholder="Type to assign a user..."
label="username"
track-by="id"
select-label="Assign this user"
:showNoOptions="false"
>
<template slot="tag" slot-scope="{ option, remove }">
<user :user="option" :show-username="false" :avatar-size="30"/>
<a @click="removeAssignee(option)" class="remove-assignee">
<icon icon="times"/>
</a>
</template>
<template slot="clear" slot-scope="props">
<div class="multiselect__clear" v-if="newAssignee !== null && newAssignee.id !== 0"
@mousedown.prevent.stop="clearAllFoundUsers(props.search)"></div>
</template>
<span slot="noResult">No user found. Consider changing the search query.</span>
</multiselect>
</template>
<script>
import {differenceWith} from 'lodash'
import message from '../../../message'
import multiselect from 'vue-multiselect'
import UserModel from '../../../models/user'
import ListUserService from '../../../services/listUsers'
import TaskAssigneeService from '../../../services/taskAssignee'
import TaskAssigneeModel from '../../../models/taskAssignee'
import User from '../../global/user'
export default {
name: 'editAssignees',
components: {
User,
multiselect,
},
props: {
taskID: {
type: Number,
required: true,
},
listID: {
type: Number,
required: true,
},
initialAssignees: {
type: Array,
default: () => [],
}
},
data() {
return {
newAssignee: UserModel,
listUserService: ListUserService,
foundUsers: [],
assignees: [],
taskAssigneeService: TaskAssigneeService,
}
},
created() {
this.assignees = this.initialAssignees
this.listUserService = new ListUserService()
this.newAssignee = new UserModel()
this.taskAssigneeService = new TaskAssigneeService()
},
watch: {
initialAssignees(newVal) {
this.assignees = newVal
}
},
methods: {
addAssignee(user) {
const taskAssignee = new TaskAssigneeModel({user_id: user.id, task_id: this.taskID})
this.taskAssigneeService.create(taskAssignee)
.then(() => {
message.success({message: 'The user was successfully assigned.'}, this)
})
.catch(e => {
message.error(e, this)
})
},
removeAssignee(user) {
const taskAssignee = new TaskAssigneeModel({user_id: user.id, task_id: this.taskID})
this.taskAssigneeService.delete(taskAssignee)
.then(() => {
// Remove the assignee from the list
for (const a in this.assignees) {
if (this.assignees[a].id === user.id) {
this.assignees.splice(a, 1)
}
}
message.success({message: 'The user was successfully unassigned.'}, this)
})
.catch(e => {
message.error(e, this)
})
},
findUser(query) {
if (query === '') {
this.clearAllFoundUsers()
return
}
this.listUserService.getAll({listID: this.listID}, {s: query})
.then(response => {
// Filter the results to not include users who are already assigned
this.$set(this, 'foundUsers', differenceWith(response, this.assignees, (first, second) => {
return first.id === second.id
}))
})
.catch(e => {
message.error(e, this)
})
},
clearAllFoundUsers() {
this.$set(this, 'foundUsers', [])
},
},
}
</script>

View file

@ -0,0 +1,155 @@
<template>
<multiselect
:multiple="true"
:close-on-select="false"
:clear-on-select="true"
:options-limit="300"
:hide-selected="true"
v-model="labels"
:options="foundLabels"
:searchable="true"
:loading="labelService.loading || labelTaskService.loading"
:internal-search="true"
@search-change="findLabel"
@select="addLabel"
placeholder="Type to add a new label..."
label="title"
track-by="id"
:taggable="true"
:showNoOptions="false"
@tag="createAndAddLabel"
tag-placeholder="Add this as new label"
>
<template slot="tag" slot-scope="{ option, remove }">
<span class="tag"
:style="{'background': option.hex_color, 'color': option.textColor}">
<span>{{ option.title }}</span>
<a class="delete is-small" @click="removeLabel(option)"></a>
</span>
</template>
<template slot="clear" slot-scope="props">
<div class="multiselect__clear" v-if="labels.length"
@mousedown.prevent.stop="clearAllLabels(props.search)"></div>
</template>
</multiselect>
</template>
<script>
import message from '../../../message'
import { differenceWith } from 'lodash'
import multiselect from 'vue-multiselect'
import LabelService from '../../../services/label'
import LabelModel from '../../../models/label'
import LabelTaskService from '../../../services/labelTask'
import LabelTaskModel from '../../../models/labelTask'
export default {
name: 'edit-labels',
props: {
startLabels: {
default: () => [],
type: Array,
},
taskID: {
type: Number,
required: true,
},
},
data() {
return {
labelService: LabelService,
labelTaskService: LabelTaskService,
foundLabels: [],
labelTimeout: null,
labels: [],
searchQuery: '',
}
},
components: {
multiselect,
},
watch: {
startLabels(newLabels) {
this.labels = newLabels
}
},
created() {
this.labelService = new LabelService()
this.labelTaskService = new LabelTaskService()
this.labels = this.startLabels
},
methods: {
findLabel(query) {
this.searchQuery = query
if (query === '') {
this.clearAllLabels()
return
}
if (this.labelTimeout !== null) {
clearTimeout(this.labelTimeout)
}
// Delay the search 300ms to not send a request on every keystroke
this.labelTimeout = setTimeout(() => {
this.labelService.getAll({}, {s: query})
.then(response => {
this.$set(this, 'foundLabels', differenceWith(response, this.labels, (first, second) => {
return first.id === second.id
}))
this.labelTimeout = null
})
.catch(e => {
message.error(e, this)
})
}, 300)
},
clearAllLabels() {
this.$set(this, 'foundLabels', [])
},
addLabel(label) {
let labelTask = new LabelTaskModel({taskID: this.taskID, label_id: label.id})
this.labelTaskService.create(labelTask)
.then(() => {
message.success({message: 'The label was successfully added.'}, this)
})
.catch(e => {
message.error(e, this)
})
},
removeLabel(label) {
let labelTask = new LabelTaskModel({taskID: this.taskID, label_id: label.id})
this.labelTaskService.delete(labelTask)
.then(() => {
// Remove the label from the list
for (const l in this.labels) {
if (this.labels[l].id === label.id) {
this.labels.splice(l, 1)
}
}
message.success({message: 'The label was successfully removed.'}, this)
})
.catch(e => {
message.error(e, this)
})
},
createAndAddLabel(title) {
let newLabel = new LabelModel({title: title})
this.labelService.create(newLabel)
.then(r => {
this.addLabel(r)
this.labels.push(r)
})
.catch(e => {
message.error(e, this)
})
},
},
}
</script>
<style scoped>
</style>

View file

@ -0,0 +1,49 @@
<template>
<div class="select">
<select v-model.number="percentDone" @change="updateData">
<option value="0">0%</option>
<option value="0.1">10%</option>
<option value="0.2">20%</option>
<option value="0.3">30%</option>
<option value="0.4">40%</option>
<option value="0.5">50%</option>
<option value="0.6">60%</option>
<option value="0.7">70%</option>
<option value="0.8">80%</option>
<option value="0.9">90%</option>
<option value="1">100%</option>
</select>
</div>
</template>
<script>
export default {
name: 'percentDoneSelect',
data() {
return {
percentDone: 0,
}
},
props: {
value: {
default: 0,
type: Number,
}
},
watch: {
// Set the priority to the :value every time it changes from the outside
value(newVal) {
this.percentDone = newVal
},
},
mounted() {
this.percentDone = this.value
},
methods: {
updateData() {
this.$emit('input', this.percentDone)
this.$emit('change')
}
},
}
</script>

View file

@ -0,0 +1,32 @@
<template>
<span v-if="priority >= priorities.HIGH" class="high-priority" :class="{'not-so-high': priority === priorities.HIGH}">
<span class="icon">
<icon icon="exclamation"/>
</span>
<template v-if="priority === priorities.HIGH">High</template>
<template v-if="priority === priorities.URGENT">Urgent</template>
<template v-if="priority === priorities.DO_NOW">DO NOW</template>
<span class="icon" v-if="priority === priorities.DO_NOW">
<icon icon="exclamation"/>
</span>
</span>
</template>
<script>
import priorites from '../../../models/priorities'
export default {
name: 'priorityLabel',
data() {
return {
priorities: priorites,
}
},
props: {
priority: {
default: 0,
type: Number,
}
}
}
</script>

View file

@ -0,0 +1,47 @@
<template>
<div class="select">
<select v-model="priority" @change="updateData">
<option :value="priorities.UNSET">Unset</option>
<option :value="priorities.LOW">Low</option>
<option :value="priorities.MEDIUM">Medium</option>
<option :value="priorities.HIGH">High</option>
<option :value="priorities.URGENT">Urgent</option>
<option :value="priorities.DO_NOW">DO NOW</option>
</select>
</div>
</template>
<script>
import priorites from '../../../models/priorities'
export default {
name: 'prioritySelect',
data() {
return {
priorities: priorites,
priority: 0,
}
},
props: {
value: {
default: 0,
type: Number,
}
},
watch: {
// Set the priority to the :value every time it changes from the outside
value(newVal) {
this.priority = newVal
},
},
mounted() {
this.priority = this.value
},
methods: {
updateData() {
this.$emit('input', this.priority)
this.$emit('change')
}
},
}
</script>

View file

@ -0,0 +1,192 @@
<template>
<div class="task-relations">
<label class="label">New Task Relation</label>
<div class="columns">
<div class="column is-three-quarters">
<multiselect
v-model="newTaskRelationTask"
:options="foundTasks"
:multiple="false"
:searchable="true"
:loading="taskService.loading"
:internal-search="true"
@search-change="findTasks"
placeholder="Type search for a new task to add as related..."
label="text"
track-by="id"
>
<template slot="clear" slot-scope="props">
<div class="multiselect__clear"
v-if="newTaskRelationTask !== null && newTaskRelationTask.id !== 0"
@mousedown.prevent.stop="clearAllFoundTasks(props.search)"></div>
</template>
<span slot="noResult">No task found. Consider changing the search query.</span>
</multiselect>
</div>
<div class="column field has-addons">
<div class="control is-expanded">
<div class="select is-fullwidth has-defaults">
<select v-model="newTaskRelationKind">
<option value="unset">Select a relation kind</option>
<option v-for="(label, rk) in relationKinds" :key="rk" :value="rk">
{{ label }}
</option>
</select>
</div>
</div>
<div class="control">
<a class="button is-primary" @click="addTaskRelation()">Add task Relation</a>
</div>
</div>
</div>
<div class="related-tasks" v-for="(rts, kind ) in relatedTasks" :key="kind" v-if="rts.length > 0">
<span class="title">{{ relationKinds[kind] }}</span>
<div class="tasks noborder">
<div class="task" v-for="t in rts" :key="t.id">
<router-link :to="{ name: 'taskDetailView', params: { id: t.id } }">
<span class="tasktext" :class="{ 'done': t.done}">
{{t.text}}
</span>
</router-link>
<a class="remove" @click="() => {showDeleteModal = true; relationToDelete = {relation_kind: kind, other_task_id: t.id}}">
<icon icon="trash-alt"/>
</a>
</div>
</div>
</div>
<p v-if="showNoRelationsNotice && Object.keys(relatedTasks).length === 0" class="none">No task relations yet.</p>
<!-- Delete modal -->
<modal
v-if="showDeleteModal"
@close="showDeleteModal = false"
@submit="removeTaskRelation()">
<span slot="header">Delete Task Relation</span>
<p slot="text">Are you sure you want to delete this task relation?<br/>
<b>This CANNOT BE UNDONE!</b></p>
</modal>
</div>
</template>
<script>
import TaskService from '../../../services/task'
import TaskModel from '../../../models/task'
import TaskRelationService from '../../../services/taskRelation'
import relationKinds from '../../../models/relationKinds'
import TaskRelationModel from '../../../models/taskRelation'
import multiselect from 'vue-multiselect'
import message from '../../../message'
export default {
name: 'relatedTasks',
data() {
return {
relatedTasks: {},
taskService: TaskService,
foundTasks: [],
relationKinds: relationKinds,
newTaskRelationTask: TaskModel,
newTaskRelationKind: 'unset',
taskRelationService: TaskRelationService,
showDeleteModal: false,
relationToDelete: {},
}
},
components: {
multiselect,
},
props: {
taskID: {
type: Number,
required: true,
},
initialRelatedTasks: {
type: Object,
default: () => {},
},
showNoRelationsNotice: {
type: Boolean,
default: false,
},
},
created() {
this.taskService = new TaskService()
this.taskRelationService = new TaskRelationService()
this.newTaskRelationTask = new TaskModel()
},
watch: {
initialRelatedTasks(newVal) {
this.relatedTasks = newVal
},
},
mounted() {
this.relatedTasks = this.initialRelatedTasks
},
methods: {
findTasks(query) {
if (query === '') {
this.clearAllFoundTasks()
return
}
this.taskService.getAll({}, {s: query})
.then(response => {
this.$set(this, 'foundTasks', response)
})
.catch(e => {
message.error(e, this)
})
},
clearAllFoundTasks() {
this.$set(this, 'foundTasks', [])
},
addTaskRelation() {
let rel = new TaskRelationModel({
task_id: this.taskID,
other_task_id: this.newTaskRelationTask.id,
relation_kind: this.newTaskRelationKind,
})
this.taskRelationService.create(rel)
.then(() => {
if (!this.relatedTasks[this.newTaskRelationKind]) {
this.$set(this.relatedTasks, this.newTaskRelationKind, [])
}
this.relatedTasks[this.newTaskRelationKind].push(this.newTaskRelationTask)
this.newTaskRelationKind = 'unset'
this.newTaskRelationTask = new TaskModel()
message.success({message: 'The task relation was created successfully'}, this)
})
.catch(e => {
message.error(e, this)
})
},
removeTaskRelation() {
let rel = new TaskRelationModel({
relation_kind: this.relationToDelete.relation_kind,
task_id: this.taskID,
other_task_id: this.relationToDelete.other_task_id,
})
this.taskRelationService.delete(rel)
.then(r => {
Object.keys(this.relatedTasks).forEach(relationKind => {
for (const t in this.relatedTasks[relationKind]) {
if (this.relatedTasks[relationKind][t].id === this.relationToDelete.other_task_id && relationKind === this.relationToDelete.relation_kind) {
this.relatedTasks[relationKind].splice(t, 1)
}
}
})
message.success(r, this)
})
.catch(e => {
message.error(e, this)
})
.finally(() => {
this.showDeleteModal = false
})
},
},
}
</script>

View file

@ -0,0 +1,96 @@
<template>
<div class="reminders">
<div class="reminder-input"
:class="{ 'overdue': (r < nowUnix && index !== (reminders.length - 1))}"
v-for="(r, index) in reminders" :key="index">
<flat-pickr
:v-model="reminders"
:config="flatPickerConfig"
:id="'taskreminderdate' + index"
:value="r"
:data-index="index"
placeholder="Add a new reminder..."
>
</flat-pickr>
<a v-if="index !== (reminders.length - 1)" @click="removeReminderByIndex(index)">
<icon icon="times"></icon>
</a>
</div>
</div>
</template>
<script>
import flatPickr from 'vue-flatpickr-component'
import 'flatpickr/dist/flatpickr.css'
export default {
name: 'reminders',
data() {
return {
reminders: [],
lastReminder: 0,
nowUnix: new Date(),
flatPickerConfig: {
altFormat: 'j M Y H:i',
altInput: true,
dateFormat: 'Y-m-d H:i',
enableTime: true,
onOpen: this.updateLastReminderDate,
onClose: this.addReminderDate,
},
}
},
props: {
value: {
default: () => [],
type: Array,
}
},
components: {
flatPickr,
},
mounted() {
this.reminders = this.value
},
watch: {
value(newVal) {
this.reminders = newVal
},
},
methods: {
updateData() {
this.$emit('input', this.reminders)
this.$emit('change')
},
updateLastReminderDate(selectedDates) {
this.lastReminder = +new Date(selectedDates[0])
},
addReminderDate(selectedDates, dateStr, instance) {
let newDate = +new Date(selectedDates[0])
// Don't update if nothing changed
if (newDate === this.lastReminder) {
return
}
let index = parseInt(instance.input.dataset.index)
this.reminders[index] = newDate
let lastIndex = this.reminders.length - 1
// put a new null at the end if we changed something
if (lastIndex === index && !isNaN(newDate)) {
this.reminders.push(null)
}
this.updateData()
},
removeReminderByIndex(index) {
this.reminders.splice(index, 1)
// Reset the last to 0 to have the "add reminder" button
this.reminders[this.reminders.length - 1] = null
this.updateData()
},
},
}
</script>

View file

@ -0,0 +1,61 @@
<template>
<div class="control repeat-after-input columns">
<div class="column">
<p>
Each
</p>
</div>
<div class="column is-two-fifths">
<input class="input" placeholder="Specify an amount..." v-model="repeatAfter.amount" @change="updateData"/>
</div>
<div class="column is-two-fifths">
<div class="select">
<select v-model="repeatAfter.type" @change="updateData">
<option value="hours">Hours</option>
<option value="days">Days</option>
<option value="weeks">Weeks</option>
<option value="months">Months</option>
<option value="years">Years</option>
</select>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'repeatAfter',
data() {
return {
repeatAfter: {},
}
},
props: {
value: {
default: () => {},
required: true,
}
},
watch: {
value(newVal) {
this.repeatAfter = newVal
},
},
mounted() {
this.repeatAfter = this.value
},
methods: {
updateData() {
this.$emit('input', this.repeatAfter)
this.$emit('change')
}
},
}
</script>
<style scoped>
p {
padding-top: 6px;
}
</style>

View file

@ -54,6 +54,14 @@ import { faPaste } from '@fortawesome/free-solid-svg-icons'
import { faPencilAlt } from '@fortawesome/free-solid-svg-icons' import { faPencilAlt } from '@fortawesome/free-solid-svg-icons'
import { faTimesCircle } from '@fortawesome/free-regular-svg-icons' import { faTimesCircle } from '@fortawesome/free-regular-svg-icons'
import { faCalendarAlt } from '@fortawesome/free-regular-svg-icons' import { faCalendarAlt } from '@fortawesome/free-regular-svg-icons'
import { faCloudDownloadAlt } from '@fortawesome/free-solid-svg-icons'
import { faCloudUploadAlt } from '@fortawesome/free-solid-svg-icons'
import { faPercent } from '@fortawesome/free-solid-svg-icons'
import { faStar } from '@fortawesome/free-regular-svg-icons'
import { faAlignLeft } from '@fortawesome/free-solid-svg-icons'
import { faPaperclip } from '@fortawesome/free-solid-svg-icons'
import { faClock } from '@fortawesome/free-regular-svg-icons'
import { faHistory } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
library.add(faSignOutAlt) library.add(faSignOutAlt)
@ -82,6 +90,14 @@ library.add(faChevronDown)
library.add(faCheck) library.add(faCheck)
library.add(faPaste) library.add(faPaste)
library.add(faPencilAlt) library.add(faPencilAlt)
library.add(faCloudDownloadAlt)
library.add(faCloudUploadAlt)
library.add(faPercent)
library.add(faStar)
library.add(faAlignLeft)
library.add(faPaperclip)
library.add(faClock)
library.add(faHistory)
Vue.component('icon', FontAwesomeIcon) Vue.component('icon', FontAwesomeIcon)

21
src/models/attachment.js Normal file
View file

@ -0,0 +1,21 @@
import AbstractModel from './abstractModel'
import UserModel from './user'
import FileModel from './file'
export default class AttachmentModel extends AbstractModel {
constructor(data) {
super(data)
this.created_by = new UserModel(this.created_by)
this.file = new FileModel(this.file)
}
defaults() {
return {
id: 0,
task_id: 0,
file: FileModel,
created_by: UserModel,
created: 0,
}
}
}

32
src/models/file.js Normal file
View file

@ -0,0 +1,32 @@
import AbstractModel from './abstractModel'
export default class FileModel extends AbstractModel {
defaults() {
return {
id: 0,
mime: '',
name: '',
size: '',
created: 0,
}
}
getHumanSize() {
const sizes = {
0: 'B',
1: 'KB',
2: 'MB',
3: 'GB',
4: 'TB',
}
let it = 0
let size = this.size
while (size > 1024) {
size /= 1024
it++
}
return Number(Math.round(size+'e2')+'e-2') + ' ' + sizes[it]
}
}

View file

@ -1,12 +1,16 @@
import AbstractModel from './abstractModel'; import AbstractModel from './abstractModel';
import UserModel from './user' import UserModel from './user'
import LabelModel from "./label"; import LabelModel from './label'
import AttachmentModel from './attachment'
export default class TaskModel extends AbstractModel { export default class TaskModel extends AbstractModel {
constructor(data) { constructor(data) {
super(data) super(data)
this.id = Number(this.id)
this.listID = Number(this.listID)
// Make date objects from timestamps // Make date objects from timestamps
this.dueDate = this.parseDateIfNessecary(this.dueDate) this.dueDate = this.parseDateIfNessecary(this.dueDate)
this.startDate = this.parseDateIfNessecary(this.startDate) this.startDate = this.parseDateIfNessecary(this.startDate)
@ -44,6 +48,11 @@ export default class TaskModel extends AbstractModel {
return new TaskModel(t) return new TaskModel(t)
}) })
}) })
// Make all attachments to attachment models
this.attachments = this.attachments.map(a => {
return new AttachmentModel(a)
})
} }
defaults() { defaults() {
@ -65,6 +74,7 @@ export default class TaskModel extends AbstractModel {
hexColor: '', hexColor: '',
percentDone: 0, percentDone: 0,
related_tasks: {}, related_tasks: {},
attachments: [],
createdBy: UserModel, createdBy: UserModel,
created: 0, created: 0,

View file

@ -0,0 +1,11 @@
import AbstractModel from './abstractModel'
export default class TaskAssigneeModel extends AbstractModel {
defaults() {
return {
created: 0,
user_id: 0,
task_id: 0,
}
}
}

View file

@ -13,6 +13,7 @@ import NewListComponent from '@/components/lists/NewList'
import EditListComponent from '@/components/lists/EditList' import EditListComponent from '@/components/lists/EditList'
import ShowTasksInRangeComponent from '@/components/tasks/ShowTasksInRange' import ShowTasksInRangeComponent from '@/components/tasks/ShowTasksInRange'
import LinkShareAuthComponent from '@/components/sharing/linkSharingAuth' import LinkShareAuthComponent from '@/components/sharing/linkSharingAuth'
import TaskDetailViewComponent from '@/components/tasks/TaskDetailView'
// Namespace Handling // Namespace Handling
import NewNamespaceComponent from '@/components/namespaces/NewNamespace' import NewNamespaceComponent from '@/components/namespaces/NewNamespace'
import EditNamespaceComponent from '@/components/namespaces/EditNamespace' import EditNamespaceComponent from '@/components/namespaces/EditNamespace'
@ -115,10 +116,15 @@ export default new Router({
component: EditTeamComponent component: EditTeamComponent
}, },
{ {
path: '/tasks/:type', path: '/tasks/by/:type',
name: 'showTasksInRange', name: 'showTasksInRange',
component: ShowTasksInRangeComponent component: ShowTasksInRangeComponent
}, },
{
path: '/tasks/:id',
name: 'taskDetailView',
component: TaskDetailViewComponent,
},
{ {
path: '/labels', path: '/labels',
name: 'listLabels', name: 'listLabels',

View file

@ -40,13 +40,16 @@ export default class AbstractService {
this.http.interceptors.request.use( (config) => { this.http.interceptors.request.use( (config) => {
switch (config.method) { switch (config.method) {
case 'post': case 'post':
config.data = JSON.stringify(self.beforeUpdate(config.data)) if(this.useUpdateInterceptor())
config.data = JSON.stringify(self.beforeUpdate(config.data))
break break
case 'put': case 'put':
config.data = JSON.stringify(self.beforeCreate(config.data)) if(this.useCreateInterceptor())
config.data = JSON.stringify(self.beforeCreate(config.data))
break break
case 'delete': case 'delete':
config.data = JSON.stringify(self.beforeDelete(config.data)) if(this.useDeleteInterceptor())
config.data = JSON.stringify(self.beforeDelete(config.data))
break break
} }
return config return config
@ -70,6 +73,30 @@ export default class AbstractService {
} }
} }
/**
* Whether or not to use the create interceptor which processes a request payload into json
* @returns {boolean}
*/
useCreateInterceptor() {
return true
}
/**
* Whether or not to use the update interceptor which processes a request payload into json
* @returns {boolean}
*/
useUpdateInterceptor() {
return true
}
/**
* Whether or not to use the delete interceptor which processes a request payload into json
* @returns {boolean}
*/
useDeleteInterceptor() {
return true
}
///////////////////// /////////////////////
// Global error handler // Global error handler
/////////////////// ///////////////////

View file

@ -0,0 +1,85 @@
import AbstractService from './abstractService'
import AttachmentModel from '../models/attachment'
export default class AttachmentService extends AbstractService {
constructor() {
super({
create: '/tasks/{task_id}/attachments',
getAll: '/tasks/{task_id}/attachments',
delete: '/tasks/{task_id}/attachments/{id}',
})
}
uploadProgress = 0
useCreateInterceptor() {
return false
}
modelFactory(data) {
return new AttachmentModel(data)
}
modelCreateFactory(data) {
// Success contains the uploaded attachments
data.success = (data.success === null ? [] : data.success).map(a => {
return this.modelFactory(a)
})
return data
}
download(model) {
this.http({
url: '/tasks/' + model.task_id + '/attachments/' + model.id,
method: 'GET',
responseType: 'blob',
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', model.file.name);
link.click();
window.URL.revokeObjectURL(url);
});
}
/**
* Uploads a file to the server
* @param model
* @param files
* @returns {Promise<any|never>}
*/
create(model, files) {
let data = new FormData()
for (let i = 0; i < files.length; i++) {
// TODO: Validation of file size
data.append('files', new Blob([files[i]]), files[i].name);
}
const cancel = this.setLoading()
return this.http.put(
this.getReplacedRoute(this.paths.create, model),
data,
{
headers: {
'Content-Type':
'multipart/form-data; boundary=' + data._boundary,
},
onUploadProgress: progressEvent => {
this.uploadProgress = Math.round( (progressEvent.loaded * 100) / progressEvent.total );
}
}
)
.catch(error => {
return this.errorHandler(error)
})
.then(response => {
return Promise.resolve(this.modelCreateFactory(response.data))
})
.finally(() => {
this.uploadProgress = 0
cancel()
})
}
}

View file

@ -1,4 +1,4 @@
import AbstractService from "./abstractService"; import AbstractService from './abstractService'
import LabelModel from '../models/label' import LabelModel from '../models/label'
export default class LabelService extends AbstractService { export default class LabelService extends AbstractService {

View file

@ -6,6 +6,7 @@ export default class TaskService extends AbstractService {
super({ super({
create: '/lists/{listID}', create: '/lists/{listID}',
getAll: '/tasks/all', getAll: '/tasks/all',
get: '/tasks/{id}',
update: '/tasks/{id}', update: '/tasks/{id}',
delete: '/tasks/{id}', delete: '/tasks/{id}',
}); });
@ -73,6 +74,13 @@ export default class TaskService extends AbstractService {
model.hexColor = model.hexColor.substring(1, 7) model.hexColor = model.hexColor.substring(1, 7)
} }
// Do the same for all related tasks
Object.keys(model.related_tasks).forEach(relationKind => {
model.related_tasks[relationKind] = model.related_tasks[relationKind].map(t => {
return this.processModel(t)
})
})
return model return model
} }
} }

View file

@ -0,0 +1,15 @@
import AbstractService from './abstractService'
import TaskAssigneeModel from '../models/taskAssignee'
export default class TaskAssigneeService extends AbstractService {
constructor() {
super({
create: '/tasks/{task_id}/assignees',
delete: '/tasks/{task_id}/assignees/{user_id}',
})
}
modelFactory(data) {
return new TaskAssigneeModel(data)
}
}

View file

@ -1,4 +1,4 @@
import AbstractService from "./abstractService"; import AbstractService from './abstractService'
import TaskRelationModel from '../models/taskRelation' import TaskRelationModel from '../models/taskRelation'
export default class TaskRelationService extends AbstractService { export default class TaskRelationService extends AbstractService {

View file

@ -0,0 +1,66 @@
@-webkit-keyframes bounce {
from,
20%,
53%,
80%,
to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
40%,
43% {
-webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
-webkit-transform: translate3d(0, -30px, 0);
transform: translate3d(0, -30px, 0);
}
70% {
-webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
-webkit-transform: translate3d(0, -15px, 0);
transform: translate3d(0, -15px, 0);
}
90% {
-webkit-transform: translate3d(0, -4px, 0);
transform: translate3d(0, -4px, 0);
}
}
@keyframes bounce {
from,
20%,
53%,
80%,
to {
-webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
40%,
43% {
-webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
-webkit-transform: translate3d(0, -30px, 0);
transform: translate3d(0, -30px, 0);
}
70% {
-webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
-webkit-transform: translate3d(0, -15px, 0);
transform: translate3d(0, -15px, 0);
}
90% {
-webkit-transform: translate3d(0, -4px, 0);
transform: translate3d(0, -4px, 0);
}
}

View file

@ -137,6 +137,12 @@ fieldset[disabled] .multiselect {
.multiselect__tags-wrap { .multiselect__tags-wrap {
display: inline; display: inline;
.user {
display: inline-block;
min-height: 30px;
margin: 0 0 .5em;
}
} }
.multiselect__tags { .multiselect__tags {

View file

@ -0,0 +1,48 @@
.attachments {
input[type=file] {
display: none;
}
.dropzone {
position: fixed;
background: rgba(250,250,250,0.8);
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: 100;
text-align: center;
&.hidden {
display:none;
}
.drop-hint {
position: absolute;
bottom: 0;
left: 0;
right: 0;
.icon {
width: 100%;
font-size: 5em;
height: auto;
text-shadow: 0 2px 2px rgba(0, 0, 0, .14), 0 3px 1px rgba(0, 0, 0, .2), 0 1px 5px rgba(0, 0, 0, .12);
-moz-animation: bounce 2s infinite;
-webkit-animation: bounce 2s infinite;
animation: bounce 2s infinite;
}
.hint {
margin: .5em auto 2em;
border-radius: 2px;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .2), 0 1px 5px 0 rgba(0, 0, 0, .12);
background: $primary;
padding: 1em;
color: $white;
width: 100%;
max-width: 300px;
}
}
}
}

28
src/styles/reminders.scss Normal file
View file

@ -0,0 +1,28 @@
.reminders {
.reminder-input {
margin: 0;
&.overdue input {
color: $red;
}
&:last-child {
margin-bottom: 0.75rem;
}
a {
color: $red;
vertical-align: sub;
}
input {
width: 90%;
border: none;
&:focus {
border: none;
box-shadow: none;
}
}
}
}

185
src/styles/task.scss Normal file
View file

@ -0,0 +1,185 @@
.task-view {
.subtitle {
color: $grey;
a {
color: $grey-dark;
}
}
.has-top-border {
border-top: 1px solid lighten($grey, 35%);
padding-top: .5em;
}
h3 .button {
vertical-align: middle;
}
.icon.is-grey {
color: lighten($grey, 5%);
}
.heading {
display: flex;
justify-content: space-between;
text-transform: none;
align-items: center;
.title {
margin-bottom: 0;
}
.title.task-id {
color: lighten($grey, 25%);
white-space: nowrap;
}
.input.title{
font-size: 1.8rem;
font-family: $vikunja-font;
font-weight: 400 !important;
background: transparent;
border-color: transparent;
margin: 0 .3em;
height: 1.5em;
padding: 0 .3em;
&:hover,&:active {
background: $input-background-color;
border-color: $input-border-color;
}
&:focus {
background: $input-background-color;
border-color: $input-focus-border-color;
}
}
.is-done {
background: $green;
color: $white;
padding: .5em;
font-size: 1.5em;
margin-left: .5em;
font-weight: bold;
line-height: 1;
border-radius: 4px;
}
}
.date-input {
display: flex;
align-items: center;
a {
color: $red;
vertical-align: middle;
padding-left: .5em;
line-height: 1;
}
}
.details {
padding-bottom: 0.75em;
flex-flow: row wrap;
.detail-title {
display: block;
color: lighten($grey, 15%);
}
.none {
font-style: italic;
}
// Break after the 4th element
.column:nth-child(4n) {
page-break-after: always; // CSS 2.1 syntax
break-after: always; // New syntax
}
&.labels-list, .assignees{
.multiselect__tags {
padding: 3px 0 0 3px;
border: none;
background: transparent;
}
.multiselect__input, .multiselect__single {
width: 100% !important;
margin: 0;
padding: .35em !important;
position: relative !important;
background: transparent;
}
.multiselect__placeholder {
display: none;
}
.multiselect__select {
// We may need to enable this since it may also be responsable for showing the loading spinner
display: none;
}
.multiselect__content-wrapper {
border: none;
}
}
.input:not(.has-defaults),
.textarea,
.select:not(.has-defaults) select {
border-color: transparent;
background: transparent;
cursor: pointer;
transition: all $transition-duration;
&::placeholder {
color: $text-light;
opacity: 1;
font-style: italic;
}
&:hover {
border-color: $input-border-color;
background: $input-background-color;
}
}
.textarea {
&:hover {
cursor: text;
}
&:focus {
border-color: $input-focus-border-color
}
}
.select:not(.has-defaults):after {
opacity: 0;
}
.select:not(.has-defaults):hover:after {
opacity: 1;
}
}
.attachments {
margin-bottom: 0;
table tr:last-child td {
border-bottom: none;
}
}
.action-buttons {
a.button {
width: 100%;
margin-bottom: .5em;
justify-content: left;
}
}
}

View file

@ -0,0 +1,39 @@
.task-relations {
padding-bottom: 1em;
&.is-narrow .columns {
display: block;
.column {
width: 100%;
}
}
.related-tasks {
margin-bottom: .75em;
.title {
font-size: 1em;
margin: 0;
}
.tasks {
margin: 0;
.task {
padding: .5em;
}
}
}
.multiselect__input {
width: 90% !important;
padding-left: 5px !important;
z-index: 1;
}
.none {
font-style: italic;
text-align: center;
}
}

View file

@ -28,7 +28,7 @@
padding: 0.5rem 1rem; padding: 0.5rem 1rem;
border-bottom: 1px solid darken(#fff, 10%); border-bottom: 1px solid darken(#fff, 10%);
label{ span:not(.tag) {
width: 96%; width: 96%;
display: inline-block; display: inline-block;
cursor: pointer; cursor: pointer;
@ -66,24 +66,21 @@
height: 27px; height: 27px;
width: 27px; width: 27px;
} }
a {
color: $text;
transition: color ease $transition-duration;
&:hover {
color: darken($text, 40%);
}
}
} }
.remove { .remove {
color: $red; color: $red;
} }
.high-priority{
color: $red;
.icon {
vertical-align: middle;
}
&.not-so-high {
color: $orange;
}
}
input[type="checkbox"] { input[type="checkbox"] {
vertical-align: middle; vertical-align: middle;
} }
@ -104,32 +101,6 @@
min-height: calc(100% - 1rem); min-height: calc(100% - 1rem);
margin-top: 1rem; margin-top: 1rem;
.reminder-input{
margin: 0;
&.overdue input{
color: $red;
}
&:last-child {
margin-bottom: 0.75rem;
}
a {
color: $red;
vertical-align: sub;
}
input {
width: 90%;
border: none;
&:focus {
border: none;
box-shadow: none;
}
}
}
.priority-select{ .priority-select{
.select, select{ .select, select{
@ -165,3 +136,15 @@
} }
} }
} }
.high-priority{
color: $red;
.icon {
vertical-align: middle;
}
&.not-so-high {
color: $orange;
}
}

View file

@ -1,6 +1,8 @@
@import url('/fonts/fonts.css'); @import url('/fonts/fonts.css');
@import 'variables'; @import 'variables';
@import "../../node_modules/bulma/bulma"; @import '../../node_modules/bulma/bulma';
@import 'animations';
*, *:hover, *:active, *:focus{ *, *:hover, *:active, *:focus{
outline: none; outline: none;
@ -55,6 +57,10 @@
&:focus:not(:active) { &:focus:not(:active) {
box-shadow: 0.1em 0.1em 0.7em lighten($color, 30) !important; box-shadow: 0.1em 0.1em 0.7em lighten($color, 30) !important;
} }
&.is-outlined {
border: 2px solid $color;
}
} }
} }
@ -70,6 +76,10 @@
box-shadow: none; box-shadow: none;
} }
} }
&.is-small {
border-radius: $radius;
}
} }
.input, .input,
@ -263,3 +273,18 @@ h1,h2,h3,h4,h5,h6{
} }
} }
} }
.multiselect__tags {
.remove-assignee {
vertical-align: bottom;
color: $red;
margin-left: -1.8em;
background: $white;
padding: 0 4px;
display: inline-block;
border-radius: 100%;
font-size: .8em;
width: 18px;
height: 18px;
}
}

View file

@ -4,6 +4,7 @@
@import 'styles/transitions'; @import 'styles/transitions';
@import 'styles/tasks'; @import 'styles/tasks';
@import 'styles/task';
@import 'styles/teams'; @import 'styles/teams';
@import 'styles/fullpage'; @import 'styles/fullpage';
@import 'styles/labels'; @import 'styles/labels';
@ -13,4 +14,8 @@
@import 'styles/tooltip'; @import 'styles/tooltip';
@import 'styles/gantt'; @import 'styles/gantt';
@import 'styles/attachments';
@import 'styles/taskRelations';
@import 'styles/reminders';
@import 'styles/multiselect'; @import 'styles/multiselect';

View file

@ -3710,6 +3710,18 @@ code-point-at@^1.0.0:
resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"
integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=
codemirror-spell-checker@1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/codemirror-spell-checker/-/codemirror-spell-checker-1.1.2.tgz#1c660f9089483ccb5113b9ba9ca19c3f4993371e"
integrity sha1-HGYPkIlIPMtRE7m6nKGcP0mTNx4=
dependencies:
typo-js "*"
codemirror@^5.48.4:
version "5.49.2"
resolved "https://registry.yarnpkg.com/codemirror/-/codemirror-5.49.2.tgz#c84fdaf11b19803f828b0c67060c7bc6d154ccad"
integrity sha512-dwJ2HRPHm8w51WB5YTF9J7m6Z5dtkqbU9ntMZ1dqXyFB9IpjoUFDj80ahRVEoVanfIp6pfASJbOlbWdEf8FOzQ==
collection-visit@^1.0.0: collection-visit@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0"
@ -4371,7 +4383,7 @@ debug@^4.1.0, debug@^4.1.1:
dependencies: dependencies:
ms "^2.1.1" ms "^2.1.1"
debuglog@*, debuglog@^1.0.1: debuglog@^1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492"
integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI= integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=
@ -4813,6 +4825,15 @@ easy-stack@^1.0.0:
resolved "https://registry.yarnpkg.com/easy-stack/-/easy-stack-1.0.0.tgz#12c91b3085a37f0baa336e9486eac4bf94e3e788" resolved "https://registry.yarnpkg.com/easy-stack/-/easy-stack-1.0.0.tgz#12c91b3085a37f0baa336e9486eac4bf94e3e788"
integrity sha1-EskbMIWjfwuqM26UhurEv5Tj54g= integrity sha1-EskbMIWjfwuqM26UhurEv5Tj54g=
easymde@^2.8.0:
version "2.8.0"
resolved "https://registry.yarnpkg.com/easymde/-/easymde-2.8.0.tgz#a2f5e2618f23f4eaef3aee50056b6172dc6ead7e"
integrity sha512-ci0c31shzLYO9OzTcCveEr5MMghO3f+BIa58HjEJf7nYMAQxNl4gCQSk2A8+k2jTsBYln2wSF/+4lSjkvgHQww==
dependencies:
codemirror "^5.48.4"
codemirror-spell-checker "1.1.2"
marked "^0.7.0"
ecc-jsbn@~0.1.1: ecc-jsbn@~0.1.1:
version "0.1.2" version "0.1.2"
resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9"
@ -6638,7 +6659,7 @@ import-local@^2.0.0:
pkg-dir "^3.0.0" pkg-dir "^3.0.0"
resolve-cwd "^2.0.0" resolve-cwd "^2.0.0"
imurmurhash@*, imurmurhash@^0.1.4: imurmurhash@^0.1.4:
version "0.1.4" version "0.1.4"
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= integrity sha1-khi5srkoojixPcT7a21XbyMUU+o=
@ -7750,11 +7771,6 @@ lockfile@^1.0.4:
dependencies: dependencies:
signal-exit "^3.0.2" signal-exit "^3.0.2"
lodash._baseindexof@*:
version "3.1.0"
resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c"
integrity sha1-/lK1OhxnYeQmGNZU5KJXie1hgiw=
lodash._baseuniq@~4.6.0: lodash._baseuniq@~4.6.0:
version "4.6.0" version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8" resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8"
@ -7763,33 +7779,11 @@ lodash._baseuniq@~4.6.0:
lodash._createset "~4.0.0" lodash._createset "~4.0.0"
lodash._root "~3.0.0" lodash._root "~3.0.0"
lodash._bindcallback@*:
version "3.0.1"
resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e"
integrity sha1-5THCdkTPi1epnhftlbNcdIeJOS4=
lodash._cacheindexof@*:
version "3.0.2"
resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92"
integrity sha1-PcaayCSY0u5ePOVgkbr9Ktx73pI=
lodash._createcache@*:
version "3.1.2"
resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093"
integrity sha1-VtagZAF2JeeevKa4AY4XRAvc8JM=
dependencies:
lodash._getnative "^3.0.0"
lodash._createset@~4.0.0: lodash._createset@~4.0.0:
version "4.0.3" version "4.0.3"
resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26" resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26"
integrity sha1-D0ZZ+7CddRlPqeK4imZE02PJ/iY= integrity sha1-D0ZZ+7CddRlPqeK4imZE02PJ/iY=
lodash._getnative@*, lodash._getnative@^3.0.0:
version "3.9.1"
resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5"
integrity sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=
lodash._reinterpolate@^3.0.0: lodash._reinterpolate@^3.0.0:
version "3.0.0" version "3.0.0"
resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"
@ -7850,11 +7844,6 @@ lodash.pickby@4.6.0:
resolved "https://registry.yarnpkg.com/lodash.pickby/-/lodash.pickby-4.6.0.tgz#7dea21d8c18d7703a27c704c15d3b84a67e33aff" resolved "https://registry.yarnpkg.com/lodash.pickby/-/lodash.pickby-4.6.0.tgz#7dea21d8c18d7703a27c704c15d3b84a67e33aff"
integrity sha1-feoh2MGNdwOifHBMFdO4SmfjOv8= integrity sha1-feoh2MGNdwOifHBMFdO4SmfjOv8=
lodash.restparam@*:
version "3.6.1"
resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805"
integrity sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=
lodash.sortby@^4.7.0: lodash.sortby@^4.7.0:
version "4.7.0" version "4.7.0"
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
@ -8062,6 +8051,11 @@ map-visit@^1.0.0:
dependencies: dependencies:
object-visit "^1.0.0" object-visit "^1.0.0"
marked@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/marked/-/marked-0.7.0.tgz#b64201f051d271b1edc10a04d1ae9b74bb8e5c0e"
integrity sha512-c+yYdCZJQrsRjTPhUx7VKkApw9bwDkNbHUKo1ovgcfDjb2kc8rLuRbIFyXL5WOEUwzSSKo3IXpph2K6DqB/KZg==
md5.js@^1.3.4: md5.js@^1.3.4:
version "1.3.5" version "1.3.5"
resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f"
@ -12157,6 +12151,11 @@ typescript@^3.4.5:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.4.tgz#b18752bb3792bc1a0281335f7f6ebf1bbfc5b91d" resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.4.tgz#b18752bb3792bc1a0281335f7f6ebf1bbfc5b91d"
integrity sha512-unoCll1+l+YK4i4F8f22TaNVPRHcD9PA3yCuZ8g5e0qGqlVlJ/8FSateOLLSagn+Yg5+ZwuPkL8LFUc0Jcvksg== integrity sha512-unoCll1+l+YK4i4F8f22TaNVPRHcD9PA3yCuZ8g5e0qGqlVlJ/8FSateOLLSagn+Yg5+ZwuPkL8LFUc0Jcvksg==
typo-js@*:
version "1.0.3"
resolved "https://registry.yarnpkg.com/typo-js/-/typo-js-1.0.3.tgz#54d8ebc7949f1a7810908b6002c6841526c99d5a"
integrity sha1-VNjrx5SfGngQkItgAsaEFSbJnVo=
uglify-js@3.4.x: uglify-js@3.4.x:
version "3.4.10" version "3.4.10"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.4.10.tgz#9ad9563d8eb3acdfb8d38597d2af1d815f6a755f" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.4.10.tgz#9ad9563d8eb3acdfb8d38597d2af1d815f6a755f"
@ -12552,6 +12551,14 @@ vue-drag-resize@^1.3.2:
resolved "https://registry.yarnpkg.com/vue-drag-resize/-/vue-drag-resize-1.3.2.tgz#99132a99746c878e4596fad08d36c98f604930a3" resolved "https://registry.yarnpkg.com/vue-drag-resize/-/vue-drag-resize-1.3.2.tgz#99132a99746c878e4596fad08d36c98f604930a3"
integrity sha512-XiSEep3PPh9IPQqa4vIy/YENBpYch2SIPNipcPAEGhaSa0V8A8gSq9s7JQ66p/hiINdnR7f5ZqAkOdm6zU/4Gw== integrity sha512-XiSEep3PPh9IPQqa4vIy/YENBpYch2SIPNipcPAEGhaSa0V8A8gSq9s7JQ66p/hiINdnR7f5ZqAkOdm6zU/4Gw==
vue-easymde@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/vue-easymde/-/vue-easymde-1.0.1.tgz#bd304991596aff244a1136d3fb008573c864f865"
integrity sha512-HhivI75g+RtV4XgKQ5nxu5mO3a/ksMifJadwSMjMX5OM/M9DIRf4MDn56A3RXB3sW/7m1wYmrW/nFcGo14D9cg==
dependencies:
easymde "^2.8.0"
marked "^0.7.0"
vue-eslint-parser@^2.0.3: vue-eslint-parser@^2.0.3:
version "2.0.3" version "2.0.3"
resolved "https://registry.yarnpkg.com/vue-eslint-parser/-/vue-eslint-parser-2.0.3.tgz#c268c96c6d94cfe3d938a5f7593959b0ca3360d1" resolved "https://registry.yarnpkg.com/vue-eslint-parser/-/vue-eslint-parser-2.0.3.tgz#c268c96c6d94cfe3d938a5f7593959b0ca3360d1"