You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

repo_list.tmpl 8.8 kB

3 years ago
3 years ago
9 years ago
Repository avatars (#6986) * Repository avatars - first variant of code from old work for gogs - add migration 87 - add new option in app.ini - add en-US locale string - add new class in repository.less * Add changed index.css, remove unused template name * Update en-us doc about configuration options * Add comments to new functions, add new option to docker app.ini * Add comment for lint * Remove variable, not needed * Fix formatting * Update swagger api template * Check if avatar exists * Fix avatar link/path checks * Typo * TEXT column can't have a default value * Fixes: - remove old avatar file on upload - use ID in name of avatar file - users may upload same files - add simple tests * Fix fmt check * Generate PNG instead of "static" GIF * More informative comment * Fix error message * Update avatar upload checks: - add file size check - add new option - update config docs - add new string to en-us locale * Fixes: - use FileHEader field for check file size - add new test - upload big image * Fix formatting * Update comments * Update log message * Removed wrong style - not needed * Use Sync2 to migrate * Update repos list view - bigger avatar - fix html blocks alignment * A little adjust avatar size * Use small icons for explore/repo list * Use new cool avatar preparation func by @lafriks * Missing changes for new function * Remove unused import, move imports * Missed new option definition in app.ini Add file size check in user/profile avatar upload * Use smaller field length for Avatar * Use session to update repo DB data, update DeleteAvatar - use session too * Fix err variable definition * As suggested @lafriks - return as soon as possible, code readability
6 years ago
Repository avatars (#6986) * Repository avatars - first variant of code from old work for gogs - add migration 87 - add new option in app.ini - add en-US locale string - add new class in repository.less * Add changed index.css, remove unused template name * Update en-us doc about configuration options * Add comments to new functions, add new option to docker app.ini * Add comment for lint * Remove variable, not needed * Fix formatting * Update swagger api template * Check if avatar exists * Fix avatar link/path checks * Typo * TEXT column can't have a default value * Fixes: - remove old avatar file on upload - use ID in name of avatar file - users may upload same files - add simple tests * Fix fmt check * Generate PNG instead of "static" GIF * More informative comment * Fix error message * Update avatar upload checks: - add file size check - add new option - update config docs - add new string to en-us locale * Fixes: - use FileHEader field for check file size - add new test - upload big image * Fix formatting * Update comments * Update log message * Removed wrong style - not needed * Use Sync2 to migrate * Update repos list view - bigger avatar - fix html blocks alignment * A little adjust avatar size * Use small icons for explore/repo list * Use new cool avatar preparation func by @lafriks * Missing changes for new function * Remove unused import, move imports * Missed new option definition in app.ini Add file size check in user/profile avatar upload * Use smaller field length for Avatar * Use session to update repo DB data, update DeleteAvatar - use session too * Fix err variable definition * As suggested @lafriks - return as soon as possible, code readability
6 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <style>
  2. .ui.repository.list>.item {
  3. position: relative;
  4. border: 1px solid #E1E3E6;
  5. border-radius: 0.8rem;
  6. margin-bottom: 1.0rem;
  7. padding: 1.0rem !important;
  8. }
  9. .ui.repository.list>.item .header {
  10. font-size: 1.4rem !important;
  11. font-weight: 200;
  12. }
  13. .ui.list>.item>.content {
  14. margin-left: 36px;
  15. }
  16. .ui.list .list>.item>img.image+.content,
  17. .ui.list>.item>img.image+.content {
  18. width: calc(100% - 34px);
  19. margin-left: 0;
  20. }
  21. .ui.repository.list>.item::before {
  22. position: absolute;
  23. left: 0;
  24. right: 0;
  25. content: "";
  26. height: 1px;
  27. background-color: #E1E3E6;
  28. bottom: 2.8rem;
  29. }
  30. .repository .ui.mini.menu {
  31. font-size: .6rem;
  32. }
  33. .repository .ui.right.compact .item {
  34. padding-top: 0;
  35. padding-bottom: 0;
  36. }
  37. .ui.repository.list .item .time {
  38. margin-top: 1.5rem;
  39. }
  40. </style>
  41. <div class="ui secondary pointing tabular top attached borderless menu navbar">
  42. {{if .PageIsExplore}}
  43. <a class="{{if eq .SortType "hot"}}active{{end}} item"
  44. href="{{$.Link}}?q={{$.Keyword}}&topic={{$.Topic}}&sort=hot&tab={{$.TabName}}">
  45. <svg class="svg octicon-repo" width="16" height="16" aria-hidden="true">
  46. <use xlink:href="#octicon-repo" />
  47. </svg>
  48. {{.i18n.Tr "explore.hot_repo"}}
  49. </a>
  50. <a class="{{if eq .SortType "active"}}active{{end}} item"
  51. href="{{$.Link}}?q={{$.Keyword}}&topic={{$.Topic}}&sort=active&tab={{$.TabName}}">
  52. <svg class="svg octicon-inbox" width="16" height="16" aria-hidden="true">
  53. <use xlink:href="#octicon-inbox" />
  54. </svg>
  55. {{.i18n.Tr "explore.active_repo"}}
  56. </a>
  57. {{end}}
  58. <a class="{{if eq .SortType "recentupdate"}}active{{end}} item"
  59. href="{{$.Link}}?q={{$.Keyword}}&topic={{$.Topic}}&sort=recentupdate&tab={{$.TabName}}">
  60. <svg class="svg octicon-organization" width="16" height="16" aria-hidden="true">
  61. <use xlink:href="#octicon-organization" />
  62. </svg> {{.i18n.Tr "repo.issues.filter_sort.recentupdate"}}
  63. </a>
  64. <div class="ui right floated secondary filter menu">
  65. <!-- Sort -->
  66. <div class="ui right dropdown type jump item">
  67. <span class="text">
  68. {{.i18n.Tr "repo.issues.filter_sort"}}
  69. <i class="dropdown icon"></i>
  70. </span>
  71. <div class="menu">
  72. <a class="{{if eq .SortType "newest"}}active{{end}} item"
  73. href="{{$.Link}}?sort=newest&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.latest"}}</a>
  74. <a class="{{if eq .SortType "oldest"}}active{{end}} item"
  75. href="{{$.Link}}?sort=oldest&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.oldest"}}</a>
  76. <a class="{{if eq .SortType "alphabetically"}}active{{end}} item"
  77. href="{{$.Link}}?sort=alphabetically&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.label.filter_sort.alphabetically"}}</a>
  78. <a class="{{if eq .SortType "reversealphabetically"}}active{{end}} item"
  79. href="{{$.Link}}?sort=reversealphabetically&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a>
  80. <a class="{{if eq .SortType "recentupdate"}}active{{end}} item"
  81. href="{{$.Link}}?sort=recentupdate&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.recentupdate"}}</a>
  82. <a class="{{if eq .SortType "leastupdate"}}active{{end}} item"
  83. href="{{$.Link}}?sort=leastupdate&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.leastupdate"}}</a>
  84. <a class="{{if eq .SortType "moststars"}}active{{end}} item"
  85. href="{{$.Link}}?sort=moststars&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.moststars"}}</a>
  86. <a class="{{if eq .SortType "feweststars"}}active{{end}} item"
  87. href="{{$.Link}}?sort=feweststars&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.feweststars"}}</a>
  88. <a class="{{if eq .SortType "mostforks"}}active{{end}} item"
  89. href="{{$.Link}}?sort=mostforks&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.mostforks"}}</a>
  90. <a class="{{if eq .SortType "fewestforks"}}active{{end}} item"
  91. href="{{$.Link}}?sort=fewestforks&q={{$.Keyword}}&topic={{$.Topic}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.fewestforks"}}</a>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. <div class="ui repository list">
  97. {{range .Repos}}
  98. <div class="item">
  99. {{if .RelAvatarLink}}
  100. <img class="ui avatar image" style="width: 28px;height: 28px;" src="{{.RelAvatarLink}}">
  101. {{else}}
  102. <img class="ui avatar image" style="width: 28px;height: 28px;" avatar="{{.Owner.Name}}">
  103. {{end}}
  104. <div class="content">
  105. <div class="ui header">
  106. <div class="ui grid">
  107. <div class="ui sixteen wide mobile ten wide tablet twelve wide computer column">
  108. <a class="name" href="{{.Link}}">
  109. {{if or $.PageIsExplore $.PageIsProfileStarList }}{{if .Owner}}{{.Owner.Name}}
  110. <span>/</span> {{end}}{{end}}<strong>{{.DisplayName}}</strong>
  111. {{if .IsArchived}}<i class="archive icon archived-icon"></i>{{end}}
  112. </a>
  113. {{if .IsPrivate}}
  114. <span class="middle text gold">{{svg "octicon-lock" 16}}</span>
  115. {{else if .IsFork}}
  116. <span class="middle">{{svg "octicon-repo-forked" 16}}</span>
  117. {{else if .IsMirror}}
  118. <span class="middle">{{svg "octicon-repo-clone" 16}}</span>
  119. {{else if .Owner}}
  120. {{if .Owner.Visibility.IsPrivate}}
  121. <span class="text gold">{{svg "octicon-lock" 16}}</span>
  122. {{end}}
  123. {{end}}
  124. </div>
  125. <div class="ui sixteen wide mobile six wide tablet four wide computer column">
  126. <div class="ui mini right compact menu">
  127. {{if eq $.SortType "hot"}}
  128. <a class="item">
  129. <svg class="svg octicon-inbox" width="16" height="16" viewBox="0 0 24 24">
  130. <path fill="currentColor"
  131. d="M17.66 11.2C17.43 10.9 17.15 10.64 16.89 10.38C16.22 9.78 15.46 9.35 14.82 8.72C13.33 7.26 13 4.85 13.95 3C13 3.23 12.17 3.75 11.46 4.32C8.87 6.4 7.85 10.07 9.07 13.22C9.11 13.32 9.15 13.42 9.15 13.55C9.15 13.77 9 13.97 8.8 14.05C8.57 14.15 8.33 14.09 8.14 13.93C8.08 13.88 8.04 13.83 8 13.76C6.87 12.33 6.69 10.28 7.45 8.64C5.78 10 4.87 12.3 5 14.47C5.06 14.97 5.12 15.47 5.29 15.97C5.43 16.57 5.7 17.17 6 17.7C7.08 19.43 8.95 20.67 10.96 20.92C13.1 21.19 15.39 20.8 17.03 19.32C18.86 17.66 19.5 15 18.56 12.72L18.43 12.46C18.22 12 17.66 11.2 17.66 11.2M14.5 17.5C14.22 17.74 13.76 18 13.4 18.1C12.28 18.5 11.16 17.94 10.5 17.28C11.69 17 12.4 16.12 12.61 15.23C12.78 14.43 12.46 13.77 12.33 13C12.21 12.26 12.23 11.63 12.5 10.94C12.69 11.32 12.89 11.7 13.13 12C13.9 13 15.11 13.44 15.37 14.8C15.41 14.94 15.43 15.08 15.43 15.23C15.46 16.05 15.1 16.95 14.5 17.5H14.5Z" />
  132. </svg>
  133. {{.Hot}}
  134. </a>
  135. {{else if eq $.SortType "active"}}
  136. <a class="item">
  137. <svg class="svg octicon-inbox" width="16" height="16" viewBox="0 0 24 24">
  138. <path fill="currentColor"
  139. d="M13.13 22.19L11.5 18.36C13.07 17.78 14.54 17 15.9 16.09L13.13 22.19M5.64 12.5L1.81 10.87L7.91 8.1C7 9.46 6.22 10.93 5.64 12.5M21.61 2.39C21.61 2.39 16.66 .269 11 5.93C8.81 8.12 7.5 10.53 6.65 12.64C6.37 13.39 6.56 14.21 7.11 14.77L9.24 16.89C9.79 17.45 10.61 17.63 11.36 17.35C13.5 16.53 15.88 15.19 18.07 13C23.73 7.34 21.61 2.39 21.61 2.39M14.54 9.46C13.76 8.68 13.76 7.41 14.54 6.63S16.59 5.85 17.37 6.63C18.14 7.41 18.15 8.68 17.37 9.46C16.59 10.24 15.32 10.24 14.54 9.46M8.88 16.53L7.47 15.12L8.88 16.53M6.24 22L9.88 18.36C9.54 18.27 9.21 18.12 8.91 17.91L4.83 22H6.24M2 22H3.41L8.18 17.24L6.76 15.83L2 20.59V22M2 19.17L6.09 15.09C5.88 14.79 5.73 14.47 5.64 14.12L2 17.76V19.17Z" />
  140. </svg> {{.Active}}
  141. </a>
  142. {{else}}
  143. <a class="item">
  144. {{svg "octicon-eye" 16}} {{.NumWatches}}
  145. </a>
  146. <a class="item">
  147. {{svg "octicon-git-branch" 16}} {{.NumForks}}
  148. </a>
  149. {{end}}
  150. <a class="item">
  151. {{svg "octicon-star" 16}} {{.NumStars}}
  152. </a>
  153. </div>
  154. </div>
  155. </div>
  156. </div>
  157. <div class="description">
  158. {{if .DescriptionHTML}}<p class="has-emoji">{{.DescriptionHTML}}</p>{{end}}
  159. {{if .Topics }}
  160. <div class="ui tags">
  161. {{range .Topics}}
  162. {{if ne . "" }}<a href="{{AppSubUrl}}/explore/repos?q={{.}}&topic={{$.Topic}}">
  163. <div class="ui small label topic">{{.}}</div>
  164. </a>{{end}}
  165. {{end}}
  166. </div>
  167. {{end}}
  168. <p class="time">
  169. {{$.i18n.Tr "org.repo_updated"}} {{TimeSinceUnix .UpdatedUnix $.i18n.Lang}}
  170. {{if .PrimaryLanguage }}
  171. <span class="text grey"><i class="color-icon"
  172. style="background-color: {{.PrimaryLanguage.Color}}"></i>{{ .PrimaryLanguage.Language }}</span>
  173. {{end}}
  174. </p>
  175. </div>
  176. </div>
  177. </div>
  178. {{else}}
  179. <div>
  180. {{$.i18n.Tr "explore.repo_no_results"}}
  181. </div>
  182. {{end}}
  183. </div>