Browse Source

Delete unused AnnotationView

pull/10/head
Hironsan 6 years ago
parent
commit
7e16c87990
4 changed files with 102 additions and 263 deletions
  1. 115
      doccano/app/server/templates/annotation.1.html
  2. 237
      doccano/app/server/templates/annotation.html
  3. 3
      doccano/app/server/urls.py
  4. 10
      doccano/app/server/views.py

115
doccano/app/server/templates/annotation.1.html

@ -1,115 +0,0 @@
{% extends "base.html" %} {% load static %} {% block header %}
<link rel="stylesheet" type="text/css" href="{% static 'inbox.css' %}"> {% endblock %} {% block content %}
<div class="columns" id="mail-app">
<aside class="column is-2 aside hero is-fullheight">
<div>
<aside class="menu">
<p class="menu-label" style="color:#f2f2f2;">
Progress
</p>
<ul class="menu-list">
<li>
<progress class="progress" v-bind:class="progressColor" v-bind:value="achievement" max="100">30%</progress>
</li>
<!--
<li class="level-right has-text-white">
[[ achievement ]]%
</li>
-->
</ul>
</aside>
<aside class="menu">
<p class="menu-label" style="color:#f2f2f2;">
Labels
</p>
<ul class="menu-list">
<div class="control" v-for="label in labels">
<li class="tags has-addons">
<span class="tag is-primary">[[label.shortcut]]</span>
<a class="tag is-grey" v-on:click="addLabel(label.text)" v-shortkey.once="['ctrl', [[ label.shortcut ]]]" @shortkey="addLabel(label.text)">[[label.text]]</a>
</li>
</div>
</ul>
</aside>
</div>
</aside>
<div class="column is-3 messages hero is-fullheight" id="message-feed">
<div class="field has-addons" style="margin:0 10px;">
<div class="control is-expanded">
<input class="input" type="text" placeholder="Find a document" v-model="searchQuery" @keyup.enter="submit">
</div>
<div class="control">
<a class="button is-primary">
<span class="icon is-small">
<i class="fas fa-search"></i>
</span>
</a>
</div>
</div>
<div class="inbox-messages" id="inbox-messages">
<div v-for="(msg, index) in items" class="card" v-bind:id="'msg-card-'+index" v-on:click="showMessage(index)" v-bind:data-preview-id="index">
<div class="card-content">
<div class="msg-header">
<span class="msg-from">
<div class="field is-grouped is-grouped-multiline">
<div class="control" v-for="(label, index) in msg.labels">
<div class="tags has-addons">
<span class="tag is-dark">
<button class="delete is-small" v-on:click="deleteLabel(index)"></button>
[[label.text]]
</span>
<span class="tag is-primary" v-if="label.prob">[[label.prob]]</span>
</div>
</div>
</div>
</span>
</div>
<div class="msg-snippet">
<p id="fake-snippet-1">[[ msg.text.slice(0, 100) ]]</p>
</div>
</div>
</div>
</div>
</div>
<div class="column is-7 message hero is-fullheight" id="message-pane">
<div class="action-buttons">
<div class="control is-grouped">
<a class="button is-small" v-on:click="prevPage" v-shortkey="['ctrl', 'p']" @shortkey="prevPage">
<i class="fa fa-chevron-left"></i>
</a>
<a class="button is-small" v-on:click="nextPage" v-shortkey="['ctrl', 'n']" @shortkey="nextPage">
<i class="fa fa-chevron-right"></i>
</a>
</div>
</div>
<div class="box message-preview">
<div class="top">
<div class="field is-grouped is-grouped-multiline">
<div class="control" v-for="(label, index) in items[cur].labels">
<div class="tags has-addons">
<span class="tag is-dark">
<button class="delete is-small" v-on:click="deleteLabel(index)"></button>
[[label.text]]
</span>
<span class="tag is-primary" v-if="label.prob">[[label.prob]]</span>
</div>
</div>
</div>
<hr>
<div class="content">
[[ message_body ]]
</div>
</div>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Faker/3.1.0/faker.min.js" integrity="sha256-QHdJObhDO++VITP6S4tMlDHRWMaUOk+s/xWIRgF/YY0="
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment.min.js" integrity="sha256-4PIvl58L9q7iwjT654TQJM+C/acEyoG738iL8B8nhXg="
crossorigin="anonymous"></script>
<script type="text/javascript" src="{% static 'main.js' %}"></script>
{% endblock %}

237
doccano/app/server/templates/annotation.html

