Skip to content

Commit 8c0eb4d

Browse files
authored
Merge pull request doccano#176 from CatalystCode/enhancement/remove-django-template-inheritance-from-admin
Enhancement/Remove Django template inheritance in admin pages
2 parents 1e7533e + df2bbe3 commit 8c0eb4d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1109
-1013
lines changed

app/server/models.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ def image(self):
3636
def get_bundle_name(self):
3737
raise NotImplementedError()
3838

39-
def get_upload_template(self):
39+
def get_bundle_name_upload(self):
4040
raise NotImplementedError()
4141

42-
def get_download_template(self):
42+
def get_bundle_name_download(self):
4343
raise NotImplementedError()
4444

4545
def get_annotation_serializer(self):
@@ -64,11 +64,11 @@ def image(self):
6464
def get_bundle_name(self):
6565
return 'document_classification'
6666

67-
def get_upload_template(self):
68-
return 'admin/upload/text_classification.html'
67+
def get_bundle_name_upload(self):
68+
return 'upload_text_classification'
6969

70-
def get_download_template(self):
71-
return 'admin/download/text_classification.html'
70+
def get_bundle_name_download(self):
71+
return 'download_text_classification'
7272

7373
def get_annotation_serializer(self):
7474
from .serializers import DocumentAnnotationSerializer
@@ -91,11 +91,11 @@ def image(self):
9191
def get_bundle_name(self):
9292
return 'sequence_labeling'
9393

94-
def get_upload_template(self):
95-
return 'admin/upload/sequence_labeling.html'
94+
def get_bundle_name_upload(self):
95+
return 'upload_sequence_labeling'
9696

97-
def get_download_template(self):
98-
return 'admin/download/sequence_labeling.html'
97+
def get_bundle_name_download(self):
98+
return 'download_sequence_labeling'
9999

100100
def get_annotation_serializer(self):
101101
from .serializers import SequenceAnnotationSerializer
@@ -118,11 +118,11 @@ def image(self):
118118
def get_bundle_name(self):
119119
return 'seq2seq'
120120

121-
def get_upload_template(self):
122-
return 'admin/upload/seq2seq.html'
121+
def get_bundle_name_upload(self):
122+
return 'upload_seq2seq'
123123

124-
def get_download_template(self):
125-
return 'admin/download/seq2seq.html'
124+
def get_bundle_name_download(self):
125+
return 'download_seq2seq'
126126

127127
def get_annotation_serializer(self):
128128
from .serializers import Seq2seqAnnotationSerializer

app/server/package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/server/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"dependencies": {
1717
"axios": "^0.18.0",
1818
"chart.js": "^2.7.2",
19+
"highlight.js": "^9.12.0",
1920
"marked": "^0.3.19",
2021
"swiper": "^4.3.3",
2122
"vue": "^2.5.16",

app/server/static/js/dataset.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

app/server/static/js/document_classification.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ hr {
4848
</style>
4949

5050
<script>
51-
import annotationMixin from './mixin';
51+
import { annotationMixin } from './mixin';
5252
import HTTP from './http';
5353
import { simpleShortcut } from './filter';
5454

app/server/static/js/download.pug

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
div.columns(v-cloak="")
2+
div.column.is-12
3+
messages(v-bind:messages="messages")
4+
5+
div.card
6+
7+
header.card-header
8+
p.card-header-title File Downloader
9+
10+
div.card-content
11+
h2.subtitle Download labeled data
12+
13+
div.control(style="margin-bottom: 1em;")
14+
block select-format-area
15+
16+
block example-format-area
17+
18+
button.button.is-primary(
19+
style="margin-top: 1em;"
20+
type="submit"
21+
v-on:click="download()"
22+
) Download
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import Vue from 'vue';
2+
import DownloadSeq2Seq from './download_seq2seq.vue';
3+
4+
new Vue({
5+
el: '#mail-app',
6+
7+
components: { DownloadSeq2Seq },
8+
9+
template: '<DownloadSeq2Seq />',
10+
});
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<template lang="pug">
2+
extends ./download.pug
3+
4+
block select-format-area
5+
label.radio
6+
input(
7+
type="radio"
8+
name="format"
9+
value="csv"
10+
v-bind:checked="format == 'csv'"
11+
v-model="format"
12+
)
13+
| CSV
14+
15+
label.radio
16+
input(
17+
type="radio"
18+
name="format"
19+
value="json"
20+
v-bind:checked="format == 'json'"
21+
v-model="format"
22+
)
23+
| JSONL
24+
25+
block example-format-area
26+
pre.code-block(v-show="format == 'csv'")
27+
code.csv
28+
include ./examples/download_seq2seq.csv
29+
| ...
30+
31+
pre.code-block(v-show="format == 'json'")
32+
code.json
33+
include ./examples/download_seq2seq.jsonl
34+
| ...
35+
</template>
36+
37+
<script>
38+
import { uploadMixin } from './mixin';
39+
40+
export default uploadMixin;
41+
</script>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import Vue from 'vue';
2+
import DownloadSequenceLabeling from './download_sequence_labeling.vue';
3+
4+
new Vue({
5+
el: '#mail-app',
6+
7+
components: { DownloadSequenceLabeling },
8+
9+
template: '<DownloadSequenceLabeling />',
10+
});
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<template lang="pug">
2+
extends ./download.pug
3+
4+
block select-format-area
5+
label.radio
6+
input(
7+
type="radio"
8+
name="format"
9+
value="json"
10+
v-bind:checked="format == 'json'"
11+
v-model="format"
12+
)
13+
| JSONL
14+
15+
block example-format-area
16+
pre.code-block(v-show="format == 'json'")
17+
code.json
18+
include ./examples/download_sequence_labeling.jsonl
19+
| ...
20+
</template>
21+
22+
<script>
23+
import { uploadMixin } from './mixin';
24+
25+
export default uploadMixin;
26+
</script>

0 commit comments

Comments
 (0)