PageRenderTime 24ms CodeModel.GetById 14ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

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