mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-28 16:28:01 -05:00
wiki: Rename c.wiki to c.wiki_page.
This commit is contained in:
@@ -202,7 +202,7 @@ class VWikiPage(Validator):
|
||||
|
||||
page = normalize_page(page)
|
||||
|
||||
c.page = page
|
||||
c.wiki_page = page
|
||||
if (not c.is_wiki_mod) and self.modonly:
|
||||
return self.set_error('MOD_REQUIRED', code=403)
|
||||
|
||||
@@ -212,7 +212,7 @@ class VWikiPage(Validator):
|
||||
return
|
||||
|
||||
# TODO: MAKE NOT REQUIRED
|
||||
c.page_obj = wp
|
||||
c.wiki_page_obj = wp
|
||||
|
||||
return wp
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ class WikiController(RedditController):
|
||||
message = None
|
||||
|
||||
if not page:
|
||||
return self.redirect(join_urls(c.wiki_base_url, '/notfound/', c.page))
|
||||
return self.redirect(join_urls(c.wiki_base_url, '/notfound/', c.wiki_page))
|
||||
|
||||
if version:
|
||||
edit_by = version.author_name()
|
||||
@@ -216,7 +216,7 @@ class WikiController(RedditController):
|
||||
c.wiki_base_url = '%s/wiki' % base
|
||||
c.wiki_api_url = '%s/api/wiki' % base
|
||||
c.wiki_id = g.default_sr if frontpage else c.site.name
|
||||
c.page = None
|
||||
c.wiki_page = None
|
||||
c.show_wiki_actions = True
|
||||
self.editconflict = False
|
||||
c.is_wiki_mod = (c.user_is_admin or c.site.is_moderator(c.user)) if c.user_is_loggedin else False
|
||||
|
||||
@@ -14,7 +14,7 @@ class WikiView(Templated):
|
||||
self.edit_by = edit_by
|
||||
self.edit_date = edit_date
|
||||
self.base_url = c.wiki_base_url
|
||||
self.may_revise = this_may_revise(c.page_obj)
|
||||
self.may_revise = this_may_revise(c.wiki_page_obj)
|
||||
Templated.__init__(self)
|
||||
|
||||
class WikiPageListing(Templated):
|
||||
@@ -68,16 +68,16 @@ class WikiBase(Reddit):
|
||||
def __init__(self, content, actionless=False, alert=None, **context):
|
||||
pageactions = []
|
||||
|
||||
if not actionless and c.page:
|
||||
pageactions += [(c.page, _("view"), False)]
|
||||
if this_may_revise(c.page_obj):
|
||||
if not actionless and c.wiki_page:
|
||||
pageactions += [(c.wiki_page, _("view"), False)]
|
||||
if this_may_revise(c.wiki_page_obj):
|
||||
pageactions += [('edit', _("edit"), True)]
|
||||
pageactions += [('revisions/%s' % c.page, _("history"), False)]
|
||||
pageactions += [('revisions/%s' % c.wiki_page, _("history"), False)]
|
||||
pageactions += [('discussions', _("talk"), True)]
|
||||
if c.is_wiki_mod:
|
||||
pageactions += [('settings', _("settings"), True)]
|
||||
|
||||
action = context.get('wikiaction', (c.page, 'wiki'))
|
||||
action = context.get('wikiaction', (c.wiki_page, 'wiki'))
|
||||
|
||||
context['title'] = c.site.name
|
||||
if alert:
|
||||
@@ -90,7 +90,7 @@ class WikiBase(Reddit):
|
||||
class WikiPageView(WikiBase):
|
||||
def __init__(self, content, diff=None, **context):
|
||||
if not content and not context.get('alert'):
|
||||
if this_may_revise(c.page_obj):
|
||||
if this_may_revise(c.wiki_page_obj):
|
||||
context['alert'] = _("this page is empty, edit it to add some content.")
|
||||
content = WikiView(content, context.get('edit_by'), context.get('edit_date'), diff=diff)
|
||||
WikiBase.__init__(self, content, **context)
|
||||
@@ -117,7 +117,7 @@ class WikiSettings(WikiBase):
|
||||
class WikiRevisions(WikiBase):
|
||||
def __init__(self, revisions, **context):
|
||||
content = WikiPageRevisions(revisions)
|
||||
context['wikiaction'] = ('revisions/%s' % c.page, _("revisions"))
|
||||
context['wikiaction'] = ('revisions/%s' % c.wiki_page, _("revisions"))
|
||||
WikiBase.__init__(self, content, **context)
|
||||
|
||||
class WikiRecent(WikiBase):
|
||||
|
||||
@@ -151,8 +151,8 @@ def js_config():
|
||||
"static_root": static(''),
|
||||
}
|
||||
|
||||
if c.page:
|
||||
config["wiki_page"] = c.page
|
||||
if c.wiki_page:
|
||||
config["wiki_page"] = c.wiki_page
|
||||
|
||||
return config
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
%endif
|
||||
"
|
||||
%if action[2]:
|
||||
href="${thing.base_url}/${action[0]}/${c.page}"
|
||||
href="${thing.base_url}/${action[0]}/${c.wiki_page}"
|
||||
%else:
|
||||
href="${thing.base_url}/${action[0]}"
|
||||
%endif
|
||||
@@ -41,8 +41,8 @@
|
||||
%if thing.title:
|
||||
${thing.title}
|
||||
%endif
|
||||
%if c.page:
|
||||
<strong>${c.page}</strong>
|
||||
%if c.wiki_page:
|
||||
<strong>${c.wiki_page}</strong>
|
||||
%endif
|
||||
</h1>
|
||||
|
||||
|
||||
@@ -48,5 +48,5 @@
|
||||
<input type="hidden" id="page" name="page" value="${thing.page}" />
|
||||
<input type="hidden" id="previous" name="previous" value="${thing.previous}" />
|
||||
<br/><br/><input type="submit" value="${_('save page')}" />
|
||||
<input type="button" value="${_('cancel edit')}" onclick="location.href='${thing.base_url}/${c.page}'" />
|
||||
<input type="button" value="${_('cancel edit')}" onclick="location.href='${thing.base_url}/${c.wiki_page}'" />
|
||||
</form>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
${thing.listing}
|
||||
|
||||
<div class="morelink discussionlink">
|
||||
<a href="/submit?url=http://${get_domain()}/wiki/${c.page}&resubmit=true&no_self=true&title=Check+out+this+wiki+page">${_("submit a discussion")}
|
||||
<a href="/submit?url=http://${get_domain()}/wiki/${c.wiki_page}&resubmit=true&no_self=true&title=Check+out+this+wiki+page">${_("submit a discussion")}
|
||||
<div class="nub"></div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
###############################################################################
|
||||
|
||||
${thing.revisions}
|
||||
%if c.page and thing.revisions.things:
|
||||
%if c.wiki_page and thing.revisions.things:
|
||||
<button onclick="r.wiki.goCompare()">${_("compare selected")}</button>
|
||||
%endif
|
||||
<br/>
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
<li>
|
||||
${user}
|
||||
—
|
||||
${ynbutton(_("delete"), _("done"), quote("..%s/alloweditor/del" % (c.wiki_api_url)), hidden_data=dict(username=user, page=c.page), post_callback="$.refresh")}
|
||||
${ynbutton(_("delete"), _("done"), quote("..%s/alloweditor/del" % (c.wiki_api_url)), hidden_data=dict(username=user, page=c.wiki_page), post_callback="$.refresh")}
|
||||
</li>
|
||||
%endfor
|
||||
</ul>
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
%endif
|
||||
">
|
||||
|
||||
%if c.page:
|
||||
%if c.wiki_page:
|
||||
<td style="white-space: nowrap;">
|
||||
<input type="radio" name="v1" value="${thing._id}" checked="yes">
|
||||
<input type="radio" name="v2" value="${thing._id}" checked="yes">
|
||||
@@ -44,7 +44,7 @@
|
||||
${timestamp(thing.date)} ago
|
||||
</td>
|
||||
|
||||
%if not c.page:
|
||||
%if not c.wiki_page:
|
||||
<td>
|
||||
<a href="${c.wiki_base_url}/${thing.page}">${thing.page}</a>
|
||||
</td>
|
||||
@@ -62,7 +62,7 @@
|
||||
${thing._get('reason')}
|
||||
</td>
|
||||
|
||||
%if c.page and c.is_wiki_mod:
|
||||
%if c.wiki_page and c.is_wiki_mod:
|
||||
<td>
|
||||
<a href="#" class="revision_hide" data-revision="${thing._id}">hide</a>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user