4b3f92ae34
Make backgrounds list responsive Show initial collection of backgrounds Remove test data Fix "backgroundInformation is null" when navigating Fix kanban height Remove debug log Move list title to top header Add styling for title in top header Set the current list (and background) when loading settings Only load the background if it changed Make task detail view look good again Fix bottom spacing Make list and table view look good again Make pages with background at least 100vh Fix kanban height Make extra buttons look good again Move list title and view-switcher in one row Add styling for backgrounds Set background globally Add getting list background and putting it in vuex Add setting list background Move list background setting to seperate list Add search timeout to not search on every keypress Add getting thumbnails through api Add basic search for unsplash backgrounds Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/144
58 lines
No EOL
1.2 KiB
JavaScript
58 lines
No EOL
1.2 KiB
JavaScript
import AbstractService from './abstractService'
|
|
import ListModel from '../models/list'
|
|
import TaskService from './task'
|
|
import {formatISO} from 'date-fns'
|
|
|
|
export default class ListService extends AbstractService {
|
|
constructor() {
|
|
super({
|
|
create: '/namespaces/{namespaceId}/lists',
|
|
get: '/lists/{id}',
|
|
getAll: '/lists',
|
|
update: '/lists/{id}',
|
|
delete: '/lists/{id}',
|
|
})
|
|
}
|
|
|
|
processModel(model) {
|
|
model.created = formatISO(model.created)
|
|
model.updated = formatISO(model.updated)
|
|
return model
|
|
}
|
|
|
|
modelFactory(data) {
|
|
return new ListModel(data)
|
|
}
|
|
|
|
beforeUpdate(model) {
|
|
let taskService = new TaskService()
|
|
model.tasks = model.tasks.map(task => {
|
|
return taskService.beforeUpdate(task)
|
|
})
|
|
model.hexColor = model.hexColor.substring(1, 7)
|
|
return model
|
|
}
|
|
|
|
beforeCreate(list) {
|
|
list.hexColor = list.hexColor.substring(1, 7)
|
|
return list
|
|
}
|
|
|
|
background(list) {
|
|
if (list.background === null) {
|
|
return Promise.resolve('')
|
|
}
|
|
|
|
return this.http({
|
|
url: `/lists/${list.id}/background`,
|
|
method: 'GET',
|
|
responseType: 'blob',
|
|
})
|
|
.then(response => {
|
|
return window.URL.createObjectURL(new Blob([response.data]))
|
|
})
|
|
.catch(e => {
|
|
return e
|
|
})
|
|
}
|
|
} |