@ -1,152 +1,115 @@
{% extends "base.html" %}
{% load static %}
{% extends "base.html" %} {% load static %} {% block header %}
<link rel="stylesheet" type="text/css" href="{% static 'inbox.css' %}"> {% endblock %} {% block content %}
<div class="columns" id="mail-app">
<aside class="column is-2 aside hero is-fullheight">
<div>
<aside class="menu">
<p class="menu-label" style="color:#f2f2f2;">
Progress
</p>
<ul class="menu-list">
<li>
<progress class="progress" v-bind:class="progressColor" v-bind:value="achievement" max="100">30%</progress>
</li>
<!--
<li class="level-right has-text-white">
[[ achievement ]]%
</li>
-->
</ul>
</aside>
<aside class="menu">
{% block content %}
<section class="container" id="root">
<div class="columns">
<div class="column is-8">
<tabs>
<tab name="Document" :selected="true">
<div class="box content">
<article class="post">
<h4>
<div class="field is-grouped is-grouped-multiline">
<div class="control" v-for="(label, index) in items[cur].labels">
<div class="tags has-addons">
<span class="tag is-grey">
<button class="delete is-small" v-on:click="deleteLabel(index)"></button>
[[label.text]]
</span>
<span class="tag is-primary" v-if="label.prob">[[label.prob]]</span>
</div>
</div>
</div>
</h4>
<div class="media">
<div class="media-content">
<div class="content">
<p>
[[ items[cur]['text'] ]]
</p>
</div>
</div>
</div>
</article>
</div>
<div class="is-clearfix ">
<div class="buttons has-addons is-left is-pulled-left">
<a class="button is-small" v-on:click="prevPage" :disabled="cur == 0">
<span class="icon">
<i class="fas fa-chevron-circle-left"></i>
</span>
<span>Prev</span>
</a>
</div>
<div class="buttons has-addons is-right">
<a class="button is-small" v-on:click="nextPage" :disabled="remaining == 1">
<span>Next</span>
<span class="icon">
<i class="fas fa-chevron-circle-right"></i>
</span>
</a>
</div>
</div>
</tab>
<tab name="Guideline">
<div class="box content">
<article class="post">
<h4>
Annotation Guideline
</h4>
<div class="media">
<div class="media-content">
<div class="content">
<p role="textbox" contenteditable="true">
[[ guideline ]]
</p>
</div>
</div>
</div>
</article>
<p class="menu-label" style="color:#f2f2f2;">
Labels
</p>
<ul class="menu-list">
<div class="control" v-for="label in labels">
<li class="tags has-addons">
<span class="tag is-primary">[[label.shortcut]]</span>
<a class="tag is-grey" v-on:click="addLabel(label.text)" v-shortkey.once="['ctrl', [[ label.shortcut ]]]" @shortkey="addLabel(label.text)">[[label.text]]</a>
</li>
</div> </div>
</tab>
</tabs>
</ul>
</aside>
</div>
</aside>
<div class="column is-3 messages hero is-fullheight" id="message-feed">
<div class="field has-addons" style="margin:0 10px;">
<div class="control is-expanded">
<input class="input" type="text" placeholder="Find a document" v-model="searchQuery" @keyup.enter="submit">
</div>
<div class="control">
<a class="button is-primary">
<span class="icon is-small">
<i class="fas fa-search"></i>
</span>
</a>
</div>
</div> </div>
<div class="column is-4">
<tabs>
<tab name="Annotation" :selected="true">
<div class="box content">
<aside class="menu" style="padding-top:0rem;">
<p class="menu-label" style="padding-left:0;">
Active Learning
</p>
<p>
<a class="button is-primary is-small" v-on:click="activeLearn">
<b>Do It!</b>
</a>
</p>
</aside>
<aside class="menu" style="padding-top:1.5rem;">
<p class="menu-label" style="padding-left:0;">
Progress
</p>
<p>
<a class="button is-info is-small" style="height:1.5em;">[[ total ]] in set</a>
<a class="button is-success is-small" style="height:1.5em;">[[ done ]] done</a>
<a class="button is-danger is-small" style="height:1.5em;">[[ remaining ]] remaining</a>
</p>
</aside>
<aside class="menu" style="padding-top:1.5rem;">
<p class="menu-label" style="padding-left:0;">
Tags
</p>
<div class="inbox-messages" id="inbox-messages">
<div v-for="(msg, index) in items" class="card" v-bind:id="'msg-card-'+index" v-on:click="showMessage(index)" v-bind:data-preview-id="index">
<div class="card-content">
<div class="msg-header">
<span class="msg-from">
<div class="field is-grouped is-grouped-multiline"> <div class="field is-grouped is-grouped-multiline">
<div class="control" v-for="label in labels">
<div class="control" v-for="(label, index) in msg.labels">
<div class="tags has-addons"> <div class="tags has-addons">
<a class="tag is-grey" v-on:click="addLabel(label.text)">[[label.text]]</a>
<span class="tag is-primary">[[label.shortcut]]</span>
<span class="tag is-dark">
<button class="delete is-small" v-on:click="deleteLabel(index)"></button>
[[label.text]]
</span>
<span class="tag is-primary" v-if="label.prob">[[label.prob]]</span>
</div> </div>
</div> </div>
</div> </div>
</aside>
</span>
</div> </div>
</tab>
<tab name="History">
<div class="box content">
<div class="field">
<label class="label">Search</label>
<div class="control">
<input class="input" type="text" placeholder="Text input" v-model="searchQuery" @keyup.enter="submit">
</div>
</div>
<div class="card" v-for="item in history">
<div class="card-content">
<div class="content">
<p>
[[ item['text'].slice(0, 100) ]]
</p>
<div class="tags">
<a class="tag is-grey" v-for="label in item.labels">[[ label.text ]]</a>
</div>
</div>
</div>
<div class="msg-snippet">
<p id="fake-snippet-1">[[ msg.text.slice(0, 100) ]]</p>
</div>
</div>
</div>
</div>
</div>
<div class="column is-7 message hero is-fullheight" id="message-pane">
<div class="action-buttons">
<div class="control is-grouped">
<a class="button is-small" v-on:click="prevPage" v-shortkey="['ctrl', 'p']" @shortkey="prevPage">
<i class="fa fa-chevron-left"></i>
</a>
<a class="button is-small" v-on:click="nextPage" v-shortkey="['ctrl', 'n']" @shortkey="nextPage">
<i class="fa fa-chevron-right"></i>
</a>
</div>
</div>
<div class="box message-preview">
<div class="top">
<div class="field is-grouped is-grouped-multiline">
<div class="control" v-for="(label, index) in items[cur].labels">
<div class="tags has-addons">
<span class="tag is-dark">
<button class="delete is-small" v-on:click="deleteLabel(index)"></button>
[[label.text]]
</span>
<span class="tag is-primary" v-if="label.prob">[[label.prob]]</span>
</div> </div>
</div> </div>
</tab>
</tabs>
</div>
<hr>
<div class="content">
[[ message_body ]]
</div>
</div>
</div> </div>
</div> </div>
</section>
<script type="text/javascript" src="{% static 'annotation.js' %}"></script>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Faker/3.1.0/faker.min.js" integrity="sha256-QHdJObhDO++VITP6S4tMlDHRWMaUOk+s/xWIRgF/YY0="
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment.min.js" integrity="sha256-4PIvl58L9q7iwjT654TQJM+C/acEyoG738iL8B8nhXg="
crossorigin="anonymous"></script>
<script type="text/javascript" src="{% static 'main.js' %}"></script>
{% endblock %} {% endblock %}

3
doccano/app/server/urls.py

@ -1,12 +1,11 @@
from django.urls import path from django.urls import path
from .views import AnnotationView, AnnotationAPIView, ProgressAPI, SearchAPI, InboxView
from .views import AnnotationAPIView, ProgressAPI, SearchAPI, InboxView
from .views import ProjectListView, ProjectAdminView, RawDataAPI, LabelAPI, DataDownloadAPI from .views import ProjectListView, ProjectAdminView, RawDataAPI, LabelAPI, DataDownloadAPI
urlpatterns = [ urlpatterns = [
path('', ProjectListView.as_view(), name='project-list'), path('', ProjectListView.as_view(), name='project-list'),
path('<int:pk>/admin', ProjectAdminView.as_view(), name='project-admin'), path('<int:pk>/admin', ProjectAdminView.as_view(), name='project-admin'),
#path('<int:project_id>/', AnnotationView.as_view(), name='annotation'),
path('<int:project_id>/download', DataDownloadAPI.as_view(), name='download'), path('<int:project_id>/download', DataDownloadAPI.as_view(), name='download'),
path('<int:project_id>/', InboxView.as_view(), name='annotation'), path('<int:project_id>/', InboxView.as_view(), name='annotation'),
path('<int:project_id>/apis/data', AnnotationAPIView.as_view()), path('<int:project_id>/apis/data', AnnotationAPIView.as_view()),

10
doccano/app/server/views.py

@ -10,15 +10,8 @@ from django.core.paginator import Paginator
from .models import Annotation, Label, Document, Project from .models import Annotation, Label, Document, Project
class AnnotationView(View):
template_name = 'annotation.html'
def get(self, request, *args, **kwargs):
return render(request, self.template_name)
class InboxView(View): class InboxView(View):
template_name = 'annotation.1.html'
template_name = 'annotation.html'
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
return render(request, self.template_name) return render(request, self.template_name)
@ -189,7 +182,6 @@ class ProjectAdminView(DetailView):
class DataDownloadAPI(View): class DataDownloadAPI(View):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
# j = {'hoge': 'fuga'}
annotated_docs = [a.as_dict() for a in Annotation.objects.filter(manual=True)] annotated_docs = [a.as_dict() for a in Annotation.objects.filter(manual=True)]
json_str = json.dumps(annotated_docs) json_str = json.dumps(annotated_docs)
response = HttpResponse(json_str, content_type='application/json') response = HttpResponse(json_str, content_type='application/json')

Loading…
Cancel
Save