From ef3b8a2ce55b2fd5eb992b2d2895ecd5fb154023 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Wed, 10 Oct 2012 17:26:01 -0400 Subject: [PATCH] Rename class_list to stream_list. (imported from commit c9f5b10acdb20d3e923cf7f32bc5a3f37aa40705) --- templates/zephyr/index.html | 2 +- tools/jslint/check-all.js | 6 +++--- zephyr/static/js/subscribe.js | 26 +++++++++++++------------- zephyr/static/js/ui.js | 4 ++-- zephyr/static/js/zephyr.js | 6 +++--- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/templates/zephyr/index.html b/templates/zephyr/index.html index c51c83860c..055024f409 100644 --- a/templates/zephyr/index.html +++ b/templates/zephyr/index.html @@ -45,7 +45,7 @@ {% autoescape off %} var initial_pointer = {{ user_profile.pointer }}; var email = "{{ user_profile.user.email }}"; -var class_list = {{ streams }}; +var stream_list = {{ streams }}; var people_list = {{ people }}; var have_initial_messages = {{ have_initial_messages }}; {% endautoescape %} diff --git a/tools/jslint/check-all.js b/tools/jslint/check-all.js index ce916ce642..50987383c7 100644 --- a/tools/jslint/check-all.js +++ b/tools/jslint/check-all.js @@ -6,7 +6,7 @@ var globals = ' $ jQuery Spinner Handlebars XDate' // index.html - + ' initial_pointer email class_list people_list have_initial_messages' + + ' initial_pointer email stream_list people_list have_initial_messages' // compose.js + ' show_compose hide_compose toggle_compose compose_button' @@ -28,8 +28,8 @@ var globals = + ' loading_spinner templates' // subscribe.js - + ' fetch_subs sub_from_home subscribed_to class_list_hash' - + ' add_to_class_list' + + ' fetch_subs sub_from_home subscribed_to stream_list_hash' + + ' add_to_stream_list' // ui.js + ' register_onclick hide_email show_email' diff --git a/zephyr/static/js/subscribe.js b/zephyr/static/js/subscribe.js index a3749529cd..727440be38 100644 --- a/zephyr/static/js/subscribe.js +++ b/zephyr/static/js/subscribe.js @@ -27,7 +27,7 @@ function sub_from_home(stream, prompt_button) { dataType: 'json', timeout: 10*60*1000, // 10 minutes in ms success: function (response) { - add_to_class_list(response.data); + add_to_stream_list(response.data); $("#compose form").ajaxSubmit(); prompt_button.stop(true).fadeOut(500); }, @@ -37,36 +37,36 @@ function sub_from_home(stream, prompt_button) { }); } -class_list_hash = []; +stream_list_hash = []; function subscribed_to(class_name) { - return (class_list_hash[class_name.toLowerCase()] === true); + return (stream_list_hash[class_name.toLowerCase()] === true); } function case_insensitive_subscription_index(class_name) { var i; var name = class_name.toLowerCase(); - for (i = 1; i < class_list.length; i++) { - if (name === class_list[i].toLowerCase()) { + for (i = 1; i < stream_list.length; i++) { + if (name === stream_list[i].toLowerCase()) { return i; } } return -1; } -function add_to_class_list(class_name) { +function add_to_stream_list(class_name) { if (!subscribed_to(class_name)) { - class_list.push(class_name); - class_list_hash[class_name.toLowerCase()] = true; + stream_list.push(class_name); + stream_list_hash[class_name.toLowerCase()] = true; } } -function remove_from_class_list(class_name) { - delete class_list_hash[class_name.toLowerCase()]; +function remove_from_stream_list(class_name) { + delete stream_list_hash[class_name.toLowerCase()]; var removal_index = case_insensitive_subscription_index(class_name); if (removal_index !== -1) { - class_list.splice(removal_index, 1); + stream_list.splice(removal_index, 1); } } @@ -77,7 +77,7 @@ $(function () { success: function (resp, statusText, xhr, form) { var name = $.parseJSON(xhr.responseText).data; $('#subscriptions_table').find('button[value="' + name + '"]').parents('tr').remove(); - remove_from_class_list(name); + remove_from_stream_list(name); update_autocomplete(); report_success("Successfully removed subscription to " + name, $("#subscriptions-status")); @@ -93,7 +93,7 @@ $(function () { $("#new_subscription").val(""); var name = $.parseJSON(xhr.responseText).data; $('#subscriptions_table').prepend(templates.subscription({subscription: name})); - add_to_class_list(name); + add_to_stream_list(name); report_success("Successfully added subscription to " + name, $("#subscriptions-status")); $("#new_subscription").focus(); diff --git a/zephyr/static/js/ui.js b/zephyr/static/js/ui.js index df27ab6f34..748158d3c9 100644 --- a/zephyr/static/js/ui.js +++ b/zephyr/static/js/ui.js @@ -74,13 +74,13 @@ function mousemove() { var autocomplete_needs_update = false; function update_autocomplete() { - class_list.sort(); + stream_list.sort(); instance_list.sort(); people_list.sort(); // limit number of items so the list doesn't fall off the screen $( "#class" ).typeahead({ - source: class_list, + source: stream_list, items: 3 }); $( "#instance" ).typeahead({ diff --git a/zephyr/static/js/zephyr.js b/zephyr/static/js/zephyr.js index 0314fdc4d6..c43e1a3999 100644 --- a/zephyr/static/js/zephyr.js +++ b/zephyr/static/js/zephyr.js @@ -38,9 +38,9 @@ $(function () { send_status.hide(); $("#compose form").ajaxForm(options); - // Populate class_list_hash with data handed over to client-side template. - for (i = 0; i < class_list.length; i++) { - class_list_hash[class_list[i].toLowerCase()] = true; + // Populate stream_list_hash with data handed over to client-side template. + for (i = 0; i < stream_list.length; i++) { + stream_list_hash[stream_list[i].toLowerCase()] = true; } });