File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010 :key =" option.id"
1111 :aria-label =" isMobile ? option.ariaLabel : null"
1212 :checked =" active.id"
13- :disabled =" disabled"
13+ :disabled =" disabled || option.disabled "
1414 class =" pill-menu__toggle"
1515 :class =" { 'pill-menu__toggle--icon-only': isMobile && option.icon }"
1616 button-variant
Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ const editView = {
5353 icon: mdiPencil,
5454 title: t (' forms' , ' Edit' ),
5555 id: ' edit' ,
56+ disabled: false ,
5657}
5758const resultsView = {
5859 ariaLabel: t (' forms' , ' Show results' ),
@@ -78,6 +79,11 @@ export default {
7879 default: false ,
7980 },
8081
82+ locked: {
83+ type: Boolean ,
84+ required: true ,
85+ },
86+
8187 sidebarOpened: {
8288 type: Boolean ,
8389 default: false ,
@@ -112,7 +118,10 @@ export default {
112118 views .push (submitView)
113119 }
114120 if (this .canEdit ) {
115- views .push (editView)
121+ views .push ({
122+ ... editView,
123+ disabled: this .locked ,
124+ })
116125 }
117126 if (this .canSeeResults ) {
118127 views .push (resultsView)
Original file line number Diff line number Diff line change 33 * SPDX-License-Identifier: AGPL-3.0-or-later
44 */
55
6+ import { getCurrentUser } from '@nextcloud/auth'
67import { generateOcsUrl } from '@nextcloud/router'
78import { showError } from '@nextcloud/dialogs'
89import { emit } from '@nextcloud/event-bus'
@@ -12,6 +13,7 @@ import MarkdownIt from 'markdown-it'
1213import CancelableRequest from '../utils/CancelableRequest.js'
1314import OcsResponse2Data from '../utils/OcsResponse2Data.js'
1415import logger from '../utils/Logger.js'
16+ import moment from '@nextcloud/moment'
1517
1618export default {
1719 provide ( ) {
@@ -92,6 +94,20 @@ export default {
9294 || this . form . description
9395 )
9496 } ,
97+
98+ isFormLocked ( ) {
99+ logger . debug ( 'Checking if form is locked' , {
100+ lockedUntil : this . form . lockedUntil ,
101+ currentTime : moment ( ) . unix ( ) ,
102+ formLockedBy : this . form . lockedBy ,
103+ currentUser : getCurrentUser ( ) . uid ,
104+ } )
105+ return (
106+ this . form . lockedUntil === 0
107+ || ( this . form . lockedUntil > moment ( ) . unix ( )
108+ && this . form . lockedBy !== getCurrentUser ( ) . uid )
109+ )
110+ } ,
95111 } ,
96112
97113 methods : {
Original file line number Diff line number Diff line change 1111 <!-- Show results & sidebar button -->
1212 <TopBar
1313 :archived =" isFormArchived"
14+ :locked =" isFormLocked"
1415 :permissions =" form?.permissions"
1516 :sidebar-opened =" sidebarOpened"
1617 :submission-count =" form?.submissionCount"
3940 </template >
4041 </NcEmptyContent >
4142
43+ <NcEmptyContent
44+ v-else-if =" isFormLocked"
45+ class =" emtpycontent"
46+ :name =" t('forms', 'Form is locked')"
47+ :description ="
48+ t(
49+ 'forms',
50+ 'Form \'{title}\' is locked by \'{lockedBy}\' until {lockedUntil} and cannot be modified.',
51+ {
52+ title: form.title,
53+ lockedBy: form.lockedBy,
54+ lockedUntil:
55+ form.lockedUntil === 0
56+ ? t('forms', 'forever')
57+ : t('forms', lockedUntilFormatted),
58+ },
59+ )
60+ " >
61+ <template #icon >
62+ <IconLock :size =" 64" />
63+ </template >
64+ </NcEmptyContent >
65+
4266 <template v-else >
4367 <!-- Forms title & description-->
4468 <header >
@@ -279,6 +303,10 @@ export default {
279303 const { datetime , ... filteredAnswerTypes } = answerTypes
280304 return filteredAnswerTypes
281305 },
306+
307+ lockedUntilFormatted () {
308+ return moment (this .form .lockedUntil , ' X' ).format (' LL' )
309+ }
282310 },
283311
284312 watch: {
Original file line number Diff line number Diff line change 2020
2121 <TopBar
2222 :archived =" isFormArchived"
23+ :locked =" isFormLocked"
2324 :permissions =" form?.permissions"
2425 :sidebar-opened =" sidebarOpened"
2526 :submission-count =" form?.submissionCount"
Original file line number Diff line number Diff line change 1010 <TopBar
1111 v-if =" !publicView"
1212 :archived =" isArchived"
13+ :locked =" isFormLocked"
1314 :permissions =" form?.permissions"
1415 :sidebar-opened =" sidebarOpened"
1516 :submission-count =" form?.submissionCount"
You can’t perform that action at this time.
0 commit comments