diff --git a/SciPost_v1/settings/base.py b/SciPost_v1/settings/base.py index 62c8ff2aa6d133346ce7476f8fcb4e83617fbba7..05df150ab0683d6a9aa9999c7ec7d6f716d1fff5 100644 --- a/SciPost_v1/settings/base.py +++ b/SciPost_v1/settings/base.py @@ -276,6 +276,8 @@ JOURNALS_DIR = 'journals' CROSSREF_LOGIN_ID = '' CROSSREF_LOGIN_PASSWORD = '' +CROSSREF_DEBUG = True +CROSSREF_DEPOSIT_EMAIL = 'techsupport@scipost.org' DOAJ_API_KEY = '' # Google reCaptcha with Google's global test keys diff --git a/SciPost_v1/settings/local_JSC.py b/SciPost_v1/settings/local_JSC.py index 843fea24255bb1b2521b3144f4d0f173eb79d460..14b06d9ab44773b41532eee5147490c1cc7deb22 100644 --- a/SciPost_v1/settings/local_JSC.py +++ b/SciPost_v1/settings/local_JSC.py @@ -15,3 +15,4 @@ MAILCHIMP_API_KEY = get_secret("MAILCHIMP_API_KEY") # Logging LOGGING['handlers']['scipost_file_arxiv']['filename'] = '/Users/jscaux/Sites/SciPost.org/scipost_v1/local_files/logs/arxiv.log' LOGGING['handlers']['scipost_file_doi']['filename'] = '/Users/jscaux/Sites/SciPost.org/scipost_v1/local_files/logs/doi.log' +CROSSREF_DEPOSIT_EMAIL = 'jscaux@scipost.org' diff --git a/SciPost_v1/settings/local_jorran.py b/SciPost_v1/settings/local_jorran.py index b458216b2d898d444ce1e586d892d86c76c97410..0ca80ebb49d60854a148e3619d6d79bae6e0d078 100644 --- a/SciPost_v1/settings/local_jorran.py +++ b/SciPost_v1/settings/local_jorran.py @@ -30,3 +30,8 @@ ITHENTICATE_PASSWORD = get_secret('ITHENTICATE_PASSWORD') # Logging LOGGING['handlers']['scipost_file_arxiv']['filename'] = '/Users/jorranwit/Develop/SciPost/SciPost_v1/logs/arxiv.log' LOGGING['handlers']['scipost_file_doi']['filename'] = '/Users/jorranwit/Develop/SciPost/SciPost_v1/logs/doi.log' + +# Other +CROSSREF_LOGIN_ID = get_secret("CROSSREF_LOGIN_ID") +CROSSREF_LOGIN_PASSWORD = get_secret("CROSSREF_LOGIN_PASSWORD") +CROSSREF_DEPOSIT_EMAIL = 'jorrandewit@scipost.org' diff --git a/SciPost_v1/settings/production.py b/SciPost_v1/settings/production.py index 4d6bb7a6c1f88119eebe06c08b530fb341c53450..0b17f6fed8f94416e5f98d6117b838beda9c3820 100644 --- a/SciPost_v1/settings/production.py +++ b/SciPost_v1/settings/production.py @@ -36,6 +36,9 @@ SERVER_EMAIL = get_secret("SERVER_EMAIL") # Other CROSSREF_LOGIN_ID = get_secret("CROSSREF_LOGIN_ID") CROSSREF_LOGIN_PASSWORD = get_secret("CROSSREF_LOGIN_PASSWORD") +CROSSREF_DEBUG = False +CROSSREF_DEPOSIT_EMAIL = 'admin@scipost.org' + DOAJ_API_KEY = get_secret("DOAJ_API_KEY") HAYSTACK_CONNECTIONS['default']['PATH'] = '/home/scipost/webapps/scipost/SciPost_v1/whoosh_index' MAILCHIMP_API_USER = get_secret("MAILCHIMP_API_USER") diff --git a/SciPost_v1/settings/staging_release.py b/SciPost_v1/settings/staging_release.py index 6d8b1fed0ff69b3321cbbdbb96e0b8589aa8865d..bef469d83c25b8e9418898747d2057fa002aa0fd 100644 --- a/SciPost_v1/settings/staging_release.py +++ b/SciPost_v1/settings/staging_release.py @@ -20,7 +20,6 @@ MEDIA_ROOT = '/home/jdewit/webapps/scipost_media/' WEBPACK_LOADER['DEFAULT']['CACHE'] = True WEBPACK_LOADER['DEFAULT']['BUNDLE_DIR_NAME'] = '/home/jdewit/webapps/scipost_static/bundles/' - # Logging LOGGING['handlers']['scipost_file_arxiv']['filename'] = '/home/jdewit/webapps/scipost/logs/arxiv.log' LOGGING['handlers']['scipost_file_doi']['filename'] = '/home/jdewit/webapps/scipost/logs/doi.log' diff --git a/commentaries/templates/commentaries/commentary_detail.html b/commentaries/templates/commentaries/commentary_detail.html index 4d0160aa6a71bb8447f9fcb3fd1aed472e771f25..710c058dba581f1db8c6edccfc684991f0f0838e 100644 --- a/commentaries/templates/commentaries/commentary_detail.html +++ b/commentaries/templates/commentaries/commentary_detail.html @@ -21,7 +21,10 @@ <h3>Abstract:</h3> <p>{{ commentary.pub_abstract }}</p> -{% include 'scipost/comments_block.html' with comments=commentary.comments.vetted type_of_object='Commentary' %} +{% if commentary.comments.vetted %} + <hr class="divider"> + {% include 'scipost/comments_block.html' with comments=commentary.comments.vetted type_of_object='Commentary' %} +{% endif %} {% include 'comments/new_comment.html' with object_id=commentary.id type_of_object='commentary' open_for_commenting=commentary.open_for_commenting %} diff --git a/comments/models.py b/comments/models.py index 5410c48ffe73fc3ae9b174b69216fc497bb964e3..e138ca39ad2b9a7fefc8d3f7606207bdfc176df5 100644 --- a/comments/models.py +++ b/comments/models.py @@ -10,6 +10,7 @@ from guardian.shortcuts import assign_perm from scipost.behaviors import TimeStampedModel from scipost.models import Contributor +from commentaries.constants import COMMENTARY_PUBLISHED from .behaviors import validate_file_extension, validate_max_file_size from .constants import COMMENT_STATUS, STATUS_PENDING @@ -188,3 +189,64 @@ class Comment(TimeStampedModel): self.nr_N = self.in_notsure.count() self.nr_D = self.in_disagreement.count() self.save() + + @property + def relation_to_published(self): + """ + Check if the Comment relates to a SciPost-published object. + If it is, return a dict with info on relation to the published object, + based on Crossref's peer review content type. + """ + # Import here due to circular import errors + from submissions.models import Submission + from journals.models import Publication + from commentaries.models import Commentary + + to_object = self.core_content_object + if isinstance(to_object, Submission): + publication = Publication.objects.filter( + accepted_submission__arxiv_identifier_wo_vn_nr=to_object.arxiv_identifier_wo_vn_nr) + if publication: + relation = { + 'isReviewOfDOI': publication.doi_string, + 'stage': 'pre-publication', + 'title': 'Comment on ' + to_object.arxiv_identifier_w_vn_nr, + } + if self.is_author_reply: + relation['type'] = 'author-comment' + else: + relation['type'] = 'community-comment' + return relation + if isinstance(to_object, Commentary): + if to_object.type == COMMENTARY_PUBLISHED: + relation = { + 'isReviewOfDOI': to_object.pub_doi, + 'stage': 'post-publication', + 'title': 'Comment on ' + to_object.pub_doi, + } + if self.is_author_reply: + relation['type'] = 'author-comment' + relation['contributor_role'] = 'author' + else: + relation['type'] = 'community-comment' + relation['contributor_role'] = 'reviewer-external' + return relation + + return None + + @property + def citation(self): + citation = '' + if self.doi_string: + if self.anonymous: + citation += 'Anonymous, ' + else: + citation += '%s %s, ' % (self.author.user.first_name, self.author.user.last_name) + + if self.is_author_reply: + citation += 'SciPost Author Replies, ' + else: + citation += 'SciPost Comments, ' + citation += 'Delivered %s, ' % self.date_submitted.strftime('%Y-%m-%d') + citation += 'doi: %s' % self.doi_string + return citation diff --git a/comments/templates/comments/_comment_identifier.html b/comments/templates/comments/_comment_identifier.html index 2d518ecedeea4fe7dd83cdf87755bd40e115d019..5eb681610a2fd2e657a5d71fcea0a9d1656e16f3 100644 --- a/comments/templates/comments/_comment_identifier.html +++ b/comments/templates/comments/_comment_identifier.html @@ -17,7 +17,7 @@ <a href="{{comment.author.get_absolute_url}}">{{comment.author.user.first_name}} {{comment.author.user.last_name}}</a> on {{comment.date_submitted|date:'Y-m-d'}} {% endif %} - {% if comment.doi_string %} <small>doi: {{ comment.doi_string }}</small>{% endif %} + {% if comment.doi_string %} <small>{{ comment|citation }}</small>{% endif %} </h3> diff --git a/general.py b/general.py new file mode 100644 index 0000000000000000000000000000000000000000..5570b662718dd4458c5d43ddd33f02efb8df178d --- /dev/null +++ b/general.py @@ -0,0 +1,110 @@ +from django.conf.urls import url +from django.urls import reverse_lazy +from django.views.generic import TemplateView, RedirectView + +from journals import views as journals_views + +urlpatterns = [ + # Journals + url(r'^$', journals_views.journals, name='journals'), + url(r'scipost_physics', RedirectView.as_view(url=reverse_lazy('scipost:landing_page', + args=['SciPostPhys']))), + url(r'^journals_terms_and_conditions$', + TemplateView.as_view(template_name='journals/journals_terms_and_conditions.html'), + name='journals_terms_and_conditions'), + url(r'^crossmark_policy$', + TemplateView.as_view(template_name='journals/crossmark_policy.html'), + name='crossmark_policy'), + + # Editorial and Administrative Workflow + url(r'^initiate_publication$', + journals_views.initiate_publication, + name='initiate_publication'), + url(r'^validate_publication$', + journals_views.validate_publication, + name='validate_publication'), + url(r'^mark_first_author/(?P<publication_id>[0-9]+)/(?P<contributor_id>[0-9]+)$', + journals_views.mark_first_author, + name='mark_first_author'), + url(r'^mark_first_author_unregistered/(?P<publication_id>[0-9]+)/(?P<unregistered_author_id>[0-9]+)$', + journals_views.mark_first_author_unregistered, + name='mark_first_author_unregistered'), + url(r'^add_author/(?P<publication_id>[0-9]+)/(?P<contributor_id>[0-9]+)$', + journals_views.add_author, + name='add_author'), + url(r'^add_author/(?P<publication_id>[0-9]+)$', + journals_views.add_author, + name='add_author'), + url(r'^add_unregistered_author/(?P<publication_id>[0-9]+)/(?P<unregistered_author_id>[0-9]+)$', + journals_views.add_unregistered_author, + name='add_unregistered_author'), + url(r'^add_new_unreg_author/(?P<publication_id>[0-9]+)$', + journals_views.add_new_unreg_author, + name='add_new_unreg_author'), + url(r'^manage_metadata/(?P<doi_label>[a-zA-Z]+.[0-9]+.[0-9]+.[0-9]{3,})$', + journals_views.manage_metadata, + name='manage_metadata'), + url(r'^manage_metadata/(?P<issue_doi_label>[a-zA-Z]+.[0-9]+.[0-9]+)$', + journals_views.manage_metadata, + name='manage_metadata'), + url(r'^manage_metadata/$', + journals_views.manage_metadata, + name='manage_metadata'), + url(r'^create_citation_list_metadata/(?P<doi_label>[a-zA-Z]+.[0-9]+.[0-9]+.[0-9]{3,})$', + journals_views.create_citation_list_metadata, + name='create_citation_list_metadata'), + url(r'^create_funding_info_metadata/(?P<doi_label>[a-zA-Z]+.[0-9]+.[0-9]+.[0-9]{3,})$', + journals_views.create_funding_info_metadata, + name='create_funding_info_metadata'), + url(r'^add_associated_grant/(?P<doi_label>[a-zA-Z]+.[0-9]+.[0-9]+.[0-9]{3,})$', + journals_views.add_associated_grant, + name='add_associated_grant'), + url(r'^add_generic_funder/(?P<doi_label>[a-zA-Z]+.[0-9]+.[0-9]+.[0-9]{3,})$', + journals_views.add_generic_funder, + name='add_generic_funder'), + url(r'^create_metadata_xml/(?P<doi_label>[a-zA-Z]+.[0-9]+.[0-9]+.[0-9]{3,})$', + journals_views.create_metadata_xml, + name='create_metadata_xml'), + url(r'^metadata_xml_deposit/(?P<doi_label>[a-zA-Z]+.[0-9]+.[0-9]+.[0-9]{3,})/(?P<option>[a-z]+)$', + journals_views.metadata_xml_deposit, + name='metadata_xml_deposit'), + url(r'^mark_deposit_success/(?P<deposit_id>[0-9]+)/(?P<success>[0-1])$', + journals_views.mark_deposit_success, + name='mark_deposit_success'), + url(r'^produce_metadata_DOAJ/(?P<doi_label>[a-zA-Z]+.[0-9]+.[0-9]+.[0-9]{3,})$', + journals_views.produce_metadata_DOAJ, + name='produce_metadata_DOAJ'), + url(r'^metadata_DOAJ_deposit/(?P<doi_label>[a-zA-Z]+.[0-9]+.[0-9]+.[0-9]{3,})$', + journals_views.metadata_DOAJ_deposit, + name='metadata_DOAJ_deposit'), + url(r'^mark_doaj_deposit_success/(?P<deposit_id>[0-9]+)/(?P<success>[0-1])$', + journals_views.mark_doaj_deposit_success, + name='mark_doaj_deposit_success'), + url(r'^harvest_citedby_list/$', + journals_views.harvest_citedby_list, + name='harvest_citedby_list'), + url(r'^harvest_citedby_links/(?P<doi_label>[a-zA-Z]+.[0-9]+.[0-9]+.[0-9]{3,})$', + journals_views.harvest_citedby_links, + name='harvest_citedby_links'), + url(r'^sign_existing_report/(?P<report_id>[0-9]+)$', + journals_views.sign_existing_report, + name='sign_existing_report'), + url(r'^manage_report_metadata/$', + journals_views.manage_report_metadata, + name='manage_report_metadata'), + url(r'^manage_comment_metadata/$', + journals_views.manage_comment_metadata, + name='manage_comment_metadata'), + url(r'^mark_report_doi_needed/(?P<report_id>[0-9]+)/(?P<needed>[0-1])$', + journals_views.mark_report_doi_needed, + name='mark_report_doi_needed'), + url(r'^mark_comment_doi_needed/(?P<comment_id>[0-9]+)/(?P<needed>[0-1])$', + journals_views.mark_comment_doi_needed, + name='mark_comment_doi_needed'), + url(r'^generic_metadata_xml_deposit/(?P<type_of_object>[a-z]+)/(?P<object_id>[0-9]+)$', + journals_views.generic_metadata_xml_deposit, + name='generic_metadata_xml_deposit'), + url(r'^mark_generic_deposit_success/(?P<deposit_id>[0-9]+)/(?P<success>[0-1])$', + journals_views.mark_generic_deposit_success, + name='mark_generic_deposit_success'), +] diff --git a/journals/migrations/0004_auto_20180122_2109.py b/journals/migrations/0004_auto_20180122_2109.py new file mode 100644 index 0000000000000000000000000000000000000000..de58b2237846e33f49e27fca994656b72c05371a --- /dev/null +++ b/journals/migrations/0004_auto_20180122_2109.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2018-01-22 20:09 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('journals', '0003_auto_20180117_2323'), + ] + + operations = [ + migrations.AlterField( + model_name='publication', + name='accepted_submission', + field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='publication', to='submissions.Submission'), + ), + ] diff --git a/journals/models.py b/journals/models.py index aed5b5e22a65a8f5c4f47eaed84cc6400151ef6e..c443f7f99d6392a1096dca531aa9b2d75069c4bb 100644 --- a/journals/models.py +++ b/journals/models.py @@ -167,7 +167,8 @@ class Publication(models.Model): the actual publication file, author data, etc. etc. """ # Publication data - accepted_submission = models.OneToOneField('submissions.Submission', on_delete=models.CASCADE) + accepted_submission = models.OneToOneField('submissions.Submission', on_delete=models.CASCADE, + related_name='publication') in_issue = models.ForeignKey('journals.Issue', on_delete=models.CASCADE) paper_nr = models.PositiveSmallIntegerField() diff --git a/journals/templates/journals/manage_report_metadata.html b/journals/templates/journals/manage_report_metadata.html index cd2dce24d5ebcee24ff2c2c2860dec19c8319f3e..9d491ccecc3aa31612ba24beca5503d0e33114cf 100644 --- a/journals/templates/journals/manage_report_metadata.html +++ b/journals/templates/journals/manage_report_metadata.html @@ -21,13 +21,24 @@ event: "focusin" {% block content %} + <div class="rol"> + <div class="col-12"> + {% for page in reports.paginator.page_range %} + {% if forloop.counter != 1 %} | {% endif %} + <a href="?page={{ page }}">{{ page }}</a> + {% endfor %} + </div> + </div> + <table class="table table-hover mb-5"> <thead class="thead-default"> <tr> <th>Submission</th> + <th>Associated doi</th> <th>Report nr</th> - <th>Needs doi</th> + <th>Needs own doi</th> + <th>own doi</th> <th>Latest successful Crossref deposit</th> <th>Deposit needs updating?</th> </tr> @@ -37,13 +48,15 @@ event: "focusin" {% for report in reports %} <tr data-toggle="collapse" data-parent="#accordion" href="#collapse{{ report.id }}" aria-expanded="true" aria-controls="collapse{{ report.id }}" style="cursor: pointer;"> <td>{{ report.submission.arxiv_identifier_w_vn_nr }}</td> + <td>{{ report.associated_published_doi }}</td> <td>{{ report.report_nr }}</td> <td>{{ report.needs_doi }}</td> + <td>{{ report.doi_label }}</td> <td>{{ report|latest_successful_crossref_deposit_report }}</td> <td>{{ report.doideposit_needs_updating }}</td> </tr> <tr id="collapse{{ report.id }}" class="collapse" role="tabpanel" aria-labelledby="heading{{ report.id }}" style="background-color: #fff;"> - <td colspan="5"> + <td colspan="7"> <p><a href="{{ report.submission.get_absolute_url }}">{{ report.submission.arxiv_identifier_w_vn_nr }}</a>, <a href="{{ report.get_absolute_url }}">{{ report.report_nr }}</a></p> <h2 class="ml-3">Actions</h2> @@ -89,4 +102,15 @@ event: "focusin" </tbody> </table> + +<div class="rol"> + <div class="col-12"> + {% for page in reports.paginator.page_range %} + {% if forloop.counter != 1 %} | {% endif %} + <a href="?page={{ page }}">{{ page }}</a> + {% endfor %} + </div> +</div> + + {% endblock content %} diff --git a/journals/templates/journals/metadata_xml_deposit.html b/journals/templates/journals/metadata_xml_deposit.html index a6e405b3c01252b3b7b659446258325597ad1f30..0f40882d3e4f459ebd331fc81fcf12d3a708f4e8 100644 --- a/journals/templates/journals/metadata_xml_deposit.html +++ b/journals/templates/journals/metadata_xml_deposit.html @@ -28,6 +28,7 @@ <div class="row"> <div class="col-12"> + {% if errormessage %} <h2 class="text-danger">{{ errormessage }}</h2> {% endif %} @@ -38,7 +39,9 @@ </div> <h3 class="mt-3">Response text:</h3> - <p>{{ response_text|linebreaks }}</p> + <div> + <pre><code>{{ response_text|linebreaks }}</code></pre> + </div> <h3><a href="{{publication.get_absolute_url}}">return to the publication's page</a>, to the <a href="{% url 'journals:manage_metadata' %}">general metadata management page</a> or to <a href="{% url 'journals:manage_metadata' doi_label=publication.doi_label %}">this publication's metadata management page</a></h3> diff --git a/journals/views.py b/journals/views.py index 37ee5003c99fb32ea56d4288ec4061042e55e98a..06edc2905c7199c411b8dce3f7207e9d0adf349d 100644 --- a/journals/views.py +++ b/journals/views.py @@ -10,6 +10,7 @@ import xml.etree.ElementTree as ET from django.contrib.auth.decorators import login_required from django.contrib.contenttypes.models import ContentType +from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.core.urlresolvers import reverse from django.conf import settings from django.contrib import messages @@ -579,7 +580,7 @@ def create_metadata_xml(request, doi_label): '<timestamp>' + timezone.now().strftime('%Y%m%d%H%M%S') + '</timestamp>\n' '<depositor>\n' '<depositor_name>scipost</depositor_name>\n' - '<email_address>admin@scipost.org</email_address>\n' + '<email_address>' + settings.CROSSREF_DEPOSIT_EMAIL + '</email_address>\n' '</depositor>\n' '<registrant>scipost</registrant>\n' '</head>\n' @@ -949,7 +950,7 @@ def harvest_citedby_links(request, doi_label): 'xsi:schemaLocation="http://www.crossref.org/qschema/2.0 ' 'http://www.crossref.org/qschema/crossref_query_input2.0.xsd">' '<head>' - '<email_address>admin@scipost.org</email_address>' + '<email_address>' + settings.CROSSREF_DEPOSIT_EMAIL + '</email_address>' '<doi_batch_id>' + str(doi_batch_id) + '</doi_batch_id>' '</head>' '<body>' @@ -1057,6 +1058,16 @@ def manage_report_metadata(request): the metadata of Reports. """ reports = Report.objects.all() + paginator = Paginator(reports, 25) + + page = request.GET.get('page') + try: + reports = paginator.page(page) + except PageNotAnInteger: + reports = paginator.page(1) + except EmptyPage: + reports = paginator.page(paginator.num_pages) + context = { 'reports': reports, } @@ -1105,14 +1116,20 @@ def generic_metadata_xml_deposit(request, **kwargs): This method creates the metadata for non-Publication objects such as Reports and Comments, and deposits the metadata to Crossref. + If there exists a relation to a SciPost-published object, + the deposit uses Crossref's peer review content type. + Otherwise the deposit is done as a dataset. """ type_of_object = kwargs['type_of_object'] object_id = int(kwargs['object_id']) + if type_of_object == 'report': _object = get_object_or_404(Report, id=object_id) elif type_of_object == 'comment': _object = get_object_or_404(Comment, id=object_id) + relation_to_published = _object.relation_to_published + if not _object.doi_label: _object.create_doi_label() @@ -1123,37 +1140,86 @@ def generic_metadata_xml_deposit(request, **kwargs): salt = salt.encode('utf8') idsalt = str(_object)[:10] idsalt = idsalt.encode('utf8') - timestamp=timezone.now().strftime('%Y%m%d%H%M%S') + timestamp = timezone.now().strftime('%Y%m%d%H%M%S') doi_batch_id = hashlib.sha1(salt+idsalt).hexdigest() metadata_xml = ( '<?xml version="1.0" encoding="UTF-8"?>\n' - '<doi_batch version="4.4.0" xmlns="http://www.crossref.org/schema/4.4.0" ' + '<doi_batch version="4.4.1" xmlns="http://www.crossref.org/schema/4.4.1" ' 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' - 'xmlns:fr="http://www.crossref.org/fundref.xsd" ' - 'xsi:schemaLocation="http://www.crossref.org/schema/4.4.0 ' - 'http://www.crossref.org/shema/deposit/crossref4.4.0.xsd" ' - 'xmlns:ai="http://www.crossref.org/AccessIndicators.xsd">\n' + 'xsi:schemaLocation="http://www.crossref.org/schema/4.4.1 ' + 'http://www.crossref.org/shema/deposit/crossref4.4.1.xsd">\n' '<head>\n' '<doi_batch_id>' + str(doi_batch_id) + '</doi_batch_id>\n' '<timestamp>' + timestamp + '</timestamp>\n' '<depositor>\n' '<depositor_name>scipost</depositor_name>\n' - '<email_address>admin@scipost.org</email_address>\n' + '<email_address>' + settings.CROSSREF_DEPOSIT_EMAIL + '</email_address>\n' '</depositor>\n' '<registrant>scipost</registrant>\n' '</head>\n' - '<body>\n' - '<database>\n' - '<database_metadata language="en">\n' - '<titles><title>SciPost Reports and Comments</title></titles>\n' - '</database_metadata>\n' - '<dataset dataset_type="collection">\n' - '<doi_data><doi>' + _object.doi_string + '</doi>\n' - '<resource>https://scipost.org' + _object.get_absolute_url() + '</resource></doi_data>\n' - '</dataset></database>\n' - '</body></doi_batch>' + ) + if relation_to_published: + metadata_xml += ( + '<body>\n' + '<peer_review stage="' + relation_to_published['stage'] + '">\n' + '<contributors>' ) - if not settings.DEBUG: + if _object.anonymous: + metadata_xml += ( + '<anonymous sequence="first" contributor_role="' + + relation_to_published['contributor_role'] + '"/>' + ) + else: + metadata_xml += ( + '<person_name sequence="first" contributor_role="' + + relation_to_published['contributor_role'] + '">' + '<given_name>' + _object.author.user.first_name + '</given_name>' + '<surname>' + _object.author.user.last_name + '</surname>' + '</person_name>\n' + ) + + if isinstance(_object, Publication): + url_to_declare = 'https://scipost.org{}'.format(_object.get_absolute_url()) + else: + url_to_declare = 'https://scipost.org/{}'.format(_object.doi_label) + + metadata_xml += ( + '</contributors>\n' + '<titles><title>' + relation_to_published['title'] + '</title></titles>\n' + '<review_date>' + '<month>' + _object.date_submitted.strftime('%m') + '</month>' + '<day>' + _object.date_submitted.strftime('%d') + '</day>' + '<year>' + _object.date_submitted.strftime('%Y') + '</year>' + '</review_date>\n' + '<program xmlns="http://www.crossref.org/relations.xsd">\n' + '<related_item>' + '<description>' + relation_to_published['title'] + '</description>\n' + '<inter_work_relation relationship-type="isReviewOf" identifier-type="doi">' + + relation_to_published['isReviewOfDOI'] + '</inter_work_relation></related_item>\n' + '</program>' + '<doi_data><doi>' + _object.doi_string + '</doi>\n' + '<resource>' + url_to_declare + + '</resource></doi_data>\n' + '</peer_review>\n' + '</body>\n' + '</doi_batch>\n' + ) + else: + metadata_xml += ( + '<body>\n' + '<database>\n' + '<database_metadata language="en">\n' + '<titles><title>SciPost Reports and Comments</title></titles>\n' + '</database_metadata>\n' + '<dataset dataset_type="collection">\n' + '<doi_data><doi>' + _object.doi_string + '</doi>\n' + '<resource>https://scipost.org' + _object.get_absolute_url() + + '</resource></doi_data>\n' + '</dataset></database>\n' + '</body></doi_batch>' + ) + + if not settings.CROSSREF_DEBUG: # CAUTION: Debug is False, production goes for real deposit!!! url = 'http://doi.crossref.org/servlet/deposit' else: @@ -1201,6 +1267,21 @@ def mark_generic_deposit_success(request, deposit_id, success): # Viewing # ########### +def report_detail(request, doi_label): + report = get_object_or_404(Report.objects.accepted(), doi_label=doi_label) + return redirect(report.get_absolute_url()) + + +def comment_detail(request, doi_label): + comment = get_object_or_404(Comment.objects.vetted().regular_comments(), doi_label=doi_label) + return redirect(comment.get_absolute_url()) + + +def author_reply_detail(request, doi_label): + comment = get_object_or_404(Comment.objects.vetted().author_replies(), doi_label=doi_label) + return redirect(comment.get_absolute_url()) + + def publication_detail(request, doi_label): publication = Publication.objects.get_published(doi_label=doi_label) journal = publication.in_issue.in_volume.in_journal diff --git a/scipost/static/scipost/SciPost.css b/scipost/static/scipost/SciPost.css index 59a65ec9ace010ea561c03571b2d1dc1cf80645e..44e1b4c27a9f5f124ba0bfed164a4ffca84c4685 100644 --- a/scipost/static/scipost/SciPost.css +++ b/scipost/static/scipost/SciPost.css @@ -486,32 +486,6 @@ table.tablePadded10 td { background-color: #990000; } -.reportRatings { - font-family: 'Merriweather Sans'; - font-size: 11px; - margin: 0 4px; - padding: 0; - display: inline-block; - box-shadow: 0 1px 0 1px #ccc; - background: #f4f4f4; -} -.reportRatings ul { - display: inline-block; - font-family: 'Merriweather Sans'; - margin: 0; - padding: 2px 1px; -} -.reportRatings ul li { - border: 1px solid #002b49; - display: inline-block; - font-family: 'Merriweather Sans'; - margin: 0 3px; - padding: 4px 7px; - border-radius: 1px; - background-color: #f1f1f1; -} - - article { background-color:#eeeeee; border: 1px solid grey; border-radius:5px; diff --git a/scipost/static/scipost/assets/css/_reports.scss b/scipost/static/scipost/assets/css/_reports.scss new file mode 100644 index 0000000000000000000000000000000000000000..871bb5accdaf88fc863fe537b54214286203a04a --- /dev/null +++ b/scipost/static/scipost/assets/css/_reports.scss @@ -0,0 +1,42 @@ +.report { + ul.clickables { + display: inline-block; + list-style: none; + margin: 0.5rem 0 0 0; + padding: 0; + + li { + padding: 0 0 0.25rem 0; + } + + .citation { + font-style: italic; + } + } + + .comment { + margin-top: 1rem; + } +} + + +.ratings { + background-color: #f4f4f4; + display: inline-block; + border: 1px solid #ddd; + text-transform: capitalize; + + > ul { + list-style: none; + display: flex; + padding: 0; + margin: 0; + + li { + border: 1px solid #ddd; + margin: 2px 2px; + padding: 0.25rem 0.5rem; + background: $body-bg; + } + } +} diff --git a/scipost/static/scipost/assets/css/_submissions.scss b/scipost/static/scipost/assets/css/_submissions.scss index 3dae5291ec7064cdbdbe6ec349c416222af1106b..f41deda48852a0f3e890647e5527955234e42e60 100644 --- a/scipost/static/scipost/assets/css/_submissions.scss +++ b/scipost/static/scipost/assets/css/_submissions.scss @@ -17,7 +17,7 @@ table.submission_header { box-shadow: 0 1px 0 0 $card-shadow-color; border: 1px solid; border-color: $card-grey-border-color; - z-index: -1; + z-index: 1; border-radius: $border-radius 0 $border-radius $border-radius; } @@ -37,34 +37,6 @@ table.submission_header { } } -.reportRatings { - font-size: 10px; - margin: 0.5rem 0 1rem; - padding: 0.3rem 0.5rem 0.4rem; - display: inline-block; - box-shadow: 0 1px 0 0 #ccc; - background: #f9f9f9; - border: 1px solid; - border-color: #ececec #ececec #d0d1d5; - border-radius: 2px; - - ul { - margin: 0; - padding: 0; - - li { - border: 1px solid; - display: inline-block; - margin: 0.1rem; - padding: 0.25rem 0.5rem; - border-color: #e5e6e9 #dfe0e4 #d0d1d5; - border-radius: 2px; - background: #fff; - box-shadow: 0 1px 0 0 #ccc; - } - } -} - .required-actions { padding: 0.5rem; background-color: $red; diff --git a/scipost/static/scipost/assets/css/_type.scss b/scipost/static/scipost/assets/css/_type.scss index 52798b0cc849833716e0725dcdda5b0687be69a6..f6eef699ad9eada0e0f37bebe7f9b58259e326c0 100644 --- a/scipost/static/scipost/assets/css/_type.scss +++ b/scipost/static/scipost/assets/css/_type.scss @@ -67,10 +67,9 @@ h5 { } .highlight { - background-color: #f4f4f4; + background-color: $body-bg; border-radius: $card-border-radius; - border: 1px solid #ececec; - box-shadow: 0 1px 0 0 $card-shadow-color; + border: 1px solid #ddd; &.tight { display: inline-block; @@ -119,6 +118,18 @@ hr.hr12 { &.small { height: 1px; } + + &.divider { + height: 10px; + border-radius: 0; + background-color: $body-bg; + margin-left: -$grid-gutter-width; + margin-right: -$grid-gutter-width; + margin-top: 1.5rem; + margin-bottom: 1.5rem; + box-shadow: none; + width: auto; + } } .text-blue { diff --git a/scipost/static/scipost/assets/css/scipost-physics.scss b/scipost/static/scipost/assets/css/scipost-physics.scss index 816d3a46be9e8b8e21cd44e3bc375fee10233b2b..381822f4dfd9e0796319f1ec57093e9eb95c18a5 100644 --- a/scipost/static/scipost/assets/css/scipost-physics.scss +++ b/scipost/static/scipost/assets/css/scipost-physics.scss @@ -32,7 +32,7 @@ &.active { color: #002b49; background: rgba(255, 255, 255, 0.5); - box-shadow: 0 1px 0 0 #ccc; + box-shadow: 0 1px 0 0 #ddd; } } } diff --git a/scipost/static/scipost/assets/css/style.scss b/scipost/static/scipost/assets/css/style.scss index ddd9fc91b2ca14722ee634cfe12ee1f75cb090a8..6e6fca92a968ba2d2d382a858ba4c5e410042741 100644 --- a/scipost/static/scipost/assets/css/style.scss +++ b/scipost/static/scipost/assets/css/style.scss @@ -48,6 +48,7 @@ @import "icons"; @import "journals"; @import "personal_page"; +@import "reports"; @import "submissions"; diff --git a/scipost/templates/scipost/comments_block.html b/scipost/templates/scipost/comments_block.html index bc60d0b67be828c920578e4ae16aa2194351bb3c..d3fa22a5a38ba0bf1a51739ff35d9ebc1250258e 100644 --- a/scipost/templates/scipost/comments_block.html +++ b/scipost/templates/scipost/comments_block.html @@ -1,19 +1,19 @@ {% if comments %} -<hr> -<div class="row"> - <div class="col-12"> - <div class="card card-grey"> - <div class="card-body"> - <h2 class="card-title mb-0">Comments{% if type_of_object %} on this {{type_of_object}}{% endif %}</h2> - <a href="javascript:;" data-toggle="toggle" data-target="#commentslist">Toggle comments view</a> + + <div class="row"> + <div class="col-12"> + <div class="card card-grey"> + <div class="card-body"> + <h2 class="card-title mb-0">Comments{% if type_of_object %} on this {{type_of_object}}{% endif %}</h2> + <a href="javascript:;" data-toggle="toggle" data-target="#commentslist">Toggle comments view</a> + </div> </div> </div> </div> -</div> -<div id="commentslist"> - {% for comment in comments %} - {% include 'comments/_single_comment_with_link.html' with comment=comment perms=perms user=request.user %} - {% endfor %} -</div> + <div id="commentslist"> + {% for comment in comments %} + {% include 'comments/_single_comment_with_link.html' with comment=comment perms=perms user=request.user %} + {% endfor %} + </div> {% endif %} diff --git a/scipost/urls.py b/scipost/urls.py index 102f794c0ffad8e8266a6a5c290672e5c85864ef..3c8fb02160d11ca9f26401a791166ca34be9bffb 100644 --- a/scipost/urls.py +++ b/scipost/urls.py @@ -194,6 +194,30 @@ urlpatterns = [ # Publications # ################ + # Reports + url(r'^(?P<doi_label>SciPost.Report.[0-9]+)$', + journals_views.report_detail, + name='report_detail'), + url(r'^10.21468/(?P<doi_label>SciPost.Report.[0-9]+)$', + journals_views.report_detail, + name='report_detail'), + + # Comments + url(r'^(?P<doi_label>SciPost.Comment.[0-9]+)$', + journals_views.comment_detail, + name='comment_detail'), + url(r'^10.21468/(?P<doi_label>SciPost.Comment.[0-9]+)$', + journals_views.comment_detail, + name='comment_detail'), + + # Author Replies + url(r'^(?P<doi_label>SciPost.AuthorReply.[0-9]+)$', + journals_views.author_reply_detail, + name='author_reply_detail'), + url(r'^10.21468/(?P<doi_label>SciPost.AuthorReply.[0-9]+)$', + journals_views.author_reply_detail, + name='author_reply_detail'), + # Publication detail (+pdf) url(r'^10.21468/(?P<doi_label>[a-zA-Z]+.[0-9]+.[0-9]+.[0-9]{3,})$', journals_views.publication_detail, diff --git a/submissions/admin.py b/submissions/admin.py index 0f52fe45e9c9a0c93e0579f4b2e6f1ce8ca05596..0466fba0ced8fc05b6e32063d5ef07e9deb1ed97 100644 --- a/submissions/admin.py +++ b/submissions/admin.py @@ -184,7 +184,7 @@ class ReportAdminForm(forms.ModelForm): class ReportAdmin(admin.ModelAdmin): search_fields = ['author__user__last_name', 'submission'] - list_display = ('author', 'status', submission_short_title, 'date_submitted', ) + list_display = ('author', 'status', 'doi_label', submission_short_title, 'date_submitted', ) list_display_links = ('author',) date_hierarchy = 'date_submitted' list_filter = ('status',) diff --git a/submissions/models.py b/submissions/models.py index 953b6306933a01e8847b77892e2e86535636c9ed..3d316660ecc68d44b58454d0cc7e36183fab53ee 100644 --- a/submissions/models.py +++ b/submissions/models.py @@ -487,8 +487,7 @@ class Report(SubmissionRelatedObjectMixin, models.Model): def doi_string(self): if self.doi_label: return '10.21468/' + self.doi_label - else: - return None + return '' @cached_property def title(self): @@ -498,7 +497,7 @@ class Report(SubmissionRelatedObjectMixin, models.Model): """ return self.submission.title - @cached_property + @property def is_followup_report(self): """ Check if current Report is a `FollowupReport`. A Report is a `FollowupReport` if the @@ -508,6 +507,16 @@ class Report(SubmissionRelatedObjectMixin, models.Model): submission__arxiv_identifier_wo_vn_nr=self.submission.arxiv_identifier_wo_vn_nr, submission__arxiv_vn_nr__lt=self.submission.arxiv_vn_nr).exists()) + def save(self, *args, **kwargs): + # Control Report count per Submission. + if not self.report_nr: + self.report_nr = self.submission.reports.count() + 1 + return super().save(*args, **kwargs) + + def create_doi_label(self): + self.doi_label = 'SciPost.Report.' + str(self.id) + self.save() + def latest_report_from_series(self): """ Get latest Report from the same author for the Submission series. @@ -517,6 +526,55 @@ class Report(SubmissionRelatedObjectMixin, models.Model): .order_by('submission__arxiv_identifier_wo_vn_nr').last()) + @property + def associated_published_doi(self): + """ + Check if the Report relates to a SciPost-published object. + If it is, return the doi of the published object. + """ + try: + publication = Publication.objects.get( + accepted_submission__arxiv_identifier_wo_vn_nr=self.submission.arxiv_identifier_wo_vn_nr) + except Publication.DoesNotExist: + return None + return publication.doi_string + + @property + def relation_to_published(self): + """ + Check if the Report relates to a SciPost-published object. + If it is, return a dict with info on relation to the published object, + based on Crossref's peer review content type. + """ + try: + publication = Publication.objects.get( + accepted_submission__arxiv_identifier_wo_vn_nr=self.submission.arxiv_identifier_wo_vn_nr) + except Publication.DoesNotExist: + return None + + relation = { + 'isReviewOfDOI': publication.doi_string, + 'stage': 'pre-publication', + 'type': 'referee-report', + 'title': 'Report on ' + self.submission.arxiv_identifier_w_vn_nr, + 'contributor_role': 'reviewer', + } + return relation + + @property + def citation(self): + citation = '' + if self.doi_string: + if self.anonymous: + citation += 'Anonymous, ' + else: + citation += '%s %s, ' % (self.author.user.first_name, self.author.user.last_name) + citation += 'Report on arXiv:%s, ' % self.submission.arxiv_identifier_w_vn_nr + citation += 'delivered %s, ' % self.date_submitted.strftime('%Y-%m-%d') + citation += 'doi: %s' % self.doi_string + return citation + + ########################## # EditorialCommunication # ########################## diff --git a/submissions/templates/submissions/_single_public_report_without_comments.html b/submissions/templates/submissions/_single_public_report_without_comments.html index 5f0a3cf451b00d72550a7e9da77a25270fbf617c..cd14902fb992c60cbd8637ef23a32ae738648149 100644 --- a/submissions/templates/submissions/_single_public_report_without_comments.html +++ b/submissions/templates/submissions/_single_public_report_without_comments.html @@ -7,18 +7,30 @@ {% if user.contributor == submission.editor_in_charge or user|is_in_group:'Editorial Administrators' and user|is_not_author_of_submission:submission.arxiv_identifier_w_vn_nr %} <div class="reportid"> - <h3>{% if report.anonymous %}(chose public anonymity) {% endif %}<a href="{{report.author.get_absolute_url}}">{{ report.author.user.first_name }} {{ report.author.user.last_name }}</a> - on {{ report.date_submitted|date:'Y-n-j' }} + <h3> + {% if report.anonymous %}(chose public anonymity) {% endif %}<a href="{{report.author.get_absolute_url}}">{{ report.author.user.first_name }} {{ report.author.user.last_name }}</a> + on {{ report.date_submitted|date:'Y-n-j' }} </h3> - <ul class="publicationClickables"> - {% if report.doi_string %}<li>doi: {{ report.doi_string }}</li>{% endif %} - {% if report.pdf_report %} - <li><a href="{% url 'submissions:report_detail_pdf' report.submission.arxiv_identifier_w_vn_nr report.report_nr %}" target="_blank">Download as PDF</a></li> + {% if report.doi_string or report.pdf_report %} + <ul class="clickables"> + {% if report.doi_string %} + <li>Cite as: <span class="citation">{{ report|citation }}</span></li> {% endif %} - {% if perms.scipost.can_manage_reports %} - <li><a href="{% url 'submissions:report_pdf_compile' report.id %}">Update/Compile the Report pdf</a></li> - {% endif %} - </ul> + {% if report.pdf_report %} + <li> + <a href="{% url 'submissions:report_detail_pdf' report.submission.arxiv_identifier_w_vn_nr report.report_nr %}" target="_blank"><i class="fa fa-download"></i> Download as PDF</a> + </li> + {% endif %} + </ul> + {% endif %} + {% if perms.scipost.can_manage_reports %} + <h3 class="mt-2">Administration</h3> + <ul> + <li><a href="{% url 'submissions:report_pdf_compile' report.id %}">Update/Compile the Report pdf</a></li> + <li>Mark DOI as <a href="{% url 'journals:mark_report_doi_needed' report_id=report.id needed=1 %}">needed</a> / <a href="{% url 'journals:mark_report_doi_needed' report_id=report.id needed=0 %}">not needed</a></li> + <li><a href="{% url 'journals:generic_metadata_xml_deposit' type_of_object='report' object_id=report.id %}">Create the metadata and deposit it to Crossref</a></li> + </ul> + {% endif %} </div> {% if report.flagged %} @@ -49,18 +61,30 @@ </div> {% else %} <div class="reportid"> - <h3>{% if report.anonymous %}Anonymous Report {{report.report_nr}}{% else %}<a href="{{report.author.get_absolute_url}}">{{ report.author.user.first_name }} {{ report.author.user.last_name }}</a>{% endif %} + <h3> + {% if report.anonymous %}Anonymous Report {{report.report_nr}}{% else %}<a href="{{report.author.get_absolute_url}}">{{ report.author.user.first_name }} {{ report.author.user.last_name }}</a>{% endif %} on {{ report.date_submitted|date:'Y-n-j' }}</h3> </h3> - <ul class="publicationClickables"> - {% if report.doi_string %}<li>doi: {{ report.doi_string }}</li>{% endif %} - {% if report.pdf_report %} - <li><a href="{% url 'submissions:report_detail_pdf' report.submission.arxiv_identifier_w_vn_nr report.report_nr %}" target="_blank">Download as PDF</a></li> - {% endif %} - {% if perms.scipost.can_manage_reports %} - <li><a href="{% url 'submissions:report_pdf_compile' report.id %}">Update/Compile the Report pdf</a></li> - {% endif %} - </ul> + {% if report.doi_string or report.pdf_report %} + <ul class="clickables"> + {% if report.doi_string %} + <li>Cite as: <span class="citation">{{ report|citation }}</span></li> + {% endif %} + {% if report.pdf_report %} + <li> + <a href="{% url 'submissions:report_detail_pdf' report.submission.arxiv_identifier_w_vn_nr report.report_nr %}" target="_blank"><i class="fa fa-download"></i> Download as PDF</a> + </li> + {% endif %} + </ul> + {% endif %} + {% if perms.scipost.can_manage_reports %} + <h3 class="mt-2">Administration</h3> + <ul> + <li><a href="{% url 'submissions:report_pdf_compile' report.id %}">Update/Compile the Report pdf</a></li> + <li>Mark DOI as <a href="{% url 'journals:mark_report_doi_needed' report_id=report.id needed=1 %}">needed</a> / <a href="{% url 'journals:mark_report_doi_needed' report_id=report.id needed=0 %}">not needed</a></li> + <li><a href="{% url 'journals:generic_metadata_xml_deposit' type_of_object='report' object_id=report.id %}">Create the metadata and deposit it to Crossref</a></li> + </ul> + {% endif %} </div> {% include 'submissions/_single_report_content.html' with report=report %} diff --git a/submissions/templates/submissions/_single_report_ratings.html b/submissions/templates/submissions/_single_report_ratings.html index f5280e13d6be622a957562e602a698ea460647d4..56f04fc1bcde1fa93b098fdd873c68f4adf4c8af 100644 --- a/submissions/templates/submissions/_single_report_ratings.html +++ b/submissions/templates/submissions/_single_report_ratings.html @@ -1,4 +1,4 @@ -<div class="reportRatings mt-2"> +<div class="ratings"> <ul> <li>validity: {{report.get_validity_display}}</li> <li>significance: {{report.get_significance_display}}</li> diff --git a/submissions/templates/submissions/submission_detail.html b/submissions/templates/submissions/submission_detail.html index 634cb01892954d79d85ac96e76ac0f58f5886dbd..dfd390661a321543e2c64ad961c8f6b529e7063c 100644 --- a/submissions/templates/submissions/submission_detail.html +++ b/submissions/templates/submissions/submission_detail.html @@ -10,10 +10,8 @@ <div class="container-outside breadcrumb-nav"> <div class="container"> <nav class="breadcrumb"> - - <a href="{% url 'submissions:submissions' %}" class="breadcrumb-item">Submissions</a> - <span class="breadcrumb-item">{{submission.arxiv_identifier_w_vn_nr}}</span> - + <a href="{% url 'submissions:submissions' %}" class="breadcrumb-item">Submissions</a> + <span class="breadcrumb-item">{{submission.arxiv_identifier_w_vn_nr}}</span> </nav> </div> </div> @@ -173,8 +171,10 @@ {% endif %} {% if invited_reports %} -{# <hr>#} -<div class="row mt-4"> + +<hr class="divider"> + +<div class="row"> <div class="col-12"> <div class="card card-grey"> <div class="card-body"> @@ -194,8 +194,9 @@ {% endif %} {% if contributed_reports %} -{# <hr>#} -<div class="row mt-4"> +<hr class="divider"> + +<div class="row"> <div class="col-12"> <div class="card card-grey"> <div class="card-body"> @@ -222,7 +223,10 @@ {% endif %} {% endif %} -{% include 'scipost/comments_block.html' with comments=submission.comments.vetted %} +{% if submission.comments.vetted %} + <hr class="divider"> + {% include 'scipost/comments_block.html' with comments=submission.comments.vetted %} +{% endif %} {# This is an apparent redundant logic block; however, it makes sure the "login to ..." links wouldn't be shown twice! #} diff --git a/submissions/templatetags/submissions_extras.py b/submissions/templatetags/submissions_extras.py index 97943119c4c443baf69fdaf9b1a477d53a550475..f63b5843f7d9be03df5dda65ef157acd102588cd 100644 --- a/submissions/templatetags/submissions_extras.py +++ b/submissions/templatetags/submissions_extras.py @@ -24,9 +24,18 @@ def is_viewable_by_authors(recommendation): @register.filter def user_is_referee(submission, user): + if not user.is_authenticated: + return False return submission.referee_invitations.filter(referee__user=user).exists() @register.filter def is_voting_fellow(submission, user): + if not user.is_authenticated: + return False return submission.voting_fellows.filter(contributor__user=user).exists() + + +@register.filter +def citation(citable): + return citable.citation diff --git a/theses/templates/theses/thesis_detail.html b/theses/templates/theses/thesis_detail.html index 7ed53d775a8bdfde69e842e8803cd6b4d6ec91a9..46df60782bdd374301843c0145bdabdaa51799af 100644 --- a/theses/templates/theses/thesis_detail.html +++ b/theses/templates/theses/thesis_detail.html @@ -14,7 +14,10 @@ </div> </div> -{% include 'scipost/comments_block.html' with comments=thesislink.comments.vetted type_of_object='ThesisLink' %} +{% if thesislink.comments.vetted %} + <hr class="divider"> + {% include 'scipost/comments_block.html' with comments=thesislink.comments.vetted type_of_object='ThesisLink' %} +{% endif %} {% include 'comments/new_comment.html' with object_id=thesislink.id type_of_object='thesislink' open_for_commenting=thesislink.open_for_commenting %} diff --git a/virtualmeetings/templates/virtualmeetings/VGM_detail.html b/virtualmeetings/templates/virtualmeetings/VGM_detail.html index 05eeec54c37d47cee89df2bf12aa7b5e2f6359f1..230b9b4e8207bd86b227390e961b0bec461fcd4b 100644 --- a/virtualmeetings/templates/virtualmeetings/VGM_detail.html +++ b/virtualmeetings/templates/virtualmeetings/VGM_detail.html @@ -161,24 +161,24 @@ {% for domain, spec in spec_list %} <div class="card"> <div class="card-body"> - <a href="#" class="card-link" data-toggle="collapse" data-target="#collapse{{ domain }}" aria-expanded="false" aria-controls="collapse{{ domain }}">{{ domain }}</a> + <a href="#" class="card-link" data-toggle="collapse" data-target="#collapse{{ domain|cut:" " }}" aria-expanded="false" aria-controls="collapse{{ domain|cut:" " }}">{{ domain }}</a> </div> <!-- Domain --> - <div class="card-body collapse bg-white" id="collapse{{ domain }}" aria-labelledby="heading{{ domain }}" data-parent="#accordion"> + <div class="card-body collapse bg-white" id="collapse{{ domain|cut:" " }}" aria-labelledby="heading{{ domain|cut:" " }}" data-parent="#accordion"> {% for sp, val in spec %} <div class="card"> - <div class="card-body"> + <div class="card-body bg-white"> <a href="#" class="card-link" id="heading{{ forloop.counter }}" data-toggle="collapse" data-target="#collapse{{ forloop.counter }}" aria-expanded="false" aria-controls="collapse{{ forloop.counter }}">{{ sp }}</a> <br>{{ val }} </div> - <ul class="list-group list-group-flush collapse" id="collapse{{ forloop.counter }}" aria-labelledby="heading{{ forloop.counter }}" data-parent="#collapse{{ domain }}"> + <ul class="list-group list-group-flush collapse" id="collapse{{ forloop.counter }}" aria-labelledby="heading{{ forloop.counter }}" data-parent="#collapse{{ domain|cut:" " }}"> {% for nomination in nominations %} {% if sp in nomination.expertises %} <li class="list-group-item"> - <div class="card-body"> + <div class="card-body bg-white"> {% include 'virtualmeetings/nomination_content.html' with nomination=nomination %} </div> - <div class="card-body"> + <div class="card-body bg-white"> <div class="opinionsDisplay mx-0 px-3 py-2"> <h4>Your opinion on this Nomination (voting deadline: {{ nomination.voting_deadline|date:'y-m-d' }}):</h4> <form action="{% url 'virtualmeetings:vote_on_nomination' nomination_id=nomination.id vote='A' %}" method="post"> @@ -202,7 +202,7 @@ {% endif %} </div> </div> - <div class="card-body"> + <div class="card-body bg-white"> <a href="javascript:;" class="card-link btn btn-secondary" data-toggle="toggle" data-target="#remarkForm{{ nomination.id }}">Add a remark on this Nomination</a> <div class="submitRemarkForm my-3" id="remarkForm{{ nomination.id }}" style="display: none;"> <form action="{% url 'virtualmeetings:add_remark_on_nomination' VGM_id=VGM.id nomination_id=nomination.id %}" method="post"> @@ -212,7 +212,7 @@ </form> </div> </div> - <div class="card-body"> + <div class="card-body bg-white"> <h3>Remarks on this nomination</h3> <ul> {% for rem in nomination.remarks.all %} @@ -260,60 +260,60 @@ </div> </div> -{% for key, val in motion_categories_dict.items %} - <div class="row"> - <div class="col-12"><h2>{{ val }}:</h2></div> - <div class="col-md-11 ml-auto"> - <ul> - {% for motion in VGM.motion_set.all %} - {% if motion.category == key %} - <li> - {% include 'virtualmeetings/motion_content.html' with motion=motion %} - <div class="d-block mb-3 opinionsDisplay"> - <h4>Your opinion on this Motion (voting deadline: {{ motion.voting_deadline|date:'y-m-d' }}):</h4> - <form action="{% url 'virtualmeetings:vote_on_motion' motion_id=motion.id vote='A' %}" method="post"> - {% csrf_token %} - <input type="submit" class="agree" value="Agree {{ motion.nr_A }} "/> - </form> - <form action="{% url 'virtualmeetings:vote_on_motion' motion_id=motion.id vote='N' %}" method="post"> - {% csrf_token %} - <input type="submit" class="notsure" value="Not sure {{ motion.nr_N }}"/> - </form> - <form action="{% url 'virtualmeetings:vote_on_motion' motion_id=motion.id vote='D'%}" method="post"> - {% csrf_token %} - <input type="submit" class="disagree" value="Disagree {{ motion.nr_D }}"/> - </form> - {% if request.user.contributor in motion.in_agreement.all %} - <strong>(you have voted: Agreed)</strong> - {% elif request.user.contributor in motion.in_notsure.all %} - <strong>(you have voted: Not sure)</strong> - {% elif request.user.contributor in motion.in_disagreement.all %} - <strong>(you have voted: Disagree)</strong> + {% for key, val in motion_categories_dict.items %} + <div class="row"> + <div class="col-12"><h2>{{ val }}:</h2></div> + <div class="col-md-11 ml-auto"> + <ul> + {% for motion in VGM.motion_set.all %} + {% if motion.category == key %} + <li> + {% include 'virtualmeetings/motion_content.html' with motion=motion %} + <div class="d-block mb-3 opinionsDisplay"> + <h4>Your opinion on this Motion (voting deadline: {{ motion.voting_deadline|date:'y-m-d' }}):</h4> + <form action="{% url 'virtualmeetings:vote_on_motion' motion_id=motion.id vote='A' %}" method="post"> + {% csrf_token %} + <input type="submit" class="agree" value="Agree {{ motion.nr_A }} "/> + </form> + <form action="{% url 'virtualmeetings:vote_on_motion' motion_id=motion.id vote='N' %}" method="post"> + {% csrf_token %} + <input type="submit" class="notsure" value="Not sure {{ motion.nr_N }}"/> + </form> + <form action="{% url 'virtualmeetings:vote_on_motion' motion_id=motion.id vote='D'%}" method="post"> + {% csrf_token %} + <input type="submit" class="disagree" value="Disagree {{ motion.nr_D }}"/> + </form> + {% if request.user.contributor in motion.in_agreement.all %} + <strong>(you have voted: Agreed)</strong> + {% elif request.user.contributor in motion.in_notsure.all %} + <strong>(you have voted: Not sure)</strong> + {% elif request.user.contributor in motion.in_disagreement.all %} + <strong>(you have voted: Disagree)</strong> + {% endif %} + </div> + <a class="btn btn-secondary" href="javascript:;" data-toggle="toggle" data-target="#remarkForm{{ motion.id }}">Add a remark on this Motion</a> + <div class="submitRemarkForm mt-3" id="remarkForm{{ motion.id }}" style="display: none;"> + <form action="{% url 'virtualmeetings:add_remark_on_motion' motion_id=motion.id %}" method="post"> + {% csrf_token %} + {{ remark_form|bootstrap:"0,12" }} + <input type="submit" class="btn btn-secondary" value="Submit" /> + </form> + </div> + {% if motion.remarks.all %} + <h3>Remarks on this motion:</h3> + <ul> + {% for rem in motion.remarks.all %} + {% include 'scipost/_remark_li.html' with remark=rem %} + {% endfor %} + </ul> {% endif %} - </div> - <a class="btn btn-secondary" href="javascript:;" data-toggle="toggle" data-target="#remarkForm{{ motion.id }}">Add a remark on this Motion</a> - <div class="submitRemarkForm mt-3" id="remarkForm{{ motion.id }}" style="display: none;"> - <form action="{% url 'virtualmeetings:add_remark_on_motion' motion_id=motion.id %}" method="post"> - {% csrf_token %} - {{ remark_form|bootstrap:"0,12" }} - <input type="submit" class="btn btn-secondary" value="Submit" /> - </form> - </div> - {% if motion.remarks.all %} - <h3>Remarks on this motion:</h3> - <ul> - {% for rem in motion.remarks.all %} - {% include 'scipost/_remark_li.html' with remark=rem %} - {% endfor %} - </ul> - {% endif %} - <hr> - </li> - {% endif %} - {% endfor %} - </ul> - </div> - </div> + <hr> + </li> + {% endif %} + {% endfor %} + </ul> + </div> + </div> {% endfor %} {% endblock %} diff --git a/virtualmeetings/templates/virtualmeetings/motion_content.html b/virtualmeetings/templates/virtualmeetings/motion_content.html index d809e9a219d09c7af732c14e4edefe64bee9f379..dcc7acc48f9527db37fd68b4701059743bd5769c 100644 --- a/virtualmeetings/templates/virtualmeetings/motion_content.html +++ b/virtualmeetings/templates/virtualmeetings/motion_content.html @@ -1,6 +1,6 @@ <div class="Motion" id="motion_{{ motion.id }}"> <h2 class="pb-0">Motion {{ motion.id }}</h2> - <h3 class="pt-0 mb-2">put forward by {{ motion.put_forward_by.user.first_name }} {{ motion.put_forward_by.user.first_name }}</h3> + <h3 class="pt-0 mb-2">put forward on {{ motion.date|date:"Y-m-d" }} by {{ motion.put_forward_by.user.first_name }} {{ motion.put_forward_by.user.last_name }}</h3> <h3>Background:</h3> <div>{{ motion.background|linebreaks }}</div> diff --git a/virtualmeetings/views.py b/virtualmeetings/views.py index 2bff5ddac47eda58df7a274b9a760d43dbd39665..d12759c0f27c7cddf47ccfc94a64271d3ca5ba9e 100644 --- a/virtualmeetings/views.py +++ b/virtualmeetings/views.py @@ -110,22 +110,15 @@ def nominate_Fellow(request, VGM_id): nomination_form = NominationForm(request.POST) if nomination_form.is_valid(): - nomination = Nomination( - VGM=VGM_instance, - by=request.user.contributor, - date=timezone.now().date(), - first_name=nomination_form.cleaned_data['first_name'], - last_name=nomination_form.cleaned_data['last_name'], - discipline=nomination_form.cleaned_data['discipline'], - expertises=nomination_form.cleaned_data['expertises'], - webpage=nomination_form.cleaned_data['webpage'], - voting_deadline=VGM_instance.end_date + datetime.timedelta(days=7), - ) + nomination = nomination_form.save(commit=False) + nomination.VGM = VGM_instance + nomination.by = request.user.contributor + nomination.voting_deadline = VGM_instance.end_date + datetime.timedelta(days=7) nomination.save() nomination.update_votes(request.user.contributor.id, 'A') messages.success(request, 'The nomination has been registered.') else: - messages.danger(request, 'The form was not filled properly.') + messages.warning(request, 'The form was not filled properly.') return redirect(VGM_instance.get_absolute_url())