Skip to content

Commit

Permalink
Add paper assignment page
Browse files Browse the repository at this point in the history
  • Loading branch information
mvidalgarcia committed Dec 9, 2016
1 parent 5e3ad25 commit c4d3194
Show file tree
Hide file tree
Showing 6 changed files with 225 additions and 3 deletions.
24 changes: 22 additions & 2 deletions indico/htdocs/js/indico/modules/papers.js
Expand Up @@ -15,7 +15,27 @@
* along with Indico; if not, see <http://www.gnu.org/licenses/>.
*/

(function() {
/* global setupListGenerator:false, applySearchFilters:false, setupTableSorter: false */

(function(global) {
'use strict';

})();
global.setupPaperAssignmentList = function setupPaperAssignmentList() {
var filterConfig = {
itemHandle: 'tr',
listItems: '#assignment-list tbody tr',
term: '#search-input',
state: '#filtering-state',
placeholder: '#filter-placeholder'
};

$('.list-section [data-toggle=dropdown]').closest('.group').dropdown();
setupTableSorter('#assignment-list .tablesorter');
enableIfChecked('#assignment-list', 'input[name=contribution_id]', '.js-enable-if-checked');
$('#assignment-list').on('indico:htmlUpdated', function() {
setupTableSorter('#assignment-list .tablesorter');
applySearchFilters();
});
setupListGenerator(filterConfig);
};
})(window);
1 change: 1 addition & 0 deletions indico/modules/events/papers/blueprint.py
Expand Up @@ -34,6 +34,7 @@
methods=('GET', 'POST'))
_bp.add_url_rule('/manage/papers/enable/<any(content,layout):reviewing_type>', 'switch',
management.RHSwitchReviewingType, methods=('PUT', 'DELETE'))
_bp.add_url_rule('/manage/papers/assign', 'assignment', management.RHPapersAssignment)

# URLs available in both management and display areas
# Note: When adding a new one here make sure to specify `defaults=defaults`
Expand Down
9 changes: 9 additions & 0 deletions indico/modules/events/papers/controllers/management.py
Expand Up @@ -71,3 +71,12 @@ def _process_PUT(self):
def _process_DELETE(self):
set_reviewing_state(self.event_new, request.view_args['reviewing_type'], False)
return jsonify_data(flash=False, html=_render_paper_dashboard(self.event_new))


class RHPapersAssignment(RHManagePapersBase):
"""Assign contrubutions to reviewers and judges"""

def _process(self):
contribs = sorted(self.event_new.contributions, key=lambda x: x.friendly_id)
return WPManagePapers.render_template('management/assignment.html', self._conf, event=self.event_new,
contribs=contribs)
@@ -0,0 +1,115 @@
{% from 'message_box.html' import message_box %}

