home » zplus/clif.git
ID: f6f5add22e020f3a804330ad58d4d28f6b9784da
108 lines — 4K — View raw


{% extends "repository/repository.html" %}

{% block page_title %}Log: {{ repository }}/{{ revision }}{% endblock %}

{% block menu_log_class %}selected{% endblock %}

{% block content %}

    <div>
        <form action="{{ url('log_change', repository=repository[:-4]) }}" method="post">
            <select name="revision" id="revision">
                <optgroup label="heads">
                    {% for h in heads %}
                        <option value="{{ h[11:] }}"
                                {{ "selected" if h[11:] == revision }}
                                {{ "selected" if revision == "HEAD" and head_ref == h }}
                        >{{ h[11:] }}{{ ' [HEAD]' if head_ref == h }}</option>
                    {% endfor %}
                </optgroup>
                
                <optgroup label="tags">
                    {% for t in tags %}
                        <option value="{{ t[10:] }}"
                                {{ "selected" if t[10:] == revision }}
                                {{ "selected" if revision == "HEAD" and head_ref == h }}
                        >{{ t[10:] }}</option>
                    {% endfor %}
                </optgroup>
            </select>
            <input type="submit" value="switch" />
        </form>
    </div>

    <div class="">
        
        <table class="log">
            <thead>
                <tr>
                    <td class="author">Author</td>
                    <td class="id">ID</td>
                    <td class="message">Message</td>
                    <td class="time">Commit time</td>
                    {% if defaults.LOG_STATS %}
                        <td class="files">Files</td>
                        <td class="lines">Lines</td>
                    {% endif %}
                </tr>
            </thead>
            
            <tbody class="striped">
            {% for commit in commits %}
                <tr>
                    <td title="{{ commit.author.email }}" class="author">
                        {% if commit.author.name|length > 0 %}
                            {{ commit.author.name }}
                        {% else %}
                            [anonymous]
                        {% endif %}
                    </td>
                    <td class="short_id" title="{{ commit.id }}">
                        <a href="{{ url('commit', repository=repository[:-4], commit_id=commit.id) }}">{{ commit.short_id }}</a>
                    </td>
                    <td class="message">
                        {% set subject, body = commit.message.split('\n', 1) %}
                        {% if body|length == 0 %}
                            {{ commit.message }}
                        {% else %}
                            <details>
                                <summary>{{ subject }}</summary>
                                <div class="fulltext">{{ body.strip() }}</div>
                            </details>
                        {% endif %}
                    </td>
                    <td class="time" title="{{ commit_time(commit.commit_time, commit.commit_time_offset) }}">
                        {{ commit_time(commit.commit_time, commit.commit_time_offset)|ago }}
                    </td>
                    
                    {% if defaults.LOG_STATS %}
                        <td class="files">
                            {% if commit.short_id in diff %}
                                {{ diff[commit.short_id].stats.files_changed }}
                            {% endif %}
                        </td>
                        <td class="lines">
                            {% if commit.short_id in diff %}
                                <span class="insertions">+{{ diff[commit.short_id].stats.insertions }}</span>/<span class="deletions">-{{ diff[commit.short_id].stats.deletions }}</span>
                            {% endif %}
                        </td>
                    {% endif %}
                </tr>
            {% endfor %}
            </tbody>
        </table>
        
        <br />
        
        {% if offset > 0 %}
            {% set prev_offset = offset - log_pagination %}
            <a href="{{ url('log', repository=repository[:-4], revision=revision, offset=prev_offset) }}">« Prev</a>
        {% endif %}
        
        {% if commits|length == log_pagination %}
            {% set next_offset = offset + log_pagination %}
            <a href="{{ url('log', repository=repository[:-4], revision=revision, offset=next_offset) }}">Next »</a>
        {% endif %}
    </div>

{% endblock %}