diff --git a/frontends/etiquette_flask/static/css/cards.css b/frontends/etiquette_flask/static/css/cards.css index 2b51b5a..7f77aff 100644 --- a/frontends/etiquette_flask/static/css/cards.css +++ b/frontends/etiquette_flask/static/css/cards.css @@ -102,6 +102,7 @@ .bookmark_card .bookmark_url { + display: none; } .bookmark_card input diff --git a/frontends/etiquette_flask/static/js/cards.js b/frontends/etiquette_flask/static/js/cards.js index d189d58..0a8d47a 100644 --- a/frontends/etiquette_flask/static/js/cards.js +++ b/frontends/etiquette_flask/static/js/cards.js @@ -72,7 +72,7 @@ function drag_drop(event) cards.bookmarks = {}; cards.bookmarks.create = -function create(bookmark, add_delete_button) +function create(bookmark, add_author, add_delete_button, add_url_element) { const bookmark_card = document.createElement("div"); bookmark_card.className = "bookmark_card" @@ -84,27 +84,39 @@ function create(bookmark, add_delete_button) bookmark_title.innerText = bookmark.display_name; bookmark_card.appendChild(bookmark_title); - const bookmark_url = document.createElement("a"); - bookmark_url.className = "bookmark_url"; - bookmark_url.href = bookmark.url; - bookmark_url.innerText = bookmark.url; - bookmark_card.appendChild(bookmark_url); - - const bookmark_toolbox = document.createElement("div"); - bookmark_toolbox.className = "bookmark_toolbox" - bookmark_card.appendChild(bookmark_toolbox); + // The URL element is always display:none, but its presence is useful in + // facilitating the Editor object. If this bookmark will not be editable, + // there is no need for it. + if (add_url_element) + { + const bookmark_url = document.createElement("a"); + bookmark_url.className = "bookmark_url"; + bookmark_url.href = bookmark.url; + bookmark_url.innerText = bookmark.url; + bookmark_card.appendChild(bookmark_url); + } + // If more tools are added, this will become an `or`. + // I just want to have the structure in place now. if (add_delete_button) { - const delete_button = document.createElement("button"); - delete_button.className = "red_button button_with_confirm"; - delete_button.dataset.onclick = "return delete_bookmark_form(event);"; - delete_button.dataset.prompt = "Delete Bookmark?"; - delete_button.dataset.cancelClass = "gray_button"; - delete_button.innerText = "Delete"; - bookmark_toolbox.appendChild(delete_button); - common.init_button_with_confirm(delete_button); + const bookmark_toolbox = document.createElement("div"); + bookmark_toolbox.className = "bookmark_toolbox" + bookmark_card.appendChild(bookmark_toolbox); + + if (add_delete_button) + { + const delete_button = document.createElement("button"); + delete_button.className = "red_button button_with_confirm"; + delete_button.dataset.onclick = "return delete_bookmark_form(event);"; + delete_button.dataset.prompt = "Delete Bookmark?"; + delete_button.dataset.cancelClass = "gray_button"; + delete_button.innerText = "Delete"; + bookmark_toolbox.appendChild(delete_button); + common.init_button_with_confirm(delete_button); + } } + return bookmark_card; } diff --git a/frontends/etiquette_flask/templates/bookmarks.html b/frontends/etiquette_flask/templates/bookmarks.html index 68dc28f..d97e6ba 100644 --- a/frontends/etiquette_flask/templates/bookmarks.html +++ b/frontends/etiquette_flask/templates/bookmarks.html @@ -23,6 +23,11 @@ flex: 0 0 auto; flex-direction: column; } +.bookmark_card h2 .editor_input +{ + font-size: inherit; + font-weight: inherit; +} @@ -32,7 +37,7 @@