vikunja-frontend/src/main.js

219 lines
4.5 KiB
JavaScript
Raw Normal View History

2018-08-28 22:50:22 +02:00
import Vue from 'vue'
import App from './App.vue'
import router from './router'
2018-08-28 22:50:22 +02:00
import {formatDate, formatDateSince} from '@/helpers/time/formatDate'
import {VERSION} from './version.json'
2021-04-22 14:26:48 +02:00
// Register the modal
import Modal from './components/modal/modal'
// Add CSS
import './styles/vikunja.scss'
// Notifications
import Notifications from 'vue-notification'
// Icons
import {library} from '@fortawesome/fontawesome-svg-core'
import {
faAlignLeft,
faAngleRight,
faBars,
faCalendar,
faCalendarWeek,
faCheck,
faCheckDouble,
faChevronDown,
faCloudDownloadAlt,
faCloudUploadAlt,
faCog,
faEllipsisV,
faExclamation,
faFillDrip,
faFilter,
faHistory,
faKeyboard,
faLayerGroup,
faList,
faListOl,
faLock,
faPaperclip,
faPaste,
faPen,
faPencilAlt,
faPercent,
faPlus,
faPowerOff,
faSearch,
faSignOutAlt,
faSort,
faSortUp,
faStar as faStarSolid,
faTachometerAlt,
faTags,
faTasks,
faTh,
faTimes,
faTrashAlt,
faUser,
faUsers,
Better reminders (#308) Fix setting the new reminder component to null after adding a new date Add "close on change" event which only fires if the component closed and the value actually changed Hide the "today" option after 21:00 Add "confirm" button to close the component Use disabled in reminders Add a disabled property to the datepicker Cleanup workarounds for flatpickr Use the new datepicker for end dates Use the new datepicker for start date Use the new datepicker for due dates Mobile styling Format Sync flatpickr when clicking on choose a date Make sure to only hide the popup when not clicked something inside of it Make flatpickr dates work Use datepicker component for reminders Merge branch 'master' into feature/better-reminders Fix bottom padding of inline flatpickr Set time Add method to calculate the neares time Move time helpers in separate folder Remove separate flatpickr date Cleanup Set the flatpickr date when setting changing the date Better formatting of the chosen date Bubble Set date when choosing one Fix test Show correct weekday in preview Change hover background color Make label to show if selected date is null configurable Use a different icon for weekend Ignore test files when linting Add tests to dron Move day interval calculation to separate file and test it Add next date calculation Add basic date picker component Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/308 Co-Authored-By: konrad <konrad@kola-entertainments.de> Co-Committed-By: konrad <konrad@kola-entertainments.de>
2020-11-28 14:59:27 +01:00
faForward,
faChessKnight,
faCoffee,
faCocktail,
faEllipsisH,
faArchive,
faShareAlt,
faImage,
faBell,
} from '@fortawesome/free-solid-svg-icons'
import {
faCalendarAlt,
faClock,
faComments,
faSave,
faStar,
faTimesCircle,
faSun,
faBellSlash
} from '@fortawesome/free-regular-svg-icons'
import {FontAwesomeIcon} from '@fortawesome/vue-fontawesome'
// PWA
import './registerServiceWorker'
// Shortcuts
import vueShortkey from 'vue-shortkey'
// Mixins
import message from './message'
import {colorIsDark} from './helpers/color/colorIsDark'
import {setTitle} from './helpers/setTitle'
// Vuex
import {store} from './store'
// i18n
import {i18n} from './i18n/setup'
console.info(`Vikunja frontend version ${VERSION}`)
// Check if we have an api url in local storage and use it if that's the case
const apiUrlFromStorage = localStorage.getItem('API_URL')
if (apiUrlFromStorage !== null) {
window.API_URL = apiUrlFromStorage
}
// Make sure the api url does not contain a / at the end
if (window.API_URL.substr(window.API_URL.length - 1, window.API_URL.length) === '/') {
window.API_URL = window.API_URL.substr(0, window.API_URL.length - 1)
}
2018-09-12 08:22:17 +02:00
Vue.component('modal', Modal)
2018-08-28 22:50:22 +02:00
Vue.config.productionTip = false
2018-09-08 21:43:16 +02:00
Vue.use(Notifications)
2018-09-09 17:23:06 +02:00
library.add(faSignOutAlt)
2018-09-09 19:09:46 +02:00
library.add(faPlus)
library.add(faListOl)
library.add(faTasks)
2018-09-10 21:06:39 +02:00
library.add(faCog)
library.add(faAngleRight)
2018-09-11 19:20:07 +02:00
library.add(faLayerGroup)
2018-09-11 20:16:08 +02:00
library.add(faTrashAlt)
library.add(faUsers)
library.add(faUser)
library.add(faLock)
library.add(faPen)
2018-11-25 22:02:22 +01:00
library.add(faTimes)
2018-12-25 16:03:51 +01:00
library.add(faTachometerAlt)
library.add(faCalendar)
library.add(faTimesCircle)
library.add(faBars)
library.add(faPowerOff)
library.add(faCalendarWeek)
library.add(faCalendarAlt)
2019-03-03 16:03:08 +01:00
library.add(faExclamation)
2019-03-07 20:48:40 +01:00
library.add(faTags)
2019-04-23 21:50:37 +02:00
library.add(faChevronDown)
2019-04-29 23:41:39 +02:00
library.add(faCheck)
2019-09-09 19:55:43 +02:00
library.add(faPaste)
2019-10-19 21:41:23 +02:00
library.add(faPencilAlt)
2019-11-24 14:16:24 +01:00
library.add(faCloudDownloadAlt)
library.add(faCloudUploadAlt)
library.add(faPercent)
library.add(faStar)
library.add(faAlignLeft)
library.add(faPaperclip)
library.add(faClock)
library.add(faHistory)
library.add(faSearch)
library.add(faCheckDouble)
library.add(faComments)
library.add(faTh)
library.add(faSort)
library.add(faSortUp)
2020-04-18 14:39:56 +02:00
library.add(faList)
Kanban (#118) Add error message when trying to create an invalid new task in a bucket Prevent creation of new buckets if the bucket title is empty Disable deleting a bucket if it's the last one Disable dragging tasks when they are being updated Fix transition when opening tasks Send the user to list view by default Show loading spinner when updating multiple tasks Add loading spinner when moving tasks Add loading animation when bucket is loading / updating etc Add bucket title edit Fix creating new buckets Add loading animation Add removing buckets Fix creating a new bucket after tasks were moved Fix warning about labels on tasks Fix labels on tasks not updating after retrieval from api Fix property width Add closing and mobile design Make the task detail popup look good Move list views Move task detail view in a popup Add link to tasks Add saving the new task position after it was moved Fix creating new bucket Fix creating a new task Cleanup Disable user selection for task cards Fix drag placeholder Add dragging style to task Add placeholder + change animation duration More cleanup Cleanup / docs Working of dragging and dropping tasks Adjust markup and styling for new library Change kanban library to something that works Add basic calculation of new positions Don't try to create empty tasks Add indicator if a task is done Add moving tasks between buckets Make empty buckets a little smaller Add gimmick for button description Fix color Fix scrolling bucket layout Add creating a new bucket Add hiding the task input field Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/118
2020-04-26 01:11:34 +02:00
library.add(faEllipsisV)
library.add(faFilter)
library.add(faFillDrip)
library.add(faKeyboard)
library.add(faSave)
library.add(faStarSolid)
Better reminders (#308) Fix setting the new reminder component to null after adding a new date Add "close on change" event which only fires if the component closed and the value actually changed Hide the "today" option after 21:00 Add "confirm" button to close the component Use disabled in reminders Add a disabled property to the datepicker Cleanup workarounds for flatpickr Use the new datepicker for end dates Use the new datepicker for start date Use the new datepicker for due dates Mobile styling Format Sync flatpickr when clicking on choose a date Make sure to only hide the popup when not clicked something inside of it Make flatpickr dates work Use datepicker component for reminders Merge branch 'master' into feature/better-reminders Fix bottom padding of inline flatpickr Set time Add method to calculate the neares time Move time helpers in separate folder Remove separate flatpickr date Cleanup Set the flatpickr date when setting changing the date Better formatting of the chosen date Bubble Set date when choosing one Fix test Show correct weekday in preview Change hover background color Make label to show if selected date is null configurable Use a different icon for weekend Ignore test files when linting Add tests to dron Move day interval calculation to separate file and test it Add next date calculation Add basic date picker component Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/308 Co-Authored-By: konrad <konrad@kola-entertainments.de> Co-Committed-By: konrad <konrad@kola-entertainments.de>
2020-11-28 14:59:27 +01:00
library.add(faForward)
library.add(faSun)
library.add(faChessKnight)
library.add(faCoffee)
library.add(faCocktail)
library.add(faEllipsisH)
library.add(faArchive)
library.add(faShareAlt)
library.add(faImage)
library.add(faBell)
library.add(faBellSlash)
2018-09-09 17:23:06 +02:00
Vue.component('icon', FontAwesomeIcon)
Vue.use(vueShortkey, {prevent: ['input', 'textarea', '.input']})
2020-11-02 21:52:07 +01:00
import focus from '@/directives/focus'
2020-11-02 21:52:07 +01:00
Vue.directive('focus', focus)
2018-12-25 16:03:51 +01:00
import tooltip from '@/directives/tooltip'
2021-04-22 14:26:48 +02:00
Vue.directive('tooltip', tooltip)
Better reminders (#308) Fix setting the new reminder component to null after adding a new date Add "close on change" event which only fires if the component closed and the value actually changed Hide the "today" option after 21:00 Add "confirm" button to close the component Use disabled in reminders Add a disabled property to the datepicker Cleanup workarounds for flatpickr Use the new datepicker for end dates Use the new datepicker for start date Use the new datepicker for due dates Mobile styling Format Sync flatpickr when clicking on choose a date Make sure to only hide the popup when not clicked something inside of it Make flatpickr dates work Use datepicker component for reminders Merge branch 'master' into feature/better-reminders Fix bottom padding of inline flatpickr Set time Add method to calculate the neares time Move time helpers in separate folder Remove separate flatpickr date Cleanup Set the flatpickr date when setting changing the date Better formatting of the chosen date Bubble Set date when choosing one Fix test Show correct weekday in preview Change hover background color Make label to show if selected date is null configurable Use a different icon for weekend Ignore test files when linting Add tests to dron Move day interval calculation to separate file and test it Add next date calculation Add basic date picker component Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/308 Co-Authored-By: konrad <konrad@kola-entertainments.de> Co-Committed-By: konrad <konrad@kola-entertainments.de>
2020-11-28 14:59:27 +01:00
import Button from '@/components/input/button'
Vue.component('x-button', Button)
import Card from '@/components/misc/card'
Vue.component('card', Card)
Vue.mixin({
methods: {
formatDateSince(date) {
return formatDateSince(date, (p, params) => this.$t(p, params))
},
formatDate(date) {
return formatDate(date, 'PPPPpppp', this.$t('date.locale'))
},
formatDateShort(date) {
return formatDate(date, 'PPpp', this.$t('date.locale'))
},
2021-06-22 22:07:57 +02:00
error(e, actions = []) {
return message.error(e, this, p => this.$t(p), actions)
2021-06-22 22:07:57 +02:00
},
success(s, actions = []) {
return message.success(s, this, p => this.$t(p), actions)
2021-06-22 22:07:57 +02:00
},
colorIsDark: colorIsDark,
setTitle: setTitle,
},
})
2018-08-28 22:50:22 +02:00
new Vue({
router,
store,
i18n,
render: h => h(App),
2018-08-28 22:50:22 +02:00
}).$mount('#app')