diff --git a/web/src/views/project/TemplateView.vue b/web/src/views/project/TemplateView.vue index 58b5547f..b0095123 100644 --- a/web/src/views/project/TemplateView.vue +++ b/web/src/views/project/TemplateView.vue @@ -68,7 +68,7 @@ @yes="remove()" /> - + mdi-delete @@ -100,6 +101,7 @@ mdi-content-copy @@ -107,6 +109,7 @@ mdi-pencil @@ -214,7 +217,12 @@ import YesNoDialog from '@/components/YesNoDialog.vue'; import EditDialog from '@/components/EditDialog.vue'; import TemplateForm from '@/components/TemplateForm.vue'; import TaskList from '@/components/TaskList.vue'; -import { TEMPLATE_TYPE_ACTION_TITLES, TEMPLATE_TYPE_ICONS, TEMPLATE_TYPE_TITLES } from '@/lib/constants'; +import { + TEMPLATE_TYPE_ACTION_TITLES, + TEMPLATE_TYPE_ICONS, + TEMPLATE_TYPE_TITLES, + USER_PERMISSIONS, +} from '@/lib/constants'; import ObjectRefsDialog from '@/components/ObjectRefsDialog.vue'; import NewTaskDialog from '@/components/NewTaskDialog.vue'; @@ -225,6 +233,7 @@ export default { props: { projectId: Number, + userPermissions: Number, }, data() { @@ -242,10 +251,17 @@ export default { itemRefs: null, itemRefsDialog: null, newTaskDialog: null, + USER_PERMISSIONS, }; }, computed: { + canUpdate() { + const perm = USER_PERMISSIONS.manageProjectResources; + // eslint-disable-next-line no-bitwise + return (this.userPermissions & perm) === perm; + }, + viewId() { if (/^-?\d+$/.test(this.$route.params.viewId)) { return parseInt(this.$route.params.viewId, 10); diff --git a/web/src/views/project/Templates.vue b/web/src/views/project/Templates.vue index deab47ba..fd279694 100644 --- a/web/src/views/project/Templates.vue +++ b/web/src/views/project/Templates.vue @@ -169,8 +169,12 @@ :tooltip="item.last_task.message" />
- {{ $t('by', {user_name: item.last_task.user_name, formatDate: item.last_task.created| - formatDate}) }} + {{ + $t('by', { + user_name: item.last_task.user_name, formatDate: item.last_task.created | + formatDate + }) + }}
@@ -328,6 +332,10 @@ export default { await this.loadViews(); }, + allowActions() { + return true; + }, + getViewUrl(viewId) { if (viewId == null) { return `/project/${this.projectId}/templates`;