repo_info.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  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">
  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}}
  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}}
  68. </span>
  69. {% endif %}
  70. {% if not repo.is_fork %}
  71. <span class="text-muted">
  72. Created by
  73. <a href="{{ url_for('ui_ns.view_user', username=repo.user.user)}}">
  74. {{- repo.user.user -}}
  75. </a>
  76. {{repo.date_created|humanize}}
  77. </span>
  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 not g.repo_starred %}
  85. <a href="#" class="btn btn-sm btn-outline-primary font-weight-bold"
  86. onclick="$('#star_project').submit();">
  87. <i class="fa fa-star-o fa-fw"></i>Star
  88. <form method="POST" name="star_project" id="star_project"
  89. action="{{ url_for(
  90. 'ui_ns.star_project',
  91. repo=repo.name,
  92. username=username,
  93. namespace=repo.namespace,
  94. star=1)}}">
  95. {{ g.forkbuttonform.csrf_token }}
  96. </form>
  97. </a>
  98. <a href="{{url_for(
  99. 'ui_ns.view_stargazers',
  100. repo=repo.name,
  101. username=repo.user.user if repo.is_fork else None,
  102. namespace=repo.namespace,
  103. )}}" class="btn btn-sm btn-primary font-weight-bold">{{ repo.stargazers|length }}</a>
  104. {% else %}
  105. <a href="#" class="btn btn-sm btn-outline-primary font-weight-bold"
  106. onclick="$('#unstar_project').submit();">
  107. <form method="POST" name="unstar_project" id="unstar_project"
  108. action="{{ url_for(
  109. 'ui_ns.star_project',
  110. repo=repo.name,
  111. username=username,
  112. namespace=repo.namespace,
  113. star=0)}}">
  114. {{ g.forkbuttonform.csrf_token }}
  115. </form>
  116. <span class="fa fa-star text-warning"></span> Unstar</a>
  117. <a href="{{url_for(
  118. 'ui_ns.view_stargazers',
  119. repo=repo.name,
  120. username=repo.user.user if repo.is_fork else None,
  121. namespace=repo.namespace,
  122. )}}" class="btn btn-sm btn-primary font-weight-bold">{{repo.stargazers|length}}</a>
  123. {% endif %}
  124. </div>
  125. <div class="btn-group">
  126. <a href="#" title="{{ watch_button_title }}"
  127. class="btn btn-sm dropdown-toggle btn-outline-primary font-weight-bold"
  128. data-toggle="dropdown" id="watch-button">
  129. <i class="fa {{ 'fa-eye-slash' if watch_button_text == 'Watch' else 'fa-eye text-success' }} fa-fw"></i>
  130. <span>{{watch_button_text}}</span>
  131. </a>
  132. <span class="btn btn-sm btn-primary font-weight-bold">{{num_watchers}}</span>
  133. <div class="dropdown-menu dropdown-menu-right watch-menu">
  134. <form method="POST" id="watch_project" name="watch_project"
  135. action="{{ url_for('ui_ns.watch_repo',
  136. repo=repo.name,
  137. user=repo.user.user if repo.is_fork else None,
  138. namespace=repo.namespace,
  139. watch=0) }}">
  140. <a class="dropdown-item pl-2" id="watch_issues_button">
  141. <div class="media">
  142. <div class="align-self-center check-icon pr-2">
  143. <span class="fa fa-fw"></span>
  144. </div>
  145. <div class="media-body">
  146. Watch Issues and PRs
  147. </div>
  148. </div>
  149. </a>
  150. <a class="dropdown-item pl-2" id="watch_commits_button">
  151. <div class="media">
  152. <div class="align-self-center check-icon pr-2">
  153. <span class="fa fa-fw"></span>
  154. </div>
  155. <div class="media-body">
  156. Watch Commits
  157. </div>
  158. </div>
  159. </a>
  160. <a class="dropdown-item pl-2" id="watch_issues_commits_button">
  161. <div class="media">
  162. <div class="align-self-center check-icon pr-2">
  163. <span class="fa fa-fw"></span>
  164. </div>
  165. <div class="media-body">
  166. Watch Issues, PRs, and Commits
  167. </div>
  168. </div>
  169. </a>
  170. <a class="dropdown-item pl-2" id="unwatch_button">
  171. <div class="media">
  172. <div class="align-self-center check-icon pr-2">
  173. <span class="fa fa-fw"></span>
  174. </div>
  175. <div class="media-body">
  176. Unwatch
  177. </div>
  178. </div>
  179. </a>
  180. <a class="dropdown-item pl-2" id="reset_button">
  181. <div class="media">
  182. <div class="align-self-center check-icon pr-2">
  183. <span class="fa fa-fw"></span>
  184. </div>
  185. <div class="media-body">
  186. Reset watch status
  187. </div>
  188. </div>
  189. </a>
  190. {{ g.forkbuttonform.csrf_token }}
  191. </form>
  192. </div>
  193. </div>
  194. <div class="btn-group">
  195. <a href="#"
  196. class="btn btn-sm dropdown-toggle btn-outline-primary font-weight-bold"
  197. data-toggle="dropdown">
  198. <i class="fa fa-users fa-fw"></i>
  199. <span>Members</span>
  200. </a>
  201. {# the +1 here is for the main admin that is not listed in repo.contributors #}
  202. {% set memberstotal = repo.contributors['admin']|length +
  203. repo.contributors['commit']|length +
  204. repo.contributors['ticket']|length +
  205. repo.contributor_groups['admin']|length +
  206. repo.contributor_groups['commit']|length +
  207. repo.contributor_groups['ticket']|length + 1 %}
  208. <span class="btn btn-sm btn-primary font-weight-bold">{{ memberstotal }}</span>
  209. <div class="dropdown-menu dropdown-menu-right" style="width:500px">
  210. <div>
  211. <div class="media p-2">
  212. <img class=" align-self-center mr-3" src="{{ repo.user.default_email | avatar_url }}" width=50px height=50px>
  213. <div class="media-body align-self-center">
  214. <h4 class="my-0 font-weight-bold">
  215. <a href="{{ url_for('ui_ns.view_user', username=repo.user.user)}}">{{ repo.user.user }}</a>
  216. </h4>
  217. {{ repo.user.fullname }}
  218. </div>
  219. <div class="mr-auto align-self-center">main admin</div>
  220. </div>
  221. {% for access in repo.contributors %}
  222. {% for user in repo.contributors[access] %}
  223. <div class="media p-2">
  224. <img class=" align-self-center mr-3" src="{{ user.default_email | avatar_url }}" width=50px height=50px>
  225. <div class="media-body align-self-center">
  226. <h4 class="my-0 font-weight-bold">
  227. <a href="{{ url_for('ui_ns.view_user', username=user.user)}}">{{ user.user }}</a>
  228. </h4>
  229. {{ user.fullname }}
  230. </div>
  231. <div class="mr-auto align-self-center">{{ access }}</div>
  232. </div>
  233. {% endfor %}
  234. {% endfor %}
  235. {% for access in repo.contributor_groups %}
  236. {% for group in repo.contributor_groups[access] %}
  237. <div>
  238. <a href="{{ url_for('ui_ns.view_group', group=group.group_name)}}">
  239. @{{ group.group_name }}
  240. </a>
  241. - {{ access }}
  242. </div>
  243. <div class="media p-2">
  244. <div class="media-body align-self-center">
  245. <h4 class="my-0 font-weight-bold">
  246. <a href="{{ url_for('ui_ns.view_group', group=group.group_name)}}"> @{{ group.group_name }}</a>
  247. </h4>
  248. </div>
  249. <div class="mr-auto align-self-center">{{ access }}</div>
  250. </div>
  251. {% endfor %}
  252. {% endfor %}
  253. </div>
  254. </div>
  255. </div>
  256. {% if last_commits %}
  257. {% set commit = last_commits[0] %}
  258. <div class="alert alert-secondary bg-light d-flex align-items-center font-size-09 py-2 px-2 mt-4">
  259. <div>
  260. <a href="{{ url_for('ui_ns.view_commit',
  261. repo=repo.name,
  262. username=username,
  263. namespace=repo.namespace,
  264. commitid=commit.hex, branch=branchname) }}"
  265. class="notblue">
  266. <code style="font-size: 1em;background: #ddd;" class="py-1 px-2 font-weight-bold">{{ commit.hex|short }}</code>
  267. <span class="font-weight-bold">{{ commit.message.split('\n')[0] }}</span>
  268. </a>
  269. </div>
  270. <div class="ml-auto">
  271. <span><span class="font-weight-bold">{{ commit.author | author2avatar(20) | safe }} {{commit.author.name}}</span> committed {{ commit.commit_time|humanize }}</span>
  272. </div>
  273. </div>
  274. {% endif %}
  275. </div>
  276. </div>
  277. {% if g.repo_obj and g.repo_obj.is_empty and repo.mirrored_from %}
  278. <div class="alert {% if category == 'error' %}alert-warning{% else %}alert-info{%endif%}" role="alert">
  279. <p>This repo is brand new and meant to be mirrored from {{
  280. repo.mirrored_from }} !</p>
  281. <p>Mirrored projects are refreshed regularly, please seat tight, code will
  282. come land soon!</p>
  283. </div>
  284. {% elif g.repo_obj and g.repo_obj.is_empty %}
  285. <div class="alert {% if category == 'error' %}alert-warning{% else %}alert-info{%endif%}" role="alert">
  286. <p>This repo is brand new!</p>
  287. {% if g.authenticated and g.repo_committer %}
  288. <p>If you already have a git repo:</p>
  289. <pre>git remote add origin {{ config.get('GIT_URL_SSH') }}{{ repo.path }}
  290. git push -u origin master</pre>
  291. <p>If you have not created your git repo yet:</p>
  292. <pre>git clone {{ config.get('GIT_URL_SSH') }}{{ repo.path }}
  293. cd {{ repo.name }}
  294. touch README.rst
  295. git add README.rst
  296. git commit -m "Add README file"
  297. git push -u origin master</pre>
  298. {% else %}
  299. <p>The Project Creator has not pushed any code yet</p>
  300. {% endif %}
  301. </div>
  302. {% else %}
  303. {% if readme %}
  304. <section class="readme">
  305. {{ readme | noJS | safe }}
  306. </section>
  307. {% else %}
  308. <section class="no-readme">
  309. <div class="card">
  310. <div class="card-header text-center text-muted pt-2 pb-2">
  311. The {{repo.name}} project's README file is empty or unavailable.
  312. </div>
  313. </div>
  314. </section>
  315. {% endif %}
  316. {% endif %}
  317. </div>
  318. </div>
  319. {% endblock %}
  320. {% block jscripts %}
  321. {{ super() }}
  322. <script type="text/javascript">
  323. $(document).ready(function() {
  324. {% if g.repo_watch_levels %}
  325. var currentWatchStatusButton = $('#watch_{{ g.repo_watch_levels | join('_') }}_button .check-icon span');
  326. {% else %}
  327. var currentWatchStatusButton = $('#unwatch_button .check-icon span');
  328. {% endif %}
  329. currentWatchStatusButton.addClass('fa-check');
  330. $(".watch-menu a").click(function(){
  331. var selectedValue = $(this).attr('id');
  332. var watchProjectForm = $("#watch_project");
  333. var action = watchProjectForm.attr('action');
  334. if (selectedValue === "watch_issues_button") {
  335. action = action.replace('/settings/0', '/settings/1');
  336. } else if (selectedValue === "watch_commits_button") {
  337. action = action.replace('/settings/0', '/settings/2');
  338. } else if (selectedValue === "watch_issues_commits_button") {
  339. action = action.replace('/settings/0', '/settings/3');
  340. } else if (selectedValue === "reset_button") {
  341. action = action.replace('/settings/0', '/settings/-1');
  342. }
  343. watchProjectForm.attr('action', action);
  344. watchProjectForm.submit();
  345. });
  346. });
  347. </script>
  348. {% endblock %}