mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-27 03:00:12 -04:00
CombinedSearch: Add private, restricted, and archived indicators to subreddits.
Conflicts: r2/r2/models/subreddit.py
This commit is contained in:
@@ -2225,6 +2225,16 @@ class SearchResultSubreddit(Subreddit):
|
||||
url = UrlParser(item.path)
|
||||
url.update_query(ref="search_subreddits")
|
||||
item.search_path = url.unparse()
|
||||
can_view = item.can_view(user)
|
||||
can_comment = item.can_comment(user)
|
||||
if not can_view:
|
||||
item.display_type = "private"
|
||||
elif item.type == "archived":
|
||||
item.display_type = "archived"
|
||||
elif not can_comment:
|
||||
item.display_type = "restricted"
|
||||
else:
|
||||
item.display_type = "public"
|
||||
Printable.add_props(user, wrapped)
|
||||
|
||||
Frontpage = DefaultSR()
|
||||
|
||||
@@ -4658,15 +4658,37 @@ form input[type=radio] {margin: 2px .5em 0 0; }
|
||||
font-size: x-small;
|
||||
}
|
||||
|
||||
.nsfw-stamp acronym {
|
||||
color: #ac3939;
|
||||
@color-nsfw-stamp: darken(@color-warning-red, 5%);
|
||||
@color-private-stamp: darken(@color-orange, 10%);
|
||||
@color-restricted-stamp: darken(@color-orange, 10%);
|
||||
@color-archived-stamp: lighten(@color-text-grey, 15%);
|
||||
|
||||
.stamp {
|
||||
font-size: x-small;
|
||||
text-decoration: none;
|
||||
padding: 0 2px;
|
||||
border: 1px solid #d27979 !important;
|
||||
border: 1px solid !important;
|
||||
border-radius: 3px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.nsfw-stamp {
|
||||
color: @color-nsfw-stamp;
|
||||
}
|
||||
|
||||
.private-stamp {
|
||||
color: @color-private-stamp;
|
||||
}
|
||||
|
||||
.restricted-stamp {
|
||||
color: @color-restricted-stamp;
|
||||
}
|
||||
|
||||
.archived-stamp {
|
||||
color: @color-archived-stamp;
|
||||
}
|
||||
|
||||
|
||||
.entry .buttons li.reported-stamp {
|
||||
border: 1px solid black !important;
|
||||
padding: 0 4px;
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
<%def name="search_result_meta()">
|
||||
<%parent:search_result_meta>
|
||||
%if thing.over_18:
|
||||
<span class="nsfw-stamp">${nsfw_stamp()}</span> 
|
||||
<span class="stamp nsfw-stamp">${nsfw_stamp()}</span> 
|
||||
%endif
|
||||
${plain_link(
|
||||
'/r/%s' % thing.subreddit.name,
|
||||
|
||||
@@ -50,9 +50,7 @@
|
||||
<%parent:search_result_meta>
|
||||
<% data_attrs = {"sr_name": thing.name} %>
|
||||
${subscribe_button(thing, data_attrs, css_class='search-subscribe-button')}
|
||||
%if thing.over_18:
|
||||
<span class="nsfw-stamp">${nsfw_stamp()}</span> 
|
||||
%endif
|
||||
${self.permissions_stamps()}
|
||||
${plain_link(
|
||||
thing.path.rstrip('/'),
|
||||
thing.search_path,
|
||||
@@ -87,3 +85,16 @@
|
||||
)}
|
||||
</%parent:search_result_footer>
|
||||
</%def>
|
||||
|
||||
<%def name="permissions_stamps()">
|
||||
%if thing.over_18:
|
||||
<span class="stamp nsfw-stamp">${nsfw_stamp()}</span> 
|
||||
%endif
|
||||
%if thing.display_type == "private":
|
||||
<span class="stamp private-stamp">${_("private")}</span> 
|
||||
%elif thing.display_type == "restricted":
|
||||
<span class="stamp restricted-stamp">${_("restricted")}</span> 
|
||||
%elif thing.display_type == "archived":
|
||||
<span class="stamp archived-stamp">${_("archived")}</span> 
|
||||
%endif
|
||||
</%def>
|
||||
|
||||
Reference in New Issue
Block a user