-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from interrogator/correct
Corrections interface
- Loading branch information
Showing
46 changed files
with
2,785 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{% extends "jbase.html" %} | ||
{% load static %} | ||
{% load martortags %} | ||
{% block title %}buzzword: compare{% endblock %} | ||
{% block content %} | ||
|
||
<div style="margin-top:100px;"> | ||
|
||
{% if messages %} | ||
<ul class="messages"> | ||
{% for message in messages %} | ||
<div class="alert alert-dismissible fade show alert-{{ message.tags }}" role="alert">{{ message }} | ||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
</div> | ||
{% endfor %} | ||
</ul> | ||
{% endif %} | ||
|
||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-sm"> | ||
<div> | ||
<object data={{ pdf_filepath }} type="application/pdf" width="100%" height="400vh"> | ||
<embed src={{ pdf_filepath }} type="application/pdf" /> | ||
</object> | ||
{% include "comparenav.html" %} | ||
</div> | ||
</div> | ||
<div class="col-sm"> | ||
<form method="POST" enctype="multipart/form-data"> | ||
{% csrf_token %} | ||
<div style="height:400vh;"> | ||
{{ form.description }} | ||
<div class="float-right"> | ||
Describe your changes: | ||
{{ form.commit_msg }} | ||
<button type="submit" class="btn btn-primary">Update</button> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{% endblock %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<div class="pagination"> | ||
<span class="step-links" style="width:100%"> | ||
{% if page_obj.has_previous %} | ||
<a align='left' type='button' class='btn btn-primary' href="?page=1">« first</a> | ||
<a align='left' type='button' class='btn btn-primary' href="?page={{ page_obj.previous_page_number }}">previous</a> | ||
{% else %} | ||
<a align='left' type='button' disabled class='btn btn-primary'>« first</a> | ||
<a align='left' type='button' disabled class='btn btn-primary'">previous</a> | ||
{% endif %} | ||
|
||
<span class="current"> | ||
Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }} | ||
</span> | ||
|
||
{% if page_obj.has_next %} | ||
<a align='right' type='button' class='btn btn-primary float-right' href="?page={{ page_obj.paginator.num_pages }}">last »</a> | ||
<a align='right' type='button' class='btn btn-primary float-right' href="?page={{ page_obj.next_page_number }}">next</a> | ||
{% else %} | ||
<a align='right' type='button' disabled class='btn btn-primary float-right'>last »</a> | ||
<a align='right' type='button' disabled class='btn btn-primary float-right'>next</a> | ||
{% endif %} | ||
</span> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{% load static %}<!DOCTYPE html> | ||
<html lang="en-us"> | ||
<head> | ||
<title>{% block title %}buzzword{% endblock %}</title> | ||
<link href="{% static 'plugins/css/ace.min.css' %}" type="text/css" media="all" rel="stylesheet" /> | ||
<link href="{% static 'plugins/css/semantic.min.css' %}" type="text/css" media="all" rel="stylesheet" /> | ||
<link href="{% static 'plugins/css/resizable.min.css' %}" type="text/css" media="all" rel="stylesheet" /> | ||
<link href="{% static 'martor/css/martor.min.css' %}" type="text/css" media="all" rel="stylesheet" /> | ||
<link rel="stylesheet" href="{% static 'bootstrap.min.css' %}"/> | ||
<script type="text/javascript" src="{% static 'jquery.min.js' %}"></script> | ||
<script type="text/javascript" src="{% static 'bootstrap.min.js' %}"></script> | ||
<link rel="stylesheet" href="{% static 'custom.css' %}"/> | ||
</head> | ||
<body> | ||
{% include "nav.html" %} | ||
|
||
{% block content %}{% endblock %} | ||
|
||
<script type="text/javascript" src="{% static 'plugins/js/ace.js' %}"></script> | ||
<script type="text/javascript" src="{% static 'plugins/js/semantic.min.js' %}"></script> | ||
<script type="text/javascript" src="{% static 'plugins/js/mode-markdown.js' %}"></script> | ||
<script type="text/javascript" src="{% static 'plugins/js/ext-language_tools.js' %}"></script> | ||
<script type="text/javascript" src="{% static 'plugins/js/theme-github.js' %}"></script> | ||
<script type="text/javascript" src="{% static 'plugins/js/typo.js' %}"></script> | ||
<script type="text/javascript" src="{% static 'plugins/js/spellcheck.js' %}"></script> | ||
<script type="text/javascript" src="{% static 'plugins/js/highlight.min.js' %}"></script> | ||
<script type="text/javascript" src="{% static 'plugins/js/resizable.min.js' %}"></script> | ||
<script type="text/javascript" src="{% static 'plugins/js/emojis.min.js' %}"></script> | ||
<script type="text/javascript" src="{% static 'martor/js/martor.min.js' %}"></script> | ||
|
||
{% block js %}{% endblock %} | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from django.db import models | ||
from django.contrib import admin | ||
|
||
from martor.widgets import AdminMartorWidget | ||
from martor.models import MartorField | ||
|
||
from .models import Post | ||
|
||
|
||
class PostAdmin(admin.ModelAdmin): | ||
list_display = ["commit_msg", "description"] | ||
formfield_overrides = { | ||
MartorField: {"widget": AdminMartorWidget}, | ||
models.TextField: {"widget": AdminMartorWidget}, | ||
} | ||
|
||
|
||
admin.site.register(Post, PostAdmin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class CompareConfig(AppConfig): | ||
name = "compare" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from django import forms | ||
|
||
from martor.fields import MartorFormField | ||
from .models import Post | ||
|
||
|
||
class SubmitForm(forms.Form): | ||
description = MartorFormField() | ||
commit_msg = forms.CharField(widget=forms.TextInput()) | ||
|
||
|
||
class PostForm(forms.ModelForm): | ||
class Meta: | ||
model = Post | ||
fields = "__all__" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import os | ||
from .utils import _get_pdf_paths | ||
from .models import PDF | ||
from django.db import IntegrityError | ||
|
||
|
||
def load_pdfs(corpus): | ||
paths = _get_pdf_paths(corpus.slug) | ||
for i, path in enumerate(paths): | ||
name = os.path.basename(path) | ||
name = os.path.splitext(name)[0] | ||
pdf = PDF(name=name, num=i, path=path, slug=corpus.slug) | ||
try: | ||
pdf.save() | ||
print(f"Storing PDF in DB: {pdf.path}") | ||
except IntegrityError: | ||
print(f"PDF exists in DB: {pdf.path}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Generated by Django 3.0.6 on 2020-05-11 14:23 | ||
|
||
from django.db import migrations, models | ||
import martor.models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='OCRText', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('content', martor.models.MartorField()), | ||
('commit_msg', models.CharField(blank=True, max_length=255)), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Generated by Django 3.0.6 on 2020-05-11 17:17 | ||
|
||
from django.db import migrations, models | ||
import martor.models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('compare', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Post', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('title', models.CharField(max_length=200)), | ||
('description', martor.models.MartorField()), | ||
('wiki', martor.models.MartorField()), | ||
], | ||
), | ||
migrations.DeleteModel( | ||
name='OCRText', | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Generated by Django 3.0.6 on 2020-05-25 14:28 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('compare', '0002_auto_20200511_1717'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='PDF', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('slug', models.SlugField(max_length=255)), | ||
('path', models.TextField()), | ||
('name', models.CharField(max_length=200)), | ||
('num', models.IntegerField()), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 3.0.6 on 2020-05-25 14:46 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('compare', '0003_pdf'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterUniqueTogether( | ||
name='pdf', | ||
unique_together={('slug', 'num')}, | ||
), | ||
] |
Oops, something went wrong.