def _process(self): form = AbstractReviewedForTracksForm(event=self.event, obj=self.abstract) if form.validate_on_submit(): update_reviewed_for_tracks(self.abstract, form.reviewed_for_tracks.data) return jsonify_data(flash=False, html=render_abstract_page( self.abstract, management=self.management)) return jsonify_template( 'events/abstracts/forms/edit_review_tracks.html', form=form)
def render_abstract_page(abstract, view_class=None, management=False): from indico.modules.events.abstracts.forms import ( AbstractCommentForm, AbstractJudgmentForm, AbstractReviewedForTracksForm, build_review_form) comment_form = AbstractCommentForm(abstract=abstract, user=session.user, formdata=None) review_form = None reviewed_for_tracks = list(abstract.get_reviewed_for_groups(session.user)) if len(reviewed_for_tracks) == 1: review_form = build_review_form(abstract, reviewed_for_tracks[0]) judgment_form = AbstractJudgmentForm(abstract=abstract, formdata=None) review_track_list_form = AbstractReviewedForTracksForm( event=abstract.event, obj=abstract, formdata=None) params = { 'abstract': abstract, 'comment_form': comment_form, 'review_form': review_form, 'review_track_list_form': review_track_list_form, 'judgment_form': judgment_form, 'visible_tracks': get_visible_reviewed_for_tracks(abstract, session.user), 'management': management } if view_class: return view_class.render_template('abstract.html', abstract.event, **params) else: return render_template('events/abstracts/abstract.html', no_javascript=True, standalone=True, **params)
def render_abstract_page(abstract, view_class=None, management=False): from indico.modules.events.abstracts.forms import (AbstractCommentForm, AbstractJudgmentForm, AbstractReviewedForTracksForm, build_review_form) comment_form = AbstractCommentForm(abstract=abstract, user=session.user, formdata=None) review_form = None reviewed_for_tracks = list(abstract.get_reviewed_for_groups(session.user)) if len(reviewed_for_tracks) == 1: review_form = build_review_form(abstract, reviewed_for_tracks[0]) judgment_form = AbstractJudgmentForm(abstract=abstract, formdata=None) review_track_list_form = AbstractReviewedForTracksForm(event=abstract.event, obj=abstract, formdata=None) track_session_map = {track.id: track.default_session_id for track in abstract.event.tracks} can_manage = abstract.event.can_manage(session.user) field_values = filter_field_values(abstract.field_values, can_manage, abstract.user_owns(session.user)) params = {'abstract': abstract, 'comment_form': comment_form, 'review_form': review_form, 'review_track_list_form': review_track_list_form, 'judgment_form': judgment_form, 'visible_tracks': get_visible_reviewed_for_tracks(abstract, session.user), 'management': management, 'track_session_map': track_session_map, 'field_values': field_values} if view_class: return view_class.render_template('abstract.html', abstract.event, **params) else: return render_template('events/abstracts/abstract.html', no_javascript=True, standalone=True, **params)
def _process(self): form = AbstractReviewedForTracksForm(event=self.event, obj=self.abstract) if form.validate_on_submit(): update_reviewed_for_tracks(self.abstract, form.reviewed_for_tracks.data) return jsonify_data(flash=False, html=render_abstract_page(self.abstract, management=self.management)) return jsonify_template('events/abstracts/forms/edit_review_tracks.html', form=form)