Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pin stream (formerly "star stream") #819

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
revise UI for starred stream
  • Loading branch information
laurenzlong authored and kartikmaji committed Jun 29, 2016
commit 51f4fb056ddb548beec46cd9fc1641cc0880d0e3
201 changes: 201 additions & 0 deletions errors.log.2015-10-19

Large diffs are not rendered by default.

494 changes: 494 additions & 0 deletions frontend_tests/casper_tests/server.log

Large diffs are not rendered by default.

17,926 changes: 17,926 additions & 0 deletions server.log.2015-10-22

Large diffs are not rendered by default.

11 changes: 1 addition & 10 deletions static/js/stream_color.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ function update_stream_sidebar_swatch_color(id, color) {
$("#stream_sidebar_privacy_swatch_" + id).css('color', color);
}

function update_stream_sidebar_star_color(id, color) {
$("#stream_sidebar_swatch_" + id).css('color', color);
$("#stream_sidebar_privacy_swatch_" + id).css('color', color);
}
function update_historical_message_color(stream_name, color) {
update_table_stream_color($(".focused_table"), stream_name, color);
if ($(".focused_table").attr("id") !== "#zhome") {
Expand Down Expand Up @@ -103,12 +99,7 @@ exports.update_stream_color = function (sub, stream_name, color, opts) {
if (opts.update_historical) {
update_historical_message_color(stream_name, color);
}
if (sub.starred) {
update_stream_sidebar_star_color(id, color);
}
else {
update_stream_sidebar_swatch_color(id, color);
}
update_stream_sidebar_swatch_color(id, color);
tab_bar.colorize_tab_bar();
};

Expand Down
48 changes: 41 additions & 7 deletions static/js/stream_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,40 @@ exports.build_stream_list = function () {
streams = filter_streams_by_search(streams);

var sort_recent = (streams.length > 40);

var starred_streams = [];
var unstarred_streams = [];
var parent = $('#stream_filters');
var elems = [];

function add_label(label_text){
var label = document.createElement('li');
label.innerHTML = label_text;
label.className = 'stream-filters-label';
elems.push(label);
}

function add_sidebar_li(stream){
var li = $(stream_data.get_sub(stream).sidebar_li);
if (sort_recent) {
if (! recent_subjects.has(stream)) {
li.addClass('inactive_stream');
} else {
li.removeClass('inactive_stream');
}
}
elems.push(li.get(0));
}

if (streams.length === 0) {
return;
}

_.each(streams, function (stream) {
var starred = stream_data.get_sub(stream).starred;
if (starred) {
starred_streams.push(stream);
}
else{
else {
unstarred_streams.push(stream);
}
});
Expand All @@ -84,14 +108,17 @@ exports.build_stream_list = function () {
if (previous_sort_order !== undefined && util.array_compare(previous_sort_order, streams)) {
return;
}

previous_sort_order = streams;

var parent = $('#stream_filters');
parent.empty();
elems.push(document.createElement('hr'));
if (starred_streams.length > 0){
label = document.createElement('li');
label.innerHTML = 'STARRED';
label.className = 'stream-filters-label';
elems.push(label);
}

var elems = [];
_.each(streams, function (stream) {
_.each(starred_streams, function (stream) {
var li = $(stream_data.get_sub(stream).sidebar_li);
if (sort_recent) {
if (! stream_data.recent_subjects.has(stream)) {
Expand All @@ -102,6 +129,13 @@ exports.build_stream_list = function () {
}
elems.push(li.get(0));
});
if (starred_streams.length > 0){
add_label('STARRED');
_.each(starred_streams, add_sidebar_li);
add_label('OTHERS');
}
_.each(unstarred_streams, add_sidebar_li);

$(elems).appendTo(parent);
};

Expand Down
24 changes: 11 additions & 13 deletions static/styles/zulip.css
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,7 @@ a:hover code {
}

.sidebar-title, .share-the-love-title {
font-size: 11px;
font-weight: normal;
font-size: 14px;
display: inline;
}

Expand Down Expand Up @@ -375,6 +374,16 @@ a:hover code {
position: relative;
}

.stream-filters-label {
font-size: 12px;
color: #808080;
padding-left: 33px;
}

#stream_filters li.stream-filters-label:hover {
background-color: transparent;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this CSS for?

#stream_filters li:hover {
background-color: #e2e8dd;
}
Expand Down Expand Up @@ -2892,17 +2901,6 @@ button.topic_edit_cancel {
box-shadow: inset 0px 0px 3px -2px #000;
}

.streamlist_star{
display: block;
width: 11px;
height: 11px;
vertical-align: middle;
float: left;
position: absolute;
left: 10px;
top: 5px;
}

.streamlist_swatch.private-stream-swatch {
visibility: hidden;
}
Expand Down
6 changes: 0 additions & 6 deletions static/templates/stream_sidebar_row.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@

<div class="subscription_block selectable_sidebar_block" data-name="{{name}}">

{{#if starred}}
<div id="stream_sidebar_swatch_{{id}}" class="streamlist_star icon-vector-star{{#if invite_only}} private-stream-swatch{{/if}}"
style="color: {{color}}">&nbsp;</div>

{{else}}
<div id="stream_sidebar_swatch_{{id}}" class="streamlist_swatch{{#if invite_only}} private-stream-swatch{{/if}}"
style="background-color: {{color}}">&nbsp;</div>
{{/if}}

<a href="{{uri}}" class="subscription_name">{{name}}
</a>
Expand Down
2 changes: 2 additions & 0 deletions workers.log.2015-10-15
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
2015-10-22 21:15:50,003 INFO Worker 0 disconnecting from queue missedmessage_mobile_notifications
2015-10-22 21:15:50,040 INFO Worker 0 disconnecting from queue missedmessage_mobile_notifications
3 changes: 3 additions & 0 deletions workers.log.2015-10-22
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
2015-11-03 13:27:39,966 INFO Worker 0 connecting to queue invites
2015-11-03 13:27:39,968 INFO Worker 0 connecting to queue feedback_messages
2015-11-03 13:272015-11-03 13:27:40,030 INFO SimpleQueueClient connected (connecting took 0.036s)
19 changes: 19 additions & 0 deletions zerver/migrations/0006_subscription_starred.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('zerver', '0005_auto_20150920_1340'),
]

operations = [
migrations.AddField(
model_name='subscription',
name='starred',
field=models.BooleanField(default=False),
),
]
Loading