Correctly scope instance properties

See https://vuejs.org/v2/cookbook/adding-instance-properties.html#The-Importance-of-Scoping-Instance-Properties
Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
This commit is contained in:
Raimund Schlüßler 2019-09-05 23:08:45 +02:00
parent 612602e56d
commit a212e37ea9
No known key found for this signature in database
GPG Key ID: 036FA7EB1A599178
18 changed files with 110 additions and 110 deletions

View File

@ -12,7 +12,7 @@ module.exports = {
OC: false,
OCA: false,
moment: true,
appVersion: true,
$appVersion: true,
},
parserOptions: {
parser: 'babel-eslint'

View File

@ -62,7 +62,7 @@ export default {
.then((calendars) => {
// No calendars? Create a new one!
if (calendars.length === 0) {
this.$store.dispatch('appendCalendar', { displayName: t('tasks', 'Tasks') })
this.$store.dispatch('appendCalendar', { displayName: this.$t('tasks', 'Tasks') })
.then(() => {
this.fetchTasks()
})

View File

@ -78,10 +78,10 @@ export default {
},
computed: {
placeholder() {
return t('tasks', 'Share with users or groups')
return this.$t('tasks', 'Share with users or groups')
},
noResult() {
return t('tasks', 'No users or groups')
return this.$t('tasks', 'No users or groups')
}
},
mounted() {

View File

@ -43,7 +43,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
@change="editSharee"
>
<label :for="uid">
{{ t('tasks', 'can edit') }}
{{ $t('tasks', 'can edit') }}
</label>
<a :class="{'calendar-sharee__utils--disabled': loading}" href="#"
title="Delete"
@ -94,7 +94,7 @@ export default {
})
} catch (error) {
console.error(error)
OC.Notification.showTemporary(t('tasks', 'Unable to delete the share.'))
this.$OC.Notification.showTemporary(this.$t('tasks', 'Unable to delete the share.'))
} finally {
this.loading = false
}
@ -112,7 +112,7 @@ export default {
})
} catch (error) {
console.error(error)
OC.Notification.showTemporary(t('tasks', 'Unable to change permissions.'))
this.$OC.Notification.showTemporary(this.$t('tasks', 'Unable to change permissions.'))
} finally {
this.loading = false
}

View File

@ -23,9 +23,9 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
<li v-click-outside="reset" :class="{confirmed: activated, active: armed}">
<a class="confirmation-default" @click="activate($event)">
<span class="icon-delete" />
<span>{{ t('tasks', 'Delete') }}</span>
<span>{{ $t('tasks', 'Delete') }}</span>
</a>
<a :title="t('tasks', 'Cancel')" class="confirmation-abort icon-close" @click="reset">
<a :title="$t('tasks', 'Cancel')" class="confirmation-abort icon-close" @click="reset">
<span />
</a>
<a v-tooltip="{

View File

@ -22,7 +22,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
<template>
<div class="loadmore reactive">
<span v-show="completedTasksCount" @click="openModal">
{{ t('tasks', 'Delete all completed tasks.') }}
{{ $t('tasks', 'Delete all completed tasks.') }}
</span>
<Modal v-if="modalOpen"
:out-transition="true"
@ -32,7 +32,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
<p class="icon-delete" />
<div v-if="completedTasksCount">
<h3 class="delete-completed__header">
{{ n('tasks',
{{ $n('tasks',
'This will delete {taskCount} completed task and its subtasks from calendar "%s".',
'This will delete {taskCount} completed tasks and their subtasks from calendar "%s".',
initialCompletedRootTasksCount,
@ -44,12 +44,12 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
<button class="delete-completed__button icon-delete" type="button"
@click="deleteCompletedTasks"
>
{{ t('tasks', 'Delete completed tasks.') }}
{{ $t('tasks', 'Delete completed tasks.') }}
</button>
</div>
<div v-else>
<h3 class="delete-completed__header">
{{ t('tasks', 'Deleted all completed tasks from calendar "%s".').replace('%s', calendar.displayName) }}
{{ $t('tasks', 'Deleted all completed tasks from calendar "%s".').replace('%s', calendar.displayName) }}
</h3>
</div>
<div>
@ -57,10 +57,10 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
<p class="delete-completed__tracker">
<span>{{ percentage }} %</span>
<span v-if="failed === 0">
{{ t('tasks', 'No errors') }}
{{ $t('tasks', 'No errors') }}
</span>
<span v-else v-tooltip.auto="t('tasks', 'Open your browser console for more details')">
{{ n('tasks',
<span v-else v-tooltip.auto="$t('tasks', 'Open your browser console for more details')">
{{ $n('tasks',
'Could not delete {failedCount} task.',
'Could not delete {failedCount} tasks.',
failed,

View File

@ -22,7 +22,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
<template>
<div v-show="!loadedCompleted" class="loadmore reactive">
<span @click="loadCompletedTasks">
{{ t('tasks', 'Load all completed tasks.') }}
{{ $t('tasks', 'Load all completed tasks.') }}
</span>
</div>
</template>

View File

@ -22,7 +22,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
<template>
<div>
<div v-click-outside="closeMenu" class="app-navigation-entry-utils reactive" @click="toggleMenu">
<div :title="t('tasks', 'Change sort order')" class="app-navigation-entry-utils-menu-button">
<div :title="$t('tasks', 'Change sort order')" class="app-navigation-entry-utils-menu-button">
<button class="sortorder-dropdown-button">
<span :class="sortOrderIcon" class="icon icon-bw" />
<span :class="sortDirection ? 'icon-sort-up' : 'icon-sort-down'" class="icon icon-bw sort-indicator" />
@ -69,58 +69,58 @@ export default {
{
id: 'default',
icon: 'icon-list',
text: t('tasks', 'Default'),
hint: t('tasks', 'Sort by completed state, due date, priority, start date and summary.')
text: this.$t('tasks', 'Default'),
hint: this.$t('tasks', 'Sort by completed state, due date, priority, start date and summary.')
},
{
id: 'due',
icon: 'icon-calendar',
text: t('tasks', 'Due date'),
hint: t('tasks', 'Sort by due date and summary.')
text: this.$t('tasks', 'Due date'),
hint: this.$t('tasks', 'Sort by due date and summary.')
},
{
id: 'start',
icon: 'icon-calendar',
text: t('tasks', 'Start date'),
hint: t('tasks', 'Sort by start date and summary.')
text: this.$t('tasks', 'Start date'),
hint: this.$t('tasks', 'Sort by start date and summary.')
},
{
id: 'created',
icon: 'icon-calendar',
// TRANSLATORS The date at which a task was created.
text: t('tasks', 'Created date'),
hint: t('tasks', 'Sort by created date and summary.')
text: this.$t('tasks', 'Created date'),
hint: this.$t('tasks', 'Sort by created date and summary.')
},
{
id: 'modified',
icon: 'icon-calendar',
text: t('tasks', 'Last modified'),
hint: t('tasks', 'Sort by last-modified date and summary.')
text: this.$t('tasks', 'Last modified'),
hint: this.$t('tasks', 'Sort by last-modified date and summary.')
},
{
id: 'completedDate',
icon: 'icon-calendar',
text: t('tasks', 'Completed date'),
hint: t('tasks', 'Sort by completed date.')
text: this.$t('tasks', 'Completed date'),
hint: this.$t('tasks', 'Sort by completed date.')
},
{
id: 'priority',
icon: 'icon-task-star',
text: t('tasks', 'Priority'),
hint: t('tasks', 'Sort by priority and summary.')
text: this.$t('tasks', 'Priority'),
hint: this.$t('tasks', 'Sort by priority and summary.')
},
// Manual sorting is not yet implemented
// {
// id: 'manual',
// icon: 'icon-manual',
// text: t('tasks', 'Manually'),
// hint: t('tasks', 'Sort by manual order.')
// text: this.$t('tasks', 'Manually'),
// hint: this.$t('tasks', 'Sort by manual order.')
// },
{
id: 'alphabetically',
icon: 'icon-alphabetically',
text: t('tasks', 'Alphabetically'),
hint: t('tasks', 'Sort by summary and priority.')
text: this.$t('tasks', 'Alphabetically'),
hint: this.$t('tasks', 'Sort by summary and priority.')
}
]
}

View File

@ -35,7 +35,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
>
<div v-if="task.complete > 0" class="percentbar">
<div :style="{ width: task.complete + '%', 'background-color': task.calendar.color }"
:aria-label="t('tasks', '{complete} % completed', {complete: task.complete})"
:aria-label="$t('tasks', '{complete} % completed', {complete: task.complete})"
class="percentdone"
/>
</div>
@ -49,7 +49,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
:checked="task.completed"
:aria-checked="task.completed"
:disabled="task.calendar.readOnly"
:aria-label="t('tasks', 'Task is completed')"
:aria-label="$t('tasks', 'Task is completed')"
@click="toggleCompleted(task)"
>
<label class="reactive no-nav" :for="'toggleCompleted_' + task.uid" />
@ -67,13 +67,13 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
/>
</span>
<span v-if="Object.values(task.subTasks).length" @click="toggleSubtasksVisibility(task)">
<span :title="t('tasks', 'Toggle visibility of all subtasks.')"
<span :title="$t('tasks', 'Toggle visibility of all subtasks.')"
:class="task.hideSubtasks ? 'icon-subtasks-hidden' : 'icon-subtasks-visible'"
class="icon icon-bw right large subtasks reactive no-nav"
/>
</span>
<span v-if="hasCompletedSubtasks" @click="toggleCompletedSubtasksVisibility(task)">
<span :title="t('tasks', 'Toggle visibility of completed subtasks.')"
<span :title="$t('tasks', 'Toggle visibility of completed subtasks.')"
:class="{'active': !task.hideCompletedSubtasks}"
class="icon icon-bw icon-toggle right large toggle-completed-subtasks reactive no-nav"
/>
@ -212,7 +212,7 @@ export default {
* @returns {String} the placeholder string to show
*/
subtasksCreationPlaceholder: function() {
return t('tasks', 'Add a subtask to "%s"…').replace('%s', this.task.summary)
return this.$t('tasks', 'Add a subtask to "%s"…').replace('%s', this.task.summary)
},
/**

View File

@ -117,7 +117,7 @@ export default {
},
inputString: function() {
return t('tasks', 'Add a task to "%s"…').replace('%s', this.calendar.displayName)
return this.$t('tasks', 'Add a task to "%s"…').replace('%s', this.calendar.displayName)
},
/**
@ -126,7 +126,7 @@ export default {
* @returns {String} The string to show for the completed tasks count
*/
completedCountString: function() {
return n('tasks', '%n Completed Task', '%n Completed Tasks', this.completedCount(this.calendarId))
return this.$n('tasks', '%n Completed Task', '%n Completed Tasks', this.completedCount(this.calendarId))
},
...mapGetters({
completedCount: 'getCalendarCountCompleted',

View File

@ -117,13 +117,13 @@ export default {
inputString: function() {
switch (this.collectionId) {
case 'starred':
return t('tasks', 'Add an important task to "%s"…').replace('%s', this.calendar.displayName)
return this.$t('tasks', 'Add an important task to "%s"…').replace('%s', this.calendar.displayName)
case 'today':
return t('tasks', 'Add a task due today to "%s"…').replace('%s', this.calendar.displayName)
return this.$t('tasks', 'Add a task due today to "%s"…').replace('%s', this.calendar.displayName)
case 'current':
return t('tasks', 'Add a current task to "%s"…').replace('%s', this.calendar.displayName)
return this.$t('tasks', 'Add a current task to "%s"…').replace('%s', this.calendar.displayName)
default:
return t('tasks', 'Add a task to "%s"…').replace('%s', this.calendar.displayName)
return this.$t('tasks', 'Add a task to "%s"…').replace('%s', this.calendar.displayName)
}
},
...mapGetters({

View File

@ -61,9 +61,9 @@ export default {
var date = moment().add(day, 'day')
var dayString
if (day === 0) {
dayString = t('tasks', 'Today')
dayString = this.$t('tasks', 'Today')
} else if (day === 1) {
dayString = t('tasks', 'Tomorrow')
dayString = this.$t('tasks', 'Tomorrow')
} else {
dayString = date.format('dddd')
}

View File

@ -35,7 +35,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
:checked="task.completed"
:aria-checked="task.completed"
:disabled="task.calendar.readOnly"
:aria-label="t('tasks', 'Task is completed')"
:aria-label="$t('tasks', 'Task is completed')"
@click="toggleCompleted(task)"
>
<label :for="'detailsToggleCompleted_' + task.uid" />
@ -83,12 +83,12 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
<div v-if="edit=='start'" class="section-edit">
<DatetimePicker :value="tmpTask.start" :lang="lang"
:format="dateFormat" :clearable="false" :first-day-of-week="firstDay"
:type="'date'" :placeholder="t('tasks', 'Set start date')"
:type="'date'" :placeholder="$t('tasks', 'Set start date')"
class="date" @change="setStartDate"
/>
<DatetimePicker v-if="!task.allDay" :value="tmpTask.start" :lang="lang"
:format="timeFormat" :clearable="false" :time-picker-options="timePickerOptions"
:type="'time'" :placeholder="t('tasks', 'Set start time')"
:type="'time'" :placeholder="$t('tasks', 'Set start time')"
class="time" @change="setStartTime"
/>
</div>
@ -117,12 +117,12 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
<div v-if="edit=='due'" class="section-edit">
<DatetimePicker :value="tmpTask.due" :lang="lang"
:format="dateFormat" :clearable="false" :first-day-of-week="firstDay"
:type="'date'" :placeholder="t('tasks', 'Set due date')"
:type="'date'" :placeholder="$t('tasks', 'Set due date')"
class="date" @change="setDueDate"
/>
<DatetimePicker v-if="!task.allDay" :value="tmpTask.due" :lang="lang"
:format="timeFormat" :clearable="false" :time-picker-options="timePickerOptions"
:type="'time'" :placeholder="t('tasks', 'Set due time')"
:type="'time'" :placeholder="$t('tasks', 'Set due time')"
class="time" @change="setDueTime"
/>
</div>
@ -151,7 +151,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
@click="toggleAllDay(task)"
>
<label for="isAllDayPossible">
<span>{{ t('tasks', 'All day') }}</span>
<span>{{ $t('tasks', 'All day') }}</span>
</label>
</div>
</li>
@ -167,7 +167,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
:allow-empty="false"
:disabled="task.calendar.readOnly"
track-by="id"
:placeholder="t('tasks', 'Select a calendar')"
:placeholder="$t('tasks', 'Select a calendar')"
label="displayName"
:options="writableCalendars"
:close-on-select="true"
@ -190,7 +190,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
:allow-empty="false"
:disabled="task.calendar.readOnly"
track-by="type"
:placeholder="t('tasks', 'Select a classification')"
:placeholder="$t('tasks', 'Select a classification')"
label="displayName"
:options="classSelect"
:close-on-select="true"
@ -285,9 +285,9 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
:searchable="true"
:disabled="task.calendar.readOnly"
:options="task.categories"
:placeholder="t('tasks', 'Select categories')"
:placeholder="$t('tasks', 'Select categories')"
:taggable="true"
:tag-placeholder="t('tasks', 'Add this as a new category')"
:tag-placeholder="$t('tasks', 'Add this as a new category')"
:close-on-select="false"
class="multiselect-vue"
@input="updateCategories"
@ -340,7 +340,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
</div>
</div>
<div v-else class="notice">
<span>{{ t('tasks', 'Task not found!') }}</span>
<span>{{ $t('tasks', 'Task not found!') }}</span>
</div>
</div>
</template>
@ -523,17 +523,17 @@ export default {
},
categories: [],
classSelect: [
{ displayName: t('tasks', 'When shared show full event'), type: 'PUBLIC' },
{ displayName: t('tasks', 'When shared show only busy'), type: 'CONFIDENTIAL' },
{ displayName: t('tasks', 'When shared hide this event'), type: 'PRIVATE' },
{ displayName: this.$t('tasks', 'When shared show full event'), type: 'PUBLIC' },
{ displayName: this.$t('tasks', 'When shared show only busy'), type: 'CONFIDENTIAL' },
{ displayName: this.$t('tasks', 'When shared hide this event'), type: 'PRIVATE' },
],
}
},
computed: {
taskInfo: function() {
return t('tasks', 'Last modified %s').replace('%s', moment(this.task.modified, 'YYYY-MM-DDTHH:mm:ss').calendar())
+ '<br />' + t('tasks', 'Created %s').replace('%s', moment(this.task.created, 'YYYY-MM-DDTHH:mm:ss').calendar())
+ (this.task.completed ? ('<br />' + t('tasks', 'Completed %s').replace('%s', moment(this.task.completedDate, 'YYYY-MM-DDTHH:mm:ss').calendar())) : '')
return this.$t('tasks', 'Last modified %s').replace('%s', moment(this.task.modified, 'YYYY-MM-DDTHH:mm:ss').calendar())
+ '<br />' + this.$t('tasks', 'Created %s').replace('%s', moment(this.task.created, 'YYYY-MM-DDTHH:mm:ss').calendar())
+ (this.task.completed ? ('<br />' + this.$t('tasks', 'Completed %s').replace('%s', moment(this.task.completedDate, 'YYYY-MM-DDTHH:mm:ss').calendar())) : '')
},
isAllDayPossible: function() {
return !this.task.calendar.readOnly && (this.task.due || this.task.start)

View File

@ -83,7 +83,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
<li v-if="!calendar.readOnly">
<a @click="edit(calendar)">
<span class="icon-rename" />
<span>{{ t('tasks', 'Edit') }}</span>
<span>{{ $t('tasks', 'Edit') }}</span>
</a>
</li>
<li>
@ -91,17 +91,17 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
<span class="icon-public" />
<span>
{{ !copied
? t('tasks', 'Copy private link')
? $t('tasks', 'Copy private link')
: copySuccess
? t('tasks', 'Copied')
: t('tasks', 'Can not copy') }}
? $t('tasks', 'Copied')
: $t('tasks', 'Can not copy') }}
</span>
</a>
</li>
<li>
<a :href="exportUrl(calendar)" :download="calendar.id + '.ics'">
<span class="icon-download" />
<span>{{ t('tasks', 'Download') }}</span>
<span>{{ $t('tasks', 'Download') }}</span>
</a>
</li>
<Confirmation v-if="!calendar.readOnly" :message="deleteMessage(calendar.displayName)" @delete-calendar="deleteCalendar(calendar)" />
@ -125,13 +125,13 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
type="text"
@keyup="checkName($event, calendar, save)"
>
<input :title="t('tasks', 'Cancel')"
<input :title="$t('tasks', 'Cancel')"
type="cancel"
value=""
class="action icon-close"
@click="resetView(calendar)"
>
<input :title="t('tasks', 'Save')"
<input :title="$t('tasks', 'Save')"
type="button"
value=""
class="action icon-checkmark"
@ -146,7 +146,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
@click="startCreate($event)"
>
<span class="title">
{{ t('tasks', 'Add List…') }}
{{ $t('tasks', 'Add List…') }}
</span>
</a>
<div :class="{error: nameError}" class="app-navigation-entry-edit name">
@ -158,18 +158,18 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
show: showTooltip('list_'),
trigger: 'manual'
}"
:placeholder="t('tasks', 'New List')"
:placeholder="$t('tasks', 'New List')"
class="edit"
type="text"
@keyup="checkName($event, null, create)"
>
<input :title="t('tasks', 'Cancel')"
<input :title="$t('tasks', 'Cancel')"
type="cancel"
value=""
class="action icon-close"
@click="cancelCreate"
>
<input :title="t('tasks', 'Save')"
<input :title="$t('tasks', 'Save')"
type="button"
value=""
class="action icon-checkmark"
@ -319,7 +319,7 @@ export default {
// info tooltip about number of shares
sharedWithTooltip: function(calendar) {
return this.hasShares(calendar)
? n('tasks',
? this.$n('tasks',
'Shared with {num} entity',
'Shared with {num} entities',
calendar.shares.length, {
@ -349,11 +349,11 @@ export default {
this.copySuccess = true
this.copied = true
// Notify calendar url was copied
OC.Notification.showTemporary(t('tasks', 'Calendar link copied to clipboard.'))
this.$OC.Notification.showTemporary(this.$t('tasks', 'Calendar link copied to clipboard.'))
}, e => {
this.copySuccess = false
this.copied = true
OC.Notification.showTemporary(t('tasks', 'Calendar link could not be copied to clipboard.'))
this.$OC.Notification.showTemporary(this.$t('tasks', 'Calendar link could not be copied to clipboard.'))
}).then(() => {
setTimeout(() => {
// stop loading status regardless of outcome
@ -371,15 +371,15 @@ export default {
return url
},
url(calendar) {
const rootURL = OC.linkToRemote('dav')
const rootURL = this.$OC.linkToRemote('dav')
return new URL(calendar.url, rootURL)
},
setColor: function(color) {
this.selectedColor = color
},
startCreate: function(e) {
if (OCA.Theming) {
this.selectedColor = OCA.Theming.color
if (this.$OCA.Theming) {
this.selectedColor = this.$OCA.Theming.color
} else {
this.selectedColor = '#0082C9'
}
@ -435,16 +435,16 @@ export default {
msg: ''
}
if (this.isCalendarNameUsed(name, id)) {
check.msg = t('tasks', 'The name "%s" is already used.').replace('%s', name)
check.msg = this.$t('tasks', 'The name "%s" is already used.').replace('%s', name)
} else if (!name) {
check.msg = t('tasks', 'An empty name is not allowed.')
check.msg = this.$t('tasks', 'An empty name is not allowed.')
} else {
check.allowed = true
}
return check
},
deleteMessage: function(name) {
return t('tasks', 'This will delete the calendar "%s" and all corresponding events and tasks.').replace('%s', name)
return this.$t('tasks', 'This will delete the calendar "%s" and all corresponding events and tasks.').replace('%s', name)
}
}
}

View File

@ -23,14 +23,14 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
<div id="app-settings" class="reactive">
<div id="app-settings-header">
<button class="settings-button" data-apps-slide-toggle="#app-settings-content">
<span>{{ t('tasks', 'Settings') }}</span>
<span>{{ $t('tasks', 'Settings') }}</span>
</button>
</div>
<div id="app-settings-content">
<ul>
<li>
<label for="defaultCalendar">
{{ t('tasks', 'Default list') }}
{{ $t('tasks', 'Default list') }}
</label>
<select id="defaultCalendar" v-model="defaultCalendarId">
<option v-for="calendar in calendars"
@ -42,7 +42,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
</select>
</li>
<li class="headline">
{{ t('tasks', 'Visibility of Smart Collections') }}
{{ $t('tasks', 'Visibility of Smart Collections') }}
</li>
<li v-for="collection in collections"
:key="collection.id"
@ -83,15 +83,15 @@ export default {
collectionOptions: [
{
id: 0,
name: t('tasks', 'Hidden')
name: this.$t('tasks', 'Hidden')
},
{
id: 1,
name: t('tasks', 'Visible')
name: this.$t('tasks', 'Visible')
},
{
id: 2,
name: t('tasks', 'Automatic')
name: this.$t('tasks', 'Automatic')
}
],
dayOfMonth: moment().date()

View File

@ -57,11 +57,11 @@ if (!OCA.Tasks) {
OCA.Tasks = {}
}
Vue.prototype.t = t
Vue.prototype.n = n
Vue.prototype.OC = OC
Vue.prototype.OCA = OCA
Vue.prototype.appVersion = appVersion
Vue.prototype.$t = t
Vue.prototype.$n = n
Vue.prototype.$OC = OC
Vue.prototype.$OCA = OCA
Vue.prototype.$appVersion = $appVersion
OCA.Tasks.App = new Vue({
el: '.app-tasks',
@ -73,23 +73,23 @@ OCA.Tasks.App = new Vue({
}
},
mounted: function() {
var version = OC.config.version.split('.')
var version = this.$OC.config.version.split('.')
if (version[0] >= 14) {
OC.Search = new OCA.Search(this.filter, this.cleanSearch)
this.$OC.Search = new OCA.Search(this.filter, this.cleanSearch)
} else {
OCA.Tasks.Search = {
this.$OCA.Tasks.Search = {
attach: function(search) {
search.setFilter('tasks', this.filter)
}
}
OC.Plugins.register('OCA.Search', OCA.Tasks.Search)
this.$OC.Plugins.register('OCA.Search', this.$OCA.Tasks.Search)
}
},
beforeMount() {
// Configure the locale of moment.js
moment.locale(OC.getLocale().replace('_', '-').toLowerCase())
moment.locale(this.$OC.getLocale().replace('_', '-').toLowerCase())
this.$store.dispatch('loadCollections')
this.$store.dispatch('loadSettings')
},

View File

@ -571,7 +571,7 @@ const actions = {
return
}
const task = new Task('BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//Nextcloud Tasks v' + appVersion + '\nEND:VCALENDAR', taskData.calendar)
const task = new Task('BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//Nextcloud Tasks v' + $appVersion + '\nEND:VCALENDAR', taskData.calendar)
task.created = ICAL.Time.now()
task.summary = taskData.summary
@ -660,7 +660,7 @@ const actions = {
})
.catch((error) => {
console.debug(error)
task.syncstatus = new TaskStatus('error', t('tasks', 'Could not delete the task.'))
task.syncstatus = new TaskStatus('error', this.$t('tasks', 'Could not delete the task.'))
})
} else {
deleteTaskFromStore()
@ -699,10 +699,10 @@ const actions = {
if (!task.conflict) {
task.dav.data = vCalendar
task.syncstatus = new TaskStatus('sync', t('tasks', 'Synchronizing to the server.'))
task.syncstatus = new TaskStatus('sync', this.$t('tasks', 'Synchronizing to the server.'))
return task.dav.update()
.then((response) => {
task.syncstatus = new TaskStatus('success', t('tasks', 'Task successfully saved to server.'))
task.syncstatus = new TaskStatus('success', this.$t('tasks', 'Task successfully saved to server.'))
})
.catch((error) => {
// Wrong etag, we most likely have a conflict
@ -710,13 +710,13 @@ const actions = {
// Saving the new etag so that the user can manually
// trigger a fetchCompleteData without any further errors
task.conflict = error.xhr.getResponseHeader('etag')
task.syncstatus = new TaskStatus('refresh', t('tasks', 'Could not update the task because it was changed on the server. Please click to refresh it, local changes will be discarded.'), 'fetchFullTask')
task.syncstatus = new TaskStatus('refresh', this.$t('tasks', 'Could not update the task because it was changed on the server. Please click to refresh it, local changes will be discarded.'), 'fetchFullTask')
} else {
task.syncstatus = new TaskStatus('error', t('tasks', 'Could not update the task.'))
task.syncstatus = new TaskStatus('error', this.$t('tasks', 'Could not update the task.'))
}
})
} else {
task.syncstatus = new TaskStatus('refresh', t('tasks', 'Could not update the task because it was changed on the server. Please click to refresh it, local changes will be discared.'), 'fetchFullTask')
task.syncstatus = new TaskStatus('refresh', this.t('tasks', 'Could not update the task because it was changed on the server. Please click to refresh it, local changes will be discared.'), 'fetchFullTask')
}
},

View File

@ -56,7 +56,7 @@ module.exports = {
new VueLoaderPlugin(),
new StyleLintPlugin(),
new webpack.DefinePlugin({
appVersion: JSON.stringify(require('./package.json').version)
$appVersion: JSON.stringify(require('./package.json').version)
})
],
resolve: {