diff --git a/frontends/etiquette_flask/templates/tags.html b/frontends/etiquette_flask/templates/tags.html
index 9b89326..9103e69 100644
--- a/frontends/etiquette_flask/templates/tags.html
+++ b/frontends/etiquette_flask/templates/tags.html
@@ -3,7 +3,7 @@
{% import "header.html" as header %}
{% import "tag_object.html" as tag_object %}
- {% if specific is none %}
+ {% if specific_tag is none %}
{% if specific_tag is not none %}
-
{{specific_tag.name}}
-
{{specific_tag.description}}
+
+
+ {{-specific_tag.name-}}
+
+
+
+ {{-specific_tag.description-}}
+
{% endif %}
{% for tag in tags %}
@@ -182,5 +203,48 @@ function receive_callback(responses)
create_message_bubble(message_area, message_positivity, message_text, 8000);
}
}
+
+{% if specific_tag is not none %}
+function on_open(editor, edit_element_map)
+{
+ editor.open();
+ edit_element_map["name"].focus();
+}
+
+function on_save(editor, edit_element_map, display_element_map)
+{
+ var name_display = display_element_map["name"];
+ var name_editor = edit_element_map["name"];
+ var description_editor = edit_element_map["description"];
+
+ editor.show_spinner();
+ function callback(response)
+ {
+ console.log(response);
+ editor.hide_spinner();
+ if (response["_status"] == 200)
+ {
+ var new_name = response["name"];
+ var new_description = response["description"];
+ document.title = "Tag " + new_name;
+ window.history.replaceState(null, null, "/tag/" + new_name);
+ name_editor.value = new_name;
+ description_editor.value = new_description;
+ editor.save();
+ }
+ }
+
+ var url = "/tag/" + name_display.innerText + "/edit";
+ var data = new FormData();
+ data.append("name", name_editor.value);
+ data.append("description", description_editor.value);
+ post(url, data, callback);
+}
+on_cancel = undefined;
+
+var name_text = document.getElementById("name_text");
+var description_text = document.getElementById("description_text");
+var editor = new Editor([name_text, description_text], on_open, on_save, on_cancel);
+{% endif %}