mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-02 10:55:30 -04:00
Better format ranges on subscription manager page
This commit is contained in:
parent
e03bf32358
commit
c6fdbfd9fd
@ -68,6 +68,15 @@ const component = () => {
|
|||||||
.fail((jqXHR, status) => {
|
.fail((jqXHR, status) => {
|
||||||
alert('danger', `Failed to check subscription. Error: [${jqXHR.status}] ${jqXHR.statusText}`);
|
alert('danger', `Failed to check subscription. Error: [${jqXHR.status}] ${jqXHR.statusText}`);
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
formatRange(min, max) {
|
||||||
|
if (!isNaN(min) && isNaN(max)) return `≥ ${min}`;
|
||||||
|
if (isNaN(min) && !isNaN(max)) return `≤ ${max}`;
|
||||||
|
if (isNaN(min) && isNaN(max)) return 'All';
|
||||||
|
|
||||||
|
if (min === max) return `= ${min}`;
|
||||||
|
return `${min} - ${max}`;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,58 +1,54 @@
|
|||||||
<h2 class="uk-title">MangaDex Subscription Manager</h2>
|
<h2 class="uk-title">MangaDex Subscription Manager</h2>
|
||||||
|
|
||||||
<div x-data="component()" x-init="init()">
|
<div x-data="component()" x-init="init()">
|
||||||
<p x-show="available === false">The subscription manager uses a MangaDex API that requires authentication. Please <a href="<%= base_url %>admin/mangadex">connect to MangaDex</a> before using this feature.</p>
|
<p x-show="available === false">The subscription manager uses a MangaDex API that requires authentication. Please <a href="<%= base_url %>admin/mangadex">connect to MangaDex</a> before using this feature.</p>
|
||||||
|
|
||||||
<p x-show="available && subscriptions.length === 0">No subscription found. Go to the <a href="<%= base_url %>download">MangaDex download page</a> and start subscribing.</p>
|
<p x-show="available && subscriptions.length === 0">No subscription found. Go to the <a href="<%= base_url %>download">MangaDex download page</a> and start subscribing.</p>
|
||||||
|
|
||||||
<template x-if="subscriptions.length > 0">
|
<template x-if="subscriptions.length > 0">
|
||||||
<div class="uk-overflow-auto">
|
<div class="uk-overflow-auto">
|
||||||
<table class="uk-table uk-table-striped">
|
<table class="uk-table uk-table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Manga ID</th>
|
<th>Manga ID</th>
|
||||||
<th>Language</th>
|
<th>Language</th>
|
||||||
<th>Group ID</th>
|
<th>Group ID</th>
|
||||||
<th>Min Volume</th>
|
<th>Volume Range</th>
|
||||||
<th>Max Volume</th>
|
<th>Chapter Range</th>
|
||||||
<th>Min Chapter</th>
|
<th>Creator</th>
|
||||||
<th>Max Chapter</th>
|
<th>Last Checked</th>
|
||||||
<th>Creator</th>
|
<th>Created At</th>
|
||||||
<th>Last Checked</th>
|
<th>Actions</th>
|
||||||
<th>Created At</th>
|
</tr>
|
||||||
<th>Actions</th>
|
</thead>
|
||||||
</tr>
|
<tbody>
|
||||||
</thead>
|
<template x-for="sub in subscriptions" :key="sub">
|
||||||
<tbody>
|
<tr>
|
||||||
<template x-for="sub in subscriptions" :key="sub">
|
<td><a :href="`<%= mangadex_base_url %>/manga/${sub.manga_id}`" x-text="sub.manga_id"></a></td>
|
||||||
<tr>
|
<td x-text="sub.language || 'All'"></td>
|
||||||
<td><a :href="`<%= mangadex_base_url %>/manga/${sub.manga_id}`" x-text="sub.manga_id"></a></td>
|
<td>
|
||||||
<td x-text="sub.language || 'All'"></td>
|
<a x-show="sub.group_id" :href="`<%= mangadex_base_url %>/group/${sub.group_id}`" x-text="sub.group_id"></a>
|
||||||
<td>
|
<span x-show="!sub.group_id">All</span>
|
||||||
<a x-show="sub.group_id" :href="`<%= mangadex_base_url %>/group/${sub.group_id}`" x-text="sub.group_id"></a>
|
</td>
|
||||||
<span x-show="!sub.group_id">All</span>
|
<td x-text="formatRange(sub.min_volume, sub.max_volume)"></td>
|
||||||
</td>
|
<td x-text="formatRange(sub.min_chapter, sub.max_chapter)"></td>
|
||||||
<td x-text="sub.min_volume || '0'"></td>
|
<td x-text="sub.username"></td>
|
||||||
<td x-text="sub.max_volume || '+∞'"></td>
|
<td x-text="`${moment.unix(sub.last_checked).fromNow()}`"></td>
|
||||||
<td x-text="sub.min_chapter || '0'"></td>
|
<td x-text="`${moment.unix(sub.created_at).fromNow()}`"></td>
|
||||||
<td x-text="sub.max_chapter || '+∞'"></td>
|
<td :data-id="sub.id">
|
||||||
<td x-text="sub.username"></td>
|
<a @click="check($event)" x-show="sub.username === '<%= username %>'" uk-icon="refresh" uk-tooltip="Check for updates"></a>
|
||||||
<td x-text="`${moment.unix(sub.last_checked).fromNow()}`"></td>
|
<a @click="rm($event)" x-show="sub.username === '<%= username %>'" uk-icon="trash" uk-tooltip="Delete"></a>
|
||||||
<td x-text="`${moment.unix(sub.created_at).fromNow()}`"></td>
|
</td>
|
||||||
<td :data-id="sub.id">
|
</tr>
|
||||||
<a @click="check($event)" x-show="sub.username === '<%= username %>'" uk-icon="refresh" uk-tooltip="Check for updates"></a>
|
</template>
|
||||||
<a @click="rm($event)" x-show="sub.username === '<%= username %>'" uk-icon="trash" uk-tooltip="Delete"></a>
|
</tbody>
|
||||||
</td>
|
</table>
|
||||||
</tr>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% content_for "script" do %>
|
<% content_for "script" do %>
|
||||||
<%= render_component "moment" %>
|
<%= render_component "moment" %>
|
||||||
<script src="<%= base_url %>js/alert.js"></script>
|
<script src="<%= base_url %>js/alert.js"></script>
|
||||||
<script src="<%= base_url %>js/subscription.js"></script>
|
<script src="<%= base_url %>js/subscription.js"></script>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user