예제 #1
0
파일: issue.py 프로젝트: publicscience/hive
    def get(self, slug, id):
        ctx = self.get_context(slug=slug, id=id)
        project = ctx['project']

        # List view
        if id is None:
            issues = Issue.objects(project=project)
            return render_template('issue/list.html', issues=issues, project=project)
        # Detail view
        else:
            comment_form = model_form(Comment, exclude=['created_at', 'updated_at', 'author', 'mentions', 'attachments'])
            form = comment_form(request.form)

            issue = ctx['issue']
            issue.sync()
            all_events = issue.all_events()

            return render_template('issue/detail.html', issue=issue, events=all_events, form=form, current_user=current_user(), project=project)
예제 #2
0
    def get(self, slug):
        # List view
        if slug is None:
            projects = Project.objects.all()
            return render_template('project/list.html', projects=projects, current_user=current_user())
        # Detail view
        else:
            ctx = self.get_context(slug=slug)
            project = ctx['project']
            try:
                project.sync()
            except KeyError as e:
                if current_user().linked():
                    return redirect(url_for('github_login'))
                else:
                    return redirect(url_for('github_info'))
            issues = Issue.objects(project=project, open=True)

            return render_template('issue/list.html', issues=issues, project=project)
예제 #3
0
파일: issue.py 프로젝트: publicscience/hive
def label_issues(slug, label):
    project = Project.objects.get_or_404(slug=slug)
    issues = Issue.objects(labels=label, project=project)
    return render_template('issue/list.html', issues=issues, project=project)
예제 #4
0
파일: issue.py 프로젝트: publicscience/hive
def open_issues(slug):
    project = Project.objects.get_or_404(slug=slug)
    issues = Issue.objects(open=True, project=project)
    return render_template('issue/list.html', issues=issues, project=project)