display a hint if no bookmarks are in the system
This commit is contained in:
parent
04a5e6705f
commit
8b5cf9983e
@ -261,6 +261,7 @@ $.fn.bookmarktable = function() {
|
|||||||
$(this).on('click', '.bookmark-add', function() {
|
$(this).on('click', '.bookmark-add', function() {
|
||||||
if ($table.find('tr[data-id="new"]').length) return;
|
if ($table.find('tr[data-id="new"]').length) return;
|
||||||
|
|
||||||
|
$table.find('.emptytext').remove();
|
||||||
var row = $('<tr data-id="new">');
|
var row = $('<tr data-id="new">');
|
||||||
|
|
||||||
var inputs = Object.fromEntries(
|
var inputs = Object.fromEntries(
|
||||||
@ -371,6 +372,7 @@ $.fn.bookmarktable = function() {
|
|||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
}).done(function(data){
|
}).done(function(data){
|
||||||
|
$table.find('.emptytext').remove();
|
||||||
var modes = $table.data('modes');
|
var modes = $table.data('modes');
|
||||||
if (data.length && data.length == selected.length) {
|
if (data.length && data.length == selected.length) {
|
||||||
$table.append(data.map(function(obj, index) {
|
$table.append(data.map(function(obj, index) {
|
||||||
|
@ -22,7 +22,12 @@ class BookmarksController(AuthorizationMixin, BreadcrumbMixin, WebpageController
|
|||||||
return variables
|
return variables
|
||||||
|
|
||||||
def render_table(self):
|
def render_table(self):
|
||||||
bookmarks = Bookmarks.getSharedInstance()
|
bookmarks = Bookmarks.getSharedInstance().getBookmarks()
|
||||||
|
emptyText = """
|
||||||
|
<tr class="emptytext"><td colspan="4">
|
||||||
|
No bookmarks in storage. You can add new bookmarks using the buttons below.
|
||||||
|
</td></tr>
|
||||||
|
"""
|
||||||
|
|
||||||
return """
|
return """
|
||||||
<table class="table" data-modes='{modes}'>
|
<table class="table" data-modes='{modes}'>
|
||||||
@ -35,7 +40,7 @@ class BookmarksController(AuthorizationMixin, BreadcrumbMixin, WebpageController
|
|||||||
{bookmarks}
|
{bookmarks}
|
||||||
</table>
|
</table>
|
||||||
""".format(
|
""".format(
|
||||||
bookmarks="".join(self.render_bookmark(b) for b in bookmarks.getBookmarks()),
|
bookmarks="".join(self.render_bookmark(b) for b in bookmarks) if bookmarks else emptyText,
|
||||||
modes=json.dumps({m.modulation: m.name for m in Modes.getAvailableModes()}),
|
modes=json.dumps({m.modulation: m.name for m in Modes.getAvailableModes()}),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user