viewPackage.html.twig 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. {% extends "PackagistWebBundle::layout.html.twig" %}
  2. {% set showSearchDesc = 'hide' %}
  3. {% block title %}{{ package.name }} - {{ parent() }}{% endblock %}
  4. {% block head_feeds %}
  5. <link rel="alternate" type="application/rss+xml" title="New Releases - {{ package.name }}" href="{{ url('feed_package', {package: package.name, _format: 'rss'}) }}" />
  6. <link rel="alternate" type="application/rss+xml" title="New Releases - {{ package.vendor }}" href="{{ url('feed_vendor', {vendor: package.vendor, _format: 'rss'}) }}" />
  7. {{ parent() }}
  8. {% endblock %}
  9. {% block scripts %}
  10. <script src="{{ asset('bundles/packagistweb/js/view.js')}}"></script>
  11. {% endblock %}
  12. {% block description -%}
  13. {{ package.description }}
  14. {%- endblock %}
  15. {% set hasActions = is_granted('ROLE_EDIT_PACKAGES') or is_granted('ROLE_EDIT_PACKAGES') or package.maintainers.contains(app.user) %}
  16. {% block content %}
  17. <div class="row">
  18. <div class="col-xs-12 package"{% if app.user and package.crawledAt is null and (is_granted('ROLE_EDIT_PACKAGES') or package.maintainers.contains(app.user)) %} data-force-crawl="true"{% endif %}>
  19. <div class="package-header">
  20. <div class="row">
  21. <div class="col-md-9">
  22. <h2 class="title">
  23. {% if is_favorite is defined %}
  24. <i class="mark-favorite glyphicon glyphicon-star {% if is_favorite %}is-starred{% endif %}" data-remove-url="{{ path('user_remove_fav', {name: app.user.username, package: package.name}) }}" data-add-url="{{ path('user_add_fav', {name: app.user.username}) }}" data-package="{{ package.name }}"></i>
  25. {% endif %}
  26. <a href="{{ path("view_vendor", {"vendor": package.vendor}) }}">{{ package.vendor }}/</a>{{ package.packageName }}
  27. </h2>
  28. </div>
  29. </div>
  30. </div>
  31. <div class="row">
  32. <div class="col-md-8">
  33. <p class="requireme"><i class="glyphicon glyphicon-save"></i> <input type="text" readonly="readonly" value="composer require {{ "#{package.vendor}/#{package.packageName}" }}" /></p>
  34. {% if not package.autoUpdated and app.user and (package.maintainers.contains(app.user) or is_granted('ROLE_UPDATE_PACKAGES')) %}
  35. {% if "github.com" in package.repository %}
  36. <div class="alert alert-danger">This package is not auto-updated. Please set up the <a href="{{ path('fos_user_profile_show') }}">GitHub Service Hook</a> for Packagist so that it gets updated whenever you push!</div>
  37. {% elseif "bitbucket.org" in package.repository %}
  38. <div class="alert alert-danger">This package is not auto-updated. Please set up the <a href="{{ path('fos_user_profile_show') }}">BitBucket POST Service</a> for Packagist so that it gets updated whenever you push!</div>
  39. {% endif %}
  40. {% endif %}
  41. {% if package.abandoned %}
  42. <div class="alert alert-danger">
  43. This package is <strong>abandoned</strong> and no longer maintained.
  44. {% if package.replacementPackage is not empty %}
  45. The author suggests using the <a href="{{ path('view_package', {name: package.replacementPackage}) }}">{{ package.replacementPackage }}</a> package instead.
  46. {% else %}
  47. No replacement package was suggested.
  48. {% if (is_granted('ROLE_EDIT_PACKAGES') or package.maintainers.contains(app.user)) %}
  49. <a href="{{ path('abandon_package', {name: package.name}) }}">Suggest a replacement.</a>
  50. {% endif %}
  51. {% endif %}
  52. </div>
  53. {% endif %}
  54. {% if package.updateFailureNotified
  55. and app.user and (package.maintainers.contains(app.user) or is_granted('ROLE_UPDATE_PACKAGES'))
  56. %}
  57. <div class="alert alert-danger">This package is in a broken state and will not update anymore. Some branches contain invalid data and until you fix them the entire package is frozen. Click "Force Update" above to see details.</div>
  58. {% endif %}
  59. {% if expandedVersion and not expandedVersion.license %}
  60. <div class="alert alert-danger">There is no license information available for the current version ({{ expandedVersion.version }}) of this package. Please contact the maintainer for more information.</div>
  61. {% endif %}
  62. <p class="description">{{ package.description }}</p>
  63. {% if hasActions %}
  64. <div class="btn-group btn-group-xs">
  65. {% if (is_granted('ROLE_EDIT_PACKAGES') or package.maintainers.contains(app.user)) and not package.abandoned %}
  66. <form class="action abandon" action="{{ path('abandon_package', {name: package.name}) }}">
  67. <input class="btn btn-warning" type="submit" value="Abandon" />
  68. </form>
  69. {% endif %}
  70. {% if (is_granted('ROLE_EDIT_PACKAGES') or package.maintainers.contains(app.user)) and package.abandoned %}
  71. <form class="action un-abandon" action="{{ path('unabandon_package', {name: package.name}) }}">
  72. <input class="btn btn-default" type="submit" value="Un-abandon" />
  73. </form>
  74. {% endif %}
  75. {% if deleteForm is defined %}
  76. <form class="delete action" action="{{ path('delete_package', {name: package.name}) }}" method="DELETE">
  77. {{ form_widget(deleteForm._token) }}
  78. <input class="btn btn-danger" type="submit" value="Delete" />
  79. </form>
  80. {% endif %}
  81. {% if is_granted('ROLE_UPDATE_PACKAGES') or package.maintainers.contains(app.user) %}
  82. <form class="force-update action" action="{{ path('update_package', {name: package.name}) }}" method="PUT">
  83. <input type="hidden" name="update" value="1" />
  84. <input class="btn btn-success" type="submit" value="Update" />
  85. </form>
  86. {% endif %}
  87. {% if is_granted('ROLE_EDIT_PACKAGES') or package.maintainers.contains(app.user) %}
  88. <form class="action" action="{{ path("edit_package", {name: package.name}) }}">
  89. <input class="btn btn-primary" type="submit" value="Edit" />
  90. </form>
  91. {% endif %}
  92. </div>
  93. {% endif %}
  94. </div>
  95. <div class="col-md-offset-1 col-md-3">
  96. <div class="row package-aside">
  97. <div class="details col-xs-12 col-sm-6 col-md-12">
  98. <p class="maintainers">
  99. {% for maintainer in package.maintainers -%}
  100. <a href="{{ path('user_profile', {'name': maintainer.username}) }}"><img width="48" height="48" title="{{ maintainer.username }}" src="//www.gravatar.com/avatar/{{ maintainer.email|gravatar_hash }}?s=48&amp;d=identicon"></a>
  101. {% endfor %}
  102. {% if addMaintainerForm is defined or removeMaintainerForm is defined %}
  103. {% if addMaintainerForm is defined %}<a id="add-maintainer" href="{{ path('add_maintainer', {'name': package.name}) }}"><i class="glyphicon glyphicon-plus"></i></a>{% endif %}
  104. {% if removeMaintainerForm is defined %}<a id="remove-maintainer" href="{{ path('remove_maintainer', {'name': package.name}) }}"><i class="glyphicon glyphicon-remove"></i></a>{% endif %}
  105. {% endif %}
  106. </p>
  107. {% set repoUrl = package.repository|replace({'git://github.com/': 'https://github.com/', 'git@github.com:': 'https://github.com/'}) %}
  108. <p class="canonical">
  109. <a href="{{ repoUrl }}" title="Canonical Repository URL">{{ repoUrl|replace({'https://':'', 'http://':''}) }}</a>
  110. </p>
  111. {% if version and version.homepage %}
  112. <p><a href="{{ version.homepage }}">Homepage</a></p>
  113. {% endif %}
  114. {% if version.support.source is defined %}
  115. <p><a href="{{ version.support.source }}">Source</a></p>
  116. {% endif %}
  117. {% if version and version.support.issues is defined %}
  118. <p><a href="{{ version.support.issues }}">Issues</a></p>
  119. {% endif %}
  120. {% if version and version.support.irc is defined %}
  121. <p><a href="{{ version.support.irc }}">IRC</a></p>
  122. {% endif %}
  123. {% if version and version.support.forum is defined %}
  124. <p><a href="{{ version.support.forum }}">Forum</a></p>
  125. {% endif %}
  126. {% if version and version.support.wiki is defined %}
  127. <p><a href="{{ version.support.wiki }}">Wiki</a></p>
  128. {% endif %}
  129. {% if version and version.support.docs is defined %}
  130. <p><a href="{{ version.support.docs }}">Documentation</a></p>
  131. {% endif %}
  132. </div>
  133. <div class="facts col-xs-12 col-sm-6 col-md-12">
  134. <p><span><a href="{{ path('view_package_stats', {name: package.name}) }}" rel="nofollow">Installs</a>:</span> {% if downloads.total is defined %}{{ downloads.total|number_format(0, '.', '&#8201;')|raw }}{% else %}N/A{% endif %}</p>
  135. {% if dependents is defined %}<p><span><a href="{{ path('view_package_dependents', {name: package.name}) }}" rel="nofollow">Dependents</a>:</span> {{ dependents|number_format(0, '.', '&#8201;')|raw }}</p>{% endif %}
  136. {% if package.gitHubStars is not null %}<p><span>Stars:</span> {{ package.gitHubStars|number_format(0, '.', '&#8201;')|raw }}</p>{% endif %}
  137. {% if package.gitHubWatches is not null %}<p><span>Watchers:</span> {{ package.gitHubWatches|number_format(0, '.', '&#8201;')|raw }}</p>{% endif %}
  138. {% if package.gitHubForks is not null %}<p><span>Forks:</span> {{ package.gitHubForks|number_format(0, '.', '&#8201;')|raw }}</p>{% endif %}
  139. {% if package.gitHubOpenIssues is not null %}<p><span>Open Issues:</span> {{ package.gitHubOpenIssues|number_format(0, '.', '&#8201;')|raw }}</p>{% endif %}
  140. {% if package.language is not empty %}<p><span>Language:</span> {{ package.language }}</p>{% endif %}
  141. </div>
  142. </div>
  143. </div>
  144. </div>
  145. {% if addMaintainerForm is defined or removeMaintainerForm is defined %}
  146. <div class="row">
  147. {% if addMaintainerForm is defined %}
  148. <form id="add-maintainer-form" class="col-sm-6 col-md-3 col-md-offset-9 {{ show_add_maintainer_form|default(false) ? '': 'hidden' }}" action="{{ path('add_maintainer', {'name': package.name}) }}" method="POST" {{ form_enctype(addMaintainerForm) }}>
  149. <div>
  150. <h4>Add Maintainer</h4>
  151. <p>
  152. {{ form_label(addMaintainerForm.user, "Username") }}
  153. {{ form_errors(addMaintainerForm.user) }}
  154. {{ form_widget(addMaintainerForm.user) }}
  155. </p>
  156. {{ form_rest(addMaintainerForm) }}
  157. <input class="btn btn-block btn-success btn-lg" type="submit" value="Add Maintainer" />
  158. </div>
  159. </form>
  160. {% endif %}
  161. {% if removeMaintainerForm is defined %}
  162. <form id="remove-maintainer-form" class="col-sm-6 col-md-3 col-md-offset-9 {{ show_remove_maintainer_form|default(false) ? '': 'hidden' }}" action="{{ path('remove_maintainer', {'name': package.name}) }}" method="POST" {{ form_enctype(removeMaintainerForm) }}>
  163. <div>
  164. <h4>Remove Maintainer</h4>
  165. <p>
  166. {{ form_label(removeMaintainerForm.user, "Username") }}
  167. {{ form_errors(removeMaintainerForm.user) }}
  168. {{ form_widget(removeMaintainerForm.user) }}
  169. </p>
  170. {{ form_rest(removeMaintainerForm) }}
  171. <input class="btn btn-block btn-danger btn-lg" type="submit" value="Remove Maintainer" />
  172. </div>
  173. </form>
  174. {% endif %}
  175. </div>
  176. {% endif %}
  177. {% if versions|length %}
  178. <div class="row versions-section">
  179. <div class="version-details col-md-9">
  180. {% if expandedVersion %}
  181. {% include 'PackagistWebBundle:Package:versionDetails.html.twig' with {version: expandedVersion} %}
  182. {% endif %}
  183. </div>
  184. {% include 'PackagistWebBundle:Package:versionList.html.twig' with {versions: versions, expandedId: expandedVersion.id, deleteVersionCsrfToken: deleteVersionCsrfToken|default(null)} %}
  185. {% elseif package.crawledAt is null %}
  186. <p class="col-xs-12">This package has not been crawled yet, some information is missing.</p>
  187. {% else %}
  188. <p class="col-xs-12">This package has no released version yet, and little information is available.</p>
  189. {% endif %}
  190. </div>
  191. {% if package.readme != null %}
  192. <hr class="clearfix">
  193. <div class="readme">
  194. <h1>README</h1>
  195. {{ package.readme|raw }}
  196. </div>
  197. <div class="hidden readme-expander">
  198. <i class="glyphicon glyphicon-chevron-down"></i>
  199. </div>
  200. {% endif %}
  201. </div>
  202. {% endblock %}