doctype html

div.wrapper(ng-controller="TaskDetailController as ctrl",
            ng-init="section='backlog-kanban'")
    div.main.us-detail
        div.us-detail-header.header-with-actions
            include ../includes/components/mainTitle
            .action-buttons
                a.button-gray(
                    tg-check-permission="view_milestones",
                    href="", title="{{'TASK.LINK_TASKBOARD' | translate}}",
                    tg-nav="project-taskboard:project=project.slug,sprint=sprint.slug",
                    ng-if="sprint && project.is_backlog_activated", translate="TASKBOARD.SECTION_NAME")

        section.us-story-main-data
            div.us-title(ng-class="{blocked: task.is_blocked}")
                h2.us-title-text
                    span.us-number(tg-bo-ref="task.ref")
                    span.us-name(tg-editable-subject, ng-model="task", required-perm="modify_task")

                h3.us-related-task(translate="TASK.OWNER_US")
                    a(tg-check-permission="view_us", href="", title="{{'TASK.TITLE_LINK_GO_OWNER' | translate}}",
                    tg-nav="project-userstories-detail:project=project.slug, ref=us.ref",
                    ng-if="us")
                        span(tg-bo-ref="us.ref")
                        span(tg-bo-bind="us.subject")

                p.external-reference(ng-if="task.external_reference", translate="TASK.ORIGIN_US")
                    a(target="_blank", tg-bo-href="task.external_reference[1]", title="{{'TASK.TITLE_LINK_GO_ORIGIN' | translate}}")
                        span {{ task.external_reference[1] }}

                p.block-desc-container(ng-show="task.is_blocked")
                    span.block-description-title(translate="COMMON.BLOCKED")
                    span.block-description(ng-bind="task.blocked_note || ('TASK.BLOCKED_DESCRIPTION' | translate)")
                div.issue-nav
                    a.icon.icon-arrow-left(ng-show="previousUrl", tg-bo-href="previousUrl",
                                           title="{{'TASK.PREVIOUS' | translate}}")
                    a.icon.icon-arrow-right(ng-show="nextUrl", tg-bo-href="nextUrl",
                                            title="{{'TASK.NEXT' | translate}}")

            div.tags-block(tg-tag-line, ng-model="task", required-perm="modify_task")

        section.duty-content(tg-editable-description, ng-model="task", required-perm="modify_task")

        // Custom Fields
        tg-custom-attributes-values(ng-model="task", type="task", project="project", required-edition-perm="modify_task")

        tg-attachments(ng-model="task", type="task")
        tg-history(ng-model="task", type="task")

    sidebar.menu-secondary.sidebar
        section.us-status
            h1(tg-task-status-display, ng-model="task")
            div.us-created-by(tg-created-by-display, ng-model="task")
            div.duty-data-container
                div.duty-data(tg-task-status-button, ng-model="task")

        section.duty-assigned-to(tg-assigned-to, ng-model="task", required-perm="modify_task")

        section.watchers(tg-watchers, ng-model="task", required-perm="modify_task")

        section.us-detail-settings
           tg-task-is-iocaine-button(ng-model="task")
           tg-block-button(tg-check-permission="modify_task", ng-model="task")
           tg-delete-button(tg-check-permission="delete_task",
                            on-delete-title="{{'TASK.TITLE_DELETE_ACTION' | translate}}",
                            on-delete-go-to-url="onDeleteGoToUrl",
                            ng-model="task")

    div.lightbox.lightbox-block(tg-lb-block, title="TASK.LIGHTBOX_TITLE_BLOKING_TASK", ng-model="task")
    div.lightbox.lightbox-select-user(tg-lb-assignedto)
    div.lightbox.lightbox-select-user(tg-lb-watchers)
