From 975b971ae6efacbd5614be7f057f32d7c302966b Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 27 Nov 2020 11:26:55 +0100 Subject: Documents: dynamic filter of support and medium by document type - collapse related fields on edition --- ishtar_common/static/js/ishtar.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'ishtar_common/static/js') diff --git a/ishtar_common/static/js/ishtar.js b/ishtar_common/static/js/ishtar.js index fcaa73053..6528d3797 100644 --- a/ishtar_common/static/js/ishtar.js +++ b/ishtar_common/static/js/ishtar.js @@ -1856,3 +1856,22 @@ var is_valid_issn = function(str) { } return (check == str[str.length-1].toUpperCase()); } + +var update_select_widget = function(input_name, values, only_values, excluded_values){ + cvalue = $("#id_" + input_name).val(); + var options = ""; + for (var idx in values){ + var option = values[idx]; + if (!(option[0] && option[0] != cvalue + && ((excluded_values && + excluded_values.indexOf(option[0]) != -1) || + (only_values && only_values.indexOf(option[0]) == -1) + ))){ + var selected = ""; + if (option[0] == cvalue) selected = " selected"; + options += ""; + } + } + $("#id_" + input_name).html(options); +}; \ No newline at end of file -- cgit v1.2.3