mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-05 03:00:15 -04:00
Add mod tools box to /r/mod and multireddits.
Additionally: * Change the name "admin box" to "moderation tools". * Move it to the top of the sidebar.
This commit is contained in:
@@ -189,31 +189,48 @@ class Reddit(Templated):
|
||||
self.toolbars = self.build_toolbars()
|
||||
|
||||
def sr_admin_menu(self):
|
||||
buttons = [NavButton(menu.community_settings, css_class = 'reddit-edit',
|
||||
dest = "edit"),
|
||||
NamedButton('modmail', dest = "message/inbox",
|
||||
css_class = 'moderator-mail'),
|
||||
NamedButton('moderators', css_class = 'reddit-moderators')]
|
||||
buttons = []
|
||||
is_single_subreddit = not isinstance(c.site, (ModSR, MultiReddit))
|
||||
|
||||
if c.site.type != 'public':
|
||||
buttons.append(NamedButton('contributors',
|
||||
css_class = 'reddit-contributors'))
|
||||
elif (c.user_is_loggedin and
|
||||
(c.site.is_moderator(c.user) or c.user_is_admin)):
|
||||
buttons.append(NavButton(menu.contributors, "contributors",
|
||||
css_class = 'reddit-contributors'))
|
||||
if is_single_subreddit:
|
||||
buttons.append(NavButton(menu.community_settings,
|
||||
css_class="reddit-edit",
|
||||
dest="edit"))
|
||||
|
||||
buttons.extend([
|
||||
NamedButton('traffic', css_class = 'reddit-traffic'),
|
||||
NamedButton('modqueue', css_class = 'reddit-modqueue'),
|
||||
NamedButton('reports', css_class = 'reddit-reported'),
|
||||
NamedButton('spam', css_class = 'reddit-spam'),
|
||||
NamedButton('banned', css_class = 'reddit-ban'),
|
||||
NamedButton('flair', css_class = 'reddit-flair'),
|
||||
NamedButton('log', css_class = 'reddit-moderationlog'),
|
||||
])
|
||||
return [NavMenu(buttons, type = "flat_vert", base_path = "/about/",
|
||||
css_class = "icon-menu", separator = '')]
|
||||
buttons.append(NamedButton("modmail",
|
||||
dest="message/inbox",
|
||||
css_class="moderator-mail"))
|
||||
|
||||
if is_single_subreddit:
|
||||
buttons.append(NamedButton("moderators",
|
||||
css_class="reddit-moderators"))
|
||||
|
||||
if c.site.type != "public":
|
||||
buttons.append(NamedButton("contributors",
|
||||
css_class="reddit-contributors"))
|
||||
else:
|
||||
buttons.append(NavButton(menu.contributors,
|
||||
"contributors",
|
||||
css_class="reddit-contributors"))
|
||||
|
||||
buttons.append(NamedButton("traffic", css_class="reddit-traffic"))
|
||||
|
||||
buttons += [NamedButton("modqueue", css_class="reddit-modqueue"),
|
||||
NamedButton("reports", css_class="reddit-reported"),
|
||||
NamedButton("spam", css_class="reddit-spam")]
|
||||
|
||||
if is_single_subreddit:
|
||||
buttons += [NamedButton("banned", css_class="reddit-ban"),
|
||||
NamedButton("flair", css_class="reddit-flair")]
|
||||
|
||||
buttons.append(NamedButton("log", css_class="reddit-moderationlog"))
|
||||
|
||||
return SideContentBox(_('moderation tools'),
|
||||
[NavMenu(buttons,
|
||||
type="flat_vert",
|
||||
base_path="/about/",
|
||||
css_class="icon-menu",
|
||||
separator="")])
|
||||
|
||||
def sr_moderators(self, limit = 10):
|
||||
accounts = Account._byID([uid
|
||||
@@ -235,10 +252,19 @@ class Reddit(Templated):
|
||||
if c.user.pref_show_sponsorships or not c.user.gold:
|
||||
ps.append(SponsorshipBox())
|
||||
|
||||
if (c.user_is_loggedin and (isinstance(c.site, ModSR) or
|
||||
c.site.is_moderator(c.user))):
|
||||
ps.append(self.sr_admin_menu())
|
||||
|
||||
no_ads_yet = True
|
||||
if isinstance(c.site, (MultiReddit, ModSR)) and c.user_is_loggedin:
|
||||
srs = Subreddit._byID(c.site.sr_ids,data=True,
|
||||
return_dict=False)
|
||||
|
||||
if (isinstance(c.site, MultiReddit) and
|
||||
Subreddit.user_mods_all(c.user, srs)):
|
||||
ps.append(self.sr_admin_menu())
|
||||
|
||||
if srs:
|
||||
ps.append(SideContentBox(_('these reddits'),[SubscriptionBox(srs=srs)]))
|
||||
|
||||
@@ -291,10 +317,6 @@ class Reddit(Templated):
|
||||
more_href = mod_href,
|
||||
more_text = more_text))
|
||||
|
||||
if (c.user_is_loggedin and
|
||||
(c.site.is_moderator(c.user) or c.user_is_admin)):
|
||||
ps.append(SideContentBox(_('admin box'), self.sr_admin_menu()))
|
||||
|
||||
|
||||
if no_ads_yet and not g.disable_ads:
|
||||
if c.user.pref_show_adbox or not c.user.gold:
|
||||
|
||||
Reference in New Issue
Block a user