ModTools: Add base templates for new modtools pages.

Adds a new js module and css file for mod tools, and a new page that
includes them.  This is so that, moving forward, we don’t have to cram
everything into the reddit.js package.
This commit is contained in:
Matt Lee
2015-11-06 14:21:18 -08:00
committed by MelissaCole
parent 13e47c5a3f
commit f062de4f0c
5 changed files with 70 additions and 1 deletions

View File

@@ -87,7 +87,7 @@ clean_ini:
#################### CSS file lists
SPRITED_STYLESHEETS += reddit.less compact.css
LESS_STYLESHEETS := wiki.less adminbar.less policies.less reddit-embed.less
LESS_STYLESHEETS := wiki.less adminbar.less modtools.less policies.less reddit-embed.less
OTHER_STYLESHEETS := mobile.css highlight.css
#################### Static Files

View File

@@ -550,6 +550,10 @@ module["reddit"] = LocalizedModule("reddit.js",
wrap=catch_errors,
)
module["modtools"] = Module("modtools.js",
wrap=catch_errors,
)
# move into reddit module just after permissions when released
module["timeouts"] = Module("timeouts.js",
"timeouts.js",

View File

@@ -3982,6 +3982,17 @@ class ModTableItem(InvitedModTableItem):
return c.user != user and c.site.can_demod(c.user, user)
class ModToolsPage(Reddit):
"""A mod tool page."""
def __init__(self, **kwargs):
super(ModToolsPage, self).__init__(
page_classes=['modtools-page'],
show_newsletterbar=False,
**kwargs
)
class Rules(Templated):
"""Show subreddit rules for everyone and add edit controls for mods."""
def __init__(self):

View File

@@ -0,0 +1,12 @@
@import "components/variables.less";
@import "components/mixins.less";
@import "markdown.less";
.modtools-page {
& > div.content {
font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif;
margin: 0;
margin-right: @reddit-sidebar-width;
padding: 15px 20px;
}
}

View File

@@ -0,0 +1,42 @@
## The contents of this file are subject to the Common Public Attribution
## License Version 1.0. (the "License"); you may not use this file except in
## compliance with the License. You may obtain a copy of the License at
## http://code.reddit.com/LICENSE. The License is based on the Mozilla Public
## License Version 1.1, but Sections 14 and 15 have been added to cover use of
## software over a computer network and provide for limited attribution for the
## Original Developer. In addition, Exhibit A has been modified to be
## consistent with Exhibit B.
##
## Software distributed under the License is distributed on an "AS IS" basis,
## WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
## the specific language governing rights and limitations under the License.
##
## The Original Code is reddit.
##
## The Original Developer is the Initial Developer. The Initial Developer of
## the Original Code is reddit Inc.
##
## All portions of the code written by reddit are Copyright (c) 2006-2015
## reddit Inc. All Rights Reserved.
###############################################################################
<%!
from r2.lib.filters import unsafe
%>
<%namespace file="less.html" import="less_stylesheet"/>
<%inherit file="reddit.html"/>
<%def name="javascript_bottom()">
<% from r2.lib import js %>
${parent.javascript_bottom()}
${unsafe(js.use('modtools'))}
</%def>
<%def name="global_stylesheets()">
${parent.global_stylesheets()}
${less_stylesheet("modtools.less")}
</%def>