Remove AceEditor

I cannot find the benifit to this over the base editor.

Tabs work, but that's pretty minimal.  And tabs don't work on GitLab or
GitHub, so I don't feel not having that is substantual to functionality.
This commit is contained in:
Sachi King 2017-04-24 23:35:04 +10:00
parent 8fa8fc4012
commit 8d77023aec
3 changed files with 1 additions and 51 deletions

View file

@ -9,7 +9,6 @@ class MonkeyPatchMiddleware(object):
def do_monkey_patch():
patch_speaker_profile_form()
patch_stripe_payment_form()
# Remove this function from existence
@ -17,18 +16,6 @@ def do_monkey_patch():
do_monkey_patch = lambda: None # noqa: E731
def patch_speaker_profile_form():
''' Replaces textarea widgets with markdown editors. '''
from . import widgets
from symposion.speakers.forms import SpeakerForm
fields = SpeakerForm.base_fields
fields["biography"].widget = widgets.AceMarkdownEditor()
fields["experience"].widget = widgets.AceMarkdownEditor()
fields["accessibility"].widget = widgets.AceMarkdownEditor()
def patch_stripe_payment_form(): # noqa: C901
import inspect # Oh no.

View file

@ -1,8 +1,6 @@
from django import forms
from pinaxcon import widgets
from .models import TalkProposal, TutorialProposal, MiniconfProposal
from pinaxcon.proposals.models import TalkProposal, TutorialProposal, MiniconfProposal
class ProposalForm(forms.ModelForm):
@ -35,12 +33,6 @@ class TalkProposalForm(ProposalForm):
"materials_release",
]
widgets = {
"abstract": widgets.AceMarkdownEditor(),
"private_abstract": widgets.AceMarkdownEditor(),
"technical_requirements": widgets.AceMarkdownEditor(),
}
class TutorialProposalForm(ProposalForm):
@ -59,12 +51,6 @@ class TutorialProposalForm(ProposalForm):
"materials_release",
]
widgets = {
"abstract": widgets.AceMarkdownEditor(),
"private_abstract": widgets.AceMarkdownEditor(),
"technical_requirements": widgets.AceMarkdownEditor(),
}
class MiniconfProposalForm(ProposalForm):
@ -76,9 +62,3 @@ class MiniconfProposalForm(ProposalForm):
"private_abstract",
"technical_requirements",
]
widgets = {
"abstract": widgets.AceMarkdownEditor(),
"private_abstract": widgets.AceMarkdownEditor(),
"technical_requirements": widgets.AceMarkdownEditor(),
}

View file

@ -1,17 +0,0 @@
from django import forms
class AceMarkdownEditor(forms.Textarea):
def render(self, name, value, attrs):
original = super(AceMarkdownEditor, self).render(name, value, attrs)
ret = '''
%s
<script>
window.addEventListener("load", () => {
editor = loadEditor("%s");
}, 0);
</script>
''' % (original, attrs["id"])
return ret