From 413fdeb655ca4aa818d4ad8fe2de32a34c3e8a08 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Wed, 10 Oct 2012 17:28:31 -0400 Subject: [PATCH] Rename class_name to stream_name. (imported from commit e610f5de5edf756ef0a71c5361fcd507adbb1605) --- tools/jslint/check-all.js | 2 +- zephyr/static/js/compose.js | 18 +++++++++--------- zephyr/static/js/subscribe.js | 22 +++++++++++----------- zephyr/static/js/ui.js | 4 ++-- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/tools/jslint/check-all.js b/tools/jslint/check-all.js index 50987383c7..253ba20f95 100644 --- a/tools/jslint/check-all.js +++ b/tools/jslint/check-all.js @@ -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 diff --git a/zephyr/static/js/compose.js b/zephyr/static/js/compose.js index 47872bf889..d7fb0ae602 100644 --- a/zephyr/static/js/compose.js +++ b/zephyr/static/js/compose.js @@ -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(); diff --git a/zephyr/static/js/subscribe.js b/zephyr/static/js/subscribe.js index 727440be38..aa0d23dfd2 100644 --- a/zephyr/static/js/subscribe.js +++ b/zephyr/static/js/subscribe.js @@ -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); } diff --git a/zephyr/static/js/ui.js b/zephyr/static/js/ui.js index 748158d3c9..a0484c2c7d 100644 --- a/zephyr/static/js/ui.js +++ b/zephyr/static/js/ui.js @@ -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) {