home » zplus/clif.git
Author zPlus <zplus@peers.community> 2022-07-31 15:18:01
Committer zPlus <zplus@peers.community> 2022-07-31 15:18:01
Commit 2c55b65 (patch)
Tree 199e7c4
Parent(s)

Fix broken branch selectors in "tree" and "log" pages. - Select the correct revision in the <select> menu when loading the page - In the "log" page, redirect to the log page again instead of the tree page


commits diff: 9a1e874..2c55b65
3 files changed, 24 insertions, 6 deletionsdownload


Diffstat
-rw-r--r-- templates/repository/log.html 8
-rw-r--r-- templates/repository/tree.html 6
-rw-r--r-- web.py 16

Diff options
View
Side
Whitespace
Context lines
Inter-hunk lines
+5/-3 M   templates/repository/log.html
index 83a0ec6..aa84bf8
old size: 3K - new size: 3K
@@ -5,12 +5,13 @@
5 5 {% block content %}
6 6
7 7 <div>
8 - <form action="{{ url('tree_change', repository=repository[:-4]) }}" method="post">
8 + <form action="{{ url('log_change', repository=repository[:-4]) }}" method="post">
9 9 <select name="revision" id="revision">
10 10 <optgroup label="heads">
11 11 {% for h in heads %}
12 12 <option value="{{ h[11:] }}"
13 - {{ "selected" if h[11:] == repository[2] }}
13 + {{ "selected" if h[11:] == revision }}
14 + {{ "selected" if revision == "HEAD" and head_ref == h }}
14 15 >{{ h[11:] }}{{ ' [HEAD]' if head_ref == h }}</option>
15 16 {% endfor %}
16 17 </optgroup>
@@ -18,7 +19,8 @@
18 19 <optgroup label="tags">
19 20 {% for t in tags %}
20 21 <option value="{{ t[10:] }}"
21 - {{ "selected" if t[10:] == repository[2] }}
22 + {{ "selected" if t[10:] == revision }}
23 + {{ "selected" if revision == "HEAD" and head_ref == h }}
22 24 >{{ t[10:] }}</option>
23 25 {% endfor %}
24 26 </optgroup>

+4/-2 M   templates/repository/tree.html
index 7679756..8a9063d
old size: 2K - new size: 2K
@@ -10,7 +10,8 @@
10 10 <optgroup label="heads">
11 11 {% for h in heads %}
12 12 <option value="{{ h[11:] }}"
13 - {{ "selected" if h[11:] == repository[2] }}
13 + {{ "selected" if h[11:] == revision }}
14 + {{ "selected" if revision == "HEAD" and head_ref == h }}
14 15 >{{ h[11:] }}{{ ' [HEAD]' if head_ref == h }}</option>
15 16 {% endfor %}
16 17 </optgroup>
@@ -18,7 +19,8 @@
18 19 <optgroup label="tags">
19 20 {% for t in tags %}
20 21 <option value="{{ t[10:] }}"
21 - {{ "selected" if t[10:] == repository[2] }}
22 + {{ "selected" if t[10:] == revision }}
23 + {{ "selected" if revision == "HEAD" and head_ref == h }}
22 24 >{{ t[10:] }}</option>
23 25 {% endfor %}
24 26 </optgroup>

+15/-1 M   web.py
index eb81bac..719bde6
old size: 23K - new size: 23K
@@ -398,7 +398,7 @@ def tree(repository, revision, tree_path=None):
398 398 def tree_change(repository):
399 399 """
400 400 Switch revision in tree page.
401 - This route is used by the <form> in the "tree page when changing the revision
401 + This route is used by the <form> in the tree page when changing the revision
402 402 to be displayed.
403 403 """
404 404
@@ -474,6 +474,20 @@ def log(repository, revision):
474 474 commits=commits,
475 475 repository=repository, revision=revision)
476 476
477 + @bottle.post('/<repository:path>.git/log', name='log_change')
478 + def log_change(repository):
479 + """
480 + Switch revision in log page.
481 + This route is used by the <form> in the log page when changing the revision
482 + to be displayed.
483 + """
484 +
485 + revision = request.forms.get('revision')
486 +
487 + bottle.redirect(application.get_url('log',
488 + repository=repository,
489 + revision=revision))
490 +
477 491 @bottle.get('/<repository:path>.git/raw/<revision>/<tree_path:path>', name='raw')
478 492 def raw(repository, revision, tree_path):
479 493 """