By using this site, you agree to have cookies stored on your device, strictly for functional purposes, such as storing your session and preferences.

Dismiss

 repo-commit.html

View raw Download
text/html • 9.94 kiB
HTML document, ASCII text
        
            
1
{% extends "repo.html" %}
2
3
{% set active_page = "log" %}
4
5
{% block title %}
6
{% trans message=data.message|split("\n\n")|first, username=username, repository=repository %}{{ basename }} in {{ username }}/{{ repository }}{% endtrans %}
7
{% endblock %}
8
{% block content %}
9
<x-vbox>
10
<x-frame style="--width: 896px;" class="flexible-space">
11
<x-vbox>
12
<article>
13
<h1>{{ data.message | split("\n\n", 1) | first | inline_markdown }}</h1>
14
{{ data.message | split("\n\n", 1) | last | markdown }}
15
</article>
16
17
<p>
18
<a href="/{{ data.owner_name }}">{{ data.owner_name }}</a>,<br>
19
{% trans receive_date=data.receive_date.strftime('%A, %e %B %Y, %H:%M:%S'), author_date=data.author_date.strftime("%A, %e %B %Y, %H:%M:%S"),
20
receive_unix=data.receive_date.timestamp() | int, author_unix=data.author_date.timestamp() | int
21
%}
22
created on {{ author_date }} ({{ author_unix }}),
23
received on {{ receive_date }} ({{ receive_unix }})
24
{% endtrans %}
25
<br>
26
{% trans %}Author identity:{% endtrans %} <code>{{ data.owner_identity | harvester_protection | safe }}</code>
27
</p>
28
29
<code>{{ data.sha }}</code>
30
31
<x-vbox>
32
{% for file in diff %}
33
<article class="card">
34
<section class="card-main">
35
<h2>{{ file }}</h2>
36
{% set vars = namespace(original_line=0, modified_line=0, hunk_started=false) %}
37
{% for line in diff[file] %}
38
{% if line.startswith("@@") %}
39
{% if vars.hunk_started %}
40
</pre> <!-- close the previous pre block if this isn't the first hunk -->
41
{% endif %}
42
{% set vars.hunk_started = true %}
43
{% set diff_location = line|parse_diff_location %}
44
{% set vars.original_line = diff_location[0][0] %}
45
{% set vars.modified_line = diff_location[1][0] %}
46
<h3 class="diff-position">{{ line }}</h3>
47
<pre class="code-view">
48
{% elif vars.hunk_started %}
49
{% if line.startswith("+") %}
50
<button class="line-number" data-file="{{ file }}" data-line="{{ vars.modified_line }}">{{ vars.modified_line }}&nbsp;+</button>
51
<ins>{{ line[1:] }}</ins>
52
{% set vars.modified_line = vars.modified_line + 1 %}
53
{% elif line.startswith("-") %}
54
<button class="line-number" data-file="{{ file }}" data-line="{{ vars.original_line }}">{{ vars.original_line }}&nbsp;-</button>
55
<del>{{ line[1:] }}</del>
56
{% set vars.original_line = vars.original_line + 1 %}
57
{% elif not line.startswith("\\") %}
58
{% if line %}
59
<button class="line-number" data-file="{{ file }}" data-line="{{ vars.modified_line }}">{{ vars.modified_line }}&nbsp;&nbsp;</button>
60
<x-codeline>{{ line[1:] }}</x-codeline>
61
{% endif %}
62
{% if not line.startswith("@@") %}
63
{% set vars.original_line = vars.original_line + 1 %}
64
{% set vars.modified_line = vars.modified_line + 1 %}
65
{% endif %}
66
{% endif %}
67
{% endif %}
68
{% for comment in comment_query.filter_by(commit=data, file=file, line_number=vars.original_line, state=1).all() %}
69
<div class="comment">
70
<article>
71
{{ comment.text | safe }} {# this was generated by the markdown parser which escapes HML #}
72
</article>
73
<small>
74
{% trans %}by{% endtrans %} <a href="/{{ comment.owner_name }}">{{ comment.owner.username }}</a>,
75
{{ comment.date | strftime('%A, %e %B %Y, %H:%M:%S') }}
76
</small>
77
<x-buttonbox>
78
{% if comment.author == current_user or data.owner == current_user or permission_level >= 2 %}
79
<form method="post" action="{{ repo_data.route }}/commit/{{ data.sha }}/resolve_comment/{{ comment.number }}">
80
<button type="submit">
81
Resolve
82
</button>
83
</form>
84
<form method="post" action="{{ repo_data.route }}/commit/{{ data.sha }}/delete_comment/{{ comment.number }}">
85
<button type="submit" class="button-flat">Delete</button>
86
</form>
87
{% endif %}
88
</x-buttonbox>
89
</div>
90
{% endfor %}
91
{% if comment_query.filter_by(commit=data, file=file, line_number=vars.original_line, state=0).count() %}
92
<details class="resolved-comments">
93
<summary>{% trans count=comment_query.filter_by(commit=data, file=file, line_number=vars.original_line, state=0).count() %}Resolved comments ({{ count }}){% endtrans %}</summary>
94
{% for comment in comment_query.filter_by(commit=data, file=file, line_number=vars.original_line, state=0).all() %}
95
<div class="comment">
96
{{ comment.text | safe }} {# this was generated by the markdown parser which escapes HML #}
97
<x-buttonbox>
98
{% if comment.author == current_user or data.owner == current_user or permission_level >= 2 %}
99
<form method="post" action="{{ repo_data.route }}/commit/{{ data.sha }}/resolve_comment/{{ comment.number }}">
100
<button type="submit">
101
Un-resolve
102
</button>
103
</form>
104
<form method="post" action="{{ repo_data.route }}/commit/{{ data.sha }}/delete_comment/{{ comment.number }}">
105
<button type="submit" class="button-flat">Delete</button>
106
</form>
107
{% endif %}
108
</x-buttonbox>
109
</div>
110
{% endfor %}
111
</details>
112
{% endif %}
113
{% endfor %}
114
{% if vars.hunk_started %}
115
</pre> {# close the last hunk #}
116
{% endif %}
117
</section>
118
</article>
119
{% endfor %}
120
</x-vbox>
121
</x-vbox>
122
</x-frame>
123
</x-vbox>
124
<dialog id="add-comment-dialog">
125
<article class="card">
126
<header class="card-top">
127
<div class="navbar navbar-mini">
128
<ul>
129
<li><h4>{% trans %}Add comment{% endtrans %}</h4></li>
130
</ul>
131
<x-buttonbox class="dialog-tools">
132
<button class="button-flat button-neutral big-button" type="submit" form="info-form"><iconify-icon icon="mdi:close"></iconify-icon></button>
133
</x-buttonbox>
134
</div>
135
</header>
136
<section class="card-main" style="padding-top: var(--padding-card-top);">
137
<form method="post" action="{{ repo_data.route }}/commit/{{ data.sha }}/add_comment">
138
<input type="hidden" name="file" value="">
139
<input type="hidden" name="line" value="">
140
<textarea name="comment" required></textarea>
141
<button type="submit">Post</button>
142
</form>
143
</section>
144
</article>
145
</dialog>
146
{% endblock %}
147
{% block scripts %}
148
<script>
149
document.querySelectorAll(".line-number").forEach(function (element) {
150
element.addEventListener("click", function () {
151
let file = element.getAttribute("data-file");
152
let line = element.getAttribute("data-line");
153
let dialog = document.getElementById("add-comment-dialog");
154
dialog.querySelector("input[name=file]").value = file;
155
dialog.querySelector("input[name=line]").value = line;
156
dialog.showModal();
157
});
158
});
159
</script>
160
{% endblock %}
161