Browse Source

post new tags

master
Pascal Gloor 5 years ago
parent
commit
dbcba713ff
1 changed files with 24 additions and 2 deletions
  1. 24
    2
      www/js/autodoc.js

+ 24
- 2
www/js/autodoc.js View File

@@ -86,8 +86,6 @@ $(document).ready(function () {
var tagName = $('.autodoc_tag_list').children("option:selected").html();
var tagColor = $('.autodoc_tag_list').children("option:selected").attr('data');

console.log(tagId, tagName, tagColor);

if ( tagId == "" ) {
$(".autodoc_tag_list").addClass('d-none');
$(".autodoc_tag_text").removeClass('d-none');
@@ -105,6 +103,30 @@ $(document).ready(function () {
}
});

// tag add button
$('.autodoc_tag_add').click(function(e) {
var tagId = $('.autodoc_tag_id').val();
var tagName = $('.autodoc_tag_text').val();
var tagColor = $('.autodoc_tag_color.active').attr('data').split('_').pop();
var url = conf.openapi + "/tags/";
var urlparam = "tagName=" + encodeURIComponent(tagName) + "&tagColor=" + encodeURIComponent(tagColor);
var method = "POST";

if ( tagId != "" ) {
method = "PATCH";
url += tagId;
}

$.ajax({
type: method,
url: url + '?' + urlparam,
success: function() {
console.log("OK");
}
});

});

// tag add color events
$('.autodoc_tag_color').click(function (e) {
var btn = e.target;

Loading…
Cancel
Save