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 6.2 kB

3 years ago
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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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, .ui.list>.item>img.image+.content{
  17. width:calc(100% - 30px);
  18. margin-left: 0;
  19. }
  20. .ui.repository.list>.item::before{
  21. position: absolute;
  22. left: 0;
  23. right: 0;
  24. content: "";
  25. height: 1px;
  26. background-color: #E1E3E6;
  27. bottom: 2.8rem;
  28. }
  29. .repository .ui.mini.menu{
  30. font-size: .6rem;
  31. }
  32. .repository .ui.right.compact .item{
  33. padding-top: 0;
  34. padding-bottom: 0;
  35. }
  36. .ui.repository.list .item .time {
  37. margin-top: 1.5rem;
  38. }
  39. </style>
  40. <div class="ui secondary pointing tabular top attached borderless menu navbar">
  41. <a class="{{if eq .SortType "hot"}}active{{end}} item" href="{{$.Link}}?sort=hot&q=&tab=">
  42. <svg class="svg octicon-repo" width="16" height="16" aria-hidden="true">
  43. <use xlink:href="#octicon-repo" />
  44. </svg>
  45. 热门{{.i18n.Tr "explore.repos"}}
  46. </a>
  47. <a class="{{if eq .SortType "active"}}active{{end}} item" href="{{$.Link}}?sort=active&q=&tab=">
  48. <svg class="svg octicon-inbox" width="16" height="16" aria-hidden="true">
  49. <use xlink:href="#octicon-inbox" />
  50. </svg>
  51. 活跃{{.i18n.Tr "explore.repos"}}
  52. </a>
  53. <a class="{{if eq .SortType "recentupdate"}}active{{end}} item" href="{{$.Link}}?sort=recentupdate&q={{$.Keyword}}&tab={{$.TabName}}">
  54. <svg class="svg octicon-organization" width="16" height="16" aria-hidden="true">
  55. <use xlink:href="#octicon-organization" />
  56. </svg> {{.i18n.Tr "repo.issues.filter_sort.recentupdate"}}
  57. </a>
  58. <div class="ui right floated secondary filter menu">
  59. <!-- Sort -->
  60. <div class="ui right dropdown type jump item">
  61. <span class="text">
  62. {{.i18n.Tr "repo.issues.filter_sort"}}
  63. <i class="dropdown icon"></i>
  64. </span>
  65. <div class="menu">
  66. <a class="{{if eq .SortType "newest"}}active{{end}} item" href="{{$.Link}}?sort=newest&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.latest"}}</a>
  67. <a class="{{if eq .SortType "oldest"}}active{{end}} item" href="{{$.Link}}?sort=oldest&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.oldest"}}</a>
  68. <a class="{{if eq .SortType "alphabetically"}}active{{end}} item" href="{{$.Link}}?sort=alphabetically&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.label.filter_sort.alphabetically"}}</a>
  69. <a class="{{if eq .SortType "reversealphabetically"}}active{{end}} item" href="{{$.Link}}?sort=reversealphabetically&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a>
  70. <a class="{{if eq .SortType "recentupdate"}}active{{end}} item" href="{{$.Link}}?sort=recentupdate&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.recentupdate"}}</a>
  71. <a class="{{if eq .SortType "leastupdate"}}active{{end}} item" href="{{$.Link}}?sort=leastupdate&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.leastupdate"}}</a>
  72. <a class="{{if eq .SortType "moststars"}}active{{end}} item" href="{{$.Link}}?sort=moststars&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.moststars"}}</a>
  73. <a class="{{if eq .SortType "feweststars"}}active{{end}} item" href="{{$.Link}}?sort=feweststars&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.feweststars"}}</a>
  74. <a class="{{if eq .SortType "mostforks"}}active{{end}} item" href="{{$.Link}}?sort=mostforks&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.mostforks"}}</a>
  75. <a class="{{if eq .SortType "fewestforks"}}active{{end}} item" href="{{$.Link}}?sort=fewestforks&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.fewestforks"}}</a>
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. <div class="ui repository list">
  81. {{range .Repos}}
  82. <div class="item">
  83. {{if .RelAvatarLink}}
  84. <img class="ui avatar image" src="{{.RelAvatarLink}}">
  85. {{end}}
  86. <div class="content">
  87. <div class="ui header">
  88. <a class="name" href="{{.Link}}">
  89. {{if or $.PageIsExplore $.PageIsProfileStarList }}{{if .Owner}}{{.Owner.Name}} <span>/</span> {{end}}{{end}}<strong>{{.Name}}</strong>
  90. {{if .IsArchived}}<i class="archive icon archived-icon"></i>{{end}}
  91. </a>
  92. {{if .IsPrivate}}
  93. <span class="middle text gold">{{svg "octicon-lock" 16}}</span>
  94. {{else if .IsFork}}
  95. <span class="middle">{{svg "octicon-repo-forked" 16}}</span>
  96. {{else if .IsMirror}}
  97. <span class="middle">{{svg "octicon-repo-clone" 16}}</span>
  98. {{else if .Owner}}
  99. {{if .Owner.Visibility.IsPrivate}}
  100. <span class="text gold">{{svg "octicon-lock" 16}}</span>
  101. {{end}}
  102. {{end}}
  103. <div class="ui mini right compact menu">
  104. <a class="item">
  105. {{svg "octicon-eye" 16}} {{.NumWatches}}
  106. </a>
  107. <a class="item">
  108. {{svg "octicon-star" 16}} {{.NumStars}}
  109. </a>
  110. <a class="item">
  111. {{svg "octicon-git-branch" 16}} {{.NumForks}}
  112. </a>
  113. </div>
  114. </div>
  115. <div class="description">
  116. {{if .DescriptionHTML}}<p class="has-emoji">{{.DescriptionHTML}}</p>{{end}}
  117. {{if .Topics }}
  118. <div class="ui tags">
  119. {{range .Topics}}
  120. {{if ne . "" }}<a href="{{AppSubUrl}}/explore/repos?q={{.}}&topic=1"><div class="ui small label topic">{{.}}</div></a>{{end}}
  121. {{end}}
  122. </div>
  123. {{end}}
  124. <p class="time">
  125. {{$.i18n.Tr "org.repo_updated"}} {{TimeSinceUnix .UpdatedUnix $.i18n.Lang}}
  126. {{if .PrimaryLanguage }}
  127. <span class="text grey"><i class="color-icon" style="background-color: {{.PrimaryLanguage.Color}}"></i>{{ .PrimaryLanguage.Language }}</span>
  128. {{end}}
  129. </p>
  130. </div>
  131. </div>
  132. </div>
  133. {{else}}
  134. <div>
  135. {{$.i18n.Tr "explore.repo_no_results"}}
  136. </div>
  137. {{end}}
  138. </div>