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 • 10.66 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 %}{{ message }} 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, actual_line=0, line_type=0) %}
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.actual_line = vars.modified_line %}
53
{% set vars.line_type = 1 %}
54
{% set vars.modified_line = vars.modified_line + 1 %}
55
{% elif line.startswith("-") %}
56
<button class="line-number" data-file="{{ file }}" data-line="-{{ vars.original_line }}">{{ vars.original_line }}&nbsp;-</button>
57
<del>{{ line[1:] }}</del>
58
{% set vars.actual_line = vars.original_line %}
59
{% set vars.line_type = 0 %}
60
{% set vars.original_line = vars.original_line + 1 %}
61
{% elif not line.startswith("\\") %}
62
{% if line %}
63
<button class="line-number" data-file="{{ file }}" data-line="+{{ vars.modified_line }}">{{ vars.modified_line }}&nbsp;&nbsp;</button>
64
<x-codeline>{{ line[1:] }}</x-codeline>
65
{% endif %}
66
{% if not line.startswith("@@") %}
67
{% set vars.actual_line = vars.modified_line %}
68
{% set vars.line_type = 1 %}
69
{% set vars.original_line = vars.original_line + 1 %}
70
{% set vars.modified_line = vars.modified_line + 1 %}
71
{% endif %}
72
{% endif %}
73
{% endif %}
74
{% for comment in comment_query.filter_by(commit=data, file=file, line_number=vars.actual_line, line_type=vars.line_type, state=1).all() %}
75
<div class="comment">
76
<article>
77
{{ comment.text | safe }} {# this was generated by the markdown parser which escapes HTML #}
78
</article>
79
<small>
80
{% trans %}by{% endtrans %} <a href="/{{ comment.owner_name }}">{{ comment.owner.username }}</a>,
81
{{ comment.date | strftime('%A, %e %B %Y, %H:%M:%S') }}
82
</small>
83
<x-buttonbox>
84
{% if comment.author == current_user or data.owner == current_user or permission_level >= 2 %}
85
<form method="post" action="{{ repo_data.route }}/commit/{{ data.sha }}/resolve_comment/{{ comment.number }}">
86
<button type="submit">
87
{% trans %}Resolve{% endtrans %}
88
</button>
89
</form>
90
<form method="post" action="{{ repo_data.route }}/commit/{{ data.sha }}/delete_comment/{{ comment.number }}">
91
<button type="submit" class="button-flat">{% trans %}Delete{% endtrans %}</button>
92
</form>
93
{% endif %}
94
</x-buttonbox>
95
</div>
96
{% endfor %}
97
{% if comment_query.filter_by(commit=data, file=file, line_number=vars.actual_line, line_type=vars.line_type, state=0).count() %}
98
<details class="resolved-comments">
99
<summary>{% trans count=comment_query.filter_by(commit=data, file=file, line_number=vars.actual_line, line_type=vars.line_type, state=0).count() %}Resolved comments ({{ count }}){% endtrans %}</summary>
100
{% for comment in comment_query.filter_by(commit=data, file=file, line_number=vars.actual_line, line_type=vars.line_type, state=0).all() %}
101
<div class="comment">
102
{{ comment.text | safe }} {# this was generated by the markdown parser which escapes HML #}
103
<x-buttonbox>
104
{% if comment.author == current_user or data.owner == current_user or permission_level >= 2 %}
105
<form method="post" action="{{ repo_data.route }}/commit/{{ data.sha }}/resolve_comment/{{ comment.number }}">
106
<button type="submit">
107
{% trans %}Unresolve{% endtrans %}
108
</button>
109
</form>
110
<form method="post" action="{{ repo_data.route }}/commit/{{ data.sha }}/delete_comment/{{ comment.number }}">
111
<button type="submit" class="button-flat">{% trans %}Delete{% endtrans %}</button>
112
</form>
113
{% endif %}
114
</x-buttonbox>
115
</div>
116
{% endfor %}
117
</details>
118
{% endif %}
119
{% endfor %}
120
{% if vars.hunk_started %}
121
</pre> {# close the last hunk #}
122
{% endif %}
123
</section>
124
</article>
125
{% endfor %}
126
</x-vbox>
127
</x-vbox>
128
</x-frame>
129
</x-vbox>
130
<dialog id="add-comment-dialog">
131
<article class="card">
132
<header class="card-top">
133
<div class="navbar navbar-mini">
134
<ul>
135
<li><h4>{% trans %}Add comment{% endtrans %}</h4></li>
136
</ul>
137
<x-buttonbox class="dialog-tools">
138
<button class="button-flat button-neutral big-button" type="submit" form="info-form"><iconify-icon icon="mdi:close"></iconify-icon></button>
139
</x-buttonbox>
140
</div>
141
</header>
142
<section class="card-main" style="padding-top: var(--padding-card-top);">
143
<form method="post" action="{{ repo_data.route }}/commit/{{ data.sha }}/add_comment">
144
<input type="hidden" name="file" value="">
145
<input type="hidden" name="line" value="">
146
<textarea name="comment" required></textarea>
147
<button type="submit">Post</button>
148
</form>
149
</section>
150
</article>
151
</dialog>
152
{% endblock %}
153
{% block scripts %}
154
<script>
155
document.querySelectorAll(".line-number").forEach(function (element) {
156
element.addEventListener("click", function () {
157
let file = element.getAttribute("data-file");
158
let line = element.getAttribute("data-line");
159
let dialog = document.getElementById("add-comment-dialog");
160
dialog.querySelector("input[name=file]").value = file;
161
dialog.querySelector("input[name=line]").value = line;
162
dialog.showModal();
163
});
164
});
165
document.querySelectorAll()
166
</script>
167
{% endblock %}
168