From f0d48b71e85b3409ab42a643d114fa635cfb853a Mon Sep 17 00:00:00 2001 From: didayolo Date: Thu, 16 Apr 2026 16:10:40 +0200 Subject: [PATCH 1/3] Add description in dropdown selector --- .../riot/competitions/editor/_phases.tag | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/static/riot/competitions/editor/_phases.tag b/src/static/riot/competitions/editor/_phases.tag index a9c318c28..98b9bdf65 100644 --- a/src/static/riot/competitions/editor/_phases.tag +++ b/src/static/riot/competitions/editor/_phases.tag @@ -261,6 +261,24 @@ // awesome markdown editor self.simple_markdown_editor = create_easyMDE(self.refs.description) + // Custom menu template that renders description under the item name + // data-text is set to name-only so that selected labels show only the title + var dropdown_menu_template = function(response, fields) { + var html = '' + $.each(response[fields.values], function(index, item) { + var name = item[fields.name] || '' + var value = item[fields.value] || '' + var description = item.description + html += '
' + html += '' + name + '' + if (description) { + html += '' + } + html += '
' + }) + return html + } + // semantic multiselect $(self.refs.multiselect).dropdown({ apiSettings: { @@ -270,6 +288,7 @@ return {success: true, results: _.values(data.results)} }, }, + templates: {menu: dropdown_menu_template}, onAdd: self.task_added, onRemove: self.task_removed, }) @@ -282,10 +301,11 @@ return {success: true, results: _.values(data.results)} }, }, + templates: {menu: dropdown_menu_template}, onAdd: self.public_data_added, onRemove: self.public_data_removed, }) - + $(self.refs.starting_kit_multiselect).dropdown({ apiSettings: { url: `${URLS.API}datasets/?search={query}&type=starting_kit`, @@ -294,6 +314,7 @@ return {success: true, results: _.values(data.results)} }, }, + templates: {menu: dropdown_menu_template}, onAdd: self.starting_kit_added, onRemove: self.starting_kit_removed, }) @@ -858,5 +879,11 @@ From 1d65eaf1e655d08bcd2282ca9f949ff0a27ad6fa Mon Sep 17 00:00:00 2001 From: Ihsan Ullah Date: Fri, 15 May 2026 15:25:14 +0500 Subject: [PATCH 2/3] code simplified --- src/static/riot/competitions/editor/_phases.tag | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/static/riot/competitions/editor/_phases.tag b/src/static/riot/competitions/editor/_phases.tag index 98b9bdf65..73f60a52d 100644 --- a/src/static/riot/competitions/editor/_phases.tag +++ b/src/static/riot/competitions/editor/_phases.tag @@ -263,12 +263,13 @@ // Custom menu template that renders description under the item name // data-text is set to name-only so that selected labels show only the title - var dropdown_menu_template = function(response, fields) { + var dropdown_menu_template = function(response) { var html = '' - $.each(response[fields.values], function(index, item) { - var name = item[fields.name] || '' - var value = item[fields.value] || '' - var description = item.description + //$.each(response[fields.values], function(index, item) { + $.each(response.values, function(index, item) { + let name = item.name || '' + let value = item.value || '' + let description = item.description html += '
' html += '' + name + '' if (description) { From 1bd03fce38bdfd75a0d3b94e13853c9adaaed0dc Mon Sep 17 00:00:00 2001 From: Ihsan Ullah Date: Fri, 15 May 2026 15:31:18 +0500 Subject: [PATCH 3/3] remove comment --- src/static/riot/competitions/editor/_phases.tag | 1 - 1 file changed, 1 deletion(-) diff --git a/src/static/riot/competitions/editor/_phases.tag b/src/static/riot/competitions/editor/_phases.tag index 73f60a52d..c2855bdb6 100644 --- a/src/static/riot/competitions/editor/_phases.tag +++ b/src/static/riot/competitions/editor/_phases.tag @@ -265,7 +265,6 @@ // data-text is set to name-only so that selected labels show only the title var dropdown_menu_template = function(response) { var html = '' - //$.each(response[fields.values], function(index, item) { $.each(response.values, function(index, item) { let name = item.name || '' let value = item.value || ''