summaryrefslogtreecommitdiff
path: root/templates/admin/changeMID.html
diff options
context:
space:
mode:
Diffstat (limited to 'templates/admin/changeMID.html')
-rw-r--r--templates/admin/changeMID.html48
1 files changed, 45 insertions, 3 deletions
diff --git a/templates/admin/changeMID.html b/templates/admin/changeMID.html
index 784579d..5aff464 100644
--- a/templates/admin/changeMID.html
+++ b/templates/admin/changeMID.html
@@ -8,19 +8,61 @@
<div class="span12">
{% include "admin/sub_nav.html" %}
- Username: <input id="username" type="text">
+ Username: <br>
+
+ <input id="username" type="text" placeholder="Enter Username">
<br><br>
<select id="mid">
{% for mid in mid_count %}
- <option>
+ <option id = "{{ mid.board_id }}">
{{ mid.board__mid }}-{{mid.mcount}}
</option>
{% endfor %}
</select>
- <button class="btn btn-primary" onclick="updateMID()"> Update MID </button>
+ <br>
+ <button id="update-btn" class="btn btn-primary" onclick="updateMID()"> Update MID </button>
</div>
</div>
+
+ <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");
+
+ 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
+ }
+ });
+
+ request.done(function(data){
+ if(data.status_code == 200) {
+ alert(data.message);
+ location.reload();
+ }
+ else {
+ alert(data.message);
+ $("#update-btn").prop('disabled',false);
+ }
+ });
+
+
+ }
+
+ </script>
</div>
{% endblock %} \ No newline at end of file