Browse Source

add tags handling

master
Pascal Gloor 5 years ago
parent
commit
4cca6047b6
3 changed files with 92 additions and 15 deletions
  1. 77
    0
      etc/openapi.json
  2. 5
    14
      www/index.html
  3. 10
    1
      www/js/autodoc.js

+ 77
- 0
etc/openapi.json View File

} }
} }
} }
},
"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": {}, "parameters": {},
} }
], ],
"paths": { "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": { "/documents": {
"post": { "post": {
"summary": "Create a new document", "summary": "Create a new document",

+ 5
- 14
www/index.html View File

<!-- Tags --> <!-- Tags -->
<div class="container d-none" id="autodoc_tab_tags"> <div class="container d-none" id="autodoc_tab_tags">
<h3>Manage Tags</h3> <h3>Manage Tags</h3>
<div class="row">
<h5>Add Tags</h5>
</div>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<table class="table table-borderless"> <table class="table table-borderless">
<tbody> <tbody>
<tr> <tr>
<td> <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>
<td> <td>
<div class="btn-group" role="group"> <div class="btn-group" role="group">
</span> </span>
</button> </button>
</div> </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>
<td> <td>
<span id="autodoc_tag_result" class="badge badge-primary"></span> <span id="autodoc_tag_result" class="badge badge-primary"></span>

+ 10
- 1
www/js/autodoc.js View File

openapi: "/v1", openapi: "/v1",
pageinit: { pageinit: {
home: "page_load_home()", home: "page_load_home()",
upload: "page_load_upload()"
upload: "page_load_upload()",
tags: "page_load_tags()"
}, },
home: { home: {
width: 4, width: 4,
upload_status(); upload_status();
} }


function page_load_tags() {
// update tag list
$.getJSON(
conf.openapi +
"/tags"
)
}

function document_load() { function document_load() {
if (conf.home.curpage == 0) { if (conf.home.curpage == 0) {
$("#autodoc_home_body").html(""); $("#autodoc_home_body").html("");

Loading…
Cancel
Save