Show More
@@ -1,514 +1,496 b'' | |||
|
1 | 1 | |
|
2 | 2 | // tables.less |
|
3 | 3 | // For use in RhodeCode application tables; |
|
4 | 4 | // see style guide documentation for guidelines. |
|
5 | 5 | |
|
6 | 6 | // TABLES |
|
7 | 7 | |
|
8 | 8 | .rctable, |
|
9 | 9 | table.rctable, |
|
10 | 10 | table.dataTable { |
|
11 | 11 | clear:both; |
|
12 | 12 | width: 100%; |
|
13 | 13 | margin: 0 auto @padding; |
|
14 | 14 | padding: 0; |
|
15 | 15 | vertical-align: baseline; |
|
16 | 16 | line-height:1.5em; |
|
17 | 17 | border: none; |
|
18 | 18 | outline: none; |
|
19 | 19 | border-collapse: collapse; |
|
20 | 20 | border-spacing: 0; |
|
21 | 21 | color: @grey2; |
|
22 | 22 | |
|
23 | 23 | b { |
|
24 | 24 | font-weight: normal; |
|
25 | 25 | } |
|
26 | 26 | |
|
27 | 27 | em { |
|
28 | 28 | font-weight: bold; |
|
29 | 29 | font-style: normal; |
|
30 | 30 | } |
|
31 | 31 | |
|
32 | 32 | th, |
|
33 | 33 | td { |
|
34 | 34 | height: auto; |
|
35 | 35 | max-width: 20%; |
|
36 | 36 | padding: .65em 1em .65em 0; |
|
37 | 37 | vertical-align: middle; |
|
38 | 38 | border-bottom: @border-thickness solid @grey5; |
|
39 | 39 | white-space: normal; |
|
40 | 40 | |
|
41 | 41 | &.td-radio, |
|
42 | 42 | &.td-checkbox { |
|
43 | 43 | padding-right: 0; |
|
44 | 44 | text-align: center; |
|
45 | 45 | |
|
46 | 46 | input { |
|
47 | 47 | margin: 0 1em; |
|
48 | 48 | } |
|
49 | 49 | } |
|
50 | 50 | |
|
51 | 51 | &.truncate-wrap { |
|
52 | 52 | white-space: nowrap !important; |
|
53 | 53 | } |
|
54 | 54 | |
|
55 | 55 | pre { |
|
56 | 56 | margin: 0; |
|
57 | 57 | } |
|
58 | 58 | |
|
59 | 59 | .show_more { |
|
60 | 60 | height: inherit; |
|
61 | 61 | } |
|
62 | 62 | } |
|
63 | 63 | |
|
64 | 64 | .expired td { |
|
65 | 65 | background-color: @grey7; |
|
66 | 66 | } |
|
67 | 67 | .inactive td { |
|
68 | 68 | background-color: @grey6; |
|
69 | 69 | } |
|
70 | 70 | th { |
|
71 | 71 | text-align: left; |
|
72 | 72 | font-weight: @text-semibold-weight; |
|
73 | 73 | font-family: @text-semibold; |
|
74 | 74 | } |
|
75 | 75 | |
|
76 | 76 | .hl { |
|
77 | 77 | td { |
|
78 | 78 | background-color: lighten(@alert4,25%); |
|
79 | 79 | } |
|
80 | 80 | } |
|
81 | 81 | |
|
82 | 82 | // Special Data Cell Types |
|
83 | 83 | // See style guide for desciptions and examples. |
|
84 | 84 | |
|
85 | 85 | td { |
|
86 | 86 | |
|
87 | 87 | &.user { |
|
88 | 88 | padding-left: 1em; |
|
89 | 89 | } |
|
90 | 90 | |
|
91 | 91 | &.td-rss { |
|
92 | 92 | width: 20px; |
|
93 | 93 | min-width: 0; |
|
94 | 94 | margin: 0; |
|
95 | 95 | } |
|
96 | 96 | |
|
97 | 97 | &.quick_repo_menu { |
|
98 | 98 | width: 15px; |
|
99 | 99 | text-align: center; |
|
100 | 100 | |
|
101 | 101 | &:hover { |
|
102 | 102 | background-color: @grey5; |
|
103 | 103 | } |
|
104 | 104 | } |
|
105 | 105 | |
|
106 | 106 | &.td-hash { |
|
107 | 107 | min-width: 80px; |
|
108 | 108 | width: 200px; |
|
109 | 109 | |
|
110 | 110 | .obsolete { |
|
111 | 111 | text-decoration: line-through; |
|
112 | 112 | color: lighten(@grey2,25%); |
|
113 | 113 | } |
|
114 | 114 | } |
|
115 | 115 | |
|
116 | 116 | &.td-time { |
|
117 | 117 | width: 160px; |
|
118 | 118 | white-space: nowrap; |
|
119 | 119 | } |
|
120 | 120 | |
|
121 | 121 | &.annotate{ |
|
122 | 122 | padding-right: 0; |
|
123 | 123 | |
|
124 | 124 | div.annotatediv{ |
|
125 | 125 | margin: 0 0.7em; |
|
126 | 126 | } |
|
127 | 127 | } |
|
128 | 128 | |
|
129 | 129 | &.tags-col { |
|
130 | 130 | padding-right: 0; |
|
131 | 131 | } |
|
132 | 132 | |
|
133 | 133 | &.td-description { |
|
134 | 134 | min-width: 350px; |
|
135 | 135 | |
|
136 | 136 | &.truncate, .truncate-wrap { |
|
137 | 137 | white-space: nowrap; |
|
138 | 138 | overflow: hidden; |
|
139 | 139 | text-overflow: ellipsis; |
|
140 | 140 | max-width: 350px; |
|
141 | 141 | } |
|
142 | 142 | } |
|
143 | 143 | |
|
144 | 144 | &.td-grid-name { |
|
145 | 145 | white-space: nowrap; |
|
146 | 146 | min-width: 300px; |
|
147 | 147 | } |
|
148 | 148 | |
|
149 | 149 | &.td-componentname { |
|
150 | 150 | white-space: nowrap; |
|
151 | 151 | } |
|
152 | 152 | |
|
153 | 153 | &.td-name { |
|
154 | 154 | |
|
155 | 155 | } |
|
156 | 156 | |
|
157 | 157 | &.td-journalaction { |
|
158 | 158 | min-width: 300px; |
|
159 | 159 | |
|
160 | 160 | .journal_action_params { |
|
161 | 161 | // waiting for feedback |
|
162 | 162 | } |
|
163 | 163 | } |
|
164 | 164 | |
|
165 | 165 | &.td-active { |
|
166 | 166 | padding-left: .65em; |
|
167 | 167 | } |
|
168 | 168 | |
|
169 | 169 | &.td-url { |
|
170 | 170 | white-space: nowrap; |
|
171 | 171 | } |
|
172 | 172 | |
|
173 | 173 | &.td-comments { |
|
174 | 174 | min-width: 3em; |
|
175 | 175 | } |
|
176 | 176 | |
|
177 | 177 | &.td-buttons { |
|
178 | 178 | padding: .3em 0; |
|
179 | 179 | } |
|
180 | 180 | &.td-align-top { |
|
181 | 181 | vertical-align: text-top |
|
182 | 182 | } |
|
183 | 183 | &.td-action { |
|
184 | 184 | // this is for the remove/delete/edit buttons |
|
185 | 185 | padding-right: 0; |
|
186 | 186 | min-width: 95px; |
|
187 | 187 | text-transform: capitalize; |
|
188 | 188 | |
|
189 | 189 | i { |
|
190 | 190 | display: none; |
|
191 | 191 | } |
|
192 | 192 | } |
|
193 | 193 | |
|
194 | 194 | // TODO: lisa: this needs to be cleaned up with the buttons |
|
195 | 195 | .grid_edit, |
|
196 | 196 | .grid_delete { |
|
197 | 197 | display: inline-block; |
|
198 | 198 | margin: 0 @padding/3 0 0; |
|
199 | 199 | font-family: @text-light; |
|
200 | 200 | |
|
201 | 201 | i { |
|
202 | 202 | display: none; |
|
203 | 203 | } |
|
204 | 204 | } |
|
205 | 205 | |
|
206 | 206 | .grid_edit + .grid_delete { |
|
207 | 207 | border-left: @border-thickness solid @grey5; |
|
208 | 208 | padding-left: @padding/2; |
|
209 | 209 | } |
|
210 | 210 | |
|
211 | 211 | &.td-compare { |
|
212 | 212 | |
|
213 | 213 | input { |
|
214 | 214 | margin-right: 1em; |
|
215 | 215 | } |
|
216 | 216 | |
|
217 | 217 | .compare-radio-button { |
|
218 | 218 | margin: 0 1em 0 0; |
|
219 | 219 | } |
|
220 | 220 | |
|
221 | 221 | |
|
222 | 222 | } |
|
223 | 223 | |
|
224 | 224 | &.td-tags { |
|
225 | 225 | padding: .5em 1em .5em 0; |
|
226 | 226 | width: 140px; |
|
227 | 227 | |
|
228 | 228 | .tag { |
|
229 | 229 | margin: 1px; |
|
230 | 230 | float: left; |
|
231 | 231 | } |
|
232 | 232 | } |
|
233 | 233 | |
|
234 | 234 | .icon-svn, .icon-hg, .icon-git { |
|
235 | 235 | font-size: 1.4em; |
|
236 | 236 | } |
|
237 | 237 | |
|
238 | 238 | &.collapse_commit, |
|
239 | 239 | &.expand_commit { |
|
240 | 240 | padding-right: 0; |
|
241 | 241 | padding-left: 1em; |
|
242 | 242 | cursor: pointer; |
|
243 | 243 | width: 20px; |
|
244 | 244 | } |
|
245 | 245 | } |
|
246 | 246 | |
|
247 | 247 | .perm_admin_row { |
|
248 | 248 | color: @grey4; |
|
249 | 249 | background-color: @grey6; |
|
250 | 250 | } |
|
251 | 251 | |
|
252 | 252 | .noborder { |
|
253 | 253 | border: none; |
|
254 | 254 | |
|
255 | 255 | td { |
|
256 | 256 | border: none; |
|
257 | 257 | } |
|
258 | 258 | } |
|
259 | 259 | } |
|
260 | 260 | .rctable.audit-log { |
|
261 | 261 | td { |
|
262 | 262 | vertical-align: top; |
|
263 | 263 | } |
|
264 | 264 | } |
|
265 | 265 | |
|
266 | 266 | // TRUNCATING |
|
267 | 267 | // TODO: lisaq: should this possibly be moved out of tables.less? |
|
268 | 268 | // for truncated text |
|
269 | 269 | // used inside of table cells and in code block headers |
|
270 | 270 | .truncate-wrap { |
|
271 | 271 | white-space: nowrap !important; |
|
272 | 272 | |
|
273 | 273 | //truncated text |
|
274 | 274 | .truncate { |
|
275 | 275 | max-width: 450px; |
|
276 | 276 | width: 300px; |
|
277 | 277 | overflow: hidden; |
|
278 | 278 | text-overflow: ellipsis; |
|
279 | 279 | -o-text-overflow: ellipsis; |
|
280 | 280 | -ms-text-overflow: ellipsis; |
|
281 | 281 | |
|
282 | 282 | &.autoexpand { |
|
283 | 283 | width: 120px; |
|
284 | 284 | margin-right: 200px; |
|
285 | 285 | } |
|
286 | 286 | } |
|
287 | 287 | &:hover .truncate.autoexpand { |
|
288 | 288 | overflow: visible; |
|
289 | 289 | } |
|
290 | 290 | |
|
291 | 291 | .tags-truncate { |
|
292 | 292 | width: 150px; |
|
293 | 293 | height: 22px; |
|
294 | 294 | overflow: hidden; |
|
295 | 295 | |
|
296 | 296 | .tag { |
|
297 | 297 | display: inline-block; |
|
298 | 298 | } |
|
299 | 299 | |
|
300 | 300 | &.truncate { |
|
301 | 301 | height: 22px; |
|
302 | 302 | max-height:2em; |
|
303 | 303 | width: 140px; |
|
304 | 304 | } |
|
305 | 305 | } |
|
306 | 306 | } |
|
307 | 307 | |
|
308 | 308 | .apikeys_wrap { |
|
309 | 309 | margin-bottom: @padding; |
|
310 | 310 | |
|
311 | 311 | table.rctable td:first-child { |
|
312 | 312 | width: 340px; |
|
313 | 313 | } |
|
314 | 314 | } |
|
315 | 315 | |
|
316 | 316 | |
|
317 | 317 | |
|
318 | 318 | // SPECIAL CASES |
|
319 | 319 | |
|
320 | 320 | // Repository Followers |
|
321 | 321 | table.rctable.followers_data { |
|
322 | 322 | width: 75%; |
|
323 | 323 | margin: 0; |
|
324 | 324 | } |
|
325 | 325 | |
|
326 | 326 | // Repository List |
|
327 | 327 | // Group Members List |
|
328 | 328 | table.rctable.group_members, |
|
329 | 329 | table#repo_list_table { |
|
330 | 330 | min-width: 600px; |
|
331 | 331 | } |
|
332 | 332 | |
|
333 | 333 | // Keyboard mappings |
|
334 | 334 | table.keyboard-mappings { |
|
335 | 335 | th { |
|
336 | 336 | text-align: left; |
|
337 | 337 | font-weight: @text-semibold-weight; |
|
338 | 338 | font-family: @text-semibold; |
|
339 | 339 | } |
|
340 | 340 | } |
|
341 | 341 | |
|
342 | 342 | // Branches, Tags, and Bookmarks |
|
343 | 343 | #obj_list_table.dataTable { |
|
344 | 344 | td.td-time { |
|
345 | 345 | padding-right: 1em; |
|
346 | 346 | } |
|
347 | 347 | } |
|
348 | 348 | |
|
349 | 349 | // User Admin |
|
350 | 350 | .rctable.useremails, |
|
351 | 351 | .rctable.account_emails { |
|
352 | 352 | .tag, |
|
353 | 353 | .btn { |
|
354 | 354 | float: right; |
|
355 | 355 | } |
|
356 | 356 | .btn { //to line up with tags |
|
357 | 357 | margin-right: 1.65em; |
|
358 | 358 | } |
|
359 | 359 | } |
|
360 | 360 | |
|
361 | 361 | // User List |
|
362 | 362 | #user_list_table { |
|
363 | 363 | |
|
364 | 364 | td.td-user { |
|
365 | 365 | min-width: 100px; |
|
366 | 366 | } |
|
367 | 367 | } |
|
368 | 368 | |
|
369 | 369 | // Pull Request List Table |
|
370 | 370 | #pull_request_list_table.dataTable { |
|
371 | 371 | |
|
372 | 372 | //TODO: lisa: This needs to be removed once the description is adjusted |
|
373 | 373 | // for using an expand_commit button (see issue 765) |
|
374 | 374 | td { |
|
375 | 375 | vertical-align: middle; |
|
376 | 376 | } |
|
377 | 377 | } |
|
378 | 378 | |
|
379 | 379 | // Settings (no border) |
|
380 | 380 | table.rctable.dl-settings { |
|
381 | 381 | td { |
|
382 | 382 | border: none; |
|
383 | 383 | vertical-align: baseline; |
|
384 | 384 | } |
|
385 | 385 | } |
|
386 | 386 | |
|
387 | 387 | |
|
388 | 388 | // Statistics |
|
389 | 389 | table.trending_language_tbl { |
|
390 | 390 | width: 100%; |
|
391 | 391 | line-height: 1em; |
|
392 | 392 | |
|
393 | 393 | td div { |
|
394 | 394 | overflow: visible; |
|
395 | 395 | } |
|
396 | 396 | } |
|
397 | 397 | |
|
398 | 398 | .trending_language_tbl, .trending_language_tbl td { |
|
399 | 399 | border: 0; |
|
400 | 400 | margin: 0; |
|
401 | 401 | padding: 0; |
|
402 | 402 | background: transparent; |
|
403 | 403 | } |
|
404 | 404 | |
|
405 | 405 | .trending_language_tbl, .trending_language_tbl tr { |
|
406 | 406 | border-spacing: 0 3px; |
|
407 | 407 | } |
|
408 | 408 | |
|
409 | 409 | .trending_language { |
|
410 | 410 | position: relative; |
|
411 | width: 100%; | |
|
412 | height: 19px; | |
|
413 | 411 | overflow: hidden; |
|
414 | background-color: @grey6; | |
|
412 | color: @text-color; | |
|
413 | width: 400px; | |
|
415 | 414 | |
|
416 | span, b{ | |
|
417 | position: absolute; | |
|
418 | display: block; | |
|
419 | height: 12px; | |
|
420 | margin-bottom: 0px; | |
|
421 | white-space: pre; | |
|
422 | padding: floor(@basefontsize/4); | |
|
423 | top: 0; | |
|
424 | left: 0; | |
|
425 | } | |
|
426 | ||
|
427 | span{ | |
|
428 | color: @text-color; | |
|
429 | z-index: 0; | |
|
430 | min-width: 20px; | |
|
431 | } | |
|
432 | ||
|
433 | b { | |
|
415 | .lang-bar { | |
|
434 | 416 | z-index: 1; |
|
435 | 417 | overflow: hidden; |
|
436 | 418 | background-color: @rcblue; |
|
437 | 419 | color: #FFF; |
|
438 | 420 | text-decoration: none; |
|
439 | 421 | } |
|
440 | 422 | |
|
441 | 423 | } |
|
442 | 424 | |
|
443 | 425 | // Changesets |
|
444 | 426 | #changesets.rctable { |
|
445 | 427 | |
|
446 | 428 | // td must be fixed height for graph |
|
447 | 429 | td { |
|
448 | 430 | height: 32px; |
|
449 | 431 | padding: 0 1em 0 0; |
|
450 | 432 | vertical-align: middle; |
|
451 | 433 | white-space: nowrap; |
|
452 | 434 | |
|
453 | 435 | &.td-description { |
|
454 | 436 | white-space: normal; |
|
455 | 437 | } |
|
456 | 438 | |
|
457 | 439 | &.expand_commit { |
|
458 | 440 | padding-right: 0; |
|
459 | 441 | cursor: pointer; |
|
460 | 442 | width: 20px; |
|
461 | 443 | } |
|
462 | 444 | } |
|
463 | 445 | } |
|
464 | 446 | |
|
465 | 447 | // Compare |
|
466 | 448 | table.compare_view_commits { |
|
467 | 449 | margin-top: @space; |
|
468 | 450 | |
|
469 | 451 | td.td-time { |
|
470 | 452 | padding-left: .5em; |
|
471 | 453 | } |
|
472 | 454 | |
|
473 | 455 | // special case to not show hover actions on hidden indicator |
|
474 | 456 | tr.compare_select_hidden:hover { |
|
475 | 457 | cursor: inherit; |
|
476 | 458 | |
|
477 | 459 | td { |
|
478 | 460 | background-color: inherit; |
|
479 | 461 | } |
|
480 | 462 | } |
|
481 | 463 | |
|
482 | 464 | tr:hover { |
|
483 | 465 | cursor: pointer; |
|
484 | 466 | |
|
485 | 467 | td { |
|
486 | 468 | background-color: lighten(@alert4,25%); |
|
487 | 469 | } |
|
488 | 470 | } |
|
489 | 471 | |
|
490 | 472 | |
|
491 | 473 | } |
|
492 | 474 | |
|
493 | 475 | .file_history { |
|
494 | 476 | td.td-actions { |
|
495 | 477 | text-align: right; |
|
496 | 478 | } |
|
497 | 479 | } |
|
498 | 480 | |
|
499 | 481 | |
|
500 | 482 | // Gist List |
|
501 | 483 | #gist_list_table { |
|
502 | 484 | td { |
|
503 | 485 | vertical-align: middle; |
|
504 | 486 | |
|
505 | 487 | div{ |
|
506 | 488 | display: inline-block; |
|
507 | 489 | vertical-align: middle; |
|
508 | 490 | } |
|
509 | 491 | |
|
510 | 492 | img{ |
|
511 | 493 | vertical-align: middle; |
|
512 | 494 | } |
|
513 | 495 | } |
|
514 | 496 | } |
@@ -1,579 +1,572 b'' | |||
|
1 | 1 | // # Copyright (C) 2010-2019 RhodeCode GmbH |
|
2 | 2 | // # |
|
3 | 3 | // # This program is free software: you can redistribute it and/or modify |
|
4 | 4 | // # it under the terms of the GNU Affero General Public License, version 3 |
|
5 | 5 | // # (only), as published by the Free Software Foundation. |
|
6 | 6 | // # |
|
7 | 7 | // # This program is distributed in the hope that it will be useful, |
|
8 | 8 | // # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
9 | 9 | // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
10 | 10 | // # GNU General Public License for more details. |
|
11 | 11 | // # |
|
12 | 12 | // # You should have received a copy of the GNU Affero General Public License |
|
13 | 13 | // # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
14 | 14 | // # |
|
15 | 15 | // # This program is dual-licensed. If you wish to learn more about the |
|
16 | 16 | // # RhodeCode Enterprise Edition, including its added features, Support services, |
|
17 | 17 | // # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
18 | 18 | |
|
19 | 19 | /** |
|
20 | 20 | RhodeCode JS Files |
|
21 | 21 | **/ |
|
22 | 22 | |
|
23 | 23 | if (typeof console == "undefined" || typeof console.log == "undefined"){ |
|
24 | 24 | console = { log: function() {} } |
|
25 | 25 | } |
|
26 | 26 | |
|
27 | 27 | // TODO: move the following function to submodules |
|
28 | 28 | |
|
29 | 29 | /** |
|
30 | 30 | * show more |
|
31 | 31 | */ |
|
32 | 32 | var show_more_event = function(){ |
|
33 | 33 | $('table .show_more').click(function(e) { |
|
34 | 34 | var cid = e.target.id.substring(1); |
|
35 | 35 | var button = $(this); |
|
36 | 36 | if (button.hasClass('open')) { |
|
37 | 37 | $('#'+cid).hide(); |
|
38 | 38 | button.removeClass('open'); |
|
39 | 39 | } else { |
|
40 | 40 | $('#'+cid).show(); |
|
41 | 41 | button.addClass('open one'); |
|
42 | 42 | } |
|
43 | 43 | }); |
|
44 | 44 | }; |
|
45 | 45 | |
|
46 | 46 | var compare_radio_buttons = function(repo_name, compare_ref_type){ |
|
47 | 47 | $('#compare_action').on('click', function(e){ |
|
48 | 48 | e.preventDefault(); |
|
49 | 49 | |
|
50 | 50 | var source = $('input[name=compare_source]:checked').val(); |
|
51 | 51 | var target = $('input[name=compare_target]:checked').val(); |
|
52 | 52 | if(source && target){ |
|
53 | 53 | var url_data = { |
|
54 | 54 | repo_name: repo_name, |
|
55 | 55 | source_ref: source, |
|
56 | 56 | source_ref_type: compare_ref_type, |
|
57 | 57 | target_ref: target, |
|
58 | 58 | target_ref_type: compare_ref_type, |
|
59 | 59 | merge: 1 |
|
60 | 60 | }; |
|
61 | 61 | window.location = pyroutes.url('repo_compare', url_data); |
|
62 | 62 | } |
|
63 | 63 | }); |
|
64 | 64 | $('.compare-radio-button').on('click', function(e){ |
|
65 | 65 | var source = $('input[name=compare_source]:checked').val(); |
|
66 | 66 | var target = $('input[name=compare_target]:checked').val(); |
|
67 | 67 | if(source && target){ |
|
68 | 68 | $('#compare_action').removeAttr("disabled"); |
|
69 | 69 | $('#compare_action').removeClass("disabled"); |
|
70 | 70 | } |
|
71 | 71 | }) |
|
72 | 72 | }; |
|
73 | 73 | |
|
74 | 74 | var showRepoSize = function(target, repo_name, commit_id, callback) { |
|
75 | 75 | var container = $('#' + target); |
|
76 | 76 | var url = pyroutes.url('repo_stats', |
|
77 | 77 | {"repo_name": repo_name, "commit_id": commit_id}); |
|
78 | 78 | |
|
79 | 79 | container.show(); |
|
80 | 80 | if (!container.hasClass('loaded')) { |
|
81 | 81 | $.ajax({url: url}) |
|
82 | 82 | .complete(function (data) { |
|
83 | 83 | var responseJSON = data.responseJSON; |
|
84 | 84 | container.addClass('loaded'); |
|
85 | 85 | container.html(responseJSON.size); |
|
86 | 86 | callback(responseJSON.code_stats) |
|
87 | 87 | }) |
|
88 | 88 | .fail(function (data) { |
|
89 | 89 | console.log('failed to load repo stats'); |
|
90 | 90 | }); |
|
91 | 91 | } |
|
92 | 92 | |
|
93 | 93 | }; |
|
94 | 94 | |
|
95 | 95 | var showRepoStats = function(target, data){ |
|
96 | 96 | var container = $('#' + target); |
|
97 | 97 | |
|
98 | 98 | if (container.hasClass('loaded')) { |
|
99 | 99 | return |
|
100 | 100 | } |
|
101 | 101 | |
|
102 | 102 | var total = 0; |
|
103 | 103 | var no_data = true; |
|
104 | 104 | var tbl = document.createElement('table'); |
|
105 | tbl.setAttribute('class', 'trending_language_tbl'); | |
|
105 | tbl.setAttribute('class', 'trending_language_tbl rctable'); | |
|
106 | 106 | |
|
107 | 107 | $.each(data, function(key, val){ |
|
108 | 108 | total += val.count; |
|
109 | 109 | }); |
|
110 | 110 | |
|
111 | 111 | var sortedStats = []; |
|
112 | 112 | for (var obj in data){ |
|
113 | 113 | sortedStats.push([obj, data[obj]]) |
|
114 | 114 | } |
|
115 | 115 | var sortedData = sortedStats.sort(function (a, b) { |
|
116 | 116 | return b[1].count - a[1].count |
|
117 | 117 | }); |
|
118 | 118 | var cnt = 0; |
|
119 | 119 | $.each(sortedData, function(idx, val){ |
|
120 | 120 | cnt += 1; |
|
121 | 121 | no_data = false; |
|
122 | 122 | |
|
123 | var hide = cnt > 2; | |
|
124 | 123 | var tr = document.createElement('tr'); |
|
125 | if (hide) { | |
|
126 | tr.setAttribute('style', 'display:none'); | |
|
127 | tr.setAttribute('class', 'stats_hidden'); | |
|
128 | } | |
|
129 | 124 | |
|
130 | 125 | var key = val[0]; |
|
131 | 126 | var obj = {"desc": val[1].desc, "count": val[1].count}; |
|
132 | 127 | |
|
133 | var percentage = Math.round((obj.count / total * 100), 2); | |
|
134 | ||
|
128 | // meta language names | |
|
135 | 129 | var td1 = document.createElement('td'); |
|
136 | td1.width = 300; | |
|
137 | 130 | var trending_language_label = document.createElement('div'); |
|
138 |
trending_language_label.innerHTML = obj.desc |
|
|
131 | trending_language_label.innerHTML = obj.desc; | |
|
139 | 132 | td1.appendChild(trending_language_label); |
|
140 | 133 | |
|
134 | // extensions | |
|
141 | 135 | var td2 = document.createElement('td'); |
|
142 |
var |
|
|
143 | var nr_files = obj.count +" "+ _ngettext('file', 'files', obj.count); | |
|
144 | ||
|
145 | trending_language.title = key + " " + nr_files; | |
|
136 | var extension = document.createElement('div'); | |
|
137 | extension.innerHTML = ".{0}".format(key) | |
|
138 | td2.appendChild(extension); | |
|
146 | 139 | |
|
147 | trending_language.innerHTML = "<span>" + percentage + "% " + nr_files | |
|
148 | + "</span><b>" + percentage + "% " + nr_files + "</b>"; | |
|
140 | // number of files | |
|
141 | var td3 = document.createElement('td'); | |
|
142 | var file_count = document.createElement('div'); | |
|
143 | var percentage_num = Math.round((obj.count / total * 100), 2); | |
|
144 | var label = _ngettext('file', 'files', obj.count); | |
|
145 | file_count.innerHTML = "{0} {1} ({2}%)".format(obj.count, label, percentage_num) ; | |
|
146 | td3.appendChild(file_count); | |
|
149 | 147 | |
|
150 | trending_language.setAttribute("class", 'trending_language'); | |
|
151 | $('b', trending_language)[0].style.width = percentage + "%"; | |
|
152 |
td |
|
|
148 | // percentage | |
|
149 | var td4 = document.createElement('td'); | |
|
150 | td4.setAttribute("class", 'trending_language'); | |
|
151 | ||
|
152 | var percentage = document.createElement('div'); | |
|
153 | percentage.setAttribute('class', 'lang-bar'); | |
|
154 | percentage.innerHTML = " "; | |
|
155 | percentage.style.width = percentage_num + '%'; | |
|
156 | td4.appendChild(percentage); | |
|
153 | 157 | |
|
154 | 158 | tr.appendChild(td1); |
|
155 | 159 | tr.appendChild(td2); |
|
160 | tr.appendChild(td3); | |
|
161 | tr.appendChild(td4); | |
|
156 | 162 | tbl.appendChild(tr); |
|
157 | if (cnt == 3) { | |
|
158 | var show_more = document.createElement('tr'); | |
|
159 | var td = document.createElement('td'); | |
|
160 | lnk = document.createElement('a'); | |
|
161 | 163 | |
|
162 | lnk.href = '#'; | |
|
163 | lnk.innerHTML = _gettext('Show more'); | |
|
164 | lnk.id = 'code_stats_show_more'; | |
|
165 | td.appendChild(lnk); | |
|
166 | ||
|
167 | show_more.appendChild(td); | |
|
168 | show_more.appendChild(document.createElement('td')); | |
|
169 | tbl.appendChild(show_more); | |
|
170 | } | |
|
171 | 164 | }); |
|
172 | 165 | |
|
173 | 166 | $(container).html(tbl); |
|
174 | 167 | $(container).addClass('loaded'); |
|
175 | 168 | |
|
176 | 169 | $('#code_stats_show_more').on('click', function (e) { |
|
177 | 170 | e.preventDefault(); |
|
178 | 171 | $('.stats_hidden').each(function (idx) { |
|
179 | 172 | $(this).css("display", ""); |
|
180 | 173 | }); |
|
181 | 174 | $('#code_stats_show_more').hide(); |
|
182 | 175 | }); |
|
183 | 176 | |
|
184 | 177 | }; |
|
185 | 178 | |
|
186 | 179 | // returns a node from given html; |
|
187 | 180 | var fromHTML = function(html){ |
|
188 | 181 | var _html = document.createElement('element'); |
|
189 | 182 | _html.innerHTML = html; |
|
190 | 183 | return _html; |
|
191 | 184 | }; |
|
192 | 185 | |
|
193 | 186 | // Toggle Collapsable Content |
|
194 | 187 | function collapsableContent() { |
|
195 | 188 | |
|
196 | 189 | $('.collapsable-content').not('.no-hide').hide(); |
|
197 | 190 | |
|
198 | 191 | $('.btn-collapse').unbind(); //in case we've been here before |
|
199 | 192 | $('.btn-collapse').click(function() { |
|
200 | 193 | var button = $(this); |
|
201 | 194 | var togglename = $(this).data("toggle"); |
|
202 | 195 | $('.collapsable-content[data-toggle='+togglename+']').toggle(); |
|
203 | 196 | if ($(this).html()=="Show Less") |
|
204 | 197 | $(this).html("Show More"); |
|
205 | 198 | else |
|
206 | 199 | $(this).html("Show Less"); |
|
207 | 200 | }); |
|
208 | 201 | }; |
|
209 | 202 | |
|
210 | 203 | var timeagoActivate = function() { |
|
211 | 204 | $("time.timeago").timeago(); |
|
212 | 205 | }; |
|
213 | 206 | |
|
214 | 207 | |
|
215 | 208 | var clipboardActivate = function() { |
|
216 | 209 | /* |
|
217 | 210 | * |
|
218 | 211 | * <i class="tooltip icon-plus clipboard-action" data-clipboard-text="${commit.raw_id}" title="${_('Copy the full commit id')}"></i> |
|
219 | 212 | * */ |
|
220 | 213 | var clipboard = new ClipboardJS('.clipboard-action'); |
|
221 | 214 | |
|
222 | 215 | clipboard.on('success', function(e) { |
|
223 | 216 | var callback = function () { |
|
224 | 217 | $(e.trigger).animate({'opacity': 1.00}, 200) |
|
225 | 218 | }; |
|
226 | 219 | $(e.trigger).animate({'opacity': 0.15}, 200, callback); |
|
227 | 220 | e.clearSelection(); |
|
228 | 221 | }); |
|
229 | 222 | }; |
|
230 | 223 | |
|
231 | 224 | |
|
232 | 225 | // Formatting values in a Select2 dropdown of commit references |
|
233 | 226 | var formatSelect2SelectionRefs = function(commit_ref){ |
|
234 | 227 | var tmpl = ''; |
|
235 | 228 | if (!commit_ref.text || commit_ref.type === 'sha'){ |
|
236 | 229 | return commit_ref.text; |
|
237 | 230 | } |
|
238 | 231 | if (commit_ref.type === 'branch'){ |
|
239 | 232 | tmpl = tmpl.concat('<i class="icon-branch"></i> '); |
|
240 | 233 | } else if (commit_ref.type === 'tag'){ |
|
241 | 234 | tmpl = tmpl.concat('<i class="icon-tag"></i> '); |
|
242 | 235 | } else if (commit_ref.type === 'book'){ |
|
243 | 236 | tmpl = tmpl.concat('<i class="icon-bookmark"></i> '); |
|
244 | 237 | } |
|
245 | 238 | return tmpl.concat(escapeHtml(commit_ref.text)); |
|
246 | 239 | }; |
|
247 | 240 | |
|
248 | 241 | // takes a given html element and scrolls it down offset pixels |
|
249 | 242 | function offsetScroll(element, offset) { |
|
250 | 243 | setTimeout(function() { |
|
251 | 244 | var location = element.offset().top; |
|
252 | 245 | // some browsers use body, some use html |
|
253 | 246 | $('html, body').animate({ scrollTop: (location - offset) }); |
|
254 | 247 | }, 100); |
|
255 | 248 | } |
|
256 | 249 | |
|
257 | 250 | // scroll an element `percent`% from the top of page in `time` ms |
|
258 | 251 | function scrollToElement(element, percent, time) { |
|
259 | 252 | percent = (percent === undefined ? 25 : percent); |
|
260 | 253 | time = (time === undefined ? 100 : time); |
|
261 | 254 | |
|
262 | 255 | var $element = $(element); |
|
263 | 256 | if ($element.length == 0) { |
|
264 | 257 | throw('Cannot scroll to {0}'.format(element)) |
|
265 | 258 | } |
|
266 | 259 | var elOffset = $element.offset().top; |
|
267 | 260 | var elHeight = $element.height(); |
|
268 | 261 | var windowHeight = $(window).height(); |
|
269 | 262 | var offset = elOffset; |
|
270 | 263 | if (elHeight < windowHeight) { |
|
271 | 264 | offset = elOffset - ((windowHeight / (100 / percent)) - (elHeight / 2)); |
|
272 | 265 | } |
|
273 | 266 | setTimeout(function() { |
|
274 | 267 | $('html, body').animate({ scrollTop: offset}); |
|
275 | 268 | }, time); |
|
276 | 269 | } |
|
277 | 270 | |
|
278 | 271 | /** |
|
279 | 272 | * global hooks after DOM is loaded |
|
280 | 273 | */ |
|
281 | 274 | $(document).ready(function() { |
|
282 | 275 | firefoxAnchorFix(); |
|
283 | 276 | |
|
284 | 277 | $('.navigation a.menulink').on('click', function(e){ |
|
285 | 278 | var menuitem = $(this).parent('li'); |
|
286 | 279 | if (menuitem.hasClass('open')) { |
|
287 | 280 | menuitem.removeClass('open'); |
|
288 | 281 | } else { |
|
289 | 282 | menuitem.addClass('open'); |
|
290 | 283 | $(document).on('click', function(event) { |
|
291 | 284 | if (!$(event.target).closest(menuitem).length) { |
|
292 | 285 | menuitem.removeClass('open'); |
|
293 | 286 | } |
|
294 | 287 | }); |
|
295 | 288 | } |
|
296 | 289 | }); |
|
297 | 290 | |
|
298 | 291 | $('body').on('click', '.cb-lineno a', function(event) { |
|
299 | 292 | function sortNumber(a,b) { |
|
300 | 293 | return a - b; |
|
301 | 294 | } |
|
302 | 295 | |
|
303 | 296 | var lineNo = $(this).data('lineNo'); |
|
304 | 297 | var lineName = $(this).attr('name'); |
|
305 | 298 | |
|
306 | 299 | if (lineNo) { |
|
307 | 300 | var prevLine = $('.cb-line-selected a').data('lineNo'); |
|
308 | 301 | |
|
309 | 302 | // on shift, we do a range selection, if we got previous line |
|
310 | 303 | if (event.shiftKey && prevLine !== undefined) { |
|
311 | 304 | var prevLine = parseInt(prevLine); |
|
312 | 305 | var nextLine = parseInt(lineNo); |
|
313 | 306 | var pos = [prevLine, nextLine].sort(sortNumber); |
|
314 | 307 | var anchor = '#L{0}-{1}'.format(pos[0], pos[1]); |
|
315 | 308 | |
|
316 | 309 | // single click |
|
317 | 310 | } else { |
|
318 | 311 | var nextLine = parseInt(lineNo); |
|
319 | 312 | var pos = [nextLine, nextLine]; |
|
320 | 313 | var anchor = '#L{0}'.format(pos[0]); |
|
321 | 314 | |
|
322 | 315 | } |
|
323 | 316 | // highlight |
|
324 | 317 | var range = []; |
|
325 | 318 | for (var i = pos[0]; i <= pos[1]; i++) { |
|
326 | 319 | range.push(i); |
|
327 | 320 | } |
|
328 | 321 | // clear old selected lines |
|
329 | 322 | $('.cb-line-selected').removeClass('cb-line-selected'); |
|
330 | 323 | |
|
331 | 324 | $.each(range, function (i, lineNo) { |
|
332 | 325 | var line_td = $('td.cb-lineno#L' + lineNo); |
|
333 | 326 | |
|
334 | 327 | if (line_td.length) { |
|
335 | 328 | line_td.addClass('cb-line-selected'); // line number td |
|
336 | 329 | line_td.prev().addClass('cb-line-selected'); // line data |
|
337 | 330 | line_td.next().addClass('cb-line-selected'); // line content |
|
338 | 331 | } |
|
339 | 332 | }); |
|
340 | 333 | |
|
341 | 334 | } else if (lineName !== undefined) { // lineName only occurs in diffs |
|
342 | 335 | // clear old selected lines |
|
343 | 336 | $('td.cb-line-selected').removeClass('cb-line-selected'); |
|
344 | 337 | var anchor = '#{0}'.format(lineName); |
|
345 | 338 | var diffmode = templateContext.session_attrs.diffmode || "sideside"; |
|
346 | 339 | |
|
347 | 340 | if (diffmode === "unified") { |
|
348 | 341 | $(this).closest('tr').find('td').addClass('cb-line-selected'); |
|
349 | 342 | } else { |
|
350 | 343 | var activeTd = $(this).closest('td'); |
|
351 | 344 | activeTd.addClass('cb-line-selected'); |
|
352 | 345 | activeTd.next('td').addClass('cb-line-selected'); |
|
353 | 346 | } |
|
354 | 347 | |
|
355 | 348 | } |
|
356 | 349 | |
|
357 | 350 | // Replace URL without jumping to it if browser supports. |
|
358 | 351 | // Default otherwise |
|
359 | 352 | if (history.pushState && anchor !== undefined) { |
|
360 | 353 | var new_location = location.href.rstrip('#'); |
|
361 | 354 | if (location.hash) { |
|
362 | 355 | // location without hash |
|
363 | 356 | new_location = new_location.replace(location.hash, ""); |
|
364 | 357 | } |
|
365 | 358 | |
|
366 | 359 | // Make new anchor url |
|
367 | 360 | new_location = new_location + anchor; |
|
368 | 361 | history.pushState(true, document.title, new_location); |
|
369 | 362 | |
|
370 | 363 | return false; |
|
371 | 364 | } |
|
372 | 365 | |
|
373 | 366 | }); |
|
374 | 367 | |
|
375 | 368 | $('.collapse_file').on('click', function(e) { |
|
376 | 369 | e.stopPropagation(); |
|
377 | 370 | if ($(e.target).is('a')) { return; } |
|
378 | 371 | var node = $(e.delegateTarget).first(); |
|
379 | 372 | var icon = $($(node.children().first()).children().first()); |
|
380 | 373 | var id = node.attr('fid'); |
|
381 | 374 | var target = $('#'+id); |
|
382 | 375 | var tr = $('#tr_'+id); |
|
383 | 376 | var diff = $('#diff_'+id); |
|
384 | 377 | if(node.hasClass('expand_file')){ |
|
385 | 378 | node.removeClass('expand_file'); |
|
386 | 379 | icon.removeClass('expand_file_icon'); |
|
387 | 380 | node.addClass('collapse_file'); |
|
388 | 381 | icon.addClass('collapse_file_icon'); |
|
389 | 382 | diff.show(); |
|
390 | 383 | tr.show(); |
|
391 | 384 | target.show(); |
|
392 | 385 | } else { |
|
393 | 386 | node.removeClass('collapse_file'); |
|
394 | 387 | icon.removeClass('collapse_file_icon'); |
|
395 | 388 | node.addClass('expand_file'); |
|
396 | 389 | icon.addClass('expand_file_icon'); |
|
397 | 390 | diff.hide(); |
|
398 | 391 | tr.hide(); |
|
399 | 392 | target.hide(); |
|
400 | 393 | } |
|
401 | 394 | }); |
|
402 | 395 | |
|
403 | 396 | $('#expand_all_files').click(function() { |
|
404 | 397 | $('.expand_file').each(function() { |
|
405 | 398 | var node = $(this); |
|
406 | 399 | var icon = $($(node.children().first()).children().first()); |
|
407 | 400 | var id = $(this).attr('fid'); |
|
408 | 401 | var target = $('#'+id); |
|
409 | 402 | var tr = $('#tr_'+id); |
|
410 | 403 | var diff = $('#diff_'+id); |
|
411 | 404 | node.removeClass('expand_file'); |
|
412 | 405 | icon.removeClass('expand_file_icon'); |
|
413 | 406 | node.addClass('collapse_file'); |
|
414 | 407 | icon.addClass('collapse_file_icon'); |
|
415 | 408 | diff.show(); |
|
416 | 409 | tr.show(); |
|
417 | 410 | target.show(); |
|
418 | 411 | }); |
|
419 | 412 | }); |
|
420 | 413 | |
|
421 | 414 | $('#collapse_all_files').click(function() { |
|
422 | 415 | $('.collapse_file').each(function() { |
|
423 | 416 | var node = $(this); |
|
424 | 417 | var icon = $($(node.children().first()).children().first()); |
|
425 | 418 | var id = $(this).attr('fid'); |
|
426 | 419 | var target = $('#'+id); |
|
427 | 420 | var tr = $('#tr_'+id); |
|
428 | 421 | var diff = $('#diff_'+id); |
|
429 | 422 | node.removeClass('collapse_file'); |
|
430 | 423 | icon.removeClass('collapse_file_icon'); |
|
431 | 424 | node.addClass('expand_file'); |
|
432 | 425 | icon.addClass('expand_file_icon'); |
|
433 | 426 | diff.hide(); |
|
434 | 427 | tr.hide(); |
|
435 | 428 | target.hide(); |
|
436 | 429 | }); |
|
437 | 430 | }); |
|
438 | 431 | |
|
439 | 432 | // Mouse over behavior for comments and line selection |
|
440 | 433 | |
|
441 | 434 | // Select the line that comes from the url anchor |
|
442 | 435 | // At the time of development, Chrome didn't seem to support jquery's :target |
|
443 | 436 | // element, so I had to scroll manually |
|
444 | 437 | |
|
445 | 438 | if (location.hash) { |
|
446 | 439 | var result = splitDelimitedHash(location.hash); |
|
447 | 440 | var loc = result.loc; |
|
448 | 441 | if (loc.length > 1) { |
|
449 | 442 | |
|
450 | 443 | var highlightable_line_tds = []; |
|
451 | 444 | |
|
452 | 445 | // source code line format |
|
453 | 446 | var page_highlights = loc.substring( |
|
454 | 447 | loc.indexOf('#') + 1).split('L'); |
|
455 | 448 | |
|
456 | 449 | if (page_highlights.length > 1) { |
|
457 | 450 | var highlight_ranges = page_highlights[1].split(","); |
|
458 | 451 | var h_lines = []; |
|
459 | 452 | for (var pos in highlight_ranges) { |
|
460 | 453 | var _range = highlight_ranges[pos].split('-'); |
|
461 | 454 | if (_range.length === 2) { |
|
462 | 455 | var start = parseInt(_range[0]); |
|
463 | 456 | var end = parseInt(_range[1]); |
|
464 | 457 | if (start < end) { |
|
465 | 458 | for (var i = start; i <= end; i++) { |
|
466 | 459 | h_lines.push(i); |
|
467 | 460 | } |
|
468 | 461 | } |
|
469 | 462 | } |
|
470 | 463 | else { |
|
471 | 464 | h_lines.push(parseInt(highlight_ranges[pos])); |
|
472 | 465 | } |
|
473 | 466 | } |
|
474 | 467 | for (pos in h_lines) { |
|
475 | 468 | var line_td = $('td.cb-lineno#L' + h_lines[pos]); |
|
476 | 469 | if (line_td.length) { |
|
477 | 470 | highlightable_line_tds.push(line_td); |
|
478 | 471 | } |
|
479 | 472 | } |
|
480 | 473 | } |
|
481 | 474 | |
|
482 | 475 | // now check a direct id reference (diff page) |
|
483 | 476 | if ($(loc).length && $(loc).hasClass('cb-lineno')) { |
|
484 | 477 | highlightable_line_tds.push($(loc)); |
|
485 | 478 | } |
|
486 | 479 | $.each(highlightable_line_tds, function (i, $td) { |
|
487 | 480 | $td.addClass('cb-line-selected'); // line number td |
|
488 | 481 | $td.prev().addClass('cb-line-selected'); // line data |
|
489 | 482 | $td.next().addClass('cb-line-selected'); // line content |
|
490 | 483 | }); |
|
491 | 484 | |
|
492 | 485 | if (highlightable_line_tds.length) { |
|
493 | 486 | var $first_line_td = highlightable_line_tds[0]; |
|
494 | 487 | scrollToElement($first_line_td); |
|
495 | 488 | $.Topic('/ui/plugins/code/anchor_focus').prepareOrPublish({ |
|
496 | 489 | td: $first_line_td, |
|
497 | 490 | remainder: result.remainder |
|
498 | 491 | }); |
|
499 | 492 | } |
|
500 | 493 | } |
|
501 | 494 | } |
|
502 | 495 | collapsableContent(); |
|
503 | 496 | }); |
|
504 | 497 | |
|
505 | 498 | var feedLifetimeOptions = function(query, initialData){ |
|
506 | 499 | var data = {results: []}; |
|
507 | 500 | var isQuery = typeof query.term !== 'undefined'; |
|
508 | 501 | |
|
509 | 502 | var section = _gettext('Lifetime'); |
|
510 | 503 | var children = []; |
|
511 | 504 | |
|
512 | 505 | //filter results |
|
513 | 506 | $.each(initialData.results, function(idx, value) { |
|
514 | 507 | |
|
515 | 508 | if (!isQuery || query.term.length === 0 || value.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0) { |
|
516 | 509 | children.push({ |
|
517 | 510 | 'id': this.id, |
|
518 | 511 | 'text': this.text |
|
519 | 512 | }) |
|
520 | 513 | } |
|
521 | 514 | |
|
522 | 515 | }); |
|
523 | 516 | data.results.push({ |
|
524 | 517 | 'text': section, |
|
525 | 518 | 'children': children |
|
526 | 519 | }); |
|
527 | 520 | |
|
528 | 521 | if (isQuery) { |
|
529 | 522 | |
|
530 | 523 | var now = moment.utc(); |
|
531 | 524 | |
|
532 | 525 | var parseQuery = function(entry, now){ |
|
533 | 526 | var fmt = 'DD/MM/YYYY H:mm'; |
|
534 | 527 | var parsed = moment.utc(entry, fmt); |
|
535 | 528 | var diffInMin = parsed.diff(now, 'minutes'); |
|
536 | 529 | |
|
537 | 530 | if (diffInMin > 0){ |
|
538 | 531 | return { |
|
539 | 532 | id: diffInMin, |
|
540 | 533 | text: parsed.format(fmt) |
|
541 | 534 | } |
|
542 | 535 | } else { |
|
543 | 536 | return { |
|
544 | 537 | id: undefined, |
|
545 | 538 | text: parsed.format('DD/MM/YYYY') + ' ' + _gettext('date not in future') |
|
546 | 539 | } |
|
547 | 540 | } |
|
548 | 541 | |
|
549 | 542 | |
|
550 | 543 | }; |
|
551 | 544 | |
|
552 | 545 | data.results.push({ |
|
553 | 546 | 'text': _gettext('Specified expiration date'), |
|
554 | 547 | 'children': [{ |
|
555 | 548 | 'id': parseQuery(query.term, now).id, |
|
556 | 549 | 'text': parseQuery(query.term, now).text |
|
557 | 550 | }] |
|
558 | 551 | }); |
|
559 | 552 | } |
|
560 | 553 | |
|
561 | 554 | query.callback(data); |
|
562 | 555 | }; |
|
563 | 556 | |
|
564 | 557 | |
|
565 | 558 | var storeUserSessionAttr = function (key, val) { |
|
566 | 559 | |
|
567 | 560 | var postData = { |
|
568 | 561 | 'key': key, |
|
569 | 562 | 'val': val, |
|
570 | 563 | 'csrf_token': CSRF_TOKEN |
|
571 | 564 | }; |
|
572 | 565 | |
|
573 | 566 | var success = function(o) { |
|
574 | 567 | return true |
|
575 | 568 | }; |
|
576 | 569 | |
|
577 | 570 | ajaxPOST(pyroutes.url('store_user_session_value'), postData, success); |
|
578 | 571 | return false; |
|
579 | 572 | }; |
@@ -1,257 +1,267 b'' | |||
|
1 | 1 | <%namespace name="base" file="/base/base.mako"/> |
|
2 | 2 | |
|
3 | 3 | <%def name="refs_counters(branches, closed_branches, tags, bookmarks)"> |
|
4 | 4 | <span class="branchtag tag"> |
|
5 | 5 | <a href="${h.route_path('branches_home',repo_name=c.repo_name)}" class="childs"> |
|
6 | 6 | <i class="icon-branch"></i> |
|
7 | 7 | % if len(branches) == 1: |
|
8 | 8 | <span>${len(branches)}</span> ${_('Branch')} |
|
9 | 9 | % else: |
|
10 | 10 | <span>${len(branches)}</span> ${_('Branches')} |
|
11 | 11 | % endif |
|
12 | 12 | </a> |
|
13 | 13 | </span> |
|
14 | 14 | |
|
15 | 15 | %if closed_branches: |
|
16 | 16 | <span class="branchtag tag"> |
|
17 | 17 | <a href="${h.route_path('branches_home',repo_name=c.repo_name)}" class="childs"> |
|
18 | 18 | <i class="icon-branch"></i> |
|
19 | 19 | % if len(closed_branches) == 1: |
|
20 | 20 | <span>${len(closed_branches)}</span> ${_('Closed Branch')} |
|
21 | 21 | % else: |
|
22 | 22 | <span>${len(closed_branches)}</span> ${_('Closed Branches')} |
|
23 | 23 | % endif |
|
24 | 24 | </a> |
|
25 | 25 | </span> |
|
26 | 26 | %endif |
|
27 | 27 | |
|
28 | 28 | <span class="tagtag tag"> |
|
29 | 29 | <a href="${h.route_path('tags_home',repo_name=c.repo_name)}" class="childs"> |
|
30 | 30 | <i class="icon-tag"></i> |
|
31 | 31 | % if len(tags) == 1: |
|
32 | 32 | <span>${len(tags)}</span> ${_('Tag')} |
|
33 | 33 | % else: |
|
34 | 34 | <span>${len(tags)}</span> ${_('Tags')} |
|
35 | 35 | % endif |
|
36 | 36 | </a> |
|
37 | 37 | </span> |
|
38 | 38 | |
|
39 | 39 | %if bookmarks: |
|
40 | 40 | <span class="booktag tag"> |
|
41 | 41 | <a href="${h.route_path('bookmarks_home',repo_name=c.repo_name)}" class="childs"> |
|
42 | 42 | <i class="icon-bookmark"></i> |
|
43 | 43 | % if len(bookmarks) == 1: |
|
44 | 44 | <span>${len(bookmarks)}</span> ${_('Bookmark')} |
|
45 | 45 | % else: |
|
46 | 46 | <span>${len(bookmarks)}</span> ${_('Bookmarks')} |
|
47 | 47 | % endif |
|
48 | 48 | </a> |
|
49 | 49 | </span> |
|
50 | 50 | %endif |
|
51 | 51 | </%def> |
|
52 | 52 | |
|
53 | 53 | <%def name="summary_detail(breadcrumbs_links, show_downloads=True)"> |
|
54 | 54 | <% summary = lambda n:{False:'summary-short'}.get(n) %> |
|
55 | 55 | |
|
56 | 56 | <div id="summary-menu-stats" class="summary-detail"> |
|
57 | 57 | <div class="fieldset"> |
|
58 | 58 | <div class="left-content"> |
|
59 | 59 | <div class="left-clone"> |
|
60 | 60 | <select id="clone_option" name="clone_option"> |
|
61 | 61 | <option value="http" selected="selected">HTTP</option> |
|
62 | 62 | <option value="http_id">HTTP UID</option> |
|
63 | 63 | % if c.ssh_enabled: |
|
64 | 64 | <option value="ssh">SSH</option> |
|
65 | 65 | % endif |
|
66 | 66 | </select> |
|
67 | 67 | </div> |
|
68 | 68 | |
|
69 | 69 | <div class="right-clone"> |
|
70 | 70 | <% |
|
71 | 71 | maybe_disabled = '' |
|
72 | 72 | if h.is_svn_without_proxy(c.rhodecode_db_repo): |
|
73 | 73 | maybe_disabled = 'disabled' |
|
74 | 74 | %> |
|
75 | 75 | |
|
76 | 76 | <span id="clone_option_http"> |
|
77 | 77 | <input type="text" class="input-monospace clone_url_input" ${maybe_disabled} readonly="readonly" value="${c.clone_repo_url}"/> |
|
78 | 78 | <i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.clone_repo_url}" title="${_('Copy the clone url')}"></i> |
|
79 | 79 | </span> |
|
80 | 80 | |
|
81 | 81 | <span style="display: none;" id="clone_option_http_id"> |
|
82 | 82 | <input type="text" class="input-monospace clone_url_input" ${maybe_disabled} readonly="readonly" value="${c.clone_repo_url_id}"/> |
|
83 | 83 | <i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.clone_repo_url_id}" title="${_('Copy the clone by id url')}"></i> |
|
84 | 84 | </span> |
|
85 | 85 | |
|
86 | 86 | <span style="display: none;" id="clone_option_ssh"> |
|
87 | 87 | <input type="text" class="input-monospace clone_url_input" ${maybe_disabled} readonly="readonly" value="${c.clone_repo_url_ssh}"/> |
|
88 | 88 | <i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.clone_repo_url_ssh}" title="${_('Copy the clone by ssh url')}"></i> |
|
89 | 89 | </span> |
|
90 | 90 | |
|
91 | 91 | % if maybe_disabled: |
|
92 | 92 | <p class="help-block">${_('SVN Protocol is disabled. To enable it, see the')} <a href="${h.route_url('enterprise_svn_setup')}" target="_blank">${_('documentation here')}</a>.</p> |
|
93 | 93 | % endif |
|
94 | 94 | </div> |
|
95 | 95 | </div> |
|
96 | 96 | |
|
97 | 97 | <div class="right-content"> |
|
98 | 98 | <div class="commit-info"> |
|
99 | 99 | <div class="tags"> |
|
100 | 100 | <% commit_rev = c.rhodecode_db_repo.changeset_cache.get('revision') %> |
|
101 | 101 | % if c.rhodecode_repo: |
|
102 | 102 | ${refs_counters( |
|
103 | 103 | c.rhodecode_repo.branches, |
|
104 | 104 | c.rhodecode_repo.branches_closed, |
|
105 | 105 | c.rhodecode_repo.tags, |
|
106 | 106 | c.rhodecode_repo.bookmarks)} |
|
107 | 107 | % else: |
|
108 | 108 | ## missing requirements can make c.rhodecode_repo None |
|
109 | 109 | ${refs_counters([], [], [], [])} |
|
110 | 110 | % endif |
|
111 | 111 | |
|
112 | 112 | ## commits |
|
113 | 113 | <span class="tag"> |
|
114 | 114 | % if commit_rev == -1: |
|
115 | 115 | <i class="icon-tag"></i> |
|
116 | 116 | % if commit_rev == -1: |
|
117 | 117 | <span>0</span> ${_('Commit')} |
|
118 | 118 | % else: |
|
119 | 119 | <span>0</span> ${_('Commits')} |
|
120 | 120 | % endif |
|
121 | 121 | % else: |
|
122 | 122 | <a href="${h.route_path('repo_changelog', repo_name=c.repo_name)}"> |
|
123 | 123 | <i class="icon-tag"></i> |
|
124 | 124 | % if commit_rev == 1: |
|
125 | 125 | <span>${commit_rev}</span> ${_('Commit')} |
|
126 | 126 | % else: |
|
127 | 127 | <span>${commit_rev}</span> ${_('Commits')} |
|
128 | 128 | % endif |
|
129 | 129 | </a> |
|
130 | 130 | % endif |
|
131 | 131 | </span> |
|
132 | 132 | |
|
133 | 133 | ## forks |
|
134 | 134 | <span class="tag"> |
|
135 | 135 | <a title="${_('Number of Repository Forks')}" href="${h.route_path('repo_forks_show_all', repo_name=c.repo_name)}"> |
|
136 | 136 | <i class="icon-code-fork"></i> |
|
137 | 137 | <span>${c.repository_forks}</span> ${_ungettext('Fork', 'Forks', c.repository_forks)}</a> |
|
138 | 138 | </span> |
|
139 | 139 | </div> |
|
140 | 140 | </div> |
|
141 | 141 | </div> |
|
142 | 142 |
|
|
143 | ## owner, description, downloads, statistics | |
|
143 | 144 | |
|
145 | ## Owner | |
|
144 | 146 | <div class="fieldset collapsable-content" data-toggle="summary-details" style="display: none;"> |
|
145 | 147 | <div class="left-label-summary"> |
|
146 |
<p>${_(' |
|
|
147 | ||
|
148 | <p>${_('Owner')}</p> | |
|
148 | 149 | <div class="right-label-summary"> |
|
149 | <div class="tags"> | |
|
150 | ## repo size | |
|
151 | % if commit_rev == -1: | |
|
152 | <span class="stats-bullet">0 B</span> | |
|
153 | % else: | |
|
154 | <span> | |
|
155 | <a href="#showSize" onclick="calculateSize(); $(this).hide(); return false" id="show-repo-size">Show repository size</a> | |
|
156 | </span> | |
|
157 | <span class="stats-bullet" id="repo_size_container" style="display:none"> | |
|
158 | ${_('Calculating Repository Size...')} | |
|
159 | </span> | |
|
160 | % endif | |
|
150 | ${base.gravatar_with_user(c.rhodecode_db_repo.user.email, 16)} | |
|
161 | 151 |
|
|
162 | </div> | |
|
152 | ||
|
163 | 153 | </div> |
|
164 | 154 | </div> |
|
165 | 155 | |
|
156 | ## Description | |
|
166 | 157 | <div class="fieldset collapsable-content" data-toggle="summary-details" style="display: none;"> |
|
167 | 158 | <div class="left-label-summary"> |
|
168 | 159 | <p>${_('Description')}</p> |
|
169 | 160 | |
|
170 | 161 | <div class="right-label-summary input ${summary(c.show_stats)}"> |
|
171 | 162 | <%namespace name="dt" file="/data_table/_dt_elements.mako"/> |
|
172 | 163 | ${dt.repo_desc(c.rhodecode_db_repo.description_safe, c.visual.stylify_metatags)} |
|
173 | 164 | </div> |
|
174 | 165 | </div> |
|
175 | 166 | </div> |
|
176 | 167 |
|
|
168 | ## Downloads | |
|
177 | 169 | % if show_downloads: |
|
178 | 170 | <div class="fieldset collapsable-content" data-toggle="summary-details" style="display: none;"> |
|
179 | 171 | <div class="left-label-summary"> |
|
180 | 172 | <p>${_('Downloads')}</p> |
|
181 | 173 | |
|
182 | 174 | <div class="right-label-summary input ${summary(c.show_stats)} downloads"> |
|
183 | 175 | % if c.rhodecode_repo and len(c.rhodecode_repo.commit_ids) == 0: |
|
184 | 176 | <span class="disabled"> |
|
185 | 177 | ${_('There are no downloads yet')} |
|
186 | 178 | </span> |
|
187 | 179 | % elif not c.enable_downloads: |
|
188 | 180 | <span class="disabled"> |
|
189 | 181 | ${_('Downloads are disabled for this repository')}. |
|
190 | 182 | </span> |
|
191 | 183 | % if c.is_super_admin: |
|
192 | 184 | ${h.link_to(_('Enable downloads'),h.route_path('edit_repo',repo_name=c.repo_name, _anchor='repo_enable_downloads'))} |
|
193 | 185 | % endif |
|
194 | 186 | % else: |
|
195 | 187 | <span class="enabled"> |
|
196 | 188 | <a id="archive_link" class="btn btn-small" href="${h.route_path('repo_archivefile',repo_name=c.rhodecode_db_repo.repo_name,fname='tip.zip')}"> |
|
197 | 189 | <i class="icon-archive"></i> tip.zip |
|
198 | 190 | ## replaced by some JS on select |
|
199 | 191 | </a> |
|
200 | 192 | </span> |
|
201 | 193 | ${h.hidden('download_options')} |
|
202 | 194 | % endif |
|
203 | 195 | </div> |
|
204 | 196 | </div> |
|
205 | 197 | </div> |
|
206 | 198 | % endif |
|
207 | 199 | |
|
200 | ## Context Action | |
|
201 | <div class="fieldset collapsable-content" data-toggle="summary-details" style="display: none;"> | |
|
202 | <div class="left-label-summary"> | |
|
203 | <p>${_('Feed')}</p> | |
|
204 | ||
|
205 | <div class="right-label-summary"> | |
|
206 | %if c.rhodecode_user.username != h.DEFAULT_USER: | |
|
207 | <a href="${h.route_path('atom_feed_home', repo_name=c.rhodecode_db_repo.repo_name, _query=dict(auth_token=c.rhodecode_user.feed_token))}" title="${_('RSS Feed')}" class="btn btn-sm"><i class="icon-rss-sign"></i>RSS</a> | |
|
208 | %else: | |
|
209 | <a href="${h.route_path('atom_feed_home', repo_name=c.rhodecode_db_repo.repo_name)}" title="${_('RSS Feed')}" class="btn btn-sm"><i class="icon-rss-sign"></i>RSS</a> | |
|
210 | %endif | |
|
211 | </div> | |
|
212 | </div> | |
|
213 | </div> | |
|
214 | ||
|
215 | ## Repo size | |
|
216 | <div class="fieldset collapsable-content" data-toggle="summary-details" style="display: none;"> | |
|
217 | <div class="left-label-summary"> | |
|
218 | <p>${_('Repository size')}</p> | |
|
219 | ||
|
220 | <div class="right-label-summary"> | |
|
221 | <div class="tags"> | |
|
222 | ## repo size | |
|
223 | % if commit_rev == -1: | |
|
224 | <span class="stats-bullet">0 B</span> | |
|
225 | % else: | |
|
226 | <span> | |
|
227 | <a href="#showSize" onclick="calculateSize(); $(this).hide(); return false" id="show-repo-size">Show repository size</a> | |
|
228 | </span> | |
|
229 | <span class="stats-bullet" id="repo_size_container" style="display:none"> | |
|
230 | ${_('Calculating Repository Size...')} | |
|
231 | </span> | |
|
232 | % endif | |
|
233 | </div> | |
|
234 | </div> | |
|
235 | </div> | |
|
236 | </div> | |
|
237 | ||
|
208 | 238 | ## Statistics |
|
209 | 239 |
|
|
210 | 240 | <div class="left-label-summary"> |
|
211 | <p>${_('Statistics')}</p> | |
|
241 | <p>${_('Code Statistics')}</p> | |
|
212 | 242 | |
|
213 | 243 | <div class="right-label-summary input ${summary(c.show_stats)} statistics"> |
|
214 | 244 | % if c.show_stats: |
|
215 | 245 | <div id="lang_stats" class="enabled"> |
|
216 | ${_('Calculating Code Statistics...')} | |
|
246 | <a href="#showSize" onclick="calculateSize(); $('#show-repo-size').hide(); $(this).hide(); return false" id="show-repo-size">Show code statistics</a> | |
|
217 | 247 | </div> |
|
218 | 248 | % else: |
|
219 | 249 | <span class="disabled"> |
|
220 | 250 | ${_('Statistics are disabled for this repository')}. |
|
221 | 251 | </span> |
|
222 | 252 | % if c.is_super_admin: |
|
223 | 253 | ${h.link_to(_('Enable statistics'),h.route_path('edit_repo',repo_name=c.repo_name, _anchor='repo_enable_statistics'))} |
|
224 | 254 | % endif |
|
225 | 255 | % endif |
|
226 | 256 | </div> |
|
227 | 257 | |
|
228 | 258 | </div> |
|
229 | 259 | </div> |
|
230 | 260 | |
|
231 | <div class="fieldset collapsable-content" data-toggle="summary-details" style="display: none;"> | |
|
232 | <div class="left-label-summary"> | |
|
233 | <p>${_('Owner')}</p> | |
|
234 | <div class="right-label-summary"> | |
|
235 | ${base.gravatar_with_user(c.rhodecode_db_repo.user.email, 16)} | |
|
236 | </div> | |
|
237 | ||
|
238 | </div> | |
|
239 | </div> | |
|
240 | ||
|
241 | ## Context Action | |
|
242 | <div class="fieldset collapsable-content" data-toggle="summary-details" style="display: none;"> | |
|
243 | <div class="left-label-summary"> | |
|
244 | %if c.rhodecode_user.username != h.DEFAULT_USER: | |
|
245 | <a href="${h.route_path('atom_feed_home', repo_name=c.rhodecode_db_repo.repo_name, _query=dict(auth_token=c.rhodecode_user.feed_token))}" title="${_('RSS Feed')}" class="btn btn-sm"><i class="icon-rss-sign"></i>RSS</a> | |
|
246 | %else: | |
|
247 | <a href="${h.route_path('atom_feed_home', repo_name=c.rhodecode_db_repo.repo_name)}" title="${_('RSS Feed')}" class="btn btn-sm"><i class="icon-rss-sign"></i>RSS</a> | |
|
248 | %endif | |
|
249 | </div> | |
|
250 | </div> | |
|
251 | 261 | |
|
252 | 262 | </div><!--end summary-detail--> |
|
253 | 263 | |
|
254 | 264 | <div id="summary_details_expand" class="btn-collapse" data-toggle="summary-details"> |
|
255 | 265 | ${_('Show More')} |
|
256 | 266 | </div> |
|
257 | 267 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now