@ -0,0 +1,8 @@
import HTTP from './http';
document.querySelectorAll('.delete-document-button').forEach((deleteButton) => {
deleteButton.addEventListener('click', () => {
const documentId = deleteButton.getAttribute('data-delete-document-id');
HTTP.delete(`docs/${documentId}`).then(() => window.location.reload());
});
@ -17,6 +17,7 @@
<tr>
<th>#</th>
<th>Text</th>
<th></th>
</tr>
</thead>
<tbody>
@ -24,6 +25,16 @@
<td>{{ forloop.counter0|add:page_obj.start_index }}</td>
<td>{{ doc.text|truncatechars:200 }}</td>
<td>
<p class="control">
<button class="button is-text delete-document-button" data-delete-document-id="{{ doc.id }}">
<span class="icon is-small">
<i class="fas fa-trash"></i>
</span>
<span>Delete</span>
</button>
</p>
</td>
{% endfor %}
</tbody>
@ -34,6 +34,9 @@ class ProjectsView(LoginRequiredMixin, TemplateView):
class DatasetView(SuperUserMixin, LoginRequiredMixin, ListView):
template_name = 'dataset.html'
paginate_by = 5
extra_context = {
'bundle_name': 'dataset'
}
def get_queryset(self):
project = get_object_or_404(Project, pk=self.kwargs['project_id'])
@ -16,6 +16,7 @@ module.exports = {
'stats': './static/js/stats.js',
'label': './static/js/label.js',
'guideline': './static/js/guideline.js',
'dataset': './static/js/dataset.js',
'demo_text_classification': './static/js/demo/demo_text_classification.js',
'demo_named_entity': './static/js/demo/demo_named_entity.js',
'demo_translation': './static/js/demo/demo_translation.js',