| @@ -166,6 +166,28 @@ | |||
| } | |||
| } | |||
| } | |||
| }, | |||
| "tags": { | |||
| "description": "Tag object", | |||
| "type": "object", | |||
| "properties": { | |||
| "id": { | |||
| "type": "string" | |||
| }, | |||
| "name": { | |||
| "type": "string" | |||
| }, | |||
| "color": { | |||
| "type": "string" | |||
| } | |||
| } | |||
| }, | |||
| "tagslist": { | |||
| "description": "array of tag objects", | |||
| "type": "array", | |||
| "items": { | |||
| "$ref": "#/components/schemas/tags" | |||
| } | |||
| } | |||
| }, | |||
| "parameters": {}, | |||
| @@ -182,6 +204,61 @@ | |||
| } | |||
| ], | |||
| "paths": { | |||
| "/tags": { | |||
| "get": { | |||
| "description": "Get tags list", | |||
| "responses": { | |||
| "200": { | |||
| "description": "OK", | |||
| "content": { | |||
| "application/json": { | |||
| "schema": { | |||
| "$ref": "#/components/schemas/tagslist" | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| }, | |||
| "/tags/{tagId}": { | |||
| "patch": { | |||
| "description": "Update a tag", | |||
| "parameters": [ | |||
| { | |||
| "name": "tagId", | |||
| "in": "path", | |||
| "required": true, | |||
| "schema": { | |||
| "type": "string" | |||
| } | |||
| } | |||
| ], | |||
| "responses": { | |||
| "200": { | |||
| "description": "OK" | |||
| } | |||
| } | |||
| }, | |||
| "delete": { | |||
| "description": "Delete a tag", | |||
| "parameters": [ | |||
| { | |||
| "name": "tagId", | |||
| "in": "path", | |||
| "required": true, | |||
| "schema": { | |||
| "type": "string" | |||
| } | |||
| } | |||
| ], | |||
| "responses": { | |||
| "200": { | |||
| "description": "OK" | |||
| } | |||
| } | |||
| } | |||
| }, | |||
| "/documents": { | |||
| "post": { | |||
| "summary": "Create a new document", | |||
| @@ -211,9 +211,6 @@ | |||
| <!-- Tags --> | |||
| <div class="container d-none" id="autodoc_tab_tags"> | |||
| <h3>Manage Tags</h3> | |||
| <div class="row"> | |||
| <h5>Add Tags</h5> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="col"> | |||
| <table class="table table-borderless"> | |||
| @@ -228,7 +225,11 @@ | |||
| <tbody> | |||
| <tr> | |||
| <td> | |||
| <input type="text" placeholder="Tag name" class="autodoc_tag_text"> | |||
| <select class="custom-select autodoc_tag_list"> | |||
| <option>Choose tag to edit</option> | |||
| </select> | |||
| <input type="text" placeholder="Tag name" class="autodoc_tag_text d-none"> | |||
| </td> | |||
| <td> | |||
| <div class="btn-group" role="group"> | |||
| @@ -297,16 +298,6 @@ | |||
| </span> | |||
| </button> | |||
| </div> | |||
| <!-- | |||
| <a href="#" class="autodoc_tag_color badge badge-primary" data="primary">0</a> | |||
| <a href="#" class="autodoc_tag_color badge badge-secondary" data="secondary">0</a> | |||
| <a href="#" class="autodoc_tag_color badge badge-success" data="success">0</a> | |||
| <a href="#" class="autodoc_tag_color badge badge-danger" data="danger">0</a> | |||
| <a href="#" class="autodoc_tag_color badge badge-warning" data="warning">0</a> | |||
| <a href="#" class="autodoc_tag_color badge badge-info" data="info">0</a> | |||
| <a href="#" class="autodoc_tag_color badge badge-light" data="light">0</a> | |||
| <a href="#" class="autodoc_tag_color badge badge-dark" data="dark">0</a> | |||
| --> | |||
| </td> | |||
| <td> | |||
| <span id="autodoc_tag_result" class="badge badge-primary"></span> | |||
| @@ -5,7 +5,8 @@ var conf = { | |||
| openapi: "/v1", | |||
| pageinit: { | |||
| home: "page_load_home()", | |||
| upload: "page_load_upload()" | |||
| upload: "page_load_upload()", | |||
| tags: "page_load_tags()" | |||
| }, | |||
| home: { | |||
| width: 4, | |||
| @@ -169,6 +170,14 @@ function page_load_upload() { | |||
| upload_status(); | |||
| } | |||
| function page_load_tags() { | |||
| // update tag list | |||
| $.getJSON( | |||
| conf.openapi + | |||
| "/tags" | |||
| ) | |||
| } | |||
| function document_load() { | |||
| if (conf.home.curpage == 0) { | |||
| $("#autodoc_home_body").html(""); | |||