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