PageRenderTime 182ms CodeModel.GetById 80ms app.highlight 1ms RepoModel.GetById 100ms app.codeStats 0ms

/kai/templates/pasties/show.mako

https://bitbucket.org/bbangert/kai/
Mako | 56 lines | 52 code | 4 blank | 0 comment | 8 complexity | a765e031157669757c5cc04a75502dd0 MD5 | raw file
 1<%!
 2from kai.lib.highlight import langdict
 3%>
 4% if c.paste.old_poster or not c.paste.email:
 5${widgets.user_post(c.paste.old_poster, 'anonymous', c.paste.created, extra_classes='header')}
 6% else:
 7${widgets.user_post(h.link_to(c.paste.displayname, 
 8                              url=url('pasties_author', author=c.paste.displayname)), 
 9                    c.paste.email, c.paste.created, extra_classes='header')}
10% endif
11<h1>${c.paste.title}</h1>
12% if c.is_owner or (c.user and c.user.in_group('admin')):
13<div class="traceback_delete">${h.link_to('Delete', id_='delete_paste')}</div>
14% endif
15<div class="language">Language: <span style="lang">${langdict[c.paste.language]}</span></div>
16
17<div class="tags">Tags: <span style="taglist">\
18% for tag in c.paste.tags:
19    <a href="${url('pasties_tag', tag=tag.strip())}">${tag}</a>\
20% endfor
21</span></div>
22
23<div class="tablestop">
24${h.code_highlight(c.paste) |n}
25</div>
26
27<p class="subtle">${h.link_to('Download', url=url('download_paste', id=c.paste.old_id or c.paste.id))}</p>
28
29${widgets.show_comments(c.paste.id)}
30<%namespace name="widgets" file="/widgets.mako"/>
31<%def name="title()">${parent.title()} - ${_('View Paste: %s' % c.paste.title)}</%def>
32<%def name="javascript()">
33${parent.javascript()}
34% if c.is_owner:
35<script>
36$(document).ready(function() {
37    $('#delete_paste').click(function() {
38        var answer = window.confirm("Are you sure you want to delete this paste?");
39        if (answer) {
40            $.ajax({
41                data: {"_method":"DELETE"},
42                type: "POST",
43                url: location.pathname,
44                success: function(data, textStatus) {
45                    window.location = '/pasties';
46                }
47            });
48        }
49        return false;
50    });
51    ${widgets.comment_js(c.paste.id)}
52});
53</script>
54% endif
55</%def>
56<%inherit file="layout.mako" />