diff options
-rw-r--r-- | templates/admin/changeMID.html | 63 | ||||
-rw-r--r-- | templates/admin/index.html | 2 | ||||
-rw-r--r-- | templates/admin/testexp.html | 8 |
3 files changed, 38 insertions, 35 deletions
diff --git a/templates/admin/changeMID.html b/templates/admin/changeMID.html index 721a6b8..a2ca257 100644 --- a/templates/admin/changeMID.html +++ b/templates/admin/changeMID.html @@ -17,8 +17,8 @@ <select id="mid"> {% for mid in mid_count %} - <option id = "{{ mid.board_id }}"> - {{ mid.board__mid }}-{{mid.mcount}} + <option id = "{{ mid.2 }}"> + {{ mid.0 }}-{{mid.1}} </option> {% endfor %} </select> @@ -30,43 +30,42 @@ <script type="text/javascript"> function updateMID() { - $("#update-btn").prop('disabled',true); - var BASE_URL = window.location.origin; - var username = $("#username").val(); - var board_id = $("#mid").children(":selected").attr("id"); + $("#update-btn").prop('disabled',true); + var BASE_URL = window.location.origin + "/sbhs"; + var username = $("#username").val(); + var board_id = $("#mid").children(":selected").attr("id"); + + if(username == "") + { + alert("Username field must not be empty"); + return; + } - if(username == "") - { - alert("Username field must not be empty"); - return; + var request = $.ajax({ + url:BASE_URL + "/admin/updatemid", + method : "POST", + data : { + "username" : username, + "board_id" : board_id } + }); - var request = $.ajax({ - url:BASE_URL + "/admin/updatemid", - method : "POST", - data : { - "username" : username, - "board_id" : board_id - } - }); - - request.done(function(data){ - if(data.status_code == 200) { - alert(data.message); - location.reload(); - } - else { - alert(data.message); - $("#update-btn").prop('disabled',false); - } - }); - - + request.done(function(data){ + if(data.status_code == 200) { + alert(data.message); + $("#update-btn").prop('disabled',false); + location.reload(); + } + else { + alert(data.message); + $("#update-btn").prop('disabled',false); + } + }); } // for live search of usernames if (sessionStorage.getItem("fetchedUsers") == null) { - var BASE_URL = window.location.origin; + var BASE_URL = window.location.origin + "/sbhs"; var request = $.ajax({ url: BASE_URL + '/admin/getusers', method: 'POST' diff --git a/templates/admin/index.html b/templates/admin/index.html index e7ffe3b..dba8419 100644 --- a/templates/admin/index.html +++ b/templates/admin/index.html @@ -40,7 +40,7 @@ $(".label-warning").click(toggleState); function toggleState() { - var BASE_URL = window.location.origin; + var BASE_URL = window.location.origin + "/sbhs"; if (window.confirm("Are you sure you want to toggle the state?")) { var element = $(this); var board_class = element.attr("class"); diff --git a/templates/admin/testexp.html b/templates/admin/testexp.html index d9cbce9..c47adaa 100644 --- a/templates/admin/testexp.html +++ b/templates/admin/testexp.html @@ -13,6 +13,10 @@ padding: 15px; display: none; } + #log-data > span { + word-spacing: 5em; + margin-left: 3em; + } </style> <div class="container"> <div class="row"> @@ -71,7 +75,7 @@ </div> </div> <script> - var BASE_URL = window.location.origin; + var BASE_URL = window.location.origin + "/sbhs"; $("#tableId").on("click", "tr", function(e) { $("#tableId").find("tr.highlight").removeClass("highlight"); $(this).addClass("highlight"); @@ -214,7 +218,7 @@ if (data.status_code == 200) { console.log(data.message.logs.replace("/\n/g", "<br/>")); document.getElementById("username").innerHTML = "User : " + data.message.user; - document.getElementById("log-data").innerHTML = "<pre>Timestamp Heater Fan Temp</pre>" + data.message.logs.replace(new RegExp("\n","g"), "<br/>"); + document.getElementById("log-data").innerHTML = "<pre>Iteration Heater Fan Temp</pre><span>" + data.message.logs.replace(new RegExp("\n","g"), "</span><br/><span>") + "</span>"; } else { alert(data.status_code); |