Prevent editing read-only tasks in list view
Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
This commit is contained in:
parent
b4e175daf3
commit
b1393b7e32
3 changed files with 14 additions and 2 deletions
|
@ -1153,6 +1153,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
&.active {
|
||||
opacity: .7;
|
||||
}
|
||||
|
|
|
@ -47,11 +47,11 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|||
role="checkbox"
|
||||
@click="toggleCompleted(task)"
|
||||
>
|
||||
<span :class="{'icon-checkmark': task.completed}" class="icon icon-bw task-checkbox reactive no-nav" />
|
||||
<span :class="{'icon-checkmark': task.completed, 'disabled': task.calendar.readOnly}" class="icon icon-bw task-checkbox reactive no-nav" />
|
||||
</span>
|
||||
<span class="icon task-separator" />
|
||||
<span class="task-star" @click="toggleStarred(task)">
|
||||
<span :class="[iconStar]" class="icon right large reactive no-nav" />
|
||||
<span :class="[iconStar, {'disabled': task.calendar.readOnly}]" class="icon right large reactive no-nav" />
|
||||
</span>
|
||||
<span v-if="!task.calendar.readOnly"
|
||||
class="task-addsubtask add-subtask"
|
||||
|
|
|
@ -727,6 +727,10 @@ const actions = {
|
|||
* @param {Task} task The task to update
|
||||
*/
|
||||
async toggleCompleted(context, task) {
|
||||
// Don't try to edit tasks in read-only calendars
|
||||
if (task.calendar.readOnly) {
|
||||
return
|
||||
}
|
||||
if (task.completed) {
|
||||
await context.dispatch('setPercentComplete', { task: task, complete: 0 })
|
||||
} else {
|
||||
|
@ -788,6 +792,10 @@ const actions = {
|
|||
* @param {Task} task The task to update
|
||||
*/
|
||||
async toggleStarred(context, task) {
|
||||
// Don't try to edit tasks in read-only calendars
|
||||
if (task.calendar.readOnly) {
|
||||
return
|
||||
}
|
||||
context.commit('toggleStarred', task)
|
||||
context.dispatch('scheduleTaskUpdate', task)
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue