/templates/webapps/community/repository/view_changelog.mako

https://bitbucket.org/cistrome/cistrome-harvard/ · Mako · 145 lines · 138 code · 7 blank · 0 comment · 7 complexity · 1666985282b39741734b7e99ab5ca4c3 MD5 · raw file

  1. <%inherit file="/base.mako"/>
  2. <%namespace file="/message.mako" import="render_msg" />
  3. <%namespace file="/webapps/community/common/common.mako" import="*" />
  4. <%namespace file="/webapps/community/repository/common.mako" import="render_clone_str" />
  5. <%
  6. from galaxy.web.framework.helpers import time_ago
  7. is_admin = trans.user_is_admin()
  8. is_new = repository.is_new
  9. can_contact_owner = trans.user and trans.user != repository.user
  10. can_browse_contents = not is_new
  11. can_manage = is_admin or trans.user == repository.user
  12. can_push = trans.app.security_agent.can_push( trans.user, repository )
  13. can_rate = trans.user and repository.user != trans.user
  14. can_upload = can_push
  15. can_download = not is_new and ( not is_malicious or can_push )
  16. if can_push:
  17. browse_label = 'Browse or delete repository files'
  18. else:
  19. browse_label = 'Browse repository files'
  20. %>
  21. <%!
  22. def inherit(context):
  23. if context.get('use_panels'):
  24. return '/webapps/community/base_panels.mako'
  25. else:
  26. return '/base.mako'
  27. %>
  28. <%inherit file="${inherit(context)}"/>
  29. <%def name="stylesheets()">
  30. ${parent.stylesheets()}
  31. ${h.css( "library" )}
  32. </%def>
  33. <%def name="javascripts()">
  34. ${parent.javascripts()}
  35. ${h.js( "jquery.rating" )}
  36. </%def>
  37. <br/><br/>
  38. <ul class="manage-table-actions">
  39. <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li>
  40. <div popupmenu="repository-${repository.id}-popup">
  41. %if can_upload:
  42. <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp='community' )}">Upload files to repository</a>
  43. %endif
  44. %if can_manage:
  45. <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">Manage repository</a>
  46. %else:
  47. <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View repository</a>
  48. %endif
  49. %if can_rate:
  50. <a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a>
  51. %endif
  52. %if can_browse_contents:
  53. <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
  54. %endif
  55. %if can_contact_owner:
  56. <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ), webapp='community' )}">Contact repository owner</a>
  57. %endif
  58. %if can_download:
  59. <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='gz' )}">Download as a .tar.gz file</a>
  60. <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='bz2' )}">Download as a .tar.bz2 file</a>
  61. <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='zip' )}">Download as a zip file</a>
  62. %endif
  63. </div>
  64. </ul>
  65. %if message:
  66. ${render_msg( message, status )}
  67. %endif
  68. %if can_download:
  69. <div class="toolForm">
  70. <div class="toolFormTitle">${repository.name}</div>
  71. <div class="toolFormBody">
  72. <div class="form-row">
  73. <label>Clone this repository:</label>
  74. ${render_clone_str( repository )}
  75. </div>
  76. </div>
  77. </div>
  78. <p/>
  79. %endif
  80. <div class="toolForm">
  81. <%
  82. if can_download:
  83. title_str = 'Changesets'
  84. else:
  85. title_str = '%s changesets' % repository.name
  86. %>
  87. <div class="toolFormTitle">${title_str}</div>
  88. <% test_date = None %>
  89. <div class="toolFormBody">
  90. <table class="grid">
  91. %for changeset in changesets:
  92. <%
  93. ctx_str = str( changeset[ 'ctx' ] )
  94. ctx_parent = str( changeset[ 'parent' ] )
  95. ctx_parent_rev = changeset[ 'parent' ].rev()
  96. test_date = changeset[ 'display_date' ]
  97. changeset_str = "%s:%s" % ( changeset[ 'rev' ], ctx_str )
  98. if ctx_parent_rev < 0:
  99. ctx_parent_str = 'None'
  100. else:
  101. ctx_parent_str = "%s:%s" % ( ctx_parent_rev, ctx_parent )
  102. %>
  103. <% display_date = changeset[ 'display_date' ] %>
  104. %if test_date != display_date:
  105. <tr colspan="2"><td bgcolor="#D8D8D8">${display_date}</td></tr>
  106. %endif
  107. <tr>
  108. <td>
  109. <div class="form-row">
  110. <label>Description:</label>
  111. <a href="${h.url_for( controller='repository', action='view_changeset', id=trans.security.encode_id( repository.id ), ctx_str=ctx_str )}">${changeset[ 'description' ]}</a>
  112. </div>
  113. <div class="form-row">
  114. <label>Commit:</label>
  115. <a href="${h.url_for( controller='repository', action='view_changeset', id=trans.security.encode_id( repository.id ), ctx_str=ctx_str )}">${changeset_str}</a>
  116. </div>
  117. <div class="form-row">
  118. <label>Parent:</label>
  119. %if ctx_parent_str == 'None':
  120. ${ctx_parent_str}
  121. %else:
  122. <a href="${h.url_for( controller='repository', action='view_changeset', id=trans.security.encode_id( repository.id ), ctx_str=ctx_parent )}">${ctx_parent_str}</a>
  123. %endif
  124. </div>
  125. <div class="form-row">
  126. <label>Commited by:</label>
  127. ${changeset[ 'user' ].split()[0]}
  128. </div>
  129. <div class="form-row">
  130. <label>Pushed:</label>
  131. ${time_ago( changeset[ 'date' ] )}
  132. </div>
  133. </td>
  134. </tr>
  135. %endfor
  136. </table>
  137. </div>
  138. </div>