Tuesday & Wednesday work (#30)
* Fixes an incorrect link in dashboard * Disables the symposion sponsors app * Adds redirect links for login/logout; adds THEME_CONTACT_EMAIL value * Re-adds colophon/copyright message. * Adds AceMarkdownEditor widget * Tidies up the generated HTML * Tidies up form snippet behaviour * Proposals forms now use the markdown editor * Monkey patches the markdown editor into the speaker form. * Adds missing field to proposal details * Fixes #10 — adds a link to random unreviewed proposals * Minor tweaks
This commit is contained in:
parent
feed83f517
commit
2cdb554623
15 changed files with 172 additions and 20 deletions
25
pinaxcon/monkey_patch.py
Normal file
25
pinaxcon/monkey_patch.py
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
class MonkeyPatchMiddleware(object):
|
||||||
|
''' Ensures that our monkey patching only gets called after it is safe to do so.'''
|
||||||
|
|
||||||
|
def process_request(self, request):
|
||||||
|
do_monkey_patch()
|
||||||
|
|
||||||
|
|
||||||
|
def do_monkey_patch():
|
||||||
|
patch_speaker_profile_form()
|
||||||
|
|
||||||
|
# Remove this function from existence
|
||||||
|
global do_monkey_patch
|
||||||
|
do_monkey_patch = lambda: None
|
||||||
|
|
||||||
|
|
||||||
|
def patch_speaker_profile_form():
|
||||||
|
''' Replaces textarea widgets with markdown editors. '''
|
||||||
|
|
||||||
|
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()
|
|
@ -1,5 +1,7 @@
|
||||||
from django import forms
|
from django import forms
|
||||||
|
|
||||||
|
from pinaxcon import widgets
|
||||||
|
|
||||||
from .models import TalkProposal, TutorialProposal, MiniconfProposal
|
from .models import TalkProposal, TutorialProposal, MiniconfProposal
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,6 +33,13 @@ 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):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -48,6 +57,13 @@ 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):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -58,3 +74,9 @@ class MiniconfProposalForm(ProposalForm):
|
||||||
"private_abstract",
|
"private_abstract",
|
||||||
"technical_requirements",
|
"technical_requirements",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
widgets = {
|
||||||
|
"abstract" : widgets.AceMarkdownEditor(),
|
||||||
|
"private_abstract" : widgets.AceMarkdownEditor(),
|
||||||
|
"technical_requirements" : widgets.AceMarkdownEditor(),
|
||||||
|
}
|
||||||
|
|
|
@ -114,6 +114,7 @@ MIDDLEWARE_CLASSES = [
|
||||||
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
||||||
'wagtail.wagtailcore.middleware.SiteMiddleware',
|
'wagtail.wagtailcore.middleware.SiteMiddleware',
|
||||||
'wagtail.wagtailredirects.middleware.RedirectMiddleware',
|
'wagtail.wagtailredirects.middleware.RedirectMiddleware',
|
||||||
|
'pinaxcon.monkey_patch.MonkeyPatchMiddleware',
|
||||||
]
|
]
|
||||||
|
|
||||||
ROOT_URLCONF = "pinaxcon.urls"
|
ROOT_URLCONF = "pinaxcon.urls"
|
||||||
|
@ -224,11 +225,13 @@ EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
|
||||||
ACCOUNT_OPEN_SIGNUP = True
|
ACCOUNT_OPEN_SIGNUP = True
|
||||||
ACCOUNT_EMAIL_UNIQUE = True
|
ACCOUNT_EMAIL_UNIQUE = True
|
||||||
ACCOUNT_EMAIL_CONFIRMATION_REQUIRED = False
|
ACCOUNT_EMAIL_CONFIRMATION_REQUIRED = False
|
||||||
ACCOUNT_LOGIN_REDIRECT_URL = "home"
|
ACCOUNT_LOGIN_REDIRECT_URL = "dashboard"
|
||||||
ACCOUNT_LOGOUT_REDIRECT_URL = "home"
|
ACCOUNT_LOGOUT_REDIRECT_URL = "/"
|
||||||
ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DAYS = 2
|
ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DAYS = 2
|
||||||
ACCOUNT_USE_AUTH_AUTHENTICATE = True
|
ACCOUNT_USE_AUTH_AUTHENTICATE = True
|
||||||
|
|
||||||
|
THEME_CONTACT_EMAIL = "team@hobart.lca2017.org"
|
||||||
|
|
||||||
AUTHENTICATION_BACKENDS = [
|
AUTHENTICATION_BACKENDS = [
|
||||||
"symposion.teams.backends.TeamPermissionsBackend",
|
"symposion.teams.backends.TeamPermissionsBackend",
|
||||||
"account.auth_backends.UsernameAuthenticationBackend",
|
"account.auth_backends.UsernameAuthenticationBackend",
|
||||||
|
|
|
@ -3,21 +3,20 @@
|
||||||
{% for field in form %}
|
{% for field in form %}
|
||||||
{% if not field.is_hidden %}
|
{% if not field.is_hidden %}
|
||||||
<div class="fieldWrapper">
|
<div class="fieldWrapper">
|
||||||
{% classname field.field.widget as widget %}
|
<div>
|
||||||
{% if widget != "CheckboxInput" %}
|
{% classname field.field.widget as widget %}
|
||||||
<h4><label for="{{ field.id_for_label }}">{{ field.label }}</label></h4>
|
{% if widget != "CheckboxInput" %}
|
||||||
{{ field.errors }}
|
<h4><label for="{{ field.id_for_label }}">{{ field.label }}</label></h4>
|
||||||
{{ field }}
|
{{ field.errors }}
|
||||||
{% else %}
|
{{ field }}
|
||||||
<label for="{{ field.id_for_label }}"><strong>{{ field.label }}</strong></label>
|
{% else %}
|
||||||
{{ field }}
|
<label for="{{ field.id_for_label }}"><strong>{{ field.label }}</strong></label>
|
||||||
{{ field.errors }}
|
{{ field }}
|
||||||
{% endif %}
|
{{ field.errors }}
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
{% if field.help_text %}
|
{% if field.help_text %}
|
||||||
{% if widget != "CheckboxInput" or not field.errors %}
|
|
||||||
<br />
|
|
||||||
{% endif %}
|
|
||||||
<span class="help_text">{{ field.help_text|safe }}</span>
|
<span class="help_text">{{ field.help_text|safe }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@
|
||||||
{% available_teams as available_teams %}
|
{% available_teams as available_teams %}
|
||||||
{% if user.memberships.exists or available_teams %}
|
{% if user.memberships.exists or available_teams %}
|
||||||
<div class="panel panel__compact panel__bg">
|
<div class="panel panel__compact panel__bg">
|
||||||
<div style="background-image: url('{% static "lca2017/images/hobart_bg.jpg" %}');" class="panel--bg"></div>
|
<div style="background-image: url('{% static "lca2017/images/hobart_bg_optimised.jpg" %}');" class="panel--bg"></div>
|
||||||
<div class="panel--content">
|
<div class="panel--content">
|
||||||
<div class="panel--2-3">
|
<div class="panel--2-3">
|
||||||
<h2>{% trans "Teams" %}</h2>
|
<h2>{% trans "Teams" %}</h2>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="description" content="">
|
<meta name="description" content="">
|
||||||
{% block viewport %}
|
{% block viewport %}
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
<title>{% block head_title_base %}{% if SITE_NAME %}{{ SITE_NAME }} | {% endif %}{% block head_title %}{% endblock %}{% endblock %}</title>
|
<title>{% block head_title_base %}{% if SITE_NAME %}{{ SITE_NAME }} | {% endif %}{% block head_title %}{% endblock %}{% endblock %}</title>
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
<header role="banner" class="l-header">
|
<header role="banner" class="l-header">
|
||||||
<div class="l-header--logo">
|
<div class="l-header--logo">
|
||||||
{% block site_brand %}
|
{% block site_brand %}
|
||||||
<img src="{% static 'lca2017/images/svgs/lca2017-website-logo.svg' %}" width="300px" />
|
<img src="{% static 'lca2017/images/svgs/lca2017-website-logo.svg' %}" width="100%"/>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
{% block nav %}
|
{% block nav %}
|
||||||
|
@ -94,6 +94,9 @@
|
||||||
<div class="l-footer--logos">
|
<div class="l-footer--logos">
|
||||||
<img src="{% static 'lca2017/images/HPE.jpg' %}" role="presentation">
|
<img src="{% static 'lca2017/images/HPE.jpg' %}" role="presentation">
|
||||||
<img src="{% static 'lca2017/images/IBM.jpg' %}" role="presentation"></div>
|
<img src="{% static 'lca2017/images/IBM.jpg' %}" role="presentation"></div>
|
||||||
|
|
||||||
|
<p class="lede">© 2016 linux.conf.au 2017 and Linux Australia. Linux is a registered trademark of Linus Torvalds. Site design by <a href="http://takeflight.com.au" >Takeflight</a>. Image credits can be found on our <a href="/about/colophon">Colophon</a>.</p>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</footer>
|
</footer>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -13,4 +13,7 @@
|
||||||
|
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="{% static 'lca2017/js/app.js' %}" type="text/javascript"></script>
|
<script src="{% static 'lca2017/js/app.js' %}" type="text/javascript"></script>
|
||||||
|
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
|
||||||
|
<script src="{% static 'lca2017/js/load_editors.js' %}" type="text/javascript"></script>
|
||||||
|
<script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.2.3/ace.js"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -46,6 +46,9 @@
|
||||||
<h4>{% trans "Speaker Experience" %}</h4>
|
<h4>{% trans "Speaker Experience" %}</h4>
|
||||||
<div class="biography">{{ proposal.speaker.experience_html|safe }} </div>
|
<div class="biography">{{ proposal.speaker.experience_html|safe }} </div>
|
||||||
|
|
||||||
|
<h4>{% trans "Speaker Accessibility Requirements" %}</h4>
|
||||||
|
<div class="biography">{{ proposal.speaker.accessibility_html|safe }} </div>
|
||||||
|
|
||||||
<h4>{% trans "Documents" %}</h4>
|
<h4>{% trans "Documents" %}</h4>
|
||||||
<div>
|
<div>
|
||||||
{% if proposal.supporting_documents.exists %}
|
{% if proposal.supporting_documents.exists %}
|
||||||
|
|
|
@ -76,9 +76,15 @@
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
<a class="list-group-item user-reviewed" href="{% url "user_reviewed" section.section.slug %}">
|
||||||
|
{% trans "Reviewed by you" %}
|
||||||
|
</a>
|
||||||
<a class="list-group-item user-not-reviewed" href="{% url "user_not_reviewed" section.section.slug %}">
|
<a class="list-group-item user-not-reviewed" href="{% url "user_not_reviewed" section.section.slug %}">
|
||||||
{% trans "Unreviewed by you" %}
|
{% trans "Unreviewed by you" %}
|
||||||
</a>
|
</a>
|
||||||
|
<a class="list-group-item user-random" href="{% url "user_random" section.section.slug %}">
|
||||||
|
{% trans "Random unreviewed proposal" %}
|
||||||
|
</a>
|
||||||
<a class="list-group-item voting-status" href="{% url "review_status" section.section.slug %}">
|
<a class="list-group-item voting-status" href="{% url "review_status" section.section.slug %}">
|
||||||
{% trans "Voting Status" %}
|
{% trans "Voting Status" %}
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -6,6 +6,13 @@
|
||||||
|
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<a class="btn btn-primary" href="{% url "user_random" proposal.section.slug %}">
|
||||||
|
{% trans "Jump to a random unreviewed proposal" %}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% if is_manager %}
|
{% if is_manager %}
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
<form class="result-form form-inline" method="POST" action="">
|
<form class="result-form form-inline" method="POST" action="">
|
||||||
|
@ -165,6 +172,13 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<a class="btn btn-primary" href="{% url "user_random" proposal.section.slug %}">
|
||||||
|
{% trans "Jump to a random unreviewed proposal" %}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block extra_script %}
|
{% block extra_script %}
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
{% extends "symposion/reviews/base.html" %}
|
{% extends "symposion/reviews/base.html" %}
|
||||||
|
|
||||||
|
|
||||||
{% block body_class %}{{ block.super }} review-list{% endblock %}
|
{% block body_class %}{{ block.super }}
|
||||||
|
{% if reviewed == "all_reviews" %}
|
||||||
|
review-list
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<h3>{{ section }}</h3>
|
<h3>{{ section }}</h3>
|
||||||
|
|
|
@ -21,7 +21,7 @@ urlpatterns = [
|
||||||
|
|
||||||
url(r"^speaker/", include("symposion.speakers.urls")),
|
url(r"^speaker/", include("symposion.speakers.urls")),
|
||||||
url(r"^proposals/", include("symposion.proposals.urls")),
|
url(r"^proposals/", include("symposion.proposals.urls")),
|
||||||
url(r"^sponsors/", include("symposion.sponsorship.urls")),
|
#url(r"^sponsors/", include("symposion.sponsorship.urls")),
|
||||||
url(r"^reviews/", include("symposion.reviews.urls")),
|
url(r"^reviews/", include("symposion.reviews.urls")),
|
||||||
url(r"^schedule/", include("symposion.schedule.urls")),
|
url(r"^schedule/", include("symposion.schedule.urls")),
|
||||||
|
|
||||||
|
|
16
pinaxcon/widgets.py
Normal file
16
pinaxcon/widgets.py
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
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
|
|
@ -1187,6 +1187,7 @@ table.alt tr:not(:last-of-type) {
|
||||||
-ms-flex-item-align: start;
|
-ms-flex-item-align: start;
|
||||||
align-self: flex-start;
|
align-self: flex-start;
|
||||||
display: none;
|
display: none;
|
||||||
|
margin-left: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.l-header--menu-opener {
|
.l-header--menu-opener {
|
||||||
|
|
53
static/src/lca2017/js/load_editors.js
Normal file
53
static/src/lca2017/js/load_editors.js
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
|
||||||
|
function setupEditor(editor, textarea) {
|
||||||
|
const session = editor.getSession();
|
||||||
|
//editor.setTheme('ace/theme/tomorrow');
|
||||||
|
editor.$blockScrolling = Infinity;
|
||||||
|
editor.setOption('scrollPastEnd', false);
|
||||||
|
session.setMode('ace/mode/markdown');
|
||||||
|
session.setValue(textarea.val());
|
||||||
|
session.setUseWrapMode(true);
|
||||||
|
session.on('change', () => {
|
||||||
|
textarea.val(session.getValue());
|
||||||
|
});
|
||||||
|
editor.renderer.setShowGutter(true);
|
||||||
|
session.setTabSize(4);
|
||||||
|
session.setUseSoftTabs(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setEditorSize(reportDiv, textArea)
|
||||||
|
{
|
||||||
|
var w = textArea.width();
|
||||||
|
var h = textArea.height();
|
||||||
|
var border = textArea.css("border");
|
||||||
|
|
||||||
|
reportDiv.width(w);
|
||||||
|
reportDiv.height(h);
|
||||||
|
|
||||||
|
reportDiv.css("position", "relative");
|
||||||
|
reportDiv.css("border", border);
|
||||||
|
textArea.css("display", "none");
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadEditor(id) {
|
||||||
|
var i = id;
|
||||||
|
var el = `#${i}`;
|
||||||
|
const editorId = `markdown-editor-${i}`;
|
||||||
|
const reportDiv = $('<div>').attr('id', editorId);
|
||||||
|
const $formGroup = $(el).closest('.form-group');
|
||||||
|
const $textarea = $(el);
|
||||||
|
|
||||||
|
$textarea.after(reportDiv);
|
||||||
|
editor = ace.edit(editorId);
|
||||||
|
|
||||||
|
setupEditor(editor, $textarea);
|
||||||
|
|
||||||
|
$textarea.resize(() => {
|
||||||
|
setEditorSize(reportDiv, $textarea);
|
||||||
|
editor.resize();
|
||||||
|
});
|
||||||
|
|
||||||
|
$textarea.resize();
|
||||||
|
|
||||||
|
return editor;
|
||||||
|
}
|
Loading…
Reference in a new issue