ggdgsdbsdbbb / templates / tree.html
328 lines · 303 sloc · 15.47 KB · 1fbadcea1b606763dc692b8ffd2f84b3648759cf
Raw
1<!DOCTYPE html>
2<html>
3 <head>
4 @include 'layout/head.html'
5 @css '/css/ci.css'
6 </head>
7 <body>
8 @include 'layout/header.html'
9
10 <script>
11 const TREE_BRANCH_PATH_TEMPLATE = "/@repo.user_name/@repo.name/tree/";
12 const BRANCH_NAME = "@branch_name";
13 const REPO_ID = @repo.id;
14 const CURRENT_PATH = "@ctx.current_path";
15 const REPO_USER = "@repo.user_name";
16 const REPO_NAME = "@repo.name";
17 const TREE_MODE = "@tree_mode";
18 const TREE_FOLDER_SIZE_ENABLED = "@{show_folder_size}" === "true";
19 </script>
20
21 <div class="content">
22 @include 'layout/repo_menu.html'
23
24 <div class="repo-wrapper">
25 <span class="branch-specific-container">
26 <select class="branch-select" name="branch">
27 @for name in app.get_all_repo_branch_names(repo.id)
28 <option value="@name">@name</option>
29 @end
30 </select>
31
32 <a class="branches-link" href="/@repo.user_name/@repo.name/branches">
33 <svg aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M384 144c0-44.2-35.8-80-80-80s-80 35.8-80 80c0 36.4 24.3 67.1 57.5 76.8-.6 16.1-4.2 28.5-11 36.9-15.4 19.2-49.3 22.4-85.2 25.7-28.2 2.6-57.4 5.4-81.3 16.9v-144c32.5-10.2 56-40.5 56-76.3 0-44.2-35.8-80-80-80S0 35.8 0 80c0 35.8 23.5 66.1 56 76.3v199.3C23.5 365.9 0 396.2 0 432c0 44.2 35.8 80 80 80s80-35.8 80-80c0-34-21.2-63.1-51.2-74.6 3.1-5.2 7.8-9.8 14.9-13.4 16.2-8.2 40.4-10.4 66.1-12.8 42.2-3.9 90-8.4 118.2-43.4 14-17.4 21.1-39.8 21.6-67.9 31.6-10.8 54.4-40.7 54.4-75.9zM80 64c8.8 0 16 7.2 16 16s-7.2 16-16 16-16-7.2-16-16 7.2-16 16-16zm0 384c-8.8 0-16-7.2-16-16s7.2-16 16-16 16 7.2 16 16-7.2 16-16 16zm224-320c8.8 0 16 7.2 16 16s-7.2 16-16 16-16-7.2-16-16 7.2-16 16-16z"></path></svg>
34 @repo.format_nr_branches(ctx.lang)
35 </a>
36
37 <div class="repo-mode-switch">
38 @if is_top_files_mode
39 <a class="repo-mode-link" href="@tree_url">Tree</a>
40 <span class="repo-mode-link active">Top files</span>
41 @else
42 <span class="repo-mode-link active">Tree</span>
43 <a class="repo-mode-link" href="@top_files_url">Top files</a>
44 @end
45 </div>
46
47 <div class="repo-code-container">
48 <div class="repo-code-button">Code</div>
49
50 <div class="repo-clone-dropdown">
51 Clone with HTTPS:
52 <div class="clone-input-group">
53 <input disabled value="@{app.generate_clone_url(repo)}">
54 <button class="copy-clone-url-button">Copy</button>
55 </div>
56 </div>
57 </div>
58
59 @if repo.user_id == ctx.user.id
60 <a class="add-file-btn" href="/@repo.user_name/@repo.name/new/@branch_name">+</a>
61 @end
62 </span>
63
64 @if is_top_directory
65 <div class="repo-actions">
66 @if is_repo_starred
67 <button class="star-button">
68 @include 'svgs/unstar.html'
69 %starred @{repo.nr_stars}
70 </button>
71 @else
72 <button class="star-button">
73 @include 'svgs/star.html'
74 %star_action @{repo.nr_stars}
75 </button>
76 @end
77
78 @if is_repo_watcher
79 <button class="watch-button">
80 @include 'svgs/unwatch.html'
81 %unwatch_action @{watcher_count}
82 </button>
83 @else
84 <button class="watch-button">
85 @include 'svgs/watch.html'
86 %watch_action @{watcher_count}
87 </button>
88 @end
89 </div>
90 @end
91 </div>
92
93 @if is_top_directory
94 <div class="repo-layout">
95 <div class="repo-main">
96 @end
97
98 @if has_commits && repo.lang_stats.len > 0
99 .lang-stats-header {
100 .langs {
101 @for stat in repo.lang_stats
102 .lang-stat {
103 <span class='lang-stat-dot' style='background-color:@{stat.color}'> </span>
104 <b>@stat.name</b>
105 @{stat.pct_html()}
106 }
107 @end
108 }
109
110 .lang-stats-bar {
111 @for stat in repo.lang_stats
112 <div style='flex:@{stat.pct}; background-color:@stat.color'></div>
113 @end
114 }
115 }
116 @end
117
118 @if is_top_files_mode
119 <div class="files files--top-files">
120 <div class="top-files-header">
121 <b>Top files</b>
122 <span>Largest @top_files_limit files in @branch_name</span>
123 </div>
124
125 @if top_files.len == 0
126 <div class="top-files-empty">No files found</div>
127 @end
128
129 @for file in top_files
130 <div class="file top-file" data-name="@file.full_path()">
131 span.file-ico {
132 <svg aria-hidden="true" focusable="false" data-prefix="far" data-icon="file-alt" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M288 248v28c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-28c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12zm-12 72H108c-6.6 0-12 5.4-12 12v28c0 6.6 5.4 12 12 12h168c6.6 0 12-5.4 12-12v-28c0-6.6-5.4-12-12-12zm108-188.1V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V48C0 21.5 21.5 0 48 0h204.1C264.8 0 277 5.1 286 14.1L369.9 98c9 8.9 14.1 21.2 14.1 33.9zm-128-80V128h76.1L256 51.9zM336 464V176H232c-13.3 0-24-10.7-24-24V48H48v416h288z"></path></svg>
133 }
134 span.file-name {
135 <a href='/@repo.user_name/@repo.name/blob/@branch_name/@file.full_path()'>@file.full_path()</a>
136 }
137 <span class="file-size">
138 @file.pretty_size()
139 </span>
140 </div>
141 @end
142 </div>
143 @else
144 @if show_folder_size
145 <div class="files files--with-size">
146 @else
147 <div class="files">
148 @end
149 .last_commit {
150 <b>@last_commit.author</b>
151 span.last_commit_message {
152 @last_commit.message
153 }
154 <a href="/@repo.user_name/@repo.name/commit/@last_commit.hash" class="last_commit_hash">@last_commit.hash</a>
155 @if has_ci
156 <a href="/@repo.user_name/@repo.name/ci/@ci_status.ci_run_id" title="CI: @{ci_status.status.str()}">
157 <span class="ci-badge-inline @{ci_status.status.css_class()}"></span>
158 </a>
159 @end
160 span.time {
161 @last_commit.relative()
162 }
163 }
164
165 @if can_up
166 .file {
167 span.file-ico {
168 <svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="folder" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M464 128H272l-64-64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V176c0-26.51-21.49-48-48-48z"></path></svg>
169 }
170 span.file-name {
171 <a href="@up">..</a>
172 }
173 @if show_folder_size
174 <span class="file-size"></span>
175 @end
176 }
177 @end
178 @for file in items
179 <div class="file" data-name="@file.name">
180 span.file-ico {
181 @if file.is_dir
182 <svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="folder" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M464 128H272l-64-64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V176c0-26.51-21.49-48-48-48z"></path></svg>
183 @else
184 <svg aria-hidden="true" focusable="false" data-prefix="far" data-icon="file-alt" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M288 248v28c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-28c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12zm-12 72H108c-6.6 0-12 5.4-12 12v28c0 6.6 5.4 12 12 12h168c6.6 0 12-5.4 12-12v-28c0-6.6-5.4-12-12-12zm108-188.1V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V48C0 21.5 21.5 0 48 0h204.1C264.8 0 277 5.1 286 14.1L369.9 98c9 8.9 14.1 21.2 14.1 33.9zm-128-80V128h76.1L256 51.9zM336 464V176H232c-13.3 0-24-10.7-24-24V48H48v416h288z"></path></svg>
185 @end
186 }
187 span.file-name {
188 <a href='/@repo.user_name/@repo.name/@file.url()'>@file.name</a>
189 }
190 <span class="file-msg" data-msg-for="@file.name">
191 <a href="/@repo.user_name/@repo.name/commit/@file.last_hash#@file.full_path()">@file.format_commit_message()</a>
192 </span>
193 <span class="file-time" data-time-for="@file.name">
194 @file.pretty_last_time()
195 </span>
196 @if show_folder_size
197 @if file.is_dir
198 <span class="file-size" data-size-for="@file.name">
199 @file.pretty_tree_size()
200 </span>
201 @else
202 <span class="file-size">@file.pretty_size()</span>
203 @end
204 @end
205 </div>
206 @end
207 @if is_top_directory
208 <div class="file file-total">
209 <span class="file-size">
210 <svg aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M448 73.143v45.714C448 159.143 347.667 192 224 192S0 159.143 0 118.857V73.143C0 32.857 100.333 0 224 0s224 32.857 224 73.143zM448 176v102.857C448 319.143 347.667 512 224 512S0 479.143 0 438.857V336c48.125 33.143 136.208 48.572 224 48.572S399.874 369.143 448 336z"></path></svg>
211 @repo.format_size()
212 </span>
213 </div>
214 @end
215 </div>
216
217 @if readme.len > 0
218 <div class="readme" id="readme">
219 @readme
220 </div>
221 @end
222 @end
223
224 @if is_top_directory
225 </div>
226
227 <aside class="repo-sidebar">
228 <section class="sidebar-section">
229 <div class="sidebar-section-header">
230 <h3>%about_section</h3>
231 </div>
232 @if repo.description != ''
233 <p class="sidebar-description">@repo.description</p>
234 @else
235 <p class="sidebar-description sidebar-description--empty">%no_description</p>
236 @end
237 <ul class="sidebar-meta">
238 @if readme.len > 0
239 <li>
240 <svg aria-hidden="true" viewBox="0 0 16 16" width="16" height="16"><path fill="currentColor" d="M0 1.75A.75.75 0 0 1 .75 1h4.253c1.227 0 2.317.59 3 1.501A3.743 3.743 0 0 1 11.006 1h4.245a.75.75 0 0 1 .75.75v10.5a.75.75 0 0 1-.75.75h-4.507a2.25 2.25 0 0 0-1.591.659l-.622.621a.75.75 0 0 1-1.06 0l-.622-.621A2.25 2.25 0 0 0 5.258 13H.75a.75.75 0 0 1-.75-.75Zm7.251 10.324.004-5.073-.002-2.253A2.25 2.25 0 0 0 5.003 2.5H1.5v9h3.757a3.75 3.75 0 0 1 1.994.574ZM8.755 4.75l-.004 7.322a3.752 3.752 0 0 1 1.992-.572H14.5v-9h-3.495a2.25 2.25 0 0 0-2.25 2.25Z"/></svg>
241 <a href="#readme">%readme_link</a>
242 </li>
243 @end
244 @if license_file_path.len > 0
245 <li>
246 <svg aria-hidden="true" viewBox="0 0 16 16" width="16" height="16"><path fill="currentColor" d="M8.75.75V2h.985c.304 0 .603.08.867.231l1.29.736c.038.022.08.033.124.033h2.234a.75.75 0 0 1 0 1.5h-.427l2.111 4.692a.75.75 0 0 1-.154.838l-.53-.53.529.531-.001.002-.002.002-.006.006-.006.005-.01.01-.045.04c-.21.176-.441.327-.686.45C14.556 10.78 13.88 11 13 11a4.498 4.498 0 0 1-2.023-.454 3.544 3.544 0 0 1-.686-.45l-.045-.04-.016-.015-.006-.006-.004-.004v-.001a.75.75 0 0 1-.154-.838L12.178 4.5h-.162c-.305 0-.604-.079-.868-.231l-1.29-.736a.245.245 0 0 0-.124-.033H8.75V13h2.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1 0-1.5h2.5V3.5h-.984a.244.244 0 0 0-.124.033l-1.289.737c-.265.15-.564.23-.869.23h-.162l2.112 4.692a.75.75 0 0 1-.154.838l-.53-.53.529.531-.001.002-.002.002-.006.006-.016.015-.045.04c-.21.176-.441.327-.686.45C4.556 10.78 3.88 11 3 11a4.498 4.498 0 0 1-2.023-.454 3.544 3.544 0 0 1-.686-.45l-.045-.04-.016-.015-.006-.006-.004-.004v-.001a.75.75 0 0 1-.154-.838L2.178 4.5H1.75a.75.75 0 0 1 0-1.5h2.234a.249.249 0 0 0 .125-.033l1.288-.737c.265-.15.564-.23.869-.23h.984V.75a.75.75 0 0 1 1.5 0Zm2.945 8.477c.285.135.718.273 1.305.273s1.02-.138 1.305-.273L13 6.327Zm-10 0c.285.135.718.273 1.305.273s1.02-.138 1.305-.273L3 6.327Z"/></svg>
247 <a href="@{license_file_path}">%license_link</a>
248 </li>
249 @end
250 <li>
251 <svg aria-hidden="true" viewBox="0 0 16 16" width="16" height="16"><path fill="currentColor" d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.75.75 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Z"/></svg>
252 @repo.nr_stars %stars_label
253 </li>
254 <li>
255 <svg aria-hidden="true" viewBox="0 0 16 16" width="16" height="16"><path fill="currentColor" d="M8 2c1.981 0 3.671.992 4.933 2.078 1.27 1.091 2.187 2.345 2.637 3.023a1.62 1.62 0 0 1 0 1.798c-.45.678-1.367 1.932-2.637 3.023C11.67 13.008 9.981 14 8 14c-1.981 0-3.671-.992-4.933-2.078C1.797 10.83.88 9.576.43 8.898a1.62 1.62 0 0 1 0-1.798c.45-.677 1.367-1.931 2.637-3.022C4.33 2.992 6.019 2 8 2ZM1.679 7.932a.12.12 0 0 0 0 .136c.411.622 1.241 1.75 2.366 2.717C5.176 11.758 6.527 12.5 8 12.5c1.473 0 2.825-.742 3.955-1.715 1.124-.967 1.954-2.096 2.366-2.717a.12.12 0 0 0 0-.136c-.412-.621-1.242-1.75-2.366-2.717C10.824 4.242 9.473 3.5 8 3.5c-1.473 0-2.825.742-3.955 1.715-1.124.967-1.954 2.096-2.366 2.717ZM8 10a2 2 0 1 1-.001-3.999A2 2 0 0 1 8 10Z"/></svg>
256 @watcher_count %watching_label
257 </li>
258 </ul>
259 </section>
260
261 <section class="sidebar-section">
262 <div class="sidebar-section-header">
263 <h3><a href="#sponsor">%sponsor_section</a></h3>
264 </div>
265 <a class="sponsor-button" href="#sponsor">
266 <svg aria-hidden="true" viewBox="0 0 16 16" width="16" height="16"><path fill="#bf3989" d="m8 14.25.345.666a.75.75 0 0 1-.69 0l-.008-.004-.018-.01a7.152 7.152 0 0 1-.31-.17 22.055 22.055 0 0 1-3.434-2.414C2.045 10.731 0 8.35 0 5.5 0 2.836 2.086 1 4.25 1 5.797 1 7.153 1.802 8 3.02 8.847 1.802 10.203 1 11.75 1 13.914 1 16 2.836 16 5.5c0 2.85-2.045 5.231-3.885 6.818a22.066 22.066 0 0 1-3.744 2.584l-.018.01-.006.003h-.002ZM4.25 2.5c-1.336 0-2.75 1.164-2.75 3 0 2.15 1.58 4.144 3.365 5.682A20.58 20.58 0 0 0 8 13.393a20.58 20.58 0 0 0 3.135-2.211C12.92 9.644 14.5 7.65 14.5 5.5c0-1.836-1.414-3-2.75-3-1.373 0-2.609.986-3.029 2.456a.749.749 0 0 1-1.442 0C6.859 3.486 5.623 2.5 4.25 2.5Z"/></svg>
267 %sponsor_action
268 </a>
269 </section>
270
271 <section class="sidebar-section">
272 <div class="sidebar-section-header">
273 <h3><a href="/@repo.user_name/@repo.name/releases">%releases_section</a></h3>
274 @if repo.nr_releases > 0
275 <span class="sidebar-count">@repo.nr_releases</span>
276 @end
277 </div>
278 @if sidebar_releases.len > 0
279 <a class="sidebar-release-latest" href="/@repo.user_name/@repo.name/releases">
280 <span class="sidebar-release-badge">%latest_label</span>
281 <span class="sidebar-release-name">@sidebar_releases[0].tag_name</span>
282 <span class="sidebar-release-date">@sidebar_releases[0].date.relative()</span>
283 </a>
284 @if sidebar_releases.len > 1
285 <a class="sidebar-release-more" href="/@repo.user_name/@repo.name/releases">
286 + @{sidebar_releases.len - 1} %releases_more
287 </a>
288 @end
289 @else
290 <p class="sidebar-empty">%no_releases</p>
291 @end
292 </section>
293
294 <section class="sidebar-section">
295 <div class="sidebar-section-header">
296 <h3><a href="/@repo.user_name/@repo.name/contributors">%contributors_section</a></h3>
297 @if repo.nr_contributors > 0
298 <span class="sidebar-count">@repo.nr_contributors</span>
299 @end
300 </div>
301 @if sidebar_contributors.len > 0
302 <div class="sidebar-contributors">
303 @for contributor in sidebar_contributors
304 @if contributor.is_registered
305 <a class="sidebar-contributor" href="/@contributor.username" title="@contributor.username">
306 <img src="@{app.prepare_user_avatar_url(contributor.avatar)}" alt="@contributor.username">
307 </a>
308 @else
309 <span class="sidebar-contributor sidebar-contributor--shadow" title="@contributor.username">
310 <img src="@{app.prepare_user_avatar_url(contributor.avatar)}" alt="@contributor.username">
311 </span>
312 @end
313 @end
314 </div>
315 @else
316 <p class="sidebar-empty">%no_contributors</p>
317 @end
318 </section>
319 </aside>
320 </div>
321 @end
322
323 </div>
324
325 @js '/js/tree.js'
326 @include 'layout/footer.html'
327 </body>
328</html>
329