Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/js
diff options
context:
space:
mode:
authordartcafe <github@dartcafe.de>2021-06-19 21:32:58 +0300
committerdartcafe <github@dartcafe.de>2021-06-19 21:32:58 +0300
commitad0b6583c4ba23ff89072cfee94e087e7b838499 (patch)
treedb8c7397333809050ebb416c66f457709b205d9e /src/js
parentb039458488cc32ff3801e5afd6b82d3b4901bd40 (diff)
change soft deleted polls to archived polls
Signed-off-by: dartcafe <github@dartcafe.de>
Diffstat (limited to 'src/js')
-rw-r--r--src/js/components/Navigation/Navigation.vue14
-rw-r--r--src/js/components/Navigation/PollNavigationItems.vue14
-rw-r--r--src/js/components/Poll/PollTitle.vue4
-rw-r--r--src/js/components/PollList/PollItem.vue6
-rw-r--r--src/js/components/SideBar/SideBarTabConfiguration.vue15
-rw-r--r--src/js/store/modules/poll.js6
-rw-r--r--src/js/store/modules/polls.js12
-rw-r--r--src/js/views/Administration.vue18
-rw-r--r--src/js/views/PollList.vue20
9 files changed, 57 insertions, 52 deletions
diff --git a/src/js/components/Navigation/Navigation.vue b/src/js/components/Navigation/Navigation.vue
index 9aa3487f..680b9bc8 100644
--- a/src/js/components/Navigation/Navigation.vue
+++ b/src/js/components/Navigation/Navigation.vue
@@ -37,9 +37,9 @@
<PollNavigationItems v-for="(poll) in filteredPolls(pollCategory.id)"
:key="poll.id"
:poll="poll"
- @switch-deleted="switchDeleted(poll.id)"
+ @toggle-archive="toggleArchive(poll.id)"
@clone-poll="clonePoll(poll.id)"
- @delete-permanently="deletePermanently(poll.id)" />
+ @delete-poll="deletePoll(poll.id)" />
</ul>
</AppNavigationItem>
</template>
@@ -124,19 +124,19 @@ export default {
}
},
- async switchDeleted(pollId) {
+ async toggleArchive(pollId) {
try {
- await this.$store.dispatch('poll/switchDeleted', { pollId })
+ await this.$store.dispatch('poll/toggleArchive', { pollId })
emit('update-polls')
} catch {
- showError(t('polls', 'Error deleting poll.'))
+ showError(t('polls', 'Error archiving/restoring poll.'))
}
},
- async deletePermanently(pollId) {
+ async deletePoll(pollId) {
try {
await this.$store.dispatch('poll/delete', { pollId })
- // if we permanently delete current selected poll,
+ // if we delete current selected poll,
// reload deleted polls route
if (this.$route.params.id && this.$route.params.id === pollId) {
this.$router.push({ name: 'list', params: { type: 'deleted' } })
diff --git a/src/js/components/Navigation/PollNavigationItems.vue b/src/js/components/Navigation/PollNavigationItems.vue
index efe2b789..7ddadf21 100644
--- a/src/js/components/Navigation/PollNavigationItems.vue
+++ b/src/js/components/Navigation/PollNavigationItems.vue
@@ -30,19 +30,23 @@
{{ t('polls', 'Clone poll') }}
</ActionButton>
- <ActionButton v-if="poll.allowEdit && !poll.deleted" icon="icon-delete" @click="$emit('switch-deleted')">
- {{ t('polls', 'Delete poll') }}
+ <ActionButton v-if="poll.allowEdit && !poll.deleted"
+ icon="icon-category-app-bundles"
+ @click="$emit('toggle-archive')">
+ {{ t('polls', 'Archive poll') }}
</ActionButton>
- <ActionButton v-if="poll.allowEdit && poll.deleted" icon="icon-history" @click="$emit('switch-deleted')">
+ <ActionButton v-if="poll.allowEdit && poll.deleted"
+ icon="icon-history"
+ @click="$emit('toggle-archive')">
{{ t('polls', 'Restore poll') }}
</ActionButton>
<ActionButton v-if="poll.allowEdit && poll.deleted"
icon="icon-delete"
class="danger"
- @click="$emit('delete-permanently')">
- {{ t('polls', 'Delete poll permanently') }}
+ @click="$emit('delete-poll')">
+ {{ t('polls', 'Delete poll') }}
</ActionButton>
</template>
</AppNavigationItem>
diff --git a/src/js/components/Poll/PollTitle.vue b/src/js/components/Poll/PollTitle.vue
index a884d5c9..6e76bb1b 100644
--- a/src/js/components/Poll/PollTitle.vue
+++ b/src/js/components/Poll/PollTitle.vue
@@ -59,8 +59,8 @@ export default {
badge() {
if (this.deleted) {
return {
- title: t('polls', 'Deleted'),
- icon: 'icon-delete',
+ title: t('polls', 'Archived'),
+ icon: 'icon-category-app-bundles',
class: 'error',
}
}
diff --git a/src/js/components/PollList/PollItem.vue b/src/js/components/PollList/PollItem.vue
index ad827bd4..a4fd3a9a 100644
--- a/src/js/components/PollList/PollItem.vue
+++ b/src/js/components/PollList/PollItem.vue
@@ -132,7 +132,7 @@ export default {
accessType() {
if (this.poll.deleted) {
- return t('polls', 'Deleted')
+ return t('polls', 'Archived')
} else if (this.poll.access === 'public') {
return t('polls', 'All users')
}
@@ -142,7 +142,7 @@ export default {
accessIcon() {
if (this.poll.deleted) {
- return 'icon-delete'
+ return 'icon-category-app-bundles'
} else if (this.poll.access === 'public') {
return 'icon-polls-public-poll'
}
@@ -329,6 +329,6 @@ export default {
}
.item__access--deleted {
- background-image: var(--icon-delete-000);
+ background-image: var(--icon-category-app-bundles-000);
}
</style>
diff --git a/src/js/components/SideBar/SideBarTabConfiguration.vue b/src/js/components/SideBar/SideBarTabConfiguration.vue
index c09efd44..e904ef6f 100644
--- a/src/js/components/SideBar/SideBarTabConfiguration.vue
+++ b/src/js/components/SideBar/SideBarTabConfiguration.vue
@@ -59,14 +59,15 @@
<ConfigShowResults @change="writePoll" />
</ConfigBox>
- <ButtonDiv :icon="poll.deleted ? 'icon-history' : 'icon-delete'"
- :title="poll.deleted ? t('polls', 'Restore poll') : t('polls', 'Delete poll')"
- @click="switchDeleted()" />
+ <ButtonDiv :icon="poll.deleted ? 'icon-history' : 'icon-category-app-bundles'"
+ :title="poll.deleted ? t('polls', 'Restore poll') : t('polls', 'Archive poll')"
+ @click="toggleArchive()" />
+
<ButtonDiv v-if="poll.deleted"
icon="icon-delete"
class="error"
- :title="t('polls', 'Delete poll permanently')"
- @click="deletePermanently()" />
+ :title="t('polls', 'Delete poll')"
+ @click="deletePoll()" />
</div>
</template>
@@ -126,7 +127,7 @@ export default {
showSuccess(t('polls', '"{pollTitle}" successfully saved', { pollTitle: this.poll.title }))
}, 1500),
- switchDeleted() {
+ toggleArchive() {
if (this.poll.deleted) {
this.$store.commit('poll/setProperty', { deleted: 0 })
} else {
@@ -135,7 +136,7 @@ export default {
this.writePoll()
},
- async deletePermanently() {
+ async deletePoll() {
if (!this.poll.deleted) return
try {
await this.$store.dispatch('poll/delete', { pollId: this.poll.id })
diff --git a/src/js/store/modules/poll.js b/src/js/store/modules/poll.js
index 334d9f67..fba43db0 100644
--- a/src/js/store/modules/poll.js
+++ b/src/js/store/modules/poll.js
@@ -201,12 +201,12 @@ const actions = {
}
},
- async switchDeleted(context, payload) {
+ async toggleArchive(context, payload) {
const endPoint = 'apps/polls/poll'
try {
- await axios.put(generateUrl(endPoint + '/' + payload.pollId + '/switchDeleted'))
+ await axios.put(generateUrl(endPoint + '/' + payload.pollId + '/toggleArchive'))
} catch (e) {
- console.error('Error switching deleted status', { error: e.response }, { payload })
+ console.error('Error archiving/restoring', { error: e.response }, { payload })
}
},
diff --git a/src/js/store/modules/polls.js b/src/js/store/modules/polls.js
index 29aece85..35a0f161 100644
--- a/src/js/store/modules/polls.js
+++ b/src/js/store/modules/polls.js
@@ -86,11 +86,11 @@ const state = {
pinned: false,
},
{
- id: 'deleted',
- title: t('polls', 'Deleted polls'),
- titleExt: t('polls', 'My deleted polls'),
- description: t('polls', 'The trash bin.'),
- icon: 'icon-delete',
+ id: 'archived',
+ title: t('polls', 'Archive'),
+ titleExt: t('polls', 'My archived polls'),
+ description: t('polls', 'Your archived polls are only accessable from you.'),
+ icon: 'icon-category-app-bundles',
pinned: true,
},
],
@@ -124,7 +124,7 @@ const getters = {
return state.list.filter((poll) => (poll.access === 'public' && !poll.deleted))
} else if (filterId === 'hidden') {
return state.list.filter((poll) => (poll.access === 'hidden' && !poll.deleted))
- } else if (filterId === 'deleted') {
+ } else if (filterId === 'archived') {
return state.list.filter((poll) => (poll.deleted))
} else if (filterId === 'participated') {
return state.list.filter((poll) => (poll.userHasVoted))
diff --git a/src/js/views/Administration.vue b/src/js/views/Administration.vue
index 5dd76f35..b3668580 100644
--- a/src/js/views/Administration.vue
+++ b/src/js/views/Administration.vue
@@ -64,17 +64,17 @@
{{ t('polls', 'Take over') }}
</ActionButton>
- <ActionButton :icon="poll.deleted ? 'icon-history' : 'icon-delete'"
+ <ActionButton :icon="poll.deleted ? 'icon-history' : 'icon-category-app-bundles'"
:close-after-click="true"
- @click="switchDeleted(poll.id)">
- {{ poll.deleted ? t('polls', 'Restore poll') : t('polls', 'Set "deleted" status') }}
+ @click="toggleArchive(poll.id)">
+ {{ poll.deleted ? t('polls', 'Restore poll') : t('polls', 'Archive poll') }}
</ActionButton>
<ActionButton icon="icon-delete"
class="danger"
:close-after-click="true"
@click="confirmDelete(poll.id)">
- {{ t('polls', 'Delete poll permanently') }}
+ {{ t('polls', 'Delete poll') }}
</ActionButton>
</Actions>
</template>
@@ -105,7 +105,7 @@
@click="deleteModal = false" />
<ButtonDiv :primary="true"
:title="t('polls', 'Yes')"
- @click="deletePermanently()" />
+ @click="deletePoll()" />
</div>
</div>
</Modal>
@@ -195,16 +195,16 @@ export default {
this.deleteModal = true
},
- async switchDeleted(pollId) {
+ async toggleArchive(pollId) {
try {
- await this.$store.dispatch('poll/switchDeleted', { pollId })
+ await this.$store.dispatch('poll/toggleArchive', { pollId })
emit('update-polls')
} catch {
- showError(t('polls', 'Error switching deleted status.'))
+ showError(t('polls', 'Error archiving/restoring poll.'))
}
},
- async deletePermanently() {
+ async deletePoll() {
try {
await this.$store.dispatch('poll/delete', { pollId: this.deletePollId })
emit('update-polls')
diff --git a/src/js/views/PollList.vue b/src/js/views/PollList.vue
index 26403378..b9c4037c 100644
--- a/src/js/views/PollList.vue
+++ b/src/js/views/PollList.vue
@@ -65,16 +65,16 @@
</ActionButton>
<ActionButton v-if="poll.allowEdit && !poll.deleted"
- icon="icon-delete"
+ icon="icon-category-app-bundles"
:close-after-click="true"
- @click="switchDeleted(poll.id)">
- {{ t('polls', 'Delete poll') }}
+ @click="toggleArchive(poll.id)">
+ {{ t('polls', 'Archive poll') }}
</ActionButton>
<ActionButton v-if="poll.allowEdit && poll.deleted"
icon="icon-history"
:close-after-click="true"
- @click="switchDeleted(poll.id)">
+ @click="toggleArchive(poll.id)">
{{ t('polls', 'Restore poll') }}
</ActionButton>
@@ -82,8 +82,8 @@
icon="icon-delete"
class="danger"
:close-after-click="true"
- @click="deletePermanently(poll.id)">
- {{ t('polls', 'Delete poll permanently') }}
+ @click="deletePoll(poll.id)">
+ {{ t('polls', 'Delete poll') }}
</ActionButton>
</Actions>
</template>
@@ -208,17 +208,17 @@ export default {
})
},
- async switchDeleted(pollId) {
+ async toggleArchive(pollId) {
try {
- await this.$store.dispatch('poll/switchDeleted', { pollId })
+ await this.$store.dispatch('poll/toggleArchive', { pollId })
} catch {
- showError(t('polls', 'Error deleting poll.'))
+ showError(t('polls', 'Error archiving/restoring poll.'))
} finally {
emit('update-polls')
}
},
- async deletePermanently(pollId) {
+ async deletePoll(pollId) {
try {
await this.$store.dispatch('poll/delete', { pollId })
} catch {