Enable percent-encoded characters in calendar URI

Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
This commit is contained in:
Raimund Schlüßler 2019-07-07 10:39:52 +02:00
parent 4c8950a58c
commit c90c9a48f6
No known key found for this signature in database
GPG key ID: 036FA7EB1A599178
6 changed files with 18 additions and 31 deletions

View file

@ -95,9 +95,9 @@ export default {
closeDetails($event) {
if (!($event.target.closest('.reactive') || $event.target.classList.contains('reactive')) && !$event.target.closest('#app-sidebar')) {
if (this.$route.params.calendarId) {
this.$router.push({ path: `/calendars/${this.$route.params.calendarId}` })
this.$router.push({ name: 'calendars', params: { calendarId: this.$route.params.calendarId } })
} else {
this.$router.push({ path: `/collections/${this.$route.params.collectionId}` })
this.$router.push({ name: 'collections', params: { collectionId: this.$route.params.collectionId } })
}
}
}

View file

@ -180,21 +180,6 @@ export default {
sortDirection: 'sortDirection',
searchQuery: 'searchQuery',
}),
/**
* Returns the path of the task
*
* @returns {String} the route to the task
*/
taskRoute: function() {
var calendarId = this.$route.params.calendarId
var collectionId = this.$route.params.collectionId
if (calendarId) {
return '/calendars/' + calendarId + '/tasks/' + this.task.uri
} else if (collectionId) {
return '/collections/' + collectionId + '/tasks/' + this.task.uri
}
return ''
},
iconStar: function() {
if (+this.task.priority > 5) {
@ -332,7 +317,11 @@ export default {
if (!this.task.loadedCompleted) {
this.getTasksFromCalendar({ calendar: this.task.calendar, completed: true, related: this.task.uid })
}
this.$router.push(this.taskRoute)
if (this.$route.params.calendarId) {
this.$router.push({ name: 'calendarsTask', params: { calendarId: this.$route.params.calendarId, taskId: this.task.uri } })
} else if (this.$route.params.collectionId) {
this.$router.push({ name: 'collectionsTask', params: { collectionId: this.$route.params.collectionId, taskId: this.task.uri } })
}
}
},

View file

@ -608,9 +608,9 @@ export default {
closeDetails: function() {
if (this.$route.params.calendarId) {
this.$router.push({ path: `/calendars/${this.$route.params.calendarId}` })
this.$router.push({ name: 'calendars', params: { calendarId: this.$route.params.calendarId } })
} else {
this.$router.push({ path: `/collections/${this.$route.params.collectionId}` })
this.$router.push({ name: 'collections', params: { collectionId: this.$route.params.collectionId } })
}
},
@ -820,7 +820,7 @@ export default {
const task = await this.moveTask({ task: this.task, calendar: calendar })
// If we are in a calendar view, we have to navigate to the new calendar.
if (this.$route.params.calendarId) {
this.$router.push('/calendars/' + task.calendar.id + '/tasks/' + task.uri)
this.$router.push({ name: 'calendarsTask', params: { calendarId: task.calendar.id, taskId: task.uri } })
}
},
}

View file

@ -26,7 +26,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
:id="'collection_' + collection.id"
:key="collection.id"
:collection-id="collection.id"
:to="'/collections/' + collection.id"
:to="{ name: 'collections', params: {collectionId: collection.id } }"
:class="[collection.icon, {'animate-up': hideCollection(collection) }]"
tag="li" class="collection reactive"
active-class="active"
@ -53,7 +53,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
:key="calendar.id"
v-click-outside="() => resetView(calendar)"
:calendar-id="calendar.id"
:to="'/calendars/' + calendar.id"
:to="{ name: 'calendars', params: { calendarId: calendar.id } }"
:class="{edit: editing == calendar.id}"
tag="li"
class="list with-menu editing"

View file

@ -34,10 +34,10 @@ const routes = [
// would also be an option, but it currently does not work
// reliably with router-link due to
// https://github.com/vuejs/vue-router/issues/419
{ path: '/collections/:collectionId', component: Collections, props: true },
{ path: '/collections/:collectionId/tasks/:taskId', components: { default: Collections, details: TheDetails }, props: { default: true } },
{ path: '/calendars/:calendarId', component: Calendar, props: true },
{ path: '/calendars/:calendarId/tasks/:taskId', components: { default: Calendar, details: TheDetails }, props: { default: true } }
{ name: 'collections', path: '/collections/:collectionId', component: Collections, props: true },
{ name: 'collectionsTask', path: '/collections/:collectionId/tasks/:taskId', components: { default: Collections, details: TheDetails }, props: { default: true } },
{ name: 'calendars', path: '/calendars/:calendarId', component: Calendar, props: true },
{ name: 'calendarsTask', path: '/calendars/:calendarId/tasks/:taskId', components: { default: Calendar, details: TheDetails }, props: { default: true } }
]
Vue.use(VueRouter)

View file

@ -612,13 +612,11 @@ const actions = {
// Open the details view for the new task
var calendarId = context.rootState.route.params.calendarId
var collectionId = context.rootState.route.params.collectionId
var taskRoute = ''
if (calendarId) {
taskRoute = '/calendars/' + calendarId + '/tasks/' + task.uri
router.push({ name: 'calendarsTask', params: { calendarId: calendarId, taskId: task.uri } })
} else if (collectionId) {
taskRoute = '/collections/' + collectionId + '/tasks/' + task.uri
router.push({ name: 'collectionsTask', params: { collectionId: collectionId, taskId: task.uri } })
}
router.push(taskRoute)
})
.catch((error) => { throw error })