left_sidebar: Add "+Add streams" to bottom of streamlist.

Added a new button at the bottom of the stream list which redirects
users to '/#streams/all' where they can create new streams or subscribe
to new streams.
The button is not visible to guests.

Fixes #11642.
This commit is contained in:
vinitS101
2019-05-11 23:14:27 +05:30
committed by Tim Abbott
parent e8c1523aa2
commit 611f1f8fd2
3 changed files with 16 additions and 1 deletions

View File

@@ -84,7 +84,7 @@ li.show-more-topics a {
overflow: visible;
/* The -1px here prevents the scrollbar from going above the top of the container */
margin-top: -1px;
margin-bottom: 18px;
margin-bottom: 10px;
padding: 0;
font-weight: normal;
}
@@ -140,6 +140,15 @@ li.show-more-topics a {
background-color: hsl(120, 11%, 82%);
}
#add-stream-link {
text-decoration: none;
margin-left: 10px;
}
#add-stream-link i {
margin-right: 5px;
}
ul.filters {
list-style-type: none;
margin-left: 0px;

View File

@@ -71,6 +71,9 @@
</div>
<div id="stream-filters-container" class="scrolling_list">
<ul id="stream_filters" class="filters"></ul>
{% if show_add_streams %}
<a id="add-stream-link" href="#streams/all"><i class="fa fa-plus-circle" aria-hidden="true"></i>{{ _('Add streams') }}</a>
{% endif %}
</div>
</div>
</div>

View File

@@ -249,12 +249,14 @@ def home_real(request: HttpRequest) -> HttpResponse:
statsd.incr('views.home')
show_invites = True
show_add_streams = True
# Some realms only allow admins to invite users
if user_profile.realm.invite_by_admins_only and not user_profile.is_realm_admin:
show_invites = False
if user_profile.is_guest:
show_invites = False
show_add_streams = False
show_billing = False
show_plans = False
@@ -295,6 +297,7 @@ def home_real(request: HttpRequest) -> HttpResponse:
'pipeline': settings.PIPELINE_ENABLED,
'search_pills_enabled': settings.SEARCH_PILLS_ENABLED,
'show_invites': show_invites,
'show_add_streams': show_add_streams,
'show_billing': show_billing,
'show_plans': show_plans,
'is_admin': user_profile.is_realm_admin,