Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add support for a live-config sidebar info message.

  • Loading branch information...
commit 79ccaca4eafec4c8924bb5cee4c8b7cbca67f569 1 parent bf8750f
Max Goodman chromakode authored
2  r2/example.ini
View
@@ -574,6 +574,8 @@ frontpage_dart = false
fastlane_links =
# a message placed in the infobar
announcement_message =
+# an info message placed in the sidebar
+sidebar_message =
# spotlight links for subreddit discovery
sr_discovery_links =
# probability of the subreddit suggester showing up in the spotlight box
1  r2/r2/lib/app_globals.py
View
@@ -228,6 +228,7 @@ class Globals(object):
'goldvertisement_blurbs',
'goldvertisement_has_gold_blurbs',
'welcomebar_messages',
+ 'sidebar_message',
],
}
9 r2/r2/lib/pages/pages.py
View
@@ -328,6 +328,10 @@ def rightbox(self):
if self.searchbox:
ps.append(SearchForm())
+ sidebar_message = g.live_config.get("sidebar_message")
+ if sidebar_message and isinstance(c.site, DefaultSR):
+ ps.append(SidebarMessage(sidebar_message[0]))
+
if not c.user_is_loggedin and self.loginbox and not g.read_only_mode:
ps.append(LoginFormWide())
@@ -1624,6 +1628,11 @@ def __init__(self, client, *args, **kwargs):
InfoBar.__init__(self, *args, **kwargs)
self.client = client
+class SidebarMessage(Templated):
+ """An info message box on the sidebar."""
+ def __init__(self, message):
+ Templated.__init__(self, message=message)
+
class RedditError(BoringPage):
site_tracking = False
def __init__(self, title, message, image=None, sr_description=None,
36 r2/r2/public/static/css/reddit.less
View
@@ -400,6 +400,36 @@ ul.flat-vert {text-align: left;}
margin: 7px 0 12px 0;
}
+.side .side-message {
+ background: lighten(@info-bg, 10%) no-repeat 10px 10px;
+ border: 1px solid darken(@info-bg, 20%);
+ border-radius: 2px;
+ padding: 10px;
+ line-height: 1.75em;
+
+ &:before {
+ content: '';
+ display: inline-block;
+ float: left;
+ background-image: url(../icon-info.png); /* SPRITE */
+ width: 16px;
+ height: 16px;
+ margin-right: 7px;
+ }
+
+ p {
+ font-size: .9em;
+ margin: 0;
+
+ strong {
+ display: block;
+ font-weight: normal;
+ font-size: 1.25em;
+ margin-bottom: .25em;
+ }
+ }
+}
+
.morelink {
display:block;
text-align: center;
@@ -1176,11 +1206,13 @@ a.author { margin-right: 0.5em; }
overflow: auto;
}
+@info-bg: #f6e69f;
+@info-border: orange;
.infobar {
- background-color: #f6e69f;
+ background-color: @info-bg;
padding: 5px 10px;
margin: 5px 305px 5px 0px;
- border: 1px solid orange;
+ border: 1px solid @info-border;
font-size: small;
}
29 r2/r2/templates/sidebarmessage.html
View
@@ -0,0 +1,29 @@
+## 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-2013
+## reddit Inc. All Rights Reserved.
+###############################################################################
+
+<%!
+ from r2.lib.filters import safemarkdown
+%>
+
+<div class="side-message">
+ ${unsafe(safemarkdown(thing.message))}
+</div>
Please sign in to comment.
Something went wrong with that request. Please try again.