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:
parent
8fa8fc4012
commit
8d77023aec
3 changed files with 1 additions and 51 deletions
|
@ -9,7 +9,6 @@ class MonkeyPatchMiddleware(object):
|
||||||
|
|
||||||
|
|
||||||
def do_monkey_patch():
|
def do_monkey_patch():
|
||||||
patch_speaker_profile_form()
|
|
||||||
patch_stripe_payment_form()
|
patch_stripe_payment_form()
|
||||||
|
|
||||||
# Remove this function from existence
|
# Remove this function from existence
|
||||||
|
@ -17,18 +16,6 @@ def do_monkey_patch():
|
||||||
do_monkey_patch = lambda: None # noqa: E731
|
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
|
def patch_stripe_payment_form(): # noqa: C901
|
||||||
|
|
||||||
import inspect # Oh no.
|
import inspect # Oh no.
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
from django import forms
|
from django import forms
|
||||||
|
|
||||||
from pinaxcon import widgets
|
from pinaxcon.proposals.models import TalkProposal, TutorialProposal, MiniconfProposal
|
||||||
|
|
||||||
from .models import TalkProposal, TutorialProposal, MiniconfProposal
|
|
||||||
|
|
||||||
|
|
||||||
class ProposalForm(forms.ModelForm):
|
class ProposalForm(forms.ModelForm):
|
||||||
|
@ -35,12 +33,6 @@ class TalkProposalForm(ProposalForm):
|
||||||
"materials_release",
|
"materials_release",
|
||||||
]
|
]
|
||||||
|
|
||||||
widgets = {
|
|
||||||
"abstract": widgets.AceMarkdownEditor(),
|
|
||||||
"private_abstract": widgets.AceMarkdownEditor(),
|
|
||||||
"technical_requirements": widgets.AceMarkdownEditor(),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class TutorialProposalForm(ProposalForm):
|
class TutorialProposalForm(ProposalForm):
|
||||||
|
|
||||||
|
@ -59,12 +51,6 @@ class TutorialProposalForm(ProposalForm):
|
||||||
"materials_release",
|
"materials_release",
|
||||||
]
|
]
|
||||||
|
|
||||||
widgets = {
|
|
||||||
"abstract": widgets.AceMarkdownEditor(),
|
|
||||||
"private_abstract": widgets.AceMarkdownEditor(),
|
|
||||||
"technical_requirements": widgets.AceMarkdownEditor(),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class MiniconfProposalForm(ProposalForm):
|
class MiniconfProposalForm(ProposalForm):
|
||||||
|
|
||||||
|
@ -76,9 +62,3 @@ class MiniconfProposalForm(ProposalForm):
|
||||||
"private_abstract",
|
"private_abstract",
|
||||||
"technical_requirements",
|
"technical_requirements",
|
||||||
]
|
]
|
||||||
|
|
||||||
widgets = {
|
|
||||||
"abstract": widgets.AceMarkdownEditor(),
|
|
||||||
"private_abstract": widgets.AceMarkdownEditor(),
|
|
||||||
"technical_requirements": widgets.AceMarkdownEditor(),
|
|
||||||
}
|
|
||||||
|
|
|
@ -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
|
|
Loading…
Reference in a new issue