diff --git a/app/static/js/cookies.js b/app/static/js/cookies.js index 77ce99aca43da1c63bb7af9039b25cce23741df9..2dc3d73ce08781e852ded61af948638d7ec68970 100644 --- a/app/static/js/cookies.js +++ b/app/static/js/cookies.js @@ -66,7 +66,6 @@ function setup_session() { * Return 0 no cookies are found return 0. * Else return 1 if old_tab cookie are found => the initialization of tutos * and labels is done from the labels contained in old_tab. - * If language cookie are found, juste th language is modified => labels tab's * need to be initialise (return 0). */ var success = 0; diff --git a/app/static/js/tmp.js b/app/static/js/tmp.js index b86317b102679806979356483d4fde402b258dd9..131f7284c9580d890984f89e2684c0a6ca611f16 100644 --- a/app/static/js/tmp.js +++ b/app/static/js/tmp.js @@ -18,7 +18,7 @@ function update_elements_and_labels(){ /* Procedure update_elements_and_labels() {Update the vues #result (result.selected_elements) - and #hierarchy (hierarchy.high_discriminating_labels, hierarchy.language_label) + and #hierarchy (hierarchy.high_discriminating_labels) depending on which labels are forbiden and mandatory} */ update_high_discrimanating_labels(update_selected_elements()); @@ -59,7 +59,7 @@ function update_high_discrimanating_labels(id_selected_elements){ /* Procedure update_high_discrimanating_labels(id_selected_elements:string){ Prameter : (D) id_selected_elements : string -{ Update the vue #hierarchy (hierarchy.high_discriminating_labels, hierarchy.language_label) +{ Update the vue #hierarchy (hierarchy.high_discriminating_labels) depending on which labels are forbiden and mandatory } */ var number_of_selected_elements = result.selected_elements.length; @@ -71,24 +71,5 @@ Prameter : (D) id_selected_elements : string var id_discrimanating_labels = format_json_to_string(discrimanating_labels,'id'); url='/high_discriminating_level_labels/'; url+=id_discrimanating_labels; - var hight_discrimanating_level_labels = JSON.parse(send_simple_request(url)); - split_high_discriminating_label(hight_discrimanating_level_labels); + hierarchy.high_discriminating_labels = JSON.parse(send_simple_request(url)); } - -function split_high_discriminating_label(labels){ -/* -Procedure split_high_discriminating_label(labels:string) -Parameter : (D) label : string -{ Split label language and other high discriminating labels into two different list in order to display them - separately } -*/ - hierarchy.language_labels = []; - hierarchy.high_discriminating_labels = []; - for(i=0;i<labels.length;i++){ - if(labels[i]['label_name']=='French' || labels[i]['label_name']=='English'){ - hierarchy.language_labels.push(labels[i]); - }else{ - hierarchy.high_discriminating_labels.push(labels[i]); - } - } -} \ No newline at end of file diff --git a/app/templates/browse.html b/app/templates/browse.html index 74bdd416e43b4550439001d8658c93aef8a84784..91536000282c831395d9e1ec4feddf74e713b63b 100644 --- a/app/templates/browse.html +++ b/app/templates/browse.html @@ -75,19 +75,6 @@ </div> <!-- HIERARCHY.HIGH_DISCRIMATING_LABELS --> - <!-- HIERARCHY.LANGUAGE_LABELS --> - <div v-if="loading == 1"> - <div id="hierarchy-separator" v-if="(language_labels.length > 0) && (high_discriminating_labels.length > 0 || mandatory_labels.length > 0 || forbiden_labels.length > 0)"> - <img src="static/img/monSeparateur.png"/> - </div> - <span v-for='(label, index) in language_labels' v-bind:key="label['label_name']"> - <img title="Selects elements with this label" class="hierarchy-icone_left" @click="add_mandatory_label(index, 'lang')" src="static/img/plus.png" onmouseover="this.src='static/img/plus-agrandi.png'" onmouseout="this.src='static/img/plus.png'"> - <span :title="label['label_name']"><b>{{ label['label_name'] }}</b></span> - <img title="Prohibits elements with this label" class="hierarchy-icone_right" @click="add_forbiden_label(index, 'lang')" src="static/img/moins.png" onmouseover="this.src='static/img/moins-agrandi.png'" onmouseout="this.src='static/img/moins.png'"> - <br> - </span> - </div> - <!-- HIERARCHY.LANGUAGE_LABELS --> </div> </div> @@ -159,13 +146,11 @@ * - 'forbiden_labels' contain all labels previously selected. They * are used for select the elements and they are signaled by a minus. * - 'high_discriminating_labels' contain the labels generated thanks to elements. - * - 'language_labels' can be choosen in order to select the language of elements.. * For 'loading' see update_loading function above. */ mandatory_labels: [], forbiden_labels: [], high_discriminating_labels: [], - language_labels: [], size_div: 0, loading: 1 }, @@ -183,20 +168,13 @@ save_session(); update_loading(1); }, - add_mandatory_label: function(index, - source - ) { + add_mandatory_label: function(index) { /** * Move selected label from [high_discriminating_labels => mandatory_labels] */ update_loading(0); - if (source == "lang") { - hierarchy.mandatory_labels.push(hierarchy.language_labels[index]); - hierarchy.language_labels.splice(index, 1); - } else { - hierarchy.mandatory_labels.push(hierarchy.high_discriminating_labels[index]); - hierarchy.high_discriminating_labels.splice(index, 1); - } + hierarchy.mandatory_labels.push(hierarchy.high_discriminating_labels[index]); + hierarchy.high_discriminating_labels.splice(index, 1); update_elements_and_labels(); save_session(); update_loading(1); @@ -213,20 +191,15 @@ save_session(); update_loading(1); }, - add_forbiden_label: function(index, source) { + add_forbiden_label: function(index) { /** * After click on cross of high_discriminating_labels. * This label is add to forbiden_labels and it is remove from previous high_discriminating_labels. * Next the list of elements is updated. */ update_loading(0); - if (source == "lang") { - hierarchy.forbiden_labels.push(hierarchy.language_labels[index]); - hierarchy.language_labels.splice(index, 1); - } else { - hierarchy.forbiden_labels.push(hierarchy.high_discriminating_labels[index]); - hierarchy.high_discriminating_labels.splice(index, 1); - } + hierarchy.forbiden_labels.push(hierarchy.high_discriminating_labels[index]); + hierarchy.high_discriminating_labels.splice(index, 1); update_elements_and_labels(); save_session(); update_loading(1);