From 23e999bbdeacb24f1a68d9971cd0e119be2e6cc8 Mon Sep 17 00:00:00 2001 From: "J.-S. Caux" <J.S.Caux@uva.nl> Date: Tue, 24 Jan 2017 10:44:27 +0100 Subject: [PATCH] Add webpage to Nomination, work on styling --- scipost/forms.py | 3 ++- scipost/models.py | 23 +++++++++++++++++++---- scipost/templates/scipost/VGM_detail.html | 2 +- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/scipost/forms.py b/scipost/forms.py index 39023c20f..1999004dd 100644 --- a/scipost/forms.py +++ b/scipost/forms.py @@ -384,7 +384,8 @@ class FeedbackForm(forms.ModelForm): class NominationForm(forms.ModelForm): class Meta: model = Nomination - fields = ['first_name', 'last_name', 'discipline', 'expertises'] + fields = ['first_name', 'last_name', + 'discipline', 'expertises', 'webpage'] def __init__(self, *args, **kwargs): super(NominationForm, self).__init__(*args, **kwargs) diff --git a/scipost/models.py b/scipost/models.py index 21e846774..4ac08a325 100644 --- a/scipost/models.py +++ b/scipost/models.py @@ -631,6 +631,7 @@ class Nomination(models.Model): expertises = ChoiceArrayField( models.CharField(max_length=10, choices=SCIPOST_SUBJECT_AREAS), blank=True, null=True) + webpage = models.URLField(default='') nr_A = models.PositiveIntegerField(default=0) in_agreement = models.ManyToManyField(Contributor, related_name='in_agreement_with_nomination', blank=True) @@ -650,14 +651,28 @@ class Nomination(models.Model): self.by) def as_li(self): - html = ('<div class="Nomination" id="nomination_id{{ nomination_id }}">' - '<h3><em> {{ name }}, nominated by {{ proposer }}</em></h3>' - '</div>') + html = ('<div class="Nomination" id="nomination_id{{ nomination_id }}" ' + 'style="background-color: #eeeeee;">' + '<div class="row">' + '<div class="col-4">' + '<h3><em> {{ name }}</em></h3>' + '<p>Nominated by {{ proposer }}</p>' + '</div>' + '<div class="col-4">' + '<p><a href="{{ webpage }}">Webpage</a></p>' + '<p>Discipline: {{ discipline }}</p></div>' + '<div class="col-4"><p>expertise:<ul>') + for exp in self.expertises: + html += '<li>%s</li>' % subject_areas_dict[exp] + html += '</ul></div></div></div>' context = Context({ 'nomination_id': self.id, 'proposer': '%s %s' % (self.by.user.first_name, self.by.user.last_name), - 'name': self.first_name + ' ' + self.last_name,}) + 'name': self.first_name + ' ' + self.last_name, + 'discipline': disciplines_dict[self.discipline], + 'webpage': self.webpage, + }) template = Template(html) return template.render(context) diff --git a/scipost/templates/scipost/VGM_detail.html b/scipost/templates/scipost/VGM_detail.html index e132d6e7f..b59393387 100644 --- a/scipost/templates/scipost/VGM_detail.html +++ b/scipost/templates/scipost/VGM_detail.html @@ -147,7 +147,7 @@ $(document).ready(function(){ </div> <div class="col-1"></div> <div class="col-10"> - <ul> + <ul style="list-style-type: none;"> {% for nomination in nominations %} <li> {{ nomination.as_li }} -- GitLab