##// END OF EJS Templates
Added show as raw into gist
marcink -
r3867:73f7149f beta
parent child Browse files
Show More
@@ -381,7 +381,7 b' def make_map(config):'
381 381 action="edit", conditions=dict(method=["GET"]))
382 382 m.connect("notification", "/notification/{notification_id}",
383 383 action="show", conditions=dict(method=["GET"]))
384 m.connect("formatted_notification", "/notifications/{notification_id}.{format}",
384 m.connect("formatted_notification", "/notification/{notification_id}.{format}",
385 385 action="show", conditions=dict(method=["GET"]))
386 386
387 387 #ADMIN GIST
@@ -391,11 +391,11 b' def make_map(config):'
391 391 action="create", conditions=dict(method=["POST"]))
392 392 m.connect("gists", "/gists",
393 393 action="index", conditions=dict(method=["GET"]))
394 m.connect("formatted_gists", "/gists.{format}",
394 m.connect("formatted_gists", "/gists/{format}",
395 395 action="index", conditions=dict(method=["GET"]))
396 396 m.connect("new_gist", "/gists/new",
397 397 action="new", conditions=dict(method=["GET"]))
398 m.connect("formatted_new_gist", "/gists/new.{format}",
398 m.connect("formatted_new_gist", "/gists/new/{format}",
399 399 action="new", conditions=dict(method=["GET"]))
400 400 m.connect("/gist/{gist_id}",
401 401 action="update", conditions=dict(method=["PUT"]))
@@ -404,11 +404,13 b' def make_map(config):'
404 404 m.connect("edit_gist", "/gist/{gist_id}/edit",
405 405 action="edit", conditions=dict(method=["GET"]))
406 406 m.connect("formatted_edit_gist",
407 "/gist/{gist_id}.{format}/edit",
407 "/gist/{gist_id}/{format}/edit",
408 408 action="edit", conditions=dict(method=["GET"]))
409 409 m.connect("gist", "/gist/{gist_id}",
410 410 action="show", conditions=dict(method=["GET"]))
411 m.connect("formatted_gist", "/gists/{gist_id}.{format}",
411 m.connect("formatted_gist", "/gist/{gist_id}/{format}",
412 action="show", conditions=dict(method=["GET"]))
413 m.connect("formatted_gist_file", "/gist/{gist_id}/{format}/{revision}/{f_path:.*}",
412 414 action="show", conditions=dict(method=["GET"]))
413 415
414 416 #ADMIN MAIN PAGES
@@ -28,7 +28,7 b' import traceback'
28 28 import formencode
29 29 from formencode import htmlfill
30 30
31 from pylons import request, tmpl_context as c, url
31 from pylons import request, response, tmpl_context as c, url
32 32 from pylons.controllers.util import abort, redirect
33 33 from pylons.i18n.translation import _
34 34
@@ -169,7 +169,7 b' class GistsController(BaseController):'
169 169 return redirect(url('gists'))
170 170
171 171 @LoginRequired()
172 def show(self, gist_id, format='html'):
172 def show(self, gist_id, format='html', revision='tip', f_path=None):
173 173 """GET /admin/gists/gist_id: Show a specific item"""
174 174 # url('gist', gist_id=ID)
175 175 c.gist = Gist.get_or_404(gist_id)
@@ -185,7 +185,10 b' class GistsController(BaseController):'
185 185 except VCSError:
186 186 log.error(traceback.format_exc())
187 187 raise HTTPNotFound()
188
188 if format == 'raw':
189 content = '\n\n'.join([f.content for f in c.files if (f_path is None or f.path == f_path)])
190 response.content_type = 'text/plain'
191 return content
189 192 return render('admin/gists/show.html')
190 193
191 194 @LoginRequired()
@@ -48,14 +48,19 b''
48 48 <div class="left item last">
49 49 ${c.gist.gist_description}
50 50 </div>
51 <div class="buttons">
52 ## only owner should see that
53 %if h.HasPermissionAny('hg.admin')() or c.gist.gist_owner == c.rhodecode_user.user_id:
54 ##${h.link_to(_('Edit'),h.url(''),class_="ui-btn")}
51 %if h.HasPermissionAny('hg.admin')() or c.gist.gist_owner == c.rhodecode_user.user_id:
52 <div style="float:right;margin:-4px 0px 0px 0px">
55 53 ${h.form(url('gist', gist_id=c.gist.gist_id),method='delete')}
56 54 ${h.submit('remove_gist', _('Delete'),class_="ui-btn red",onclick="return confirm('"+_('Confirm to delete this gist')+"');")}
57 55 ${h.end_form()}
58 %endif
56 </div>
57 %endif
58 <div class="buttons">
59 ## only owner should see that
60 ##%if h.HasPermissionAny('hg.admin')() or c.gist.gist_owner == c.rhodecode_user.user_id:
61 ##${h.link_to(_('Edit'),h.url(''),class_="ui-btn")}
62 ##%endif
63 ${h.link_to(_('Show as raw'),h.url('formatted_gist', gist_id=c.gist.gist_id, format='raw'),class_="ui-btn")}
59 64 </div>
60 65 </div>
61 66
@@ -75,9 +80,9 b''
75 80 <div id="${h.FID('G', file.path)}" class="stats" style="border-bottom: 1px solid #DDD;padding: 8px 14px;">
76 81 <a href="${c.gist.gist_url()}"></a>
77 82 <b style="margin:0px 0px 0px 4px">${file.path}</b>
78 ##<div class="buttons">
79 ## ${h.link_to(_('Show as raw'),h.url(''),class_="ui-btn")}
80 ##</div>
83 <div style="float:right">
84 ${h.link_to(_('Show as raw'),h.url('formatted_gist_file', gist_id=c.gist.gist_id, format='raw', revision=file.changeset.raw_id, f_path=file.path),class_="ui-btn")}
85 </div>
81 86 </div>
82 87 <div class="code-body">
83 88 ${h.pygmentize(file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")}
General Comments 0
You need to be logged in to leave comments. Login now