roundabout,
created on Tuesday, 5 December 2023, 15:17:44 (1701789464),
received on Wednesday, 31 July 2024, 06:54:39 (1722408879)
Author identity: vlad <vlad.muntoiu@gmail.com>
eafca5a4fb21552778d68b0321e1873609d07874
templates/path-bar.html
@@ -0,0 +1,38 @@
<select id="branch-selection" style="flex: 0 1 auto;">
<option value="ref-{{ current }}" selected>{% if "tag:" in current %}tag:{% endif %}{{ current | replace("~", "/") | replace("tag:", " ") }}</option>
{% for branch in branches %}
{% if branch[0] != current | replace("~", "/") | replace("tag:", " ") %}
<option value="ref-{% if branch[1] == 'tag' %}tag:{% endif %}{{ branch[0] | replace('/', '~') }}">{% if branch[1] == "tag" %}tag: {% endif %}{{ branch[0] }}</option>
{% endif %}
{% endfor %}
<!--<option value="new">[CREATE NEW BRANCH]</option>-->
</select>
<input id="repo-path-bar" value="{{ subpath }}">
<script>
branchSelect = document.getElementById("branch-selection");
branchSelect.addEventListener("change", function() {
if(branchSelect.value == "new") {
document.getElementById("new-branch").showModal();
} else {
const PREFIX = "ref-";
if(branchSelect.value.startsWith(PREFIX)) {
branch = branchSelect.value.slice(PREFIX.length);
}
var http = new XMLHttpRequest();
http.open("HEAD", "/{{ username }}/{{ repository }}/tree/" + branch + "/{{ subpath }}", false);
http.send();
if(http.status == 404) {
location.href = "/{{ username }}/{{ repository }}/tree/" + branch;
} else {
location.href = "/{{ username }}/{{ repository }}/tree/" + branch + "/{{ subpath }}";
}
}
});
path = document.getElementById("repo-path-bar");
path.addEventListener("change", function() {
location.href = "/{{ username }}/{{ repository }}/tree/{{ current }}" + path.value;
});
</script>
templates/repo-file.html
@@ -126,44 +126,7 @@
<section class="card-main">
<x-vbox>
<x-buttonbox>
<select id="branch-selection" style="flex: 0 1 auto;">
<option value="ref-{{ current }}" selected>{% if "tag:" in current %}tag:{% endif %}{{ current | replace("~", "/") | replace("tag:", " ") }}</option>
{% for branch in branches %}
{% if branch[0] != current | replace("~", "/") | replace("tag:", " ") %}
<option value="ref-{% if branch[1] == 'tag' %}tag:{% endif %}{{ branch[0] | replace('/', '~') }}">{% if branch[1] == "tag" %}tag: {% endif %}{{ branch[0] }}</option>
{% endif %}
{% endfor %}
<!--<option value="new">[CREATE NEW BRANCH]</option>-->
</select>
<input id="repo-path-bar" value="{{ subpath }}">
<script>
branchSelect = document.getElementById("branch-selection");
branchSelect.addEventListener("change", function() {
if(branchSelect.value == "new") {
document.getElementById("new-branch").showModal();
} else {
const PREFIX = "ref-";
if(branchSelect.value.startsWith(PREFIX)) {
branch = branchSelect.value.slice(PREFIX.length);
}
var http = new XMLHttpRequest();
http.open("HEAD", "/{{ username }}/{{ repository }}/tree/" + branch + "/{{ subpath }}", false);
http.send();
if(http.status == 404) {
location.href = "/{{ username }}/{{ repository }}/tree/" + branch;
} else {
location.href = "/{{ username }}/{{ repository }}/tree/" + branch + "/{{ subpath }}";
}
}
});
path = document.getElementById("repo-path-bar");
path.addEventListener("change", function() {
location.href = "/{{ username }}/{{ repository }}/tree/{{ current }}" + path.value;
});
</script>
{% include "path-bar.html" %}
<button onclick="history.back();" class="button-flat big-button">
<iconify-icon icon="mdi:arrow-left"></iconify-icon>
</button>
templates/repo-tree.html
@@ -126,44 +126,7 @@
<section class="card-main">
<x-vbox>
<x-buttonbox>
<select id="branch-selection" style="flex: 0 1 auto;">
<option value="ref-{{ current }}" selected>{% if "tag:" in current %}tag:{% endif %}{{ current | replace("~", "/") | replace("tag:", " ") }}</option>
{% for branch in branches %}
{% if branch[0] != current | replace("~", "/") | replace("tag:", " ") %}
<option value="ref-{% if branch[1] == 'tag' %}tag:{% endif %}{{ branch[0] | replace('/', '~') }}">{% if branch[1] == "tag" %}tag: {% endif %}{{ branch[0] }}</option>
{% endif %}
{% endfor %}
<!--<option value="new">[CREATE NEW BRANCH]</option>-->
</select>
<input id="repo-path-bar" value="{{ subpath }}">
<script>
branchSelect = document.getElementById("branch-selection");
branchSelect.addEventListener("change", function() {
if(branchSelect.value == "new") {
document.getElementById("new-branch").showModal();
} else {
const PREFIX = "ref-";
if(branchSelect.value.startsWith(PREFIX)) {
branch = branchSelect.value.slice(PREFIX.length);
}
var http = new XMLHttpRequest();
http.open("HEAD", "/{{ username }}/{{ repository }}/tree/" + branch + "/{{ subpath }}", false);
http.send();
if(http.status == 404) {
location.href = "/{{ username }}/{{ repository }}/tree/" + branch;
} else {
location.href = "/{{ username }}/{{ repository }}/tree/" + branch + "/{{ subpath }}";
}
}
});
path = document.getElementById("repo-path-bar");
path.addEventListener("change", function() {
location.href = "/{{ username }}/{{ repository }}/tree/{{ current }}" + path.value;
});
</script>
{% include "path-bar.html" %}
<button onclick="history.back();" class="button-flat big-button">
<iconify-icon icon="mdi:arrow-left"></iconify-icon>
</button>