From 3b50aa5175f26984a55f6b94d9f3336aded84440 Mon Sep 17 00:00:00 2001 From: "J.-S. Caux" <J.S.Caux@uva.nl> Date: Fri, 19 Apr 2019 21:57:02 +0200 Subject: [PATCH] Rework presentation of Colleges --- .../static/colleges/colleges.js | 2 +- colleges/templates/colleges/colleges.html | 98 +++++++++++++++++++ colleges/urls.py | 6 ++ colleges/views.py | 21 +++- .../templates/scipost/_contributor_short.html | 2 +- scipost/templates/scipost/about.html | 58 +++-------- scipost/urls.py | 2 +- scipost/views.py | 26 +---- .../templates/submissions/_guidelines_dl.html | 4 + 9 files changed, 145 insertions(+), 74 deletions(-) rename scipost/static/scipost/about.js => colleges/static/colleges/colleges.js (96%) create mode 100644 colleges/templates/colleges/colleges.html diff --git a/scipost/static/scipost/about.js b/colleges/static/colleges/colleges.js similarity index 96% rename from scipost/static/scipost/about.js rename to colleges/static/colleges/colleges.js index fb7e77181..34cb85d6e 100644 --- a/scipost/static/scipost/about.js +++ b/colleges/static/colleges/colleges.js @@ -6,7 +6,7 @@ $(function() { el.toggle(); // Switch texts of link - $('[href="' + $(this).attr('href') + '"]').toggle(); + $('[data-toggle="toggle-show"]').toggle(); // Reset active search after closing the box if(!el.is(':visible')) { diff --git a/colleges/templates/colleges/colleges.html b/colleges/templates/colleges/colleges.html new file mode 100644 index 000000000..1e016b51e --- /dev/null +++ b/colleges/templates/colleges/colleges.html @@ -0,0 +1,98 @@ +{% extends 'colleges/base.html' %} + +{% load staticfiles %} +{% load scipost_extras %} +{% load add_get_parameters %} + +{% block breadcrumb_items %} + {{ block.super }} + <span class="breadcrumb-item"><a href="{% url 'colleges:colleges' %}">Editorial Colleges</a></span> +{% endblock %} + +{% block pagetitle %}: Fellowships{% endblock pagetitle %} + +{% block content %} + + <div class="row"> + <div class="col-lg-5"> + <h2 class="highlight">SciPost's Editorial Colleges</h2> + <p> + Below, you will find the composition of each of our Editorial Colleges, + one of which is formed for each field in which SciPost carries + out publishing activities. + </p> + <p>The Editorial College of a certain field, composed of a collection of Fellows, takes + end responsibility for editorial matters for all Journals operating in that field. + For interdisciplinary submissions, the services of Fellows from distinct Colleges can + be called upon during the evaluation process. + </p> + </div> + <div class="col-lg-7"> + {% include 'submissions/_guidelines_dl.html' %} + </div> + </div> + + <div class="accordion" id="accordionEditorialColleges"> + + {% for discipline,fellowships in disciplines.items %} + <div class="card"> + <div class="card-header text-center" id="editorial_college_{{ discipline|lower }}"> + <h2 class="mb-0"> + {{ discipline }}<br/> + <button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapse_editorial_college_{{ discipline|lower }}" aria-expanded="false" aria-controls="collapse_editorial_college_{{ discipline|lower }}"> + <small>Click to expand/collapse</small> + </button> + </h2> + </div> + + <div id="collapse_editorial_college_{{ discipline|lower }}" class="collapse" aria-labelledby="editorial_college_{{ discipline|lower }}" data-parent="#accordionEditorialColleges"> + <div class="card-body"> + <div class="row"> + <div class="col-12"> + <button class="btn" data-toggle="toggle-show" data-target="#specializations-{{ discipline|lower }}">Show Fellows by specialization</button> + <button class="btn" style="display: none;" data-toggle="toggle-show" data-target="#specializations-{{ discipline|lower }}">Show full list of Fellows in {{ discipline }}</button> + <div id="specializations-{{ discipline|lower }}" class="card bg-white border-default all-specializations mt-2" style="display: none"> + <div class="card-body"> + <p><em class="text-muted mt-2">Hover to highlight or click to select</em></p> + + <div class="row"> + <div class="col-md-6"> + {% with total_count=fellowships.1|length %} + {% for code in fellowships.1 %} + <div class="specialization" data-specialization="{{ code.0|lower }}">{{ code.0 }} - {{ code.1 }}</div> + {% if forloop.counter|is_modulo_one_half:total_count %} + </div> + <div class="col-md-6"> + {% endif %} + {% endfor %} + {% endwith %} + </div> + </div> + </div> + </div> + </div> + </div> + + <div class="row search-contributors" data-contributors="{{ discipline|lower }}"> + <div class="col-12"> + <div class="card-columns"> + {% for fellowship in fellowships.0 %} + <div class="card bg-white contributor mb-1"> + {% include 'scipost/_contributor_short.html' with fellowship=fellowship %} + </div> + {% endfor %} + </div> + </div> + </div> + </div> + </div> + </div> + {% endfor %} + </div> + +{% endblock content %} + +{% block footer_script %} + {{ block.super }} + <script src="{% static 'colleges/colleges.js' %}"></script> +{% endblock %} diff --git a/colleges/urls.py b/colleges/urls.py index 763e0f85d..5bc88bedf 100644 --- a/colleges/urls.py +++ b/colleges/urls.py @@ -9,6 +9,12 @@ from submissions.constants import SUBMISSIONS_COMPLETE_REGEX from . import views urlpatterns = [ + # Editorial Colleges: public view + url( + r'^$', + views.EditorialCollegesView.as_view(), + name='colleges' + ), # Fellowships url( r'^fellowships/(?P<discipline>[a-zA-Z]+)/(?P<expertise>[a-zA-Z:]+)/$', diff --git a/colleges/views.py b/colleges/views.py index d983ab7e7..67a2a5769 100644 --- a/colleges/views.py +++ b/colleges/views.py @@ -26,12 +26,31 @@ from .forms import FellowshipForm, FellowshipTerminateForm, FellowshipRemoveSubm PotentialFellowshipForm, PotentialFellowshipStatusForm, PotentialFellowshipEventForm from .models import Fellowship, PotentialFellowship, PotentialFellowshipEvent -from scipost.constants import SCIPOST_SUBJECT_AREAS +from scipost.constants import SCIPOST_DISCIPLINES, SCIPOST_SUBJECT_AREAS, subject_areas_raw_dict from scipost.mixins import PermissionsMixin, PaginationMixin, RequestViewMixin from mails.views import MailView +class EditorialCollegesView(ListView): + model = Fellowship + template_name = 'colleges/colleges.html' + + def get_queryset(self): + queryset = Fellowship.objects.none() + return queryset + + def get_context_data(self, *args, **kwargs): + context = super().get_context_data(*args, **kwargs) + context['disciplines'] = {} + for discipline in SCIPOST_DISCIPLINES: + qs = Fellowship.objects.active().regular().filter( + contributor__profile__discipline=discipline[0]) + if qs: + context['disciplines'][discipline[1]] = (qs, subject_areas_raw_dict[discipline[1]]) + return context + + class FellowshipListView(PermissionsMixin, PaginationMixin, ListView): """ List Fellowship instances (accessible to College managers). diff --git a/scipost/templates/scipost/_contributor_short.html b/scipost/templates/scipost/_contributor_short.html index e2040eb4f..c24d93ed9 100644 --- a/scipost/templates/scipost/_contributor_short.html +++ b/scipost/templates/scipost/_contributor_short.html @@ -16,7 +16,7 @@ <span class="text-muted">({{ fellowship.contributor.affiliations.active.first.institution.name }})</span> {% endif %} <div> - {% for expertise in fellowship.contributor.expertises %} + {% for expertise in fellowship.contributor.profile.expertises %} <div class="single d-inline" data-specialization="{{ expertise|lower }}" data-toggle="tooltip" data-placement="bottom" title="{{ expertise|get_specialization_display }}">{{ expertise|get_specialization_code }}</div> {% endfor %} </div> diff --git a/scipost/templates/scipost/about.html b/scipost/templates/scipost/about.html index d91eb555d..dc3b2618c 100644 --- a/scipost/templates/scipost/about.html +++ b/scipost/templates/scipost/about.html @@ -181,53 +181,17 @@ </div> <hr> - - {% for discipline,fellowships in disciplines.items %} - <h2 class="highlight" id="editorial_college_{{ discipline|lower }}">Editorial College ({{ discipline }})</h2> - - <div class="row"> - <div class="col-12"> - <a href="#editorial_college_{{ discipline|lower }}" class="mx-2" data-toggle="toggle-show" data-target="#specializations-{{discipline|lower}}">Show Fellows by specialization</a> - <a href="#editorial_college_{{ discipline|lower }}" class="mx-2" style="display: none;" data-toggle="toggle-show" data-target="#specializations-{{discipline|lower}}">Show full list of Fellows</a> - <div id="specializations-{{ discipline|lower }}" class="card bg-white border-default all-specializations mt-2" style="display: none"> - <div class="card-body"> - <p class="text-muted mt-2">Hover to highlight or click to select</p> - - <div class="row"> - <div class="col-md-6"> - {% with total_count=fellowships.1|length %} - {% for code in fellowships.1 %} - <div class="specialization" data-specialization="{{code.0|lower}}">{{code.0}} - {{code.1}}</div> - {% if forloop.counter|is_modulo_one_half:total_count %} - </div> - <div class="col-md-6"> - {% endif %} - {% endfor %} - {% endwith %} - </div> - </div> - </div> - </div> - </div> - </div> - - <div class="row search-contributors" data-contributors="{{ discipline|lower }}"> - <div class="col-12"> - <div class="card-columns"> - {% for fellowship in fellowships.0 %} - <div class="card bg-white contributor mb-1"> - {% include 'scipost/_contributor_short.html' with fellowship=fellowship %} - </div> - {% endfor %} - </div> - </div> + <div class="row"> + <div class="col"> + <h2 class="highlight" id="editorial_colleges">Editorial Colleges</h2> + <p> + Please visit our <a href="{% url 'colleges:colleges' %}">Editorial Colleges page</a> + to view the list of our current Editorial Fellows in all our fields of activity. + </p> + <p id="editorial_college_physics"> + Direct links to <a href="{% url 'colleges:colleges' %}#editorial_college_physics">Physics</a>. + </p> </div> - - {% endfor %} + </div> {% endblock content %} - -{% block footer_script %} - {{ block.super }} - <script src="{% static 'scipost/about.js' %}"></script> -{% endblock %} diff --git a/scipost/urls.py b/scipost/urls.py index ea0082031..ad7956eac 100644 --- a/scipost/urls.py +++ b/scipost/urls.py @@ -27,7 +27,7 @@ urlpatterns = [ name='acknowledgement'), # Info - url(r'^about$', views.AboutView.as_view(), name='about'), + url(r'^about$', TemplateView.as_view(template_name='scipost/about.html'), name='about'), url(r'^call$', TemplateView.as_view(template_name='scipost/call.html'), name='call'), url(r'^donations/thank-you/$', TemplateView.as_view(template_name='scipost/donation_thank_you.html'), name='donation_thank_you'), url( diff --git a/scipost/views.py b/scipost/views.py index c5f5f079a..b0ac34ba7 100644 --- a/scipost/views.py +++ b/scipost/views.py @@ -39,10 +39,10 @@ from guardian.decorators import permission_required from haystack.generic_views import SearchView from .constants import ( - SCIPOST_DISCIPLINES, SCIPOST_SUBJECT_AREAS, subject_areas_raw_dict, + SCIPOST_SUBJECT_AREAS, SciPost_from_addresses_dict, NORMAL_CONTRIBUTOR) from .decorators import has_contributor, is_contributor_user -from .models import Contributor, UnavailabilityPeriod, AuthorshipClaim, EditorialCollege +from .models import Contributor, UnavailabilityPeriod, AuthorshipClaim from .forms import ( SciPostAuthenticationForm, UserAuthInfoForm, TOTPDeviceForm, UnavailabilityPeriodForm, RegistrationForm, AuthorshipClaimForm, @@ -50,10 +50,9 @@ from .forms import ( ContributorMergeForm, EmailGroupMembersForm, EmailParticularForm, SendPrecookedEmailForm) from .mixins import PermissionsMixin, PaginationMixin -from .utils import Utils, EMAIL_FOOTER, SCIPOST_SUMMARY_FOOTER, SCIPOST_SUMMARY_FOOTER_HTML +from .utils import EMAIL_FOOTER, SCIPOST_SUMMARY_FOOTER, SCIPOST_SUMMARY_FOOTER_HTML from colleges.permissions import fellowship_or_admin_required -from colleges.models import Fellowship from commentaries.models import Commentary from comments.models import Comment from invitations.constants import STATUS_REGISTERED @@ -1371,25 +1370,6 @@ def Fellow_activity_overview(request): return render(request, 'scipost/Fellow_activity_overview.html', context) -class AboutView(ListView): - """Basic information page with stream of current regular Fellows.""" - - model = EditorialCollege - template_name = 'scipost/about.html' - queryset = Fellowship.objects.none() - - def get_context_data(self, *args, **kwargs): - """Save Fellowships per discipline to the context.""" - context = super().get_context_data(*args, **kwargs) - context['disciplines'] = {} - for discipline in SCIPOST_DISCIPLINES: - qs = Fellowship.objects.active().regular().filter( - contributor__discipline=discipline[0]) - if qs: - context['disciplines'][discipline[1]] = (qs, subject_areas_raw_dict[discipline[1]]) - return context - - def csrf_failure(request, reason=''): """CSRF Failure page with an admin mailing action.""" # Filter out privacy data diff --git a/submissions/templates/submissions/_guidelines_dl.html b/submissions/templates/submissions/_guidelines_dl.html index 237f8856a..d68fd7637 100644 --- a/submissions/templates/submissions/_guidelines_dl.html +++ b/submissions/templates/submissions/_guidelines_dl.html @@ -7,6 +7,10 @@ <dl class="row"> <dt class="col-sm-6 col-md-5">Page</dt> <dd class="col-sm-6 col-md-7"><em>... where you will find info on:</em></dd> + <dt class="col-sm-6 col-md-5"> + {% if 'colleges' in request.path %}<i class="fa fa-arrow-circle-right text-success"></i>{% endif %} + <a href="{% url 'colleges:colleges' %}">Editorial Colleges</a></dt> + <dd class="col-sm-6 col-md-7"><em>Our Colleges and their Editorial Fellows</em></dd> <dt class="col-sm-6 col-md-5"> {% if 'by-laws' in request.path %}<i class="fa fa-arrow-circle-right text-success"></i>{% endif %} <a href="{% url 'scipost:EdCol_by-laws' %}">Editorial College by-laws</a></dt> -- GitLab