Skip to content

Commit

Permalink
Merge pull request #2478 from nextcloud/enh/tasks-open-deck
Browse files Browse the repository at this point in the history
Let apps handle clicks on todo entries
  • Loading branch information
juliusknorr authored Dec 30, 2020
2 parents 20b263b + 2112efe commit d377a37
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
18 changes: 12 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"@nextcloud/auth": "^1.3.0",
"@nextcloud/axios": "^1.4.0",
"@nextcloud/dialogs": "^2.0.1",
"@nextcloud/event-bus": "^1.2.0",
"@nextcloud/initial-state": "^1.1.2",
"@nextcloud/l10n": "^1.4.1",
"@nextcloud/logger": "^1.1.2",
Expand Down
15 changes: 10 additions & 5 deletions src/fullcalendar/interaction/eventClick.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
import { generateUrl } from '@nextcloud/router'
import { translate as t } from '@nextcloud/l10n'
import { showInfo } from '@nextcloud/dialogs'
import { emit } from '@nextcloud/event-bus'

/**
* Returns a function for click action on event. This will open the editor.
Expand Down Expand Up @@ -94,17 +95,21 @@ function handleEventClick(event, store, router, route, window) {
* @param {Window} window The window object
*/
function handleToDoClick(event, store, route, window) {
if (!store.state.settings.tasksEnabled) {
if (!isPublicOrEmbeddedRoute(route.name)) {
showInfo(t('calendar', 'Please ask your administrator to enable the Tasks App.'))
}

if (isPublicOrEmbeddedRoute(route.name)) {
return
}

const davUrlParts = event.extendedProps.davUrl.split('/')
const taskId = davUrlParts.pop()
const calendarId = davUrlParts.pop()
const url = `apps/tasks/#/calendars/${calendarId}/tasks/${taskId}`

emit('calendar:handle-todo-click', { calendarId, taskId })

if (!store.state.settings.tasksEnabled) {
showInfo(t('calendar', 'Please ask your administrator to enable the Tasks App.'))
return
}
const url = `apps/tasks/#/calendars/${calendarId}/tasks/${taskId}`
window.location = window.location.protocol + '//' + window.location.host + generateUrl(url)
}

0 comments on commit d377a37

Please sign in to comment.