##// END OF EJS Templates
gists: allow copy content to clipboard
marcink -
r2121:93ba9e95 default
parent child Browse files
Show More
@@ -1,110 +1,112 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.mako"/>
2 <%inherit file="/base/base.mako"/>
3
3
4 <%def name="robots()">
4 <%def name="robots()">
5 %if c.gist.gist_type != 'public':
5 %if c.gist.gist_type != 'public':
6 <meta name="robots" content="noindex, nofollow">
6 <meta name="robots" content="noindex, nofollow">
7 %else:
7 %else:
8 ${parent.robots()}
8 ${parent.robots()}
9 %endif
9 %endif
10 </%def>
10 </%def>
11
11
12 <%def name="title()">
12 <%def name="title()">
13 ${_('Gist')} &middot; ${c.gist.gist_access_id}
13 ${_('Gist')} &middot; ${c.gist.gist_access_id}
14 %if c.rhodecode_name:
14 %if c.rhodecode_name:
15 &middot; ${h.branding(c.rhodecode_name)}
15 &middot; ${h.branding(c.rhodecode_name)}
16 %endif
16 %endif
17 </%def>
17 </%def>
18
18
19 <%def name="breadcrumbs_links()">
19 <%def name="breadcrumbs_links()">
20 ${_('Gist')} &middot; ${c.gist.gist_access_id}
20 ${_('Gist')} &middot; ${c.gist.gist_access_id}
21 </%def>
21 </%def>
22
22
23 <%def name="menu_bar_nav()">
23 <%def name="menu_bar_nav()">
24 ${self.menu_items(active='gists')}
24 ${self.menu_items(active='gists')}
25 </%def>
25 </%def>
26
26
27 <%def name="main()">
27 <%def name="main()">
28 <div class="box">
28 <div class="box">
29 <!-- box / title -->
29 <!-- box / title -->
30 <div class="title">
30 <div class="title">
31 ${self.breadcrumbs()}
31 ${self.breadcrumbs()}
32 %if c.rhodecode_user.username != h.DEFAULT_USER:
32 %if c.rhodecode_user.username != h.DEFAULT_USER:
33 <ul class="links">
33 <ul class="links">
34 <li>
34 <li>
35 <a href="${h.route_path('gists_new')}" class="btn btn-primary">${_(u'Create New Gist')}</a>
35 <a href="${h.route_path('gists_new')}" class="btn btn-primary">${_(u'Create New Gist')}</a>
36 </li>
36 </li>
37 </ul>
37 </ul>
38 %endif
38 %endif
39 </div>
39 </div>
40 <code>${c.gist.gist_url()}</code>
40 <code>${c.gist.gist_url()}</code>
41 <div class="table">
41 <div class="table">
42 <div id="files_data">
42 <div id="files_data">
43 <div id="codeblock" class="codeblock">
43 <div id="codeblock" class="codeblock">
44 <div class="code-header">
44 <div class="code-header">
45 <div class="stats">
45 <div class="stats">
46 %if h.HasPermissionAny('hg.admin')() or c.gist.gist_owner == c.rhodecode_user.user_id:
46 %if h.HasPermissionAny('hg.admin')() or c.gist.gist_owner == c.rhodecode_user.user_id:
47 <div class="remove_gist">
47 <div class="remove_gist">
48 ${h.secure_form(h.route_path('gist_delete', gist_id=c.gist.gist_access_id), request=request)}
48 ${h.secure_form(h.route_path('gist_delete', gist_id=c.gist.gist_access_id), request=request)}
49 ${h.submit('remove_gist', _('Delete'),class_="btn btn-mini btn-danger",onclick="return confirm('"+_('Confirm to delete this Gist')+"');")}
49 ${h.submit('remove_gist', _('Delete'),class_="btn btn-mini btn-danger",onclick="return confirm('"+_('Confirm to delete this Gist')+"');")}
50 ${h.end_form()}
50 ${h.end_form()}
51 </div>
51 </div>
52 %endif
52 %endif
53 <div class="buttons">
53 <div class="buttons">
54 ## only owner should see that
54 ## only owner should see that
55 <a href="#copySource" onclick="return false;" class="btn btn-mini icon-clipboard clipboard-action" data-clipboard-text="${c.files[0].content}">${_('Copy Content')}</a>
56
55 %if h.HasPermissionAny('hg.admin')() or c.gist.gist_owner == c.rhodecode_user.user_id:
57 %if h.HasPermissionAny('hg.admin')() or c.gist.gist_owner == c.rhodecode_user.user_id:
56 ${h.link_to(_('Edit'), h.route_path('gist_edit', gist_id=c.gist.gist_access_id), class_="btn btn-mini")}
58 ${h.link_to(_('Edit'), h.route_path('gist_edit', gist_id=c.gist.gist_access_id), class_="btn btn-mini")}
57 %endif
59 %endif
58 ${h.link_to(_('Show as Raw'), h.route_path('gist_show_formatted', gist_id=c.gist.gist_access_id, revision='tip', format='raw'), class_="btn btn-mini")}
60 ${h.link_to(_('Show as Raw'), h.route_path('gist_show_formatted', gist_id=c.gist.gist_access_id, revision='tip', format='raw'), class_="btn btn-mini")}
59 </div>
61 </div>
60 <div class="left" >
62 <div class="left" >
61 %if c.gist.gist_type != 'public':
63 %if c.gist.gist_type != 'public':
62 <span class="tag tag-ok disabled">${_('Private Gist')}</span>
64 <span class="tag tag-ok disabled">${_('Private Gist')}</span>
63 %endif
65 %endif
64 <span> ${c.gist.gist_description}</span>
66 <span> ${c.gist.gist_description}</span>
65 <span>${_('Expires')}:
67 <span>${_('Expires')}:
66 %if c.gist.gist_expires == -1:
68 %if c.gist.gist_expires == -1:
67 ${_('never')}
69 ${_('never')}
68 %else:
70 %else:
69 ${h.age_component(h.time_to_utcdatetime(c.gist.gist_expires))}
71 ${h.age_component(h.time_to_utcdatetime(c.gist.gist_expires))}
70 %endif
72 %endif
71 </span>
73 </span>
72 </div>
74 </div>
73 </div>
75 </div>
74
76
75 <div class="author">
77 <div class="author">
76 <div title="${h.tooltip(c.file_last_commit.author)}">
78 <div title="${h.tooltip(c.file_last_commit.author)}">
77 ${self.gravatar_with_user(c.file_last_commit.author, 16)} - ${_('created')} ${h.age_component(c.file_last_commit.date)}
79 ${self.gravatar_with_user(c.file_last_commit.author, 16)} - ${_('created')} ${h.age_component(c.file_last_commit.date)}
78 </div>
80 </div>
79
81
80 </div>
82 </div>
81 <div class="commit">${h.urlify_commit_message(c.file_last_commit.message, None)}</div>
83 <div class="commit">${h.urlify_commit_message(c.file_last_commit.message, None)}</div>
82 </div>
84 </div>
83
85
84 ## iterate over the files
86 ## iterate over the files
85 % for file in c.files:
87 % for file in c.files:
86 <% renderer = c.render and h.renderer_from_filename(file.path, exclude=['.txt', '.TXT'])%>
88 <% renderer = c.render and h.renderer_from_filename(file.path, exclude=['.txt', '.TXT'])%>
87 <!--
89 <!--
88 <div id="${h.FID('G', file.path)}" class="stats" >
90 <div id="${h.FID('G', file.path)}" class="stats" >
89 <a href="${c.gist.gist_url()}">¶</a>
91 <a href="${c.gist.gist_url()}">¶</a>
90 <b >${file.path}</b>
92 <b >${file.path}</b>
91 <div>
93 <div>
92 ${h.link_to(_('Show as raw'), h.route_path('gist_show_formatted_path', gist_id=c.gist.gist_access_id, revision=file.commit.raw_id, format='raw', f_path=file.path), class_="btn btn-mini")}
94 ${h.link_to(_('Show as raw'), h.route_path('gist_show_formatted_path', gist_id=c.gist.gist_access_id, revision=file.commit.raw_id, format='raw', f_path=file.path), class_="btn btn-mini")}
93 </div>
95 </div>
94 </div>
96 </div>
95 -->
97 -->
96 <div class="code-body textarea text-area editor">
98 <div class="code-body textarea text-area editor">
97 %if renderer:
99 %if renderer:
98 ${h.render(file.content, renderer=renderer)}
100 ${h.render(file.content, renderer=renderer)}
99 %else:
101 %else:
100 ${h.pygmentize(file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")}
102 ${h.pygmentize(file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")}
101 %endif
103 %endif
102 </div>
104 </div>
103 %endfor
105 %endfor
104 </div>
106 </div>
105 </div>
107 </div>
106 </div>
108 </div>
107
109
108
110
109 </div>
111 </div>
110 </%def>
112 </%def>
General Comments 0
You need to be logged in to leave comments. Login now