repo_info.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. {% extends "repo_master.html" %}
  2. {% block title %}{{ select.capitalize() }} - {{
  3. repo.namespace + '/' if repo.namespace }}{{ repo.name }}{% endblock %}
  4. {% set tag = "home" %}
  5. {% if g.repo_watch_levels == ['issues', 'commits'] %}
  6. {% set watch_button_title = 'You are watching issues, PRs, and commits on this project' %}
  7. {% set watch_button_text = 'Unwatch' %}
  8. {% elif g.repo_watch_levels == ['issues'] %}
  9. {% set watch_button_title = 'You are watching issues on this project' %}
  10. {% set watch_button_text = 'Unwatch' %}
  11. {% elif g.repo_watch_levels == ['commits'] %}
  12. {% set watch_button_title = 'You are watching commits on this project' %}
  13. {% set watch_button_text = 'Unwatch' %}
  14. {% else %}
  15. {% set watch_button_title = 'You are not watching this project' %}
  16. {% set watch_button_text = 'Watch' %}
  17. {% endif %}
  18. {% block header %}
  19. <meta name="go-import" content="{{ config.get('APP_URL', '').split('://', 1)[1] }}{{ repo.fullname }} git {{ config.get('GIT_URL_GIT') }}{{ repo.fullname }}.git">
  20. {% endblock %}
  21. {% block repo %}
  22. <div class="row">
  23. <div class="col-2">
  24. {% block overviewtabs %}{{ super() }}{% endblock %}
  25. </div>
  26. <div class="col-10">
  27. <div class="row text-center mb-4">
  28. <div class="col">
  29. {% if repo.is_fork -%}
  30. <i class="fa fa-code-fork text-muted fa-fw fa-3x"></i>
  31. {% elif repo.avatar_email %}
  32. <img class="mb-1" src="{{ repo.avatar_email | avatar_url }}" width=60 height=60 />
  33. {% endif %}
  34. <h2>
  35. {% if repo.is_fork -%}
  36. <a href="{{ url_for(
  37. 'ui_ns.view_user', username=repo.user.user)
  38. }}">{{ repo.user.user }}</a><span class="mt-1 text-muted">&nbsp;/&nbsp;</span>
  39. {%- endif -%}
  40. {%- if repo.namespace -%}
  41. <a href="{{ url_for(
  42. 'ui_ns.view_projects', namespace=repo.namespace, pattern='*')
  43. }}">{{ repo.namespace }}</a>&nbsp;/&nbsp;
  44. {%- endif -%}<a href="{{ url_for('ui_ns.view_repo',
  45. repo=repo.name,
  46. username=username,
  47. namespace=repo.namespace)
  48. }}"><strong>{{ repo.name }}</strong></a>
  49. {% if repo.private %}
  50. <span class="fa fa-lock text-danger fa-fw" title="Private project"></span>
  51. {% endif %}
  52. </h2>
  53. {% if repo.is_fork and repo.parent %}
  54. <span class="text-muted">
  55. Forked from
  56. <a href="{{ url_for(
  57. 'ui_ns.view_repo',
  58. repo=repo.parent.name,
  59. username=repo.parent.user.user if repo.parent.is_fork else None,
  60. namespace=repo.parent.namespace)}}">
  61. {{ repo.parent.fullname }}
  62. </a>
  63. {{repo.date_created|humanize_tooltip | safe}}
  64. </span>
  65. {% elif repo.is_fork and not repo.parent %}
  66. <span class="text-muted">
  67. Forked from a deleted repository {{repo.date_created|humanize_tooltip | safe}}
  68. </span>
  69. {% endif %}
  70. {% if not repo.is_fork %}
  71. <div class="text-muted">Created {{repo.date_created|humanize_tooltip | safe}}</div>
  72. <div class="text-muted">
  73. Maintained by
  74. <a href="{{ url_for('ui_ns.view_user', username=repo.user.user)}}">
  75. {{- repo.user.user -}}
  76. </a>
  77. </div>
  78. {% endif %}
  79. <div class="projectinfo my-3">
  80. {% if repo.description %}{{ repo.description | noJS | safe }}{% else %}-{% endif -%}
  81. {%- if repo.url %} &nbsp;| &nbsp;<a class="inline" href="{{ repo.url }}">{{ repo.url }}</a>{% endif %}
  82. </div>
  83. <div class="btn-group">
  84. {% if g.authenticated and not g.repo_starred %}
  85. <a href="#" class="btn btn-sm btn-outline-primary font-weight-bold star_btn">
  86. <form method="POST" name="star_project" id="star_project"
  87. action="{{ url_for(
  88. 'ui_ns.star_project',
  89. repo=repo.name,
  90. username=username,
  91. namespace=repo.namespace,
  92. star=1)}}">
  93. {{ g.forkbuttonform.csrf_token }}
  94. </form>
  95. <i class="fa fa-star-o fa-fw"></i>Star
  96. </a>
  97. <a href="{{url_for(
  98. 'ui_ns.view_stargazers',
  99. repo=repo.name,
  100. username=repo.user.user if repo.is_fork else None,
  101. namespace=repo.namespace,
  102. )}}" class="btn btn-sm btn-primary font-weight-bold">{{ repo.stargazers|length }}</a>
  103. {% elif g.authenticated and g.repo_starred %}
  104. <a href="#" class="btn btn-sm btn-outline-primary font-weight-bold unstar_btn">
  105. <form method="POST" name="unstar_project" id="unstar_project"
  106. action="{{ url_for(
  107. 'ui_ns.star_project',
  108. repo=repo.name,
  109. username=username,
  110. namespace=repo.namespace,
  111. star=0)}}">
  112. {{ g.forkbuttonform.csrf_token }}
  113. </form>
  114. <span class="fa fa-star text-warning"></span> Unstar
  115. </a>
  116. <a href="{{url_for(
  117. 'ui_ns.view_stargazers',
  118. repo=repo.name,
  119. username=repo.user.user if repo.is_fork else None,
  120. namespace=repo.namespace,
  121. )}}" class="btn btn-sm btn-primary font-weight-bold">{{repo.stargazers|length}}</a>
  122. {% else %}
  123. <a href="#" class="btn btn-sm btn-outline-primary font-weight-bold"
  124. title="Log in to Star the project">
  125. <span class="fa fa-star text-warning"></span> Star
  126. </a>
  127. <a href="{{url_for(
  128. 'ui_ns.view_stargazers',
  129. repo=repo.name,
  130. username=repo.user.user if repo.is_fork else None,
  131. namespace=repo.namespace,
  132. )}}" class="btn btn-sm btn-primary font-weight-bold">{{repo.stargazers|length}}
  133. </a>
  134. {% endif %}
  135. </div>
  136. <div class="btn-group">
  137. <a href="#" title="{{ watch_button_title }}"
  138. class="btn btn-sm dropdown-toggle btn-outline-primary font-weight-bold"
  139. data-toggle="dropdown" id="watch-button">
  140. <i class="fa {{ 'fa-eye-slash' if watch_button_text == 'Watch' else 'fa-eye text-success' }} fa-fw"></i>
  141. <span>{{watch_button_text}}</span>
  142. </a>
  143. <span class="btn btn-sm btn-primary font-weight-bold">{{num_watchers}}</span>
  144. <div class="dropdown-menu dropdown-menu-right watch-menu">
  145. <form method="POST" id="watch_project" name="watch_project"
  146. action="{{ url_for('ui_ns.watch_repo',
  147. repo=repo.name,
  148. user=repo.user.user if repo.is_fork else None,
  149. namespace=repo.namespace,
  150. watch=0) }}">
  151. <a class="dropdown-item pl-2" id="watch_issues_button">
  152. <div class="media">
  153. <div class="align-self-center check-icon pr-2">
  154. <span class="fa fa-fw"></span>
  155. </div>
  156. <div class="media-body">
  157. Watch Issues and PRs
  158. </div>
  159. </div>
  160. </a>
  161. <a class="dropdown-item pl-2" id="watch_commits_button">
  162. <div class="media">
  163. <div class="align-self-center check-icon pr-2">
  164. <span class="fa fa-fw"></span>
  165. </div>
  166. <div class="media-body">
  167. Watch Commits
  168. </div>
  169. </div>
  170. </a>
  171. <a class="dropdown-item pl-2" id="watch_issues_commits_button">
  172. <div class="media">
  173. <div class="align-self-center check-icon pr-2">
  174. <span class="fa fa-fw"></span>
  175. </div>
  176. <div class="media-body">
  177. Watch Issues, PRs, and Commits
  178. </div>
  179. </div>
  180. </a>
  181. <a class="dropdown-item pl-2" id="unwatch_button">
  182. <div class="media">
  183. <div class="align-self-center check-icon pr-2">
  184. <span class="fa fa-fw"></span>
  185. </div>
  186. <div class="media-body">
  187. Unwatch
  188. </div>
  189. </div>
  190. </a>
  191. <a class="dropdown-item pl-2" id="reset_button">
  192. <div class="media">
  193. <div class="align-self-center check-icon pr-2">
  194. <span class="fa fa-fw"></span>
  195. </div>
  196. <div class="media-body">
  197. Reset watch status
  198. </div>
  199. </div>
  200. </a>
  201. {{ g.forkbuttonform.csrf_token }}
  202. </form>
  203. </div>
  204. </div>
  205. <div class="btn-group">
  206. <a href="#"
  207. class="btn btn-sm dropdown-toggle btn-outline-primary font-weight-bold"
  208. data-toggle="dropdown">
  209. <i class="fa fa-users fa-fw"></i>
  210. <span>Members</span>
  211. </a>
  212. {# the +1 here is for the main admin that is not listed in repo.contributors #}
  213. {% set memberstotal = repo.contributors['admin']|length +
  214. repo.contributors['commit']|length +
  215. repo.contributors['ticket']|length +
  216. repo.contributor_groups['admin']|length +
  217. repo.contributor_groups['commit']|length +
  218. repo.contributor_groups['ticket']|length + 1 %}
  219. <span class="btn btn-sm btn-primary font-weight-bold">{{ memberstotal }}</span>
  220. <div class="dropdown-menu dropdown-menu-right" id="maintainers_dropdown">
  221. <div>
  222. <div class="media p-2">
  223. <img class=" align-self-center mr-3" src="{{ repo.user.default_email | avatar_url }}" width="50" height="50">
  224. <div class="media-body align-self-center">
  225. <h4 class="my-0 font-weight-bold">
  226. <a href="{{ url_for('ui_ns.view_user', username=repo.user.user)}}">{{ repo.user.user }}</a>
  227. </h4>
  228. {{ repo.user.fullname }}
  229. </div>
  230. <div class="mr-auto align-self-center">maintainer</div>
  231. </div>
  232. {% for access in repo.contributors %}
  233. {% for user in repo.contributors[access] %}
  234. <div class="media p-2">
  235. <img class=" align-self-center mr-3" src="{{ user.default_email | avatar_url }}" width="50" height="50">
  236. <div class="media-body align-self-center">
  237. <h4 class="my-0 font-weight-bold">
  238. <a href="{{ url_for('ui_ns.view_user', username=user.user)}}">{{ user.user }}</a>
  239. </h4>
  240. {{ user.fullname }}
  241. </div>
  242. <div class="mr-auto align-self-center">{{ access }}</div>
  243. </div>
  244. {% endfor %}
  245. {% endfor %}
  246. {% for access in repo.contributor_groups %}
  247. {% for group in repo.contributor_groups[access] %}
  248. <div>
  249. <a href="{{ url_for('ui_ns.view_group', group=group.group_name)}}">
  250. @{{ group.group_name }}
  251. </a>
  252. - {{ access }}
  253. </div>
  254. <div class="media p-2">
  255. <div class="media-body align-self-center">
  256. <h4 class="my-0 font-weight-bold">
  257. <a href="{{ url_for('ui_ns.view_group', group=group.group_name)}}"> @{{ group.group_name }}</a>
  258. </h4>
  259. </div>
  260. <div class="mr-auto align-self-center">{{ access }}</div>
  261. </div>
  262. {% endfor %}
  263. {% endfor %}
  264. </div>
  265. </div>
  266. </div>
  267. {% if last_commits %}
  268. {% set commit = last_commits[0] %}
  269. <div class="alert alert-secondary bg-light d-flex align-items-center font-size-09 py-2 px-2 mt-4">
  270. <div>
  271. <a href="{{ url_for('ui_ns.view_commit',
  272. repo=repo.name,
  273. username=username,
  274. namespace=repo.namespace,
  275. commitid=commit.hex, branch=branchname) }}"
  276. class="notblue">
  277. <code class="py-1 px-2 font-weight-bold commit_branch">{{ branchname }}</code><code
  278. class="py-1 px-2 font-weight-bold commit_hash">{{ commit.hex|short }}</code>
  279. <span class="font-weight-bold">{{ commit.message.split('\n')[0] }}</span>
  280. </a>
  281. </div>
  282. <div class="ml-auto">
  283. <span><span class="font-weight-bold">{{ commit.author | author2avatar(20) | safe }} {{commit.author.name}}</span> committed {{ commit.commit_time|humanize_tooltip | safe }}</span>
  284. </div>
  285. </div>
  286. {% endif %}
  287. </div>
  288. </div>
  289. {% if g.repo_obj and (g.repo_obj.is_empty or g.repo_obj.head_is_unborn) and repo.mirrored_from %}
  290. <div class="alert {% if category == 'error' %}alert-warning{% else %}alert-info{%endif%}" role="alert">
  291. <p>This repo is brand new and meant to be mirrored from {{
  292. repo.mirrored_from }} !</p>
  293. <p>Mirrored projects are refreshed regularly. Please sit tight, code will
  294. come land soon!</p>
  295. </div>
  296. {% elif g.repo_obj and (g.repo_obj.is_empty or g.repo_obj.head_is_unborn) %}
  297. <div class="alert {% if category == 'error' %}alert-warning{% else %}alert-info{%endif%}" role="alert">
  298. <p>This repo is brand new!</p>
  299. {% if g.authenticated and g.repo_committer %}
  300. <p>If you already have a git repo:</p>
  301. <pre>git remote add origin {{ config.get('GIT_URL_SSH') }}{{ repo.path }}
  302. git push -u origin {{ g.repo_obj | get_default_branch or "<your main branch>"}}</pre>
  303. <p>If you have not created your git repo yet:</p>
  304. <pre>git clone {{ config.get('GIT_URL_SSH') }}{{ repo.path }}
  305. cd {{ repo.name }}
  306. git checkout -b {{ g.repo_obj | get_default_branch or "<your main branch>"}}
  307. touch README.rst
  308. git add README.rst
  309. git commit -m "Add README file"
  310. git push -u origin master</pre>
  311. {% else %}
  312. <p>The Project Creator has not pushed any code yet</p>
  313. {% endif %}
  314. </div>
  315. {% else %}
  316. {% if readme %}
  317. <section class="readme">
  318. {{ readme | noJS | safe }}
  319. </section>
  320. {% else %}
  321. <section class="no-readme">
  322. <div class="card">
  323. <div class="card-header text-center text-muted pt-2 pb-2">
  324. The {{repo.name}} project's README file is empty or unavailable.
  325. </div>
  326. </div>
  327. </section>
  328. {% endif %}
  329. {% endif %}
  330. </div>
  331. </div>
  332. {% endblock %}
  333. {% block jscripts %}
  334. {{ super() }}
  335. <script type="text/javascript" nonce="{{ g.nonce }}">
  336. $(document).ready(function() {
  337. $('.star_btn').click( function() { $('#star_project').submit()} );
  338. $('.unstar_btn').click( function() { $('#unstar_project').submit()} );
  339. {% if g.repo_watch_levels %}
  340. var currentWatchStatusButton = $('#watch_{{ g.repo_watch_levels | join('_') }}_button .check-icon span');
  341. {% else %}
  342. var currentWatchStatusButton = $('#unwatch_button .check-icon span');
  343. {% endif %}
  344. currentWatchStatusButton.addClass('fa-check');
  345. $(".watch-menu a").click(function(){
  346. var selectedValue = $(this).attr('id');
  347. var watchProjectForm = $("#watch_project");
  348. var action = watchProjectForm.attr('action');
  349. if (selectedValue === "watch_issues_button") {
  350. action = action.replace('/settings/0', '/settings/1');
  351. } else if (selectedValue === "watch_commits_button") {
  352. action = action.replace('/settings/0', '/settings/2');
  353. } else if (selectedValue === "watch_issues_commits_button") {
  354. action = action.replace('/settings/0', '/settings/3');
  355. } else if (selectedValue === "reset_button") {
  356. action = action.replace('/settings/0', '/settings/-1');
  357. }
  358. watchProjectForm.attr('action', action);
  359. watchProjectForm.submit();
  360. });
  361. });
  362. </script>
  363. {% endblock %}