File name
        Commit message
        Commit date
    File name
        Commit message
        Commit date
    File name
        Commit message
        Commit date
    File name
        Commit message
        Commit date
    File name
        Commit message
        Commit date
    @**
* Yobi, Project Hosting SW
*
* Copyright 2013 NAVER Corp.
* http://yobi.io
*
* @author Keesun Baik
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**@
@(title:String, form: play.data.Form[PullRequest], project:Project,
  fromBranches: List[playRepository.GitBranch], toBranches:List[playRepository.GitBranch],
  pullRequest:models.PullRequest)
@import scala.collection.Map
@import utils.TemplateHelper._
@import utils.TemplateHelper.Branches._
@implicitField = @{ helper.FieldConstructor(simpleForm) }
@projectLayout(title, pullRequest.toProject, utils.MenuType.PULL_REQUEST) {
@projectMenu(pullRequest.toProject, utils.MenuType.PULL_REQUEST, "main-menu-only")
<div class="page-wrap-outer">
    <div class="project-page-wrap">
        <div class="content-wrap frm-wrap">
            @helper.form(action=routes.PullRequestApp.editPullRequest(pullRequest.toProject.owner, pullRequest.toProject.name, pullRequest.number), 'enctype -> "multipart/form-data", 'class->"nm"){
                <div class="pull-request-wrap">
                    <!-- from -->
                    <div class="pull-left">
                        <label for="fromProjectId" class="field-title">@Messages("pullRequest.from")</label>
                        <select id="fromProjectId" name="fromProjectId" data-toggle="select2" class="mr5" disabled>
                            <option value="@pullRequest.fromProject.id" selected>
                                @pullRequest.fromProject.owner / @pullRequest.fromProject.name
                            </option>
                        </select>
                        <select id="fromBranch" name="fromBranch" data-toggle="select2" data-format="branch" disabled
                                data-dropdown-css-class="branches" data-placeholder="@Messages("pullRequest.select.branch")">
                            <option></option>
                            @for(branch <- fromBranches) {
                                <option value="@branch.getName" @if(branch.getName == pullRequest.fromBranch){ selected }>@branch.getName</option>
                            }
                        </select>
                        <input type="hidden" name="fromProjectId" value="@pullRequest.fromProject.id">
                        <input type="hidden" name="fromBranch" value="@pullRequest.fromBranch">
                    </div>
                    <!-- // -->
                    <div class="arrow">
                        <i class="yobicon-right-2"></i>
                    </div>
                    <!-- to -->
                    <div class="pull-right">
                        <label for="toProjectId" class="field-title">@Messages("pullRequest.to")</label>
                        <select id="toProjectId" name="toProjectId" data-toggle="select2" class="mr5" disabled>
                            <option value="@pullRequest.toProject.id" selected>
                                @pullRequest.toProject.owner / @pullRequest.toProject.name
                            </option>
                        </select>
                        <select id="toBranch" name="toBranch" data-toggle="select2" data-format="branch" disabled
                                data-dropdown-css-class="branches" data-placeholder="@Messages("pullRequest.select.branch")">
                            <option></option>
                            @for(branch <- toBranches) {
                                <option value="@branch.getName" @if(branch.getName == pullRequest.toBranch){ selected }>@branch.getName</option>
                            }
                        </select>
                        <input type="hidden" name="toProjectId" value="@pullRequest.toProject.id">
                        <input type="hidden" name="toBranch" value="@pullRequest.toBranch">
                    </div>
                    <!-- // -->
                </div>
                <span id="pullRequestState" data-value="@pullRequest.state"></span>
                @if(pullRequest.isOpen) {
                    <div id="status" class="alert mt20 mb20">
                        @Messages("pullRequest.is.merging")
                    </div>
                }
                <div>
                    <input type="text" id="title" name="title" maxlength="255" class="text"
                           value="@pullRequest.title" placeholder="@Messages("title")" data-is-user-has-typed="true">
                    <div style="position: relative;">
                        @common.editor("body", pullRequest.body, "data-is-user-has-typed=true", "content-body")
                    </div>
                    @common.fileUploader(ResourceType.PULL_REQUEST, pullRequest.id)
                    @common.markdown(project)
                    <div class="actions">
                        <button type="submit" class="ybtn ybtn-success">@Messages("button.save")</button>
                        <a href="javascript:history.back();" class="ybtn">@Messages("button.cancel")</a>
                    </div>
                </div>
                <ul class="nav nav-tabs mt20">
                    <li class="active">
                        <a href="#__commits" data-toggle="tab">
                            <span class="vmiddle-inline">@Messages("pullRequest.menu.commit")</span>
                            <span id="numOfCommits" class="num-badge vmiddle-inline"></span>
                        </a>
                    </li>
                </ul>
                <div class="tab-content">
                    <div id="__commits" class="code-browse-wrap tab-pane active">
                    @** this area will be replaced with asynchronously by yobi.git.Write.js after load this page. **@
                    </div>
                </div>
            }
        </div>
    </div>
</div>
@common.select2()
<link rel="stylesheet" type="text/css" media="screen" href="@routes.Assets.at("javascripts/lib/atjs/jquery.atwho.css")">
<script type="text/javascript" src="@routes.Assets.at("javascripts/lib/atjs/jquery.caret.min.js")"></script>
<script type="text/javascript" src="@routes.Assets.at("javascripts/lib/atjs/jquery.atwho.js")"></script>
<script type="text/javascript">
$(function(){
    $yobi.loadModule("git.Write", {
        "mergeResultURL": "@routes.PullRequestApp.mergeResult(project.owner, project.name)",
        "fromProject" : $("#fromProjectId"),
        "toProject"   : $("#toProjectId"),
        "fromBranch"  : $("#fromBranch"),
        "toBranch"    : $("#toBranch"),
        "state"       : $("#pullRequestState").data("value")
    });
    // yobi.Mention
    yobi.Mention({
        "target": "textarea[id^=editor-]",
        "url"   : "@routes.ProjectApp.mentionList(project.owner, project.name)"
    });
});
</script>
}