mirror of https://github.com/zulip/zulip.git
Switch streams page over to use consistent buttons.
(imported from commit c4d7f658f361a759a38951349e027ac3e279fe9b)
This commit is contained in:
parent
66ecc7a6f2
commit
a9f01e382a
|
@ -46,14 +46,14 @@ var exports = {};
|
|||
|
||||
function display_subscribe($button, stream_name) {
|
||||
$button.text('Subscribe to ' + stream_data.canonicalized_name(stream_name))
|
||||
.removeClass('green-button')
|
||||
.addClass('gray-button');
|
||||
.removeClass('btn-success')
|
||||
.addClass('btn-default');
|
||||
}
|
||||
|
||||
function display_unsubscribe($button, stream_name) {
|
||||
$button.text('Unsubscribe from ' + stream_data.canonicalized_name(stream_name))
|
||||
.removeClass('gray-button')
|
||||
.addClass('green-button');
|
||||
.removeClass('btn-default')
|
||||
.addClass('btn-success');
|
||||
}
|
||||
|
||||
function update_button_display($button, stream_name) {
|
||||
|
|
|
@ -316,7 +316,7 @@ exports.mark_subscribed = function (stream_name, attrs) {
|
|||
var settings = settings_for_sub(sub);
|
||||
var button = button_for_sub(sub);
|
||||
if (button.length !== 0) {
|
||||
button.text("Subscribed").addClass("subscribed-button").addClass("green-button");
|
||||
button.text("Subscribed").addClass("subscribed-button").addClass("btn-success");
|
||||
// Add the user to the member list if they're currently
|
||||
// viewing the members of this stream
|
||||
if (sub.render_subscribers && settings.hasClass('in')) {
|
||||
|
@ -359,7 +359,7 @@ exports.mark_sub_unsubscribed = function (sub) {
|
|||
} else if (sub.subscribed) {
|
||||
stream_list.remove_narrow_filter(sub.name, 'stream');
|
||||
sub.subscribed = false;
|
||||
button_for_sub(sub).removeClass("subscribed-button").removeClass("green-button").removeClass("red-button").text("Subscribe");
|
||||
button_for_sub(sub).removeClass("subscribed-button").removeClass("btn-success").removeClass("btn-danger").text("Subscribe");
|
||||
var settings = settings_for_sub(sub);
|
||||
if (settings.hasClass('in')) {
|
||||
settings.collapse('hide');
|
||||
|
@ -756,9 +756,9 @@ $(function () {
|
|||
});
|
||||
|
||||
$("body").on("mouseover", ".subscribed-button", function (e) {
|
||||
$(e.target).addClass("red-button").text("Unsubscribe");
|
||||
$(e.target).addClass("btn-danger").text("Unsubscribe");
|
||||
}).on("mouseout", ".subscribed-button", function (e) {
|
||||
$(e.target).removeClass("red-button").text("Subscribed");
|
||||
$(e.target).removeClass("btn-danger").text("Subscribed");
|
||||
});
|
||||
|
||||
$("#subscriptions_table").on("click", ".email-address", function (e) {
|
||||
|
|
|
@ -2571,35 +2571,6 @@ div.floating_recipient {
|
|||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.zulip-button {
|
||||
background-image: -moz-linear-gradient(top, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0) 100%); /* FF3.6+ */
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0.05)), color-stop(100%,rgba(0,0,0,0))); /* Chrome,Safari4+ */
|
||||
background-image: -webkit-linear-gradient(top, rgba(0,0,0,0.05) 0%,rgba(0,0,0,0) 100%); /* Chrome10+,Safari5.1+ */
|
||||
background-image: -o-linear-gradient(top, rgba(0,0,0,0.05) 0%,rgba(0,0,0,0) 100%); /* Opera 11.10+ */
|
||||
background-image: -ms-linear-gradient(top, rgba(0,0,0,0.05) 0%,rgba(0,0,0,0) 100%); /* IE10+ */
|
||||
background-image: linear-gradient(to bottom, rgba(0,0,0,0.05) 0%,rgba(0,0,0,0) 100%); /* W3C */
|
||||
background-color: #ddd;
|
||||
color: #000;
|
||||
border: 1px solid #fff;
|
||||
border-radius: 3px;
|
||||
line-height: 20px;
|
||||
padding: 5px 8px 5px 8px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.zulip-button:focus {
|
||||
box-shadow: inset 0px 100px 0px 0px rgba(255,255,255,0.2), 0px 0px 0px 1px rgba(0,0,0,0.2);
|
||||
}
|
||||
|
||||
.zulip-button:hover {
|
||||
background-image: -moz-linear-gradient(top, rgba(0,0,0,0.09) 0%, rgba(0,0,0,0) 100%); /* FF3.6+ */
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0.09)), color-stop(100%,rgba(0,0,0,0))); /* Chrome,Safari4+ */
|
||||
background-image: -webkit-linear-gradient(top, rgba(0,0,0,0.09) 0%,rgba(0,0,0,0) 100%); /* Chrome10+,Safari5.1+ */
|
||||
background-image: -o-linear-gradient(top, rgba(0,0,0,0.09) 0%,rgba(0,0,0,0) 100%); /* Opera 11.10+ */
|
||||
background-image: -ms-linear-gradient(top, rgba(0,0,0,0.09) 0%,rgba(0,0,0,0) 100%); /* IE10+ */
|
||||
background-image: linear-gradient(to bottom, rgba(0,0,0,0.09) 0%,rgba(0,0,0,0) 100%); /* W3C */
|
||||
}
|
||||
|
||||
.sub_unsub_button {
|
||||
min-width: 140px;
|
||||
float: right;
|
||||
|
@ -2607,11 +2578,6 @@ div.floating_recipient {
|
|||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.green-button {
|
||||
background-color: #006e2e; /* Old browsers */
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
button.primary {
|
||||
background-color: #89a0b3;
|
||||
padding: 2px;
|
||||
|
@ -2636,16 +2602,6 @@ button.topic_edit_cancel {
|
|||
margin-top: -1px;
|
||||
}
|
||||
|
||||
.red-button {
|
||||
background-color: #cc0000;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.blue-button {
|
||||
background-color: #0000cc;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.sub_arrow {
|
||||
float: right;
|
||||
line-height: 47px;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{{#if can_make_public}}
|
||||
<button class="zulip-button blue-button make-stream-public-button" data-stream-name="{{name}}" tabindex="-1">
|
||||
<button class="btn btn-primary make-stream-public-button" data-stream-name="{{name}}" tabindex="-1">
|
||||
Make stream public
|
||||
</button>
|
||||
{{/if}}
|
||||
{{#if can_make_private}}
|
||||
<button class="zulip-button red-button make-stream-private-button" data-stream-name="{{name}}" tabindex="-1">
|
||||
<button class="btn btn-danger make-stream-private-button" data-stream-name="{{name}}" tabindex="-1">
|
||||
Make stream private
|
||||
</button>
|
||||
{{/if}}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<div class="subscriber_list_remove">
|
||||
<form class="form-inline remove-subscriber-form">
|
||||
<input type="submit" name="unsubscribe" value="Unsubscribe"
|
||||
class="zulip-button red-button remove-subscriber-button" />
|
||||
class="btn btn-danger remove-subscriber-button" />
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<span class="subscription_description subscription-description-row">{{description}}</span>
|
||||
</span>
|
||||
<span class="sub_arrow"><i class="icon-vector-chevron-down"></i></span>
|
||||
<button class="zulip-button sub_unsub_button {{^subscribed}}gray-button{{/subscribed}}{{#subscribed}} green-button subscribed-button{{/subscribed}}"
|
||||
<button class="btn sub_unsub_button btn-default{{#subscribed}} btn-success subscribed-button{{/subscribed}}"
|
||||
type="button" name="subscription">
|
||||
{{#subscribed}}
|
||||
Subscribed
|
||||
|
@ -74,14 +74,14 @@
|
|||
<div class="rename-stream">
|
||||
<form class="form-inline">
|
||||
<input type="text" name="new-name" value="" class="input-block new-stream-name" tabindex="-1" />
|
||||
<input type="submit" name="rename" value="Rename stream" class="zulip-button red-button stream-rename-button" tabindex="-1" />
|
||||
<input type="submit" name="rename" value="Rename stream" class="btn btn-danger stream-rename-button" tabindex="-1" />
|
||||
</form>
|
||||
</div>
|
||||
<div class="change-stream-description">
|
||||
<form class="form-inline">
|
||||
<input type="hidden" name="stream_name" value="{{name}}" />
|
||||
<input type="text" name="description" value="{{description}}" class="input-block description" tabindex="-1" />
|
||||
<input type="submit" name="change-stream-description" value="Change stream description" class="zulip-button red-button change-stream-description-button" tabindex="-1" />
|
||||
<input type="submit" name="change-stream-description" value="Change stream description" class="btn btn-danger change-stream-description-button" tabindex="-1" />
|
||||
</form>
|
||||
</div>
|
||||
<div class="change-stream-privacy">
|
||||
|
@ -96,7 +96,7 @@
|
|||
<div class="subscriber_list_add">
|
||||
<form class="form-inline">
|
||||
<input type="text" name="principal" placeholder="Email address" value="" class="input-block" tabindex="-1" />
|
||||
<input type="submit" name="add_subscriber" value="Add" class="zulip-button blue-button add-subscriber-button" tabindex="-1 "/>
|
||||
<input type="submit" name="add_subscriber" value="Add" class="btn btn-primary add-subscriber-button" tabindex="-1 "/>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<form id="add_new_subscription" class="form-inline" action="">
|
||||
<input type="text" name="stream_name" id="create_stream_name"
|
||||
placeholder="Stream name" value="" />
|
||||
<input type="submit" class="zulip-button blue-button"
|
||||
<input type="submit" class="btn btn-primary"
|
||||
id="create_stream_button" value="Create new stream" />
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -524,7 +524,7 @@ class StreamSubscribeButton(markdown.inlinepatterns.Pattern):
|
|||
|
||||
button = markdown.util.etree.SubElement(span, 'button')
|
||||
button.text = 'Subscribe to ' + stream_name
|
||||
button.set('class', 'inline-subscribe-button zulip-button')
|
||||
button.set('class', 'inline-subscribe-button btn')
|
||||
|
||||
error = markdown.util.etree.SubElement(span, 'span')
|
||||
error.set('class', 'inline-subscribe-error')
|
||||
|
|
|
@ -323,7 +323,7 @@ class BugdownTest(TestCase):
|
|||
converted,
|
||||
'<p>'
|
||||
'<span class="inline-subscribe" data-stream-name="simple">'
|
||||
'<button class="inline-subscribe-button zulip-button">Subscribe to simple</button>'
|
||||
'<button class="inline-subscribe-button btn">Subscribe to simple</button>'
|
||||
'<span class="inline-subscribe-error"></span>'
|
||||
'</span>'
|
||||
'</p>'
|
||||
|
@ -336,7 +336,7 @@ class BugdownTest(TestCase):
|
|||
converted,
|
||||
'<p>'
|
||||
'<span class="inline-subscribe" data-stream-name="simple (not)">'
|
||||
'<button class="inline-subscribe-button zulip-button">Subscribe to simple (not)</button>'
|
||||
'<button class="inline-subscribe-button btn">Subscribe to simple (not)</button>'
|
||||
'<span class="inline-subscribe-error"></span>'
|
||||
'</span>'
|
||||
'</p>'
|
||||
|
@ -349,7 +349,7 @@ class BugdownTest(TestCase):
|
|||
converted,
|
||||
'<p>'
|
||||
'<span class="inline-subscribe" data-stream-name="simple">'
|
||||
'<button class="inline-subscribe-button zulip-button">Subscribe to simple</button>'
|
||||
'<button class="inline-subscribe-button btn">Subscribe to simple</button>'
|
||||
'<span class="inline-subscribe-error"></span>'
|
||||
'</span>'
|
||||
' (not)</p>'
|
||||
|
@ -362,7 +362,7 @@ class BugdownTest(TestCase):
|
|||
converted,
|
||||
'<p>'
|
||||
'<span class="inline-subscribe" data-stream-name="simple\\">'
|
||||
'<button class="inline-subscribe-button zulip-button">Subscribe to simple\\</button>'
|
||||
'<button class="inline-subscribe-button btn">Subscribe to simple\\</button>'
|
||||
'<span class="inline-subscribe-error"></span>'
|
||||
'</span>'
|
||||
'</p>'
|
||||
|
|
|
@ -14,7 +14,7 @@ casper.then(function () {
|
|||
casper.then(function () {
|
||||
casper.test.assertTextExists('Subscribed', 'Initial subscriptions loaded');
|
||||
casper.fill('form#add_new_subscription', {stream_name: 'Waseemio'});
|
||||
casper.click('form#add_new_subscription input.zulip-button');
|
||||
casper.click('form#add_new_subscription input.btn');
|
||||
casper.waitForText('Waseemio');
|
||||
});
|
||||
casper.then(function () {
|
||||
|
@ -29,13 +29,13 @@ casper.then(function () {
|
|||
casper.then(function () {
|
||||
casper.test.assertSelectorHasText('.subscription_name', 'Waseemio', 'Subscribing to a stream');
|
||||
casper.fill('form#add_new_subscription', {stream_name: 'WASeemio'});
|
||||
casper.click('form#add_new_subscription input.zulip-button');
|
||||
casper.click('form#add_new_subscription input.btn');
|
||||
casper.waitForText('Already subscribed');
|
||||
});
|
||||
casper.then(function () {
|
||||
casper.test.assertTextExists('Already subscribed', "Can't subscribe twice to a stream");
|
||||
casper.fill('form#add_new_subscription', {stream_name: ' '});
|
||||
casper.click('form#add_new_subscription input.zulip-button');
|
||||
casper.click('form#add_new_subscription input.btn');
|
||||
casper.waitForText('Error adding subscription');
|
||||
});
|
||||
casper.then(function () {
|
||||
|
|
Loading…
Reference in New Issue