mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-29 08:48:18 -05:00
Add "bare" request param for reloading listing content in-page.
This commit is contained in:
@@ -88,6 +88,7 @@ class ListingController(RedditController, OAuth2ResourceController):
|
||||
def pre(self):
|
||||
self.check_for_bearer_token()
|
||||
RedditController.pre(self)
|
||||
self.bare = request.get.pop('bare', False)
|
||||
|
||||
@property
|
||||
def menus(self):
|
||||
@@ -109,15 +110,16 @@ class ListingController(RedditController, OAuth2ResourceController):
|
||||
self.listing_obj = self.listing()
|
||||
content = self.content()
|
||||
|
||||
res = self.render_cls(content = content,
|
||||
page_classes = self.extra_page_classes,
|
||||
show_sidebar = self.show_sidebar,
|
||||
nav_menus = self.menus,
|
||||
title = self.title(),
|
||||
robots = getattr(self, "robots", None),
|
||||
**self.render_params).render()
|
||||
return res
|
||||
|
||||
if self.bare:
|
||||
return responsive(content.render())
|
||||
else:
|
||||
return self.render_cls(content=content,
|
||||
page_classes=self.extra_page_classes,
|
||||
show_sidebar=self.show_sidebar,
|
||||
nav_menus=self.menus,
|
||||
title=self.title(),
|
||||
robots=getattr(self, "robots", None),
|
||||
**self.render_params).render()
|
||||
|
||||
def content(self):
|
||||
"""Renderable object which will end up as content of the render_cls"""
|
||||
|
||||
@@ -31,6 +31,19 @@ r.ui.init = function() {
|
||||
r.ui.PermissionEditor.init()
|
||||
}
|
||||
|
||||
r.ui.refreshListing = function() {
|
||||
var url = $.url(),
|
||||
params = url.param()
|
||||
params['bare'] = 'y'
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: url.attr('base') + url.attr('path'),
|
||||
data: params
|
||||
}).done(function(resp) {
|
||||
$('#siteTable').replaceWith(resp)
|
||||
})
|
||||
}
|
||||
|
||||
r.ui.Form = function(el) {
|
||||
r.ui.Base.call(this, el)
|
||||
this.$el.submit($.proxy(function(e) {
|
||||
|
||||
@@ -33,21 +33,21 @@
|
||||
%for a in thing.things:
|
||||
${a}
|
||||
%endfor
|
||||
</div>
|
||||
|
||||
%if thing.nextprev and (thing.prev or thing.next):
|
||||
<p class="nextprev"> ${_("view more:")} 
|
||||
%if thing.prev:
|
||||
${plain_link(unsafe("‹ " + _("prev")), thing.prev, _sr_path = (c.site != Sub), rel="nofollow prev")}
|
||||
%if thing.nextprev and (thing.prev or thing.next):
|
||||
<p class="nextprev"> ${_("view more:")} 
|
||||
%if thing.prev:
|
||||
${plain_link(unsafe("‹ " + _("prev")), thing.prev, _sr_path = (c.site != Sub), rel="nofollow prev")}
|
||||
%endif
|
||||
%if thing.prev and thing.next:
|
||||
<span class="separator"></span>
|
||||
%endif
|
||||
%if thing.next:
|
||||
${plain_link(unsafe(_("next") + " ›"), thing.next, _sr_path = (c.site != Sub), rel="nofollow next")}
|
||||
%endif
|
||||
</p>
|
||||
%endif
|
||||
%if thing.prev and thing.next:
|
||||
<span class="separator"></span>
|
||||
%if not thing.things:
|
||||
<p id="noresults" class="error">${_("there doesn't seem to be anything here")}</p>
|
||||
%endif
|
||||
%if thing.next:
|
||||
${plain_link(unsafe(_("next") + " ›"), thing.next, _sr_path = (c.site != Sub), rel="nofollow next")}
|
||||
%endif
|
||||
</p>
|
||||
%endif
|
||||
%if not thing.things:
|
||||
<p id="noresults" class="error">${_("there doesn't seem to be anything here")}</p>
|
||||
%endif
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user