예제 #1
0
파일: views.py 프로젝트: myrlund/Issues
def issue_view(request, project_number, issue_id):
    issue = get_object_or_404(Issue, id=issue_id)
    tools = [
        tab('edit issue', 'Rediger sak', issue.get_edit_url()),
    ]
    
    subscription = False
    if request.user in issue.subscribers.all():
        tools.append(tab('unsubscribe issue', 'Avslutt abonnement', reverse(issue_unsubscribe, args=(project_number, issue_id,))))
        subscription = IssueSubscription.objects.get(issue=issue, user=request.user)
        if subscription.notify:
            tools.append(tab('unnotify', 'Slå av varsling', reverse(issue_denotify, args=(project_number, issue_id,))))
        else:
            tools.append(tab('notify', 'Slå på varsling', reverse(issue_notify, args=(project_number, issue_id,))))
    else:
        tools.append(tab('subscribe issue', 'Abonnér på sak', reverse(issue_subscribe, args=(project_number, issue_id,))))
    
    if subscription:
        issue.subscription = subscription
    
    # Load issue notificants cache excluding current user
    issue.notificants(exclude_user=request.user)
    
    breadcrumb = issue
    return render_project_response(request, 'issue/view.html', project_number, locals())
예제 #2
0
파일: views.py 프로젝트: myrlund/Issues
def project_tabs(project):
    tabs = [
        tab('list issues', 'Saker', project.get_absolute_url()),
        tab('list contracts', 'Kontrakter', project.get_contracts_url()),
        tab('search', u'Søk', reverse('fokus.search.views.search', args=(project.number,))),
    ]
    return tabs
예제 #3
0
파일: views.py 프로젝트: myrlund/Issues
def contract_home(request, project_number, code):
    contract = get_contract(project_number, code)
    pagetitle = contract
    
    my_open_issues = contract.get_open_issues(request.user)
    my_issues = contract.get_all_issues(request.user)
    tools = [
        tab('edit contract', 'Rediger kontrakt', contract.get_edit_url()),
        tab('new issue', 'Ny sak', contract.get_new_issue_url()),
    ]
    return render_contract_response(request, 'contract/home.html', project_number, code, locals())
예제 #4
0
파일: views.py 프로젝트: myrlund/Issues
def project_tools(project):
    tools = [
        tab('edit project', 'Rediger prosjekt', project.get_edit_url()),
        tab('new issue', 'Ny sak', project.get_new_issue_url()),
    ]
    return tools