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; } });