{% macro render_paper_assignment_list(event, total_entries, contribs) %}
{% set tz = event.display_tzinfo %}
{% if contribs %}
<form method="POST">
<input type="hidden" name="csrf_token" value="{{ session.csrf_token }}">
<table class="i-table tablesorter">
<thead>
<tr class="i-table">
<th class="i-table thin-column" data-sorter="false"></th>
<th class="i-table id-column">
{% trans %}ID{% endtrans %}
</th>
<th class="i-table title-column">
{% trans %}Title{% endtrans %}
</th>
<th class="i-table state-column">
{% trans %}State{% endtrans %}
</th>
<th class="i-table revision-column">
{% trans %}Revision{% endtrans %}
</th>
<th class="i-table judge-column" data-sorter="false">
{% trans %}Judges{% endtrans %}
</th>
<th class="i-table content-reviewers-column" data-sorter="false">
{% trans %}Content reviewers{% endtrans %}
</th>
<th class="i-table layout-reviewers-column" data-sorter="false">
{% trans %}Layout reviewers{% endtrans %}
</th>
</tr>
</thead>
<tbody>
{% for contrib in contribs %}
{% set last_revision_state %}
{% if contrib.paper_revisions %}
{{ contrib.paper_revisions.0.state.title }}
{% else %}
{%- trans %}Paper not yet submitted{% endtrans -%}
{% endif %}
{% endset %}
<tr id="contrib-{{ contrib.id }}" class="i-table contribution-row"
data-friendly-id="{{ contrib.friendly_id }}"
data-title="{{ contrib.title }}">
<td class="i-table id-column">
<span class="vertical-aligner">
<input type="checkbox" class="select-row" name="contribution_id"
value="{{ contrib.id }}">
</span>
</td>
<td class="i-table id-column">
<span class="vertical-aligner">{{ contrib.friendly_id }}</span>
</td>
<td class="i-table title-column" data-searchable="{{ contrib.title | lower }}"
data-text="{{ contrib.title | lower }}">
<span class="vertical-aligner">
{# TODO: Link to the paper timeline page #}
<a href="#">
{{- contrib.title -}}
</a>
</span>
</td>
<td class="i-table state-column" data-searchable="{{ last_revision_state | lower }}">
<span class="vertical-aligner">{{ last_revision_state }}</span>
</td>
<td class="i-table revision-column">
<span class="vertical-aligner">
{% if contrib.paper_revisions %}
{{ contrib.paper_revisions | length }}
{% endif %}
</span>
</td>
<td class="i-table person-row-cell"
data-searchable="{{ contrib.paper_judges|map(attribute='name')|join(', ')|lower }}">
<span class="vertical-aligner">
{% for judge in contrib.paper_judges -%}
<div class="person-row icon-user">{{ judge.display_full_name }}</div>
{%- endfor %}
</span>
</td>
<td class="i-table person-row-cell"
data-searchable="{{ contrib.paper_content_reviewers|map(attribute='name')|join(', ')|lower }}">
<span class="vertical-aligner">
{% for reviewer in contrib.paper_content_reviewers -%}
<div class="person-row icon-user">{{ reviewer.display_full_name }}</div>
{%- endfor %}
</span>
</td>
<td class="i-table person-row-cell"
data-searchable="{{ contrib.paper_layout_reviewers|map(attribute='name')|join(', ')|lower }}">
<span class="vertical-aligner">
{% for reviewer in contrib.paper_layout_reviewers -%}
<div class="person-row icon-user">{{ reviewer.display_full_name }}</div>
{%- endfor %}
</span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</form>
{%- else %}
{%- call message_box('info') %}
{%- if total_entries %}
{%- trans -%}
The filtering criteria do not match with any of the existing contributions. Try to clear the filters.
{%- endtrans %}
{%- else %}
{%- trans %}There are no contributions yet.{% endtrans %}
{%- endif %}
{%- endcall %}
{%- endif %}
{% endmacro %}
77 changes: 77 additions & 0 deletions indico/modules/events/papers/templates/management/assignment.html
@@ -0,0 +1,77 @@
{% extends 'layout/full_content_base.html' %}
{% from 'events/papers/management/_paper_assignment_list.html' import render_paper_assignment_list %}
{% from 'events/management/_lists.html' import render_displayed_entries_fragment %}

{% block title %}
{% trans %}Paper Assignment{% endtrans %}
{% endblock %}

{% block description %}
{%- trans -%}
Assign <strong>judges</strong>, <strong>content reviewers</strong> and <strong>layout reviewers</strong>
to contributions in order to allow assessing its paper revisions.
{%- endtrans -%}
{% endblock %}

{% block content %}
<div class="toolbars space-after">
<div class="toolbar">
<div class="group">
<a class="i-button icon-checkbox-checked arrow js-dropdown" data-toggle="dropdown"></a>
<ul class="dropdown">
<li>
<a href="#" data-select-all="#assignment-list input:checkbox">{% trans %}All{% endtrans %}</a>
</li>
<li>
<a href="#" data-select-none="#assignment-list input:checkbox">{% trans %}None{% endtrans %}</a>
</li>
</ul>
</div>
<div class="group">
<button class="i-button icon-settings js-dialog-action js-customize-list highlight"
data-href="#"
data-title="{% trans %}Paper assignment list configuration{% endtrans %}"
data-dialog-classes="list-filter-dialog"
data-update='{"html": "#assignment-list", "filter_statistics": "#filter-statistics"}'
data-ajax-dialog>
{% trans %}Customize list{% endtrans %}
</button>
</div>
<div class="group">
<a class="i-button arrow js-dropdown" data-toggle="dropdown">
{%- trans %}Assign{% endtrans -%}
</a>
<ul class="dropdown">
<li><a href="#">{% trans %}Judge{% endtrans %}</a></li>
<li><a href="#">{% trans %}Content reviewer{% endtrans %}</a></li>
<li><a href="#">{% trans %}Layout reviewer{% endtrans %}</a></li>
</ul>
<a class="i-button">
{%- trans %}Unassign{% endtrans -%}
</a>
</div>
<div class="group">
<a href="#" class="i-button icon-attachment js-enable-if-checked disabled"
data-href="#">
{%- trans %}Download papers{% endtrans -%}
</a>
</div>
</div>
<div class="toolbar">
<div class="group" id="filter-statistics">
{{ render_displayed_entries_fragment(contribs|length, total_entries) }}
</div>
<div class="group">
<span class="i-button label icon-search"></span>
<input type="text" id="search-input" placeholder="{% trans %}Enter #id or search string{% endtrans %}">
</div>
</div>
</div>
<div class="list" id="assignment-list">
{{ render_paper_assignment_list(event, total_entries, contribs) }}
</div>
<div id="filter-placeholder"></div>
<script>
setupPaperAssignmentList();
</script>
{% endblock %}
Expand Up @@ -108,7 +108,7 @@
{%- trans %}Assign reviewers and referees to papers{% endtrans -%}
</div>
<div class="toolbar">
<a class="i-button icon-settings" href="#">
<a class="i-button icon-settings" href="{{ url_for('.assignment', event) }}">
{%- trans %}Assign papers{% endtrans -%}
</a>
</div>
Expand Down

0 comments on commit c4d3194

Please sign in to comment.