mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-31 09:48:01 -05:00
Dim and disable the "submit a link" button when unable to submit.
This commit is contained in:
@@ -242,12 +242,19 @@ class Reddit(Templated):
|
||||
no_ads_yet = False
|
||||
|
||||
if self.submit_box and (c.user_is_loggedin or not g.read_only_mode):
|
||||
ps.append(SideBox(_('Submit a link'),
|
||||
'/submit', 'submit',
|
||||
sr_path = (isinstance(c.site,DefaultSR)
|
||||
or not isinstance(c.site, FakeSubreddit)),
|
||||
subtitles = [strings.submit_box_text],
|
||||
show_cover = True))
|
||||
kwargs = {
|
||||
"title": _("Submit a link"),
|
||||
"css_class": "submit",
|
||||
"show_cover": True
|
||||
}
|
||||
if not c.user_is_loggedin or c.site.can_submit(c.user) or isinstance(c.site, FakeSubreddit):
|
||||
kwargs["link"] = "/submit"
|
||||
kwargs["sr_path"] = isinstance(c.site, DefaultSR) or not isinstance(c.site, FakeSubreddit),
|
||||
kwargs["subtitles"] = [strings.submit_box_text]
|
||||
else:
|
||||
kwargs["disabled"] = True
|
||||
kwargs["subtitles"] = [strings.submit_box_restricted_text]
|
||||
ps.append(SideBox(**kwargs))
|
||||
|
||||
if self.create_reddit_box and c.user_is_loggedin:
|
||||
delta = datetime.datetime.now(g.tz) - c.user._date
|
||||
@@ -523,12 +530,13 @@ class SideBox(CachedTemplate):
|
||||
"""
|
||||
Generic sidebox used to generate the 'submit' and 'create a reddit' boxes.
|
||||
"""
|
||||
def __init__(self, title, link, css_class='', subtitles = [],
|
||||
show_cover = False, nocname=False, sr_path = False):
|
||||
def __init__(self, title, link=None, css_class='', subtitles = [],
|
||||
show_cover = False, nocname=False, sr_path = False, disabled=False):
|
||||
CachedTemplate.__init__(self, link = link, target = '_top',
|
||||
title = title, css_class = css_class,
|
||||
sr_path = sr_path, subtitles = subtitles,
|
||||
show_cover = show_cover, nocname=nocname)
|
||||
show_cover = show_cover, nocname=nocname,
|
||||
disabled=disabled)
|
||||
|
||||
|
||||
class PrefsPage(Reddit):
|
||||
|
||||
@@ -124,6 +124,7 @@ string_dict = dict(
|
||||
unknown_rule_type = _('unknown CSS rule type "%(ruletype)s"')
|
||||
),
|
||||
submit_box_text = _('to anything interesting: news article, blog entry, video, picture...'),
|
||||
submit_box_restricted_text = _('submission in this subreddit is restricted to approved submitters.'),
|
||||
permalink_title = _("%(author)s comments on %(title)s"),
|
||||
link_info_title = _("%(title)s : %(site)s"),
|
||||
banned_subreddit = _("""**this reddit has been banned**\n\nmost likely this was done automatically by our spam filtering program. the program is still learning, and may even have some bugs, so if you feel the ban was a mistake, please submit a link to our [request a reddit listing](%(link)s) and be sure to include the **exact name of the reddit**."""),
|
||||
|
||||
@@ -448,6 +448,24 @@ ul.flat-vert {text-align: left;}
|
||||
background-image: url(../gradient-nub-hover.png); /* SPRITE */
|
||||
}
|
||||
|
||||
.disabled .morelink, .disabled .morelink:hover {
|
||||
background-image: url(../gradient-button-gray.png); /* SPRITE stretch-x */
|
||||
border-color: #dadada;
|
||||
}
|
||||
|
||||
.disabled .morelink a {
|
||||
cursor: default;
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
.disabled .morelink .nub, .disabled .morelink:hover .nub {
|
||||
background-image: url(../gradient-nub-gray.png); /* SPRITE */
|
||||
}
|
||||
|
||||
.sidebox.submit.disabled .spacer a {
|
||||
opacity: .5;
|
||||
}
|
||||
|
||||
/* raised box */
|
||||
|
||||
.raisedbox {
|
||||
|
||||
BIN
r2/r2/public/static/gradient-button-gray.png
Normal file
BIN
r2/r2/public/static/gradient-button-gray.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 146 B |
BIN
r2/r2/public/static/gradient-nub-gray.png
Normal file
BIN
r2/r2/public/static/gradient-nub-gray.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 696 B |
@@ -22,7 +22,7 @@
|
||||
|
||||
<%namespace file="utils.html" import="plain_link"/>
|
||||
|
||||
<div class="sidebox ${thing.css_class}">
|
||||
<div class="sidebox ${thing.css_class}${' disabled' if thing.disabled else ''}">
|
||||
<div class="morelink">
|
||||
${plain_link(thing.title, thing.link, _sr_path=thing.sr_path,
|
||||
_class='login-required' if thing.show_cover else None, nocname=thing.nocname)}
|
||||
|
||||
@@ -138,7 +138,7 @@ ${first_defined(kw[1:])}
|
||||
kw['target'] = target
|
||||
|
||||
link = _a_buffered(link_text,
|
||||
href=add_sr(path, sr_path=_sr_path, nocname=nocname),
|
||||
href=path and add_sr(path, sr_path=_sr_path, nocname=nocname),
|
||||
**kw)
|
||||
%>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user