From b4c1c0cbf5e07091c6153c5b821bf217a3e573fb Mon Sep 17 00:00:00 2001 From: Amirhossein <66219826+amirhssn@users.noreply.github.com> Date: Wed, 28 Oct 2020 23:25:00 +0330 Subject: [PATCH] Alternate badge colors --- static/js/papers.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/static/js/papers.js b/static/js/papers.js index a5de5bf..9da418b 100644 --- a/static/js/papers.js +++ b/static/js/papers.js @@ -232,8 +232,9 @@ const maybe_update = (element_ids, value, callback) => { const updateModalData = (paper) => { let program = paper.content.program; + let badgeClass = program_to_badge_class[program]; $('#modalTitle').html( - `${paper.content.title}   ${program}`); + `${paper.content.title}   ${program}`); let isVisited = persistor.get(paper.id) || false if (isVisited) @@ -452,7 +453,7 @@ const updateToolboxUI = (program, urlFilter, track) =>{ // Update program selector UI document.querySelector(`input[name=program][value=${program}]`).checked = true; - if (["main", "workshop", "all"].includes(program)) { + if (["main", "workshop"].includes(program)) { $("#track_selector").selectpicker('show'); $("#track_selector_placeholder").removeClass("d-lg-block"); } else{ @@ -602,10 +603,17 @@ const card_fav_btn_html = (is_fav) => { } } +const program_to_badge_class = new Map() +program_to_badge_class["main"] = "danger"; +program_to_badge_class["demo"] = "primary"; +program_to_badge_class["findings"] = "warning"; +program_to_badge_class["workshop"] = "info"; const card_program_badge = (paper) => { let selected_program = getUrlParameter("program"); if (selected_program === "all") - return `${paper.content.program}`; + return `${paper.content.program}`; else return ``; }