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

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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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;
  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. margin-top: -5px;
  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. <a class="active item" href="https://git.openi.org.cn/explore/repos?sort=moststars&q=&tab=">
  43. <svg class="svg octicon-repo" width="16" height="16" aria-hidden="true">
  44. <use xlink:href="#octicon-repo" />
  45. </svg>
  46. 热门{{.i18n.Tr "explore.repos"}}
  47. </a>
  48. <a class=" item" href="https://git.openi.org.cn/explore/repos?sort=mostforks&q=&tab=">
  49. <svg class="svg octicon-inbox" width="16" height="16" aria-hidden="true">
  50. <use xlink:href="#octicon-inbox" />
  51. </svg>
  52. 活跃{{.i18n.Tr "explore.repos"}}
  53. </a>
  54. <a class="{{if eq .SortType "newest"}}active{{end}} item" href="{{$.Link}}?sort=newest&q={{$.Keyword}}&tab={{$.TabName}}">
  55. <svg class="svg octicon-organization" width="16" height="16" aria-hidden="true">
  56. <use xlink:href="#octicon-organization" />
  57. </svg> {{.i18n.Tr "repo.issues.filter_sort.latest"}}
  58. </a>
  59. <div class="ui right floated secondary filter menu">
  60. <!-- Sort -->
  61. <div class="ui right dropdown type jump item">
  62. <span class="text">
  63. {{.i18n.Tr "repo.issues.filter_sort"}}
  64. <i class="dropdown icon"></i>
  65. </span>
  66. <div class="menu">
  67. <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>
  68. <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>
  69. <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>
  70. <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>
  71. <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>
  72. <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>
  73. <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>
  74. <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>
  75. <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>
  76. <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>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. <div class="ui repository list">
  82. {{range .Repos}}
  83. <div class="item">
  84. {{if .RelAvatarLink}}
  85. <img class="ui avatar image" src="{{.RelAvatarLink}}">
  86. {{end}}
  87. <div class="content">
  88. <div class="ui header">
  89. <a class="name" href="{{.Link}}">
  90. {{if or $.PageIsExplore $.PageIsProfileStarList }}{{if .Owner}}{{.Owner.Name}} <span>/</span> {{end}}{{end}}<strong>{{.Name}}</strong>
  91. {{if .IsArchived}}<i class="archive icon archived-icon"></i>{{end}}
  92. </a>
  93. {{if .IsPrivate}}
  94. <span class="middle text gold">{{svg "octicon-lock" 16}}</span>
  95. {{else if .IsFork}}
  96. <span class="middle">{{svg "octicon-repo-forked" 16}}</span>
  97. {{else if .IsMirror}}
  98. <span class="middle">{{svg "octicon-repo-clone" 16}}</span>
  99. {{else if .Owner}}
  100. {{if .Owner.Visibility.IsPrivate}}
  101. <span class="text gold">{{svg "octicon-lock" 16}}</span>
  102. {{end}}
  103. {{end}}
  104. <div class="ui mini right compact menu">
  105. <a class="item">
  106. {{svg "octicon-eye" 16}}
  107. {{.NumWatches}}
  108. </a>
  109. <a class="item">
  110. {{svg "octicon-star" 16}} {{.NumStars}}
  111. </a>
  112. <a class="item">
  113. {{svg "octicon-git-branch" 16}} {{.NumForks}}
  114. </a>
  115. </div>
  116. </div>
  117. <div class="description">
  118. {{if .DescriptionHTML}}<p class="has-emoji">{{.DescriptionHTML}}</p>{{end}}
  119. {{if .Topics }}
  120. <div class="ui tags">
  121. {{range .Topics}}
  122. {{if ne . "" }}<a href="{{AppSubUrl}}/explore/repos?q={{.}}&topic=1"><div class="ui small label topic">{{.}}</div></a>{{end}}
  123. {{end}}
  124. </div>
  125. {{end}}
  126. <p class="time">
  127. {{$.i18n.Tr "org.repo_updated"}} {{TimeSinceUnix .UpdatedUnix $.i18n.Lang}}
  128. {{if .PrimaryLanguage }}
  129. <span class="text grey"><i class="color-icon" style="background-color: {{.PrimaryLanguage.Color}}"></i>{{ .PrimaryLanguage.Language }}</span>
  130. {{end}}
  131. </p>
  132. </div>
  133. </div>
  134. </div>
  135. {{else}}
  136. <div>
  137. {{$.i18n.Tr "explore.repo_no_results"}}
  138. </div>
  139. {{end}}
  140. </div>