PageRenderTime 17ms CodeModel.GetById 13ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 1ms

/templates/webapps/community/repository/view_changeset.mako

https://bitbucket.org/cistrome/cistrome-harvard/
Mako | 192 lines | 185 code | 7 blank | 0 comment | 7 complexity | ba1e853edecc890b172bc63e074bd792 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_rate = trans.user and repository.user != trans.user
 13    can_manage = is_admin or trans.user == repository.user
 14    can_push = trans.app.security_agent.can_push( trans.user, repository )
 15    can_view_change_log = not is_new
 16    can_upload = can_push
 17    can_download = not is_new and ( not is_malicious or can_push )
 18    if can_push:
 19        browse_label = 'Browse or delete repository files'
 20    else:
 21        browse_label = 'Browse repository files'
 22%>
 23
 24<%!
 25   def inherit(context):
 26       if context.get('use_panels'):
 27           return '/webapps/community/base_panels.mako'
 28       else:
 29           return '/base.mako'
 30%>
 31<%inherit file="${inherit(context)}"/>
 32
 33<%def name="stylesheets()">
 34    ${parent.stylesheets()}
 35    ${h.css( "library" )}
 36</%def>
 37
 38<%def name="javascripts()">
 39    ${parent.javascripts()}
 40    ${h.js( "jquery.rating" )}
 41</%def>
 42
 43<br/><br/>
 44<ul class="manage-table-actions">
 45    <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li>
 46    <div popupmenu="repository-${repository.id}-popup">
 47        %if can_upload:
 48            <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>
 49        %endif
 50        %if can_manage:
 51            <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>
 52        %else:
 53            <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>
 54        %endif
 55        %if can_view_change_log:
 56            <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a>
 57        %endif
 58        %if can_rate:
 59            <a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a>
 60        %endif
 61        %if can_browse_contents:
 62            <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
 63        %endif
 64        %if can_contact_owner:
 65            <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>
 66        %endif
 67        %if can_download:
 68            <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>
 69            <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>
 70            <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>
 71        %endif
 72    </div>
 73</ul>
 74
 75%if message:
 76    ${render_msg( message, status )}
 77%endif
 78
 79%if can_download:
 80    <div class="toolForm">
 81        <div class="toolFormTitle">${repository.name}</div>
 82        <div class="toolFormBody">
 83            <div class="form-row">
 84                <label>Clone this repository:</label>
 85                ${render_clone_str( repository )}
 86            </div>
 87        </div>
 88    </div>
 89    <p/>
 90%endif
 91<div class="toolForm">
 92    <%
 93        if can_download:
 94            title_str = 'Changeset %s' % ctx
 95        else:
 96            title_str = '%s changeset %s' % ( repository.name, ctx )
 97    %>
 98    <div class="toolFormTitle">${title_str}</div>
 99    <div class="toolFormBody">
100        <table class="grid">
101            %if modified:
102                <tr>
103                    <td>
104                        <b>modified:</b>
105                        %for item in modified:
106                            <br/><a href="#${item}">${item}</a>
107                        %endfor
108                    </td>
109                </tr>
110            %endif
111            %if added:
112                <tr>
113                    <td>
114                        <b>added:</b>
115                        %for item in added:
116                            <br/><a href="#${item}">${item}</a>
117                        %endfor
118                    </td>
119                </tr>
120            %endif
121            %if removed:
122                <tr>
123                    <td>
124                        <b>removed:</b>
125                        %for item in removed:
126                            <br/><a href="#${item}">${item}</a>
127                        %endfor
128                    </td>
129                </tr>
130            %endif
131            %if deleted:
132                <tr>
133                    <td>
134                        <b>deleted:</b>
135                        %for item in deleted:
136                            <br/><a href="#${item}">${item}</a>
137                        %endfor
138                    </td>
139                </tr>
140            %endif
141            %if unknown:
142                <tr>
143                    <td>
144                        <b>unknown:</b>
145                        %for item in unknown:
146                            <br/><a href="#${item}">${item}</a>
147                        %endfor
148                    }</td>
149                </tr>
150            %endif
151            %if ignored:
152                <tr>
153                    <td>
154                        <b>ignored:</b>
155                        %for item in ignored:
156                            <br/><a href="#${item}">${item}</a>
157                        %endfor
158                    </td>
159                </tr>
160            %endif
161            %if clean:
162                <tr>
163                    <td>
164                        clean:
165                        %for item in clean:
166                            <br/><a href="#${item}">${item}</a>
167                        %endfor
168                    </td>
169                </tr>
170            %endif
171            %for diff in diffs:
172                <%
173                    # Read at most the first 10 lines of diff to determine the anchor
174                    ctr = 0
175                    lines = diff.split( '\n' )
176                    diff = diff.replace( '\n', '<br/>' )
177                    anchor_str = ''
178                    for line in lines:
179                        if ctr > 9:
180                            break
181                        for anchor in anchors:
182                            if line.find( anchor ) >= 0:
183                                anchor_str = '<a name="%s">%s</a>' % ( anchor, anchor )
184                                break
185                        ctr += 1
186                %>
187                <tr><td bgcolor="#E0E0E0">${anchor_str}</td></tr>
188                <tr><td>${diff}</td></tr>
189            %endfor
190        </table>
191    </div>
192</div>