{% extends "repo/base.html"%}
{% block repo %}
    <ul class='nav nav-tabs mt-3 mb-3'>
        <li class='nav-item'>
            <a class='nav-link' href='{{ url('/' + repo.name) }}'>コード</a>
        </li>
        <li class='nav-item'>
            <a class='nav-link active' href='{{ url('/' + repo.name + '/log') }}'>ログ</a>
        </li>
        <li class='nav-item'>
            <a class='nav-link' href='{{ url('/' + repo.name + '/merge') }}'>マージ</a>
        </li>
        <li class='nav-item'>
            <a class='nav-link' href='{{ url('/' + repo.name + '/hook') }}'>フック</a>
        </li>
    </ul>
    <h4 class='mb-4'>{{ commit.message }}</h4>
    {% if diff %}
    {% for patch in diff %}
    <div class='card mb-3'>
        <div class='card-body'>
            <h5 class='card-title'>{{ patch.path }}</h5>
            {% for hunk in patch %}
            <div class='card mb-3'>
                <div class='card-body'>
                    <h6 class='card-title'>@@ -{{ hunk.source_start }},{{ hunk.source_length }} +{{ hunk.target_start }},{{ hunk.target_length }} @@</h6>
                    <div class='diff mt-3'>
                        <div class='source'>
                            {% if hunk.source %}
                            <pre class='mb-0 mt-0'><code class='diff' data-ln-start-from='{{ hunk.source_start }}'>{{ hunk.source | join('')}}</code></pre>
                            {% else %}
                            <div class='d-flex justify-content-center align-items-center' style='height:100%'>No data</div>
                            {% endif %}
                        </div>
                        <div class='target'>
                            {% if hunk.target %}
                            <pre class='mb-0 mt-0'><code class='diff' data-ln-start-from='{{ hunk.target_start }}'>{{ hunk.target | join('') }}</code></pre>
                            {% else %}
                            <div class='d-flex justify-content-center align-items-center' style='height:100%'>No data</div>
                            {% endif %}
                        </div>
                    </div>
                </div>
            </div>
            {% endfor %}
        </div>
    </div>
    {% endfor %}
    {% else %}
    <p>表示する差分はありません</p>
    {% endif %}
{% endblock %}
