repo-file.html
HTML document, ASCII text
1{% extends "repo.html" %} 2{% block header %}{{ super() }}/<a href="/{{ username }}/{{ repository }}/tree">tree</a>{% endblock %} 3{% block content %} 4<!-- 5<dialog id="commit-dialog"> 6<x-frame style="--width: 768px; --margin: 0;"> 7<div class="card"> 8<section class="card-main"> 9<form> 10<x-vbox> 11<x-hbox style="align-items: center; justify-content: space-between;"> 12<h3>Commit</h3> 13<button class="button-flat big-button"><iconify-icon icon="mdi:close"></iconify-icon></button> 14</x-hbox> 15<div> 16<h4>Changes (-100, +100)</h4> 17<ul> 18<li>File 1: removed</li> 19<li>File 2: created</li> 20<li>File 3: modified</li> 21</ul> 22</div> 23<x-vbox class="flexible-space nopad"> 24<input id="commit-message" placeholder="Commit message"> 25<textarea rows="6"></textarea> 26</x-vbox> 27<x-buttonbox class="buttonbox-right"> 28<button class="button-flat" onclick="document.getElementById('stash-dialog').showModal(); return false;"> 29<iconify-icon icon="mdi:close-box-multiple"></iconify-icon> 30Stash 31</button> 32<button> 33<iconify-icon icon="mdi:send-check"></iconify-icon> 34Commit 35</button> 36</x-buttonbox> 37</x-vbox> 38</form> 39</section> 40</div> 41</x-frame> 42</dialog> 43<dialog id="stash-dialog"> 44<x-frame style="--width: 320px; --margin: 0;"> 45<div class="card"> 46<section class="card-main"> 47<form method="dialog"> 48<x-vbox> 49<div> 50<h4>Stash changes</h4> 51<p>Are you sure you want to stash your changes? They will be permanently lost.</p> 52</div> 53<x-buttonbox class="buttonbox-right"> 54<button class="button-flat"> 55No 56</button> 57<button class="button-flat"> 58Yes 59</button> 60</x-buttonbox> 61</x-vbox> 62</form> 63</section> 64</div> 65</x-frame> 66</dialog> 67--> 68 69<x-vbox> 70<!-- 71<x-frame style="--width: 896px;"> 72<article class="card"> 73<section class="card-main"> 74<x-hbox style="align-items: center; justify-content: space-between;"> 75You've got uncommitted changes (N files) 76<x-buttonbox> 77<button class="button-flat" onclick="document.getElementById('stash-dialog').showModal();"> 78<iconify-icon icon="mdi:close-box-multiple"></iconify-icon> 79Stash 80</button> 81<button onclick="document.getElementById('commit-dialog').showModal();"> 82<iconify-icon icon="mdi:send"></iconify-icon> 83Commit 84</button> 85</x-buttonbox> 86</x-hbox> 87</section> 88</article> 89</x-frame> 90<dialog id="new-branch"> 91<x-frame style="--width: 448px; --margin: 0;"> 92<div class="card"> 93<section class="card-main"> 94<form method="get"> 95<x-vbox> 96<div> 97<h4>Create new branch</h4> 98<p>The branch will be based on the currently selected branch.</p> 99</div> 100<x-vbox class="nopad"> 101<label for="current">Copy of:</label> 102<input id="current" name="current" value="{{ current }}" disabled> 103</x-vbox> 104<x-vbox class="nopad"> 105<label for="name">Name</label> 106<input id="name" name="name" placeholder="{{ current }}" value="" required> 107</x-vbox> 108<label><input type="checkbox" id="orphan">Orphan branch</label> 109<x-buttonbox class="buttonbox-right"> 110<button class="button-flat" onclick="document.getElementById('new-branch').close(); document.getElementById('branch-selection').value = 'branch-{{ current }}';"> 111Cancel 112</button> 113<button class="button-flat" type="submit"> 114Create 115</button> 116</x-buttonbox> 117</x-vbox> 118</form> 119</section> 120</div> 121</x-frame> 122</dialog> 123--> 124<x-frame style="--width: 896px;" class="flexible-space"> 125<article class="card"> 126<section class="card-main"> 127<x-vbox> 128<x-buttonbox> 129<select id="branch-selection" style="flex: 0 1 auto;"> 130<option value="branch-{{ current }}" selected>{{ current }}</option> 131{% for branch in branches %} 132{% if branch.name != current %} 133<option value="branch-{{ branch.name }}">{{ branch.name }}</option> 134{% endif %} 135{% endfor %} 136<!-- <option value="new">[CREATE NEW BRANCH]</option>--> 137</select> 138<input id="repo-path-bar" value="{{ subpath }}"> 139<script> 140branchSelect = document.getElementById("branch-selection"); 141 142branchSelect.addEventListener("change", function() { 143if(branchSelect.value == "new") { 144document.getElementById("new-branch").showModal(); 145} else { 146const PREFIX = "branch-"; 147if(branchSelect.value.startsWith(PREFIX)) { 148branch = branchSelect.value.slice(PREFIX.length); 149} 150var http = new XMLHttpRequest(); 151http.open("HEAD", "/{{ username }}/{{ repository }}/tree/" + branch + "/{{ subpath }}", false); 152http.send(); 153if(http.status == 404) { 154location.href = "/{{ username }}/{{ repository }}/tree/" + branch; 155} else { 156location.href = "/{{ username }}/{{ repository }}/tree/" + branch + "/{{ subpath }}"; 157} 158} 159}); 160 161path = document.getElementById("repo-path-bar"); 162 163path.addEventListener("change", function() { 164location.href = "/{{ username }}/{{ repository }}/tree/"; 165}); 166</script> 167<button onclick="history.back();" class="button-flat big-button"> 168<iconify-icon icon="mdi:arrow-left"></iconify-icon> 169</button> 170<button onclick="history.forward();" class="button-flat big-button"> 171<iconify-icon icon="mdi:arrow-right"></iconify-icon> 172</button> 173<a href="./" class="button button-flat big-button"> 174<iconify-icon icon="mdi:arrow-up"></iconify-icon> 175</a> 176<a href="/{{ username }}/{{ repository }}/tree/{{ branch }}" class="button button-flat big-button"> 177<iconify-icon icon="mdi:home"></iconify-icon> 178</a> 179<a href="" class="button button-flat big-button"> 180<iconify-icon icon="mdi:refresh"></iconify-icon> 181</a> 182</x-buttonbox> 183{% include "file-view.html" %} 184<!-- 185<x-buttonbox class="buttonbox"> 186<button class="button-flat big-button"> 187<iconify-icon icon="mdi:file-plus"></iconify-icon> 188</button> 189<button class="button-flat big-button"> 190<iconify-icon icon="mdi:upload"></iconify-icon> 191</button> 192<div class="flexible-space"></div> 193<button class="button-flat big-button" disabled> 194<iconify-icon icon="mdi:open-in-app"></iconify-icon> 195</button> 196<button class="button-flat big-button"> 197<iconify-icon icon="mdi:download"></iconify-icon> 198</button> 199<button class="button-flat big-button"> 200<iconify-icon icon="mdi:share"></iconify-icon> 201</button> 202<button class="button-flat big-button" disabled> 203<iconify-icon icon="mdi:content-copy"></iconify-icon> 204</button> 205<button class="button-flat big-button" disabled> 206<iconify-icon icon="mdi:content-cut"></iconify-icon> 207</button> 208<button class="button-flat big-button" disabled> 209<iconify-icon icon="mdi:content-paste"></iconify-icon> 210</button> 211<button class="button-flat big-button" disabled> 212<iconify-icon icon="mdi:rename"></iconify-icon> 213</button> 214<button class="button-flat big-button" disabled> 215<iconify-icon icon="mdi:delete"></iconify-icon> 216</button> 217</x-buttonbox> 218--> 219</x-vbox> 220</section> 221</article> 222</x-frame> 223</x-vbox> 224{% endblock %}