Skip to content
Snippets Groups Projects
Commit 99789a0c authored by Dan Braghis's avatar Dan Braghis Committed by Todd Dembrey
Browse files

Use rich text for the review fields

parent f57479ca
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,8 @@ import json
from django import forms
from django.core.exceptions import ValidationError, NON_FIELD_ERRORS
from tinymce.widgets import TinyMCE
from .models import Review, RECOMMENDATION_CHOICES
......@@ -16,6 +18,23 @@ RATE_CHOICES = (
(99, 'n/a - choose not to answer'),
)
RICH_TEXT_WIDGET = TinyMCE(mce_attrs={
'elementpath': False,
'branding': False,
'toolbar1': 'undo redo | styleselect | bold italic | bullist numlist | link',
'style_formats': [
{'title': 'Headers', 'items': [
{'title': 'Header 1', 'format': 'h1'},
{'title': 'Header 2', 'format': 'h2'},
{'title': 'Header 3', 'format': 'h3'},
]},
{'title': 'Inline', 'items': [
{'title': 'Bold', 'icon': 'bold', 'format': 'bold'},
{'title': 'Italic', 'icon': 'italic', 'format': 'italic'},
{'title': 'Underline', 'icon': 'underline', 'format': 'underline'},
]},
],
})
class BaseReviewForm(forms.ModelForm):
class Meta:
......@@ -53,11 +72,11 @@ class ConceptReviewForm(BaseReviewForm):
help_text='Do you recommend requesting a proposal based on this concept note?'
)
recommendation_comments = forms.CharField(
widget=forms.Textarea(attrs={'rows': 5}),
widget=RICH_TEXT_WIDGET,
label='Recommendation comments'
)
principles = forms.CharField(
widget=forms.Textarea(attrs={'rows': 5}),
widget=RICH_TEXT_WIDGET,
label='Goals and principles',
help_text='Does the project contribute and/or have relevance to OTF goals and principles? '
'Are the goals and objectives of the project clear? Is it a technology research, development, or deployment project? '
......@@ -82,7 +101,7 @@ class ConceptReviewForm(BaseReviewForm):
)
technical = forms.CharField(
widget=forms.Textarea(attrs={'rows': 5}),
widget=RICH_TEXT_WIDGET,
label='Technical merit',
help_text='Does the project clearly articulate the technical problem, solution, and approach? '
'Is the problem clearly justifiable? Does the project clearly articulate the technological objectives? '
......@@ -109,7 +128,7 @@ class ConceptReviewForm(BaseReviewForm):
)
sustainable_rate = forms.ChoiceField(
choices=RATE_CHOICES,
label='Rate reasonable and realisti'
label='Rate reasonable and realistic'
)
comments = forms.CharField(
......
......@@ -4,12 +4,14 @@
<div class="wrapper wrapper--breakout wrapper--admin">
<div class="wrapper wrapper--medium">
<h2 class="heading heading--no-margin">Create Review</h2>
<h5>For: {{ submission.title }}</h5>
<h5>For <em>{{ submission.title }}</em></h5>
</div>
</div>
<div class="wrapper wrapper--large wrapper--inner-space-medium">
<form class="form form--with-p-tags" action="" method="post">{% csrf_token %}
<form class="form form--with-p-tags" action="" method="post">
{{ form.media }}
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Submit Review" />
</form>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment