Commit fc0ec4ad authored by Duhoux Pierre-Louis's avatar Duhoux Pierre-Louis

[EVOL] add possibility to stop updating a manga

parent 9585f2c4
......@@ -430,6 +430,14 @@
"message": "Follow updates",
"description": "Follow updates action button in manga details"
},
"list_details_act_stop_updating": {
"message": "Stop updating",
"description": "Stop updating action button in manga details"
},
"list_details_act_restart_updating": {
"message": "Restart updating",
"description": "Restart updating action button in manga details"
},
"list_calendar_today": {
"message": "Last chapter found today !",
"description": "Tooltip on calendar icon when last chater was found today"
......@@ -438,6 +446,10 @@
"message": "Last chapter found $1 days ago",
"description": "Tooltip on calendar icon to tell how many days since last chater found"
},
"list_stopped_updating": {
"message": "Chapter list is not refreshed for this manga. To restart it, click on the Restart updating button",
"description": "Tooltip on timer off icon to explain that this manga's chapter list is no more updated."
},
"list_progress_reading": {
"message": "Progression : $1 %",
"description": "Tooltip on progress bar below chapters list to tell the reading progression"
......
......@@ -22,7 +22,8 @@ export default class {
this.listChaps = obj.listChaps;
}
this.read = obj.read || 0;
this.update = obj.update || 1;
this.update = obj.update;
if (this.update === undefined || this.update === null) this.update = 1;
this.display = obj.display || 0;
this.cats = obj.cats || [];
if (obj.cats && typeof obj.cats === "string") {
......
......@@ -24,6 +24,11 @@
<span v-if="timeUpdated === 0">{{i18n("list_calendar_today")}}</span>
<span v-else>{{i18n("list_calendar_days_found", timeUpdated)}}</span>
</v-tooltip>
<!-- Display a timer off if the manga is not updating anymore -->
<v-tooltip v-if="manga.update === 0" top content-class="icon-ttip">
<v-icon class="amr-timeroff-badge" slot="activator">mdi-timer-off</v-icon>
<span>{{i18n("list_stopped_updating")}}</span>
</v-tooltip>
</v-card>
</v-card>
</v-flex>
......@@ -372,8 +377,11 @@ select.amr-chap-sel {
margin-left: 25px;
width: auto;
}
.amr-calendar-badge {
.amr-calendar-badge, .amr-timeroff-badge {
float: right;
padding: 0px 4px;
}
.amr-timeroff-badge {
margin-top: 2px;
}
</style>
\ No newline at end of file
<!-- The prop "mangas" used to initialize this component is a list of manga objects with the same name : a manga read on multile sites -->
<!-- The prop "mangas" used to initialize this component is a list of manga objects with the same name : a manga read on multiple sites -->
<template>
<v-container fluid class="amr-list-line" v-if="nbDisplayed > 0">
<v-container fluid :class="'amr-list-line ' + (updating ? '' : 'noupdates')" v-if="nbDisplayed > 0">
<!-- Manga line-->
<Manga
v-for="(manga, key) in mangas"
......@@ -52,6 +52,8 @@
<v-btn dark @click='resetManga()' :color="color(0)" small>{{i18n("list_details_act_reset")}}</v-btn>
<v-btn dark v-if="mangas[0].read === 0" @click='stopFollowingUpdates()' :color="color(0)" small>{{i18n("list_details_act_stop_follow")}}</v-btn>
<v-btn dark v-if="mangas[0].read === 1" @click='followUpdates()' :color="color(0)" small>{{i18n("list_details_act_follow")}}</v-btn>
<v-btn dark v-if="mangas[0].update === 1" @click='stopUpdating()' :color="color(0)" small>{{i18n("list_details_act_stop_updating")}}</v-btn>
<v-btn dark v-if="mangas[0].update === 0" @click='restartUpdating()' :color="color(0)" small>{{i18n("list_details_act_restart_updating")}}</v-btn>
</v-flex>
</v-layout>
</v-container>
......@@ -104,6 +106,15 @@ export default {
);
}, []);
},
/**
* return true if at least one manga of the group is still updating (update top is 1)
*/
updating: function() {
for (let mg of this.mangas) {
if (mg.update === 1) return true;
}
return false;
},
/**
* Returns number of manga of this group which will be displayed according to the filters
*/
......@@ -166,6 +177,26 @@ export default {
read: 0
});
},
/**
* Stop updating (looking for new chapters) mangas in this group
*/
stopUpdating: function() {
this.$store.dispatch("markMangaUpdateTop", {
url: this.mangas[0].url,
updatesamemangas: true,
update: 0
});
},
/**
* Restart updating (looking for new chapters) mangas in this group
*/
restartUpdating: function() {
this.$store.dispatch("markMangaUpdateTop", {
url: this.mangas[0].url,
updatesamemangas: true,
update: 1
});
},
/**
* Delete a category on this group of manga
*/
......@@ -199,6 +230,9 @@ export default {
.container.amr-list-line {
padding: 0px 10px;
}
.container.amr-list-line.noupdates {
opacity: 0.75;
}
.container.amr-list-line:last-child {
padding-bottom: 10px;
}
......
......@@ -337,6 +337,29 @@ const actions = {
// refresh badge
amrUpdater.refreshBadgeAndIcon();
},
/**
* Change the update top on a manga
* @param {*} vuex object
* @param {*} message message contains info on a manga
*/
async markMangaUpdateTop({ dispatch, commit, getters, rootState }, message) {
let key = utils.mangaKey(message.url),
mg = state.all.find(manga => manga.key === key);
if (mg !== undefined) {
commit('setMangaUpdateTop', message);
dispatch('updateManga', mg);
if (message.updatesamemangas && rootState.options.groupmgs === 1) {
let titMg = utils.formatMgName(mg.name);
let smgs = state.all.filter(manga => utils.formatMgName(manga.name) === titMg)
for (let smg of smgs) {
commit('setMangaUpdateTop', { url: smg.url, update: message.update });
dispatch('updateManga', smg);
}
}
}
// refresh badge
amrUpdater.refreshBadgeAndIcon();
},
/**
* Given its key, deletes a manga from reading list
* @param {*} param0
......@@ -420,6 +443,16 @@ const mutations = {
mg = state.all.find(manga => manga.key === key)
if (mg !== undefined) mg.read = read;
},
/**
* Change manga update top
* @param {*} state
* @param {*} param1 url of the manga and update top
*/
setMangaUpdateTop(state, { url, update }) {
let key = utils.mangaKey(url),
mg = state.all.find(manga => manga.key === key)
if (mg !== undefined) mg.update = update;
},
/**
* Set upts to now (means : 'last time we found a new chapter is now');
* @param {*} state
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment