mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-25 23:08:22 -05:00
Don't show the 'flair' button on links if a subreddit isn't using link flair.
This commit is contained in:
@@ -2272,7 +2272,8 @@ class ApiController(RedditController):
|
||||
VModhash(),
|
||||
flair_enabled = VBoolean("flair_enabled"),
|
||||
flair_position = VOneOf("flair_position", ("left", "right")),
|
||||
link_flair_position = VOneOf("link_flair_position", ("left", "right")),
|
||||
link_flair_position = VOneOf("link_flair_position",
|
||||
("", "left", "right")),
|
||||
flair_self_assign_enabled = VBoolean("flair_self_assign_enabled"))
|
||||
@api_doc(api_section.flair)
|
||||
def POST_flairconfig(self, form, jquery, flair_enabled, flair_position,
|
||||
|
||||
@@ -259,6 +259,12 @@ class Link(Thing, Printable):
|
||||
s.append(getattr(wrapped, 'media_object', {}))
|
||||
s.append(wrapped.flair_text)
|
||||
s.append(wrapped.flair_css_class)
|
||||
|
||||
# if browsing a single subreddit, incorporate link flair position
|
||||
# in the key so 'flair' buttons show up appropriately for mods
|
||||
if hasattr(c.site, '_id'):
|
||||
s.append(c.site.link_flair_position)
|
||||
|
||||
return s
|
||||
|
||||
def make_permalink(self, sr, force_domain = False):
|
||||
|
||||
@@ -75,7 +75,7 @@ class Subreddit(Thing, Printable):
|
||||
link_type = 'any', # one of ('link', 'self', 'any')
|
||||
flair_enabled = True,
|
||||
flair_position = 'right', # one of ('left', 'right')
|
||||
link_flair_position = 'left', # one of ('left', 'right')
|
||||
link_flair_position = '', # one of ('', 'left', 'right')
|
||||
flair_self_assign_enabled = False,
|
||||
)
|
||||
_essentials = ('type', 'name', 'lang')
|
||||
|
||||
@@ -62,6 +62,9 @@
|
||||
</%utils:line_field>
|
||||
<%utils:line_field title="${_('link flair position')}">
|
||||
<table class="small-field">
|
||||
${utils.radio_type('link_flair_position', "", _("none"),
|
||||
_("don't show link flair"),
|
||||
not thing.link_flair_position)}
|
||||
${utils.radio_type('link_flair_position', "left", _("left"),
|
||||
_("position flair to the left of the link"),
|
||||
thing.link_flair_position == 'left')}
|
||||
|
||||
@@ -42,7 +42,7 @@ from r2.models import USER_FLAIR, LINK_FLAIR
|
||||
%elif thing.flair_type == LINK_FLAIR:
|
||||
<div class="thing">
|
||||
<p class="title">
|
||||
%if c.site.link_flair_position == 'left':
|
||||
%if c.site.link_flair_position != 'right':
|
||||
<%call expr="flair()" />
|
||||
%endif
|
||||
<a class="title loggedin" href="javascript://">Link sample</a>
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
%if thing.show_unmarknsfw:
|
||||
<li>${ynbutton(_("un-nsfw"), _("unmarked"), "unmarknsfw")}</li>
|
||||
%endif
|
||||
%if thing.show_flair:
|
||||
%if c.site.link_flair_position and thing.show_flair:
|
||||
<li>
|
||||
<a class="flairselectbtn" href="javascript://">${_('flair')}</a>
|
||||
<div class="flairselector drop-choices"></div>
|
||||
|
||||
Reference in New Issue
Block a user