From f8f22998379e3bb2b49811028464b5d461c221ba Mon Sep 17 00:00:00 2001
From: erichard <elliot.richard@lal.in2p3.fr>
Date: Thu, 24 Oct 2019 10:58:23 +0200
Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20des=20noms=20d'attributs?=
 =?UTF-8?q?=20et=20fonction?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

name -> name_label
update_tutorials_and_labels() -> update_elements_and_labels()
---
 app/static/js/cookies.js | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/app/static/js/cookies.js b/app/static/js/cookies.js
index b70b82c..77ce99a 100644
--- a/app/static/js/cookies.js
+++ b/app/static/js/cookies.js
@@ -1,4 +1,4 @@
-function setCookie(name, value) {
+function setCookie(label_name, value) {
     /**
      * Create a cookie for ten years?
      */
@@ -6,14 +6,14 @@ function setCookie(name, value) {
     var expires = new Date();
 
     expires.setTime(today.getTime() + (10*365*24*60*60*1000));
-    document.cookie = name + "=" + value + ";expires=" + expires.toGMTString();
+    document.cookie = label_name + "=" + value + ";expires=" + expires.toGMTString();
 }
 
-function getCookie(name) {
+function getCookie(label_name) {
     /**
-     * Retrieve the value of a cookie due to it's name.
+     * Retrieve the value of a cookie due to it's label_name.
      */
-    var regex = new RegExp("(?:; )?" + name + "=([^;]*);?");
+    var regex = new RegExp("(?:; )?" + label_name + "=([^;]*);?");
 
     if (regex.test(document.cookie))
         return (RegExp["$1"]);
@@ -24,13 +24,13 @@ function getCookie(name) {
 function labels_tab_to_str(labels) {
     /**
      * Transform tab of labels to string.
-     * ex : [{'id_label': 1, 'name': "Learn C++", 'father_id': 6}]
+     * ex : [{'id_label': 1, 'label_name': "Learn C++", 'father_id': 6}]
      * = 1, Learn C++, 6|...
      */
     var result = "";
     var inter = []
     for (var i = 0; labels[i]; i++)
-        inter.push([labels[i]['id'], labels[i]['name'], labels[i]['father_id']]);
+        inter.push([labels[i]['id'], labels[i]['label_name'], labels[i]['father_id']]);
     result = inter.join('|');
     return (result);
 }
@@ -46,9 +46,9 @@ function str_to_labels_tab(str) {
     for (var i = 0; split[i]; i++) {
         var inter = split[i].split(',')
         if (inter.length == 2)
-            result.push({'id': inter[0], 'name': inter[1]});
+            result.push({'id': inter[0], 'label_name': inter[1]});
         else
-            result.push({'id': inter[0], 'name': inter[1], 'father_id': inter[2]});
+            result.push({'id': inter[0], 'label_name': inter[1], 'father_id': inter[2]});
     }
     return (result);
 }
@@ -76,10 +76,10 @@ function setup_session() {
         hierarchy.forbiden_labels = str_to_labels_tab(getCookie('cookies_forbiden_labels'));
 
     if (getCookie('cookies_mandatory_labels') != null && getCookie('cookies_mandatory_labels').length != 0) {
-        update_tutorials_and_labels();
+        update_elements_and_labels();
         success = 1;
     } else if (getCookie('cookies_forbiden_labels') != null && getCookie('cookies_forbiden_labels').length != 0) {
-        update_tutorials_and_labels();
+        update_elements_and_labels();
         success = 1;
     }
     return (success);
-- 
GitLab