Example #1
0
 def _process(self):
     form = PaperCommentForm(paper=self.paper, user=session.user)
     if form.validate_on_submit():
         visibility = form.visibility.data if form.visibility else None
         create_comment(self.paper, form.text.data, visibility, session.user)
         return jsonify_data(flash=False, html=render_paper_page(self.paper))
     tpl = get_template_module('events/reviews/forms.html')
     return jsonify(html=tpl.render_comment_form(form, proposal=self.paper))
Example #2
0
 def _process(self):
     form = PaperCommentForm(paper=self.paper, user=session.user)
     if form.validate_on_submit():
         visibility = form.visibility.data if form.visibility else None
         create_comment(self.paper, form.text.data, visibility, session.user)
         return jsonify_data(flash=False, html=render_paper_page(self.paper))
     tpl = get_template_module('events/reviews/forms.html')
     return jsonify(html=tpl.render_comment_form(form, proposal=self.paper))
Example #3
0
 def _process(self):
     form = PaperCommentForm(obj=self.comment, paper=self.paper, user=session.user,
                             prefix='edit-comment-{}-'.format(self.comment.id))
     if form.validate_on_submit():
         visibility = form.visibility.data if form.visibility else self.comment.visibility
         update_comment(self.comment, form.text.data, visibility)
         return jsonify_data(flash=False, html=render_paper_page(self.paper))
     tpl = get_template_module('events/reviews/forms.html')
     return jsonify(html=tpl.render_comment_form(form, proposal=self.paper, comment=self.comment, edit=True))
Example #4
0
 def _process(self):
     form = PaperCommentForm(obj=self.comment, paper=self.paper, user=session.user,
                             prefix='edit-comment-{}-'.format(self.comment.id))
     if form.validate_on_submit():
         visibility = form.visibility.data if form.visibility else self.comment.visibility
         update_comment(self.comment, form.text.data, visibility)
         return jsonify_data(flash=False, html=render_paper_page(self.paper))
     tpl = get_template_module('events/reviews/forms.html')
     return jsonify(html=tpl.render_comment_form(form, proposal=self.paper, comment=self.comment, edit=True))
Example #5
0
def render_paper_page(paper, view_class=None):
    comment_form = (PaperCommentForm(
        paper=paper, user=session.user, formdata=None)
                    if not paper.is_in_final_state else None)
    review_form = None
    reviewed_for_groups = list(
        paper.last_revision.get_reviewed_for_groups(session.user))
    if len(reviewed_for_groups) == 1:
        review_form = build_review_form(paper.last_revision,
                                        reviewed_for_groups[0])
    judgment_form = PaperJudgmentForm(formdata=None, paper=paper)
    revision_form = PaperSubmissionForm(formdata=None)
    params = {
        'paper': paper,
        'comment_form': comment_form,
        'review_form': review_form,
        'judgment_form': judgment_form,
        'revision_form': revision_form
    }
    if view_class:
        return view_class.render_template('paper.html', paper.event, **params)
    else:
        return render_template('events/papers/paper.html',
                               no_javascript=True,
                               standalone=True,
                               **params)