add edit and delete button

This commit is contained in:
Jakob Ketterl 2019-09-29 14:48:36 +02:00
parent f292ba55c1
commit 4a7b42202e
4 changed files with 39 additions and 4 deletions

View File

@ -164,7 +164,6 @@ input[type=range]:focus::-ms-fill-upper
{ {
height: 25px; height: 25px;
background-color: #444; background-color: #444;
overflow: hidden;
position: relative; position: relative;
z-index: 1000; z-index: 1000;
} }
@ -177,18 +176,45 @@ input[type=range]:focus::-ms-fill-upper
padding: 2px 5px; padding: 2px 5px;
cursor: pointer; cursor: pointer;
white-space: nowrap; white-space: nowrap;
max-height: 14px;
max-width: 50px;
position: absolute; position: absolute;
bottom: 5px; bottom: 5px;
transform: translate(-50%, 0); transform: translate(-50%, 0);
} }
#openwebrx-bookmarks-container .bookmark .bookmark-content {
overflow: hidden;
text-overflow: ellipsis;
}
#openwebrx-bookmarks-container .bookmark .bookmark-actions {
display: none;
text-align: right;
}
.bookmark-actions .action {
line-height: 0;
}
.bookmark-actions .action img {
width: 14px;
}
#openwebrx-bookmarks-container .bookmark.selected { #openwebrx-bookmarks-container .bookmark.selected {
z-index: 1010; z-index: 1010;
} }
#openwebrx-bookmarks-container .bookmark:hover { #openwebrx-bookmarks-container .bookmark:hover {
z-index: 1011; z-index: 1011;
max-height: none;
max-width: none;
}
#openwebrx-bookmarks-container .bookmark[editable]:hover .bookmark-actions {
display: block;
margin-bottom: 5px;
} }
#openwebrx-bookmarks-container .bookmark:after { #openwebrx-bookmarks-container .bookmark:after {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 797 B

View File

@ -1337,11 +1337,20 @@ function on_ws_recv(evt)
} }
} }
function update_bookmarks(bookmarks, source) { function update_bookmarks(bookmarks, source, editable) {
editable = !!editable;
var $container = $('#openwebrx-bookmarks-container'); var $container = $('#openwebrx-bookmarks-container');
$container.find('.bookmark[data-source=' + source + ']').remove(); $container.find('.bookmark[data-source=' + source + ']').remove();
bookmarks.forEach(function(b){ bookmarks.forEach(function(b){
$bookmark = $('<div class="bookmark" data-source="' + source + '">' + b.name + '</div>'); $bookmark = $(
'<div class="bookmark" data-source="' + source + '"' + (editable?' editable="editable"':'') + '>' +
'<div class="bookmark-actions">' +
'<div class="openwebrx-button action" data-action="edit"><img src="static/gfx/openwebrx-edit.png"></div>' +
'<div class="openwebrx-button action" data-action="delete"><img src="static/gfx/openwebrx-trashcan.png"></div>' +
'</div>' +
'<div class="bookmark-content">' + b.name + '</div>' +
'</div>'
);
$bookmark.data(b); $bookmark.data(b);
$container.append($bookmark); $container.append($bookmark);
}); });
@ -1355,7 +1364,7 @@ function loadLocalBookmarks() {
var bookmarks = getLocalBookmarks().filter(function(b){ var bookmarks = getLocalBookmarks().filter(function(b){
return b.frequency >= start && b.frequency <= end; return b.frequency >= start && b.frequency <= end;
}); });
update_bookmarks(bookmarks, 'local'); update_bookmarks(bookmarks, 'local', true);
} }
function position_bookmarks() { function position_bookmarks() {