Rename class_name to stream_name.

(imported from commit e610f5de5edf756ef0a71c5361fcd507adbb1605)
This commit is contained in:
Tim Abbott 2012-10-10 17:28:31 -04:00
parent ef3b8a2ce5
commit 413fdeb655
4 changed files with 23 additions and 23 deletions

View File

@ -10,7 +10,7 @@ var globals =
// compose.js
+ ' show_compose hide_compose toggle_compose compose_button'
+ ' compose_class_name validate_message'
+ ' compose_stream_name validate_message'
+ ' status_classes'
// dom_access.js

View File

@ -42,7 +42,7 @@ function composing_huddle_message() {
return $("#personal-message").is(":visible");
}
function compose_class_name() {
function compose_stream_name() {
return $.trim($("#class").val());
}
@ -77,17 +77,17 @@ function submit_buttons() {
// *Synchronously* check if a class exists.
// If not, displays an error and returns false.
function check_class_for_send(class_name) {
function check_class_for_send(stream_name) {
var okay = true;
$.ajax({
url: "subscriptions/exists/" + class_name,
url: "subscriptions/exists/" + stream_name,
async: false,
success: function (data) {
if (data === "False") {
// The class doesn't exist
okay = false;
$('#send-status').removeClass(status_classes).show();
$('#class-dne-name').text(class_name);
$('#class-dne-name').text(stream_name);
$('#class-dne').show();
submit_buttons().removeAttr('disabled');
hide_compose();
@ -106,8 +106,8 @@ function check_class_for_send(class_name) {
}
function validate_class_message() {
var class_name = compose_class_name();
if (class_name === "") {
var stream_name = compose_stream_name();
if (stream_name === "") {
compose_error("Please specify a class", $("#class"));
return false;
}
@ -122,13 +122,13 @@ function validate_class_message() {
return false;
}
if (!check_class_for_send(class_name))
if (!check_class_for_send(stream_name))
return false;
if (!subscribed_to(class_name)) {
if (!subscribed_to(stream_name)) {
// You're not subbed to the class
$('#send-status').removeClass(status_classes).show();
$('#class-nosub-name').text(class_name);
$('#class-nosub-name').text(stream_name);
$('#class-nosub').show();
submit_buttons().removeAttr('disabled');
hide_compose();

View File

@ -39,13 +39,13 @@ function sub_from_home(stream, prompt_button) {
stream_list_hash = [];
function subscribed_to(class_name) {
return (stream_list_hash[class_name.toLowerCase()] === true);
function subscribed_to(stream_name) {
return (stream_list_hash[stream_name.toLowerCase()] === true);
}
function case_insensitive_subscription_index(class_name) {
function case_insensitive_subscription_index(stream_name) {
var i;
var name = class_name.toLowerCase();
var name = stream_name.toLowerCase();
for (i = 1; i < stream_list.length; i++) {
if (name === stream_list[i].toLowerCase()) {
@ -55,16 +55,16 @@ function case_insensitive_subscription_index(class_name) {
return -1;
}
function add_to_stream_list(class_name) {
if (!subscribed_to(class_name)) {
stream_list.push(class_name);
stream_list_hash[class_name.toLowerCase()] = true;
function add_to_stream_list(stream_name) {
if (!subscribed_to(stream_name)) {
stream_list.push(stream_name);
stream_list_hash[stream_name.toLowerCase()] = true;
}
}
function remove_from_stream_list(class_name) {
delete stream_list_hash[class_name.toLowerCase()];
var removal_index = case_insensitive_subscription_index(class_name);
function remove_from_stream_list(stream_name) {
delete stream_list_hash[stream_name.toLowerCase()];
var removal_index = case_insensitive_subscription_index(stream_name);
if (removal_index !== -1) {
stream_list.splice(removal_index, 1);
}

View File

@ -134,12 +134,12 @@ $(function () {
// Prepare the click handler for subbing to a new class to which
// you have composed a message.
$('#create-it').click(function () {
sub_from_home(compose_class_name(), $('#class-dne'));
sub_from_home(compose_stream_name(), $('#class-dne'));
});
// Prepare the click handler for subbing to an existing class.
$('#sub-it').click(function () {
sub_from_home(compose_class_name(), $('#class-nosub'));
sub_from_home(compose_stream_name(), $('#class-nosub'));
});
var throttled_scrollhandler = $.throttle(50, function(e) {