mirror of https://github.com/nextcloud/calendar
Stop using global OC, use nextcloud-l10n, nextcloud-router, etc. instead
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
This commit is contained in:
parent
7298ae58fe
commit
76b24d5114
|
@ -7,11 +7,6 @@ module.exports = {
|
|||
jest: true
|
||||
},
|
||||
globals: {
|
||||
OC: true,
|
||||
OCA: true,
|
||||
OCP: true,
|
||||
Vue: true,
|
||||
VueRouter: true,
|
||||
dayNames: true,
|
||||
dayNamesMin: true,
|
||||
monthNames: true,
|
||||
|
|
|
@ -65,6 +65,7 @@ import {
|
|||
modifyDate
|
||||
} from '../../../utils/date.js'
|
||||
import formatDateRage from '../../../filters/dateRangeFormat.js'
|
||||
import { getLocale } from 'nextcloud-l10n'
|
||||
|
||||
export default {
|
||||
name: 'AppNavigationHeaderDatePicker',
|
||||
|
@ -138,7 +139,7 @@ export default {
|
|||
mounted() {
|
||||
// Load the locale
|
||||
// convert format like en_GB to en-gb for `moment.js`
|
||||
let locale = OC.getLocale().replace('_', '-').toLowerCase()
|
||||
let locale = getLocale().replace('_', '-').toLowerCase()
|
||||
// default load e.g. fr-fr
|
||||
import('moment/locale/' + this.locale)
|
||||
.then(() => {
|
||||
|
|
|
@ -334,7 +334,7 @@ export default {
|
|||
this.unpublishingCalendar = false
|
||||
}).catch((e) => {
|
||||
this.unpublishingCalendar = false
|
||||
OC.Notification.showTemporary(this.$t('calendar', 'Unpublishing calendar failed'))
|
||||
this.$toast.error(this.$t('calendar', 'Unpublishing calendar failed'))
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ export default {
|
|||
})
|
||||
.catch((error) => {
|
||||
console.error(error)
|
||||
OC.Notification.showTemporary(this.$t('calendar', 'An error occurred, unable to create the calendar.'))
|
||||
this.$toast.error(this.$t('calendar', 'An error occurred, unable to create the calendar.'))
|
||||
this.isCreating = false
|
||||
})
|
||||
},
|
||||
|
|
|
@ -116,7 +116,7 @@ export default {
|
|||
})
|
||||
.catch((error) => {
|
||||
console.error(error)
|
||||
OC.Notification.showTemporary(this.$t('calendar', 'An error occurred, unable to create the calendar.'))
|
||||
this.$toast.error(this.$t('calendar', 'An error occurred, unable to create the calendar.'))
|
||||
this.isCreating = false
|
||||
})
|
||||
},
|
||||
|
|
|
@ -74,7 +74,7 @@ sync(store, router)
|
|||
|
||||
Vue.prototype.$t = translate
|
||||
Vue.prototype.$n = translatePlural
|
||||
Vue.prototype.$toast = OCP.Toast
|
||||
Vue.prototype.$toast = OCP.Toast // eslint-disable-line no-undef
|
||||
|
||||
// The nextcloud-vue package does currently rely on t and n
|
||||
Vue.prototype.t = translate
|
||||
|
|
|
@ -34,7 +34,7 @@ export const getDefaultCalendarObject = (props = {}) => Object.assign({}, {
|
|||
// Visible display name
|
||||
displayName: '',
|
||||
// Color of the calendar
|
||||
color: getDefaultColor(),
|
||||
color: getDefaultColor(), // TODO: use uid2Color instead
|
||||
// Whether or not the calendar is visible in the grid
|
||||
enabled: true,
|
||||
// Whether or not the calendar is loading events at the moment
|
||||
|
@ -78,7 +78,7 @@ export const getDefaultCalendarObject = (props = {}) => Object.assign({}, {
|
|||
* @returns {Object}
|
||||
*/
|
||||
export function mapDavCollectionToCalendar(calendar) {
|
||||
let color = calendar.color || getDefaultColor()
|
||||
let color = calendar.color || getDefaultColor() // TODO: use uid2Color instead
|
||||
if (color.length === 9) {
|
||||
// Make sure it's #RRGGBB, not #RRGGBBAA
|
||||
color = color.substr(0, 7)
|
||||
|
|
|
@ -41,7 +41,7 @@ function xhrProvider() {
|
|||
return result
|
||||
}
|
||||
|
||||
OC.registerXHRForErrorProcessing(xhr)
|
||||
OC.registerXHRForErrorProcessing(xhr) // eslint-disable-line no-undef
|
||||
return xhr
|
||||
}
|
||||
|
||||
|
|
|
@ -50,13 +50,8 @@ export function getRandomColor() {
|
|||
* Gets the default color of the nextcloud instance
|
||||
*
|
||||
* @returns {string}
|
||||
* @deprecated
|
||||
*/
|
||||
export function getDefaultColor() {
|
||||
const fallback = '#1483C6'
|
||||
|
||||
if (!OCA.Theming) {
|
||||
return fallback
|
||||
}
|
||||
|
||||
return OCA.Theming.color || fallback
|
||||
return '#1483C6'
|
||||
}
|
||||
|
|
|
@ -264,10 +264,10 @@ export default {
|
|||
},
|
||||
selectedCalendarColor() {
|
||||
if (!this.selectedCalendar) {
|
||||
return getDefaultColor()
|
||||
return getDefaultColor() // TODO: use uid2Color instead
|
||||
}
|
||||
|
||||
return this.selectedCalendar.color || getDefaultColor()
|
||||
return this.selectedCalendar.color || getDefaultColor() // TODO: use uid2Color instead
|
||||
},
|
||||
title() {
|
||||
if (!this.eventComponent) {
|
||||
|
|
Loading…
Reference in New Issue