Browse Source

Add project detail page

pull/10/head
Hironsan 6 years ago
parent
commit
8d7ec5ffb8
3 changed files with 84 additions and 1 deletions
  1. 70
      doccano/app/server/templates/project_detail.html
  2. 4
      doccano/app/server/urls.py
  3. 11
      doccano/app/server/views.py

70
doccano/app/server/templates/project_detail.html

@ -0,0 +1,70 @@
{% extends "base.html" %}
{% load static %}
{% block content %}
<section class="container" id="root">
<div class="columns">
<div class="column is-9">
<div class="box content">
<article class="post">
<h4>{{ object.name }}</h4>
<div class="media">
<div class="media-left">
<p class="image is-32x32">
<img src="http://bulma.io/images/placeholders/128x128.png">
</p>
</div>
<div class="media-content">
<div class="content">
<p>{{ object.description|truncatechars:200 }}</p>
<p>
<a href="#">@jsmith</a> created at {{ object.created_at|date }} &nbsp;
<span class="tag">Question</span>
</p>
</div>
</div>
<div class="media-right">
<span class="has-text-grey-light">
<i class="fa fa-comments"></i> 1</span>
</div>
</div>
</article>
</div>
</div>
<div class="column is-3">
<a class="button is-primary is-block is-alt is-large" href="#">New Project</a>
<aside class="menu">
<p class="menu-label">
Tags
</p>
<ul class="menu-list">
<li>
<span class="tag is-primary is-medium ">Dashboard</span>
</li>
<li>
<span class="tag is-link is-medium ">Customers</span>
</li>
<li>
<span class="tag is-light is-danger is-medium ">Authentication</span>
</li>
<li>
<span class="tag is-dark is-medium ">Payments</span>
</li>
<li>
<span class="tag is-success is-medium ">Transfers</span>
</li>
<li>
<span class="tag is-warning is-medium ">Balance</span>
</li>
<li>
<span class="tag is-medium ">Question</span>
</li>
</ul>
</aside>
</div>
</div>
</section>
{% endblock %}

4
doccano/app/server/urls.py

@ -1,9 +1,11 @@
from django.urls import path
from .views import AnnotationView, AnnotationAPIView, MetaInfoAPI, SearchAPI, ProjectListView
from .views import AnnotationView, AnnotationAPIView, MetaInfoAPI, SearchAPI
from .views import ProjectListView, ProjectDetailView
urlpatterns = [
path('', ProjectListView.as_view(), name='project-list'),
path('<int:pk>/', ProjectDetailView.as_view(), name='project-detail'),
path('<int:project_id>/docs', AnnotationView.as_view()),
path('<int:project_id>/apis/data', AnnotationAPIView.as_view()),
path('<int:project_id>/apis/label', MetaInfoAPI.as_view()),

11
doccano/app/server/views.py

@ -4,6 +4,7 @@ from django.http import JsonResponse
from django.shortcuts import render
from django.views import View
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from .models import Annotation, Label, RawData, Project
@ -84,3 +85,13 @@ class ProjectListView(ListView):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
return context
class ProjectDetailView(DetailView):
model = Project
template_name = 'project_detail.html'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
return context
Loading…
Cancel
Save