From 81dc9b769e8062b4128d401ab39665a5277c2665 Mon Sep 17 00:00:00 2001 From: Ryan Shaw Date: Wed, 8 Aug 2012 12:22:01 -0600 Subject: [PATCH] don't call jquery UI methods an elements with no widget initialized aka: no more .dialog('close').dialog({}).dialog('open') (does not actually change any behavior visible to end user) test plan: as far as manual testing goes, try to go to a bunch of pages that have dialogs and open and close them. For engineers, if you can think of other places where we might try to set options on a UI widget before we initialize one (like sortables or something), check that too. Change-Id: I7415c00d8c15b562ac12eeef83fa041aff1dfb35 Reviewed-on: https://gerrit.instructure.com/12810 Tested-by: Jenkins Reviewed-by: Jon Jensen --- .../EditAppointmentGroupDetails.coffee | 5 +- app/coffeescripts/conversations/Inbox.coffee | 4 +- app/coffeescripts/developer_keys.coffee | 6 +-- .../_ldap_settings_test.html.erb | 5 +- .../accounts/_add_course_or_user.html.erb | 10 ++-- .../_question_bank_config.html.erb | 2 +- app/views/courses/show.html.erb | 10 ++-- app/views/files/full_index.html.erb | 5 +- app/views/groups/_add_group_category.html.erb | 5 +- app/views/question_banks/show.html.erb | 8 +-- app/views/quizzes/statistics.html.erb | 5 +- .../shared/_zip_file_import_form.html.erb | 5 +- .../submissions/_submission_download.html.erb | 5 +- public/javascripts/account_settings.js | 12 ++--- public/javascripts/account_statistics.js | 8 +-- public/javascripts/aligned_outcomes.js | 5 +- public/javascripts/assignments.js | 10 ++-- public/javascripts/attendance.js | 10 ++-- public/javascripts/calendar.js | 38 +++++++------- public/javascripts/collaborations.js | 5 +- public/javascripts/communication_channels.js | 9 ++-- public/javascripts/conferences.js | 5 +- public/javascripts/content_locks.js | 5 +- public/javascripts/context_modules.js | 22 ++++----- public/javascripts/course_settings.js | 19 +++---- public/javascripts/edit_rubric.js | 10 ++-- public/javascripts/eportfolio.js | 15 +++--- public/javascripts/external_tools.js | 10 ++-- public/javascripts/find_outcome.js | 5 +- public/javascripts/full_assignment.js | 5 +- public/javascripts/full_files.js | 30 +++++------- public/javascripts/gradebooks.js | 49 ++++++++----------- public/javascripts/grading_standards.js | 5 +- public/javascripts/instructure.js | 17 +++---- .../jquery.instructure_misc_helpers.js | 5 +- public/javascripts/learning_outcomes.js | 10 ++-- public/javascripts/link_enrollment.js | 5 +- public/javascripts/manage_groups.js | 5 +- public/javascripts/moderate_quiz.js | 15 +++--- public/javascripts/profile.js | 17 +++---- public/javascripts/quiz_index.js | 5 +- public/javascripts/quiz_rubric.js | 7 ++- public/javascripts/quizzes.js | 31 +++++------- public/javascripts/rubric_assessment.js | 15 +++--- public/javascripts/section.js | 10 ++-- public/javascripts/select_content_dialog.js | 5 +- public/javascripts/site_admin.js | 5 +- public/javascripts/speed_grader.js | 6 +-- public/javascripts/submit_assignment.js | 5 +- .../instructure_equation/editor_plugin.js | 5 +- .../instructure_links/editor_plugin.js | 5 +- public/javascripts/topic.js | 14 +++--- public/javascripts/topics.js | 5 +- public/javascripts/user_logins.js | 5 +- public/javascripts/user_name.js | 5 +- public/javascripts/wikiSidebar.js | 10 ++-- .../selenium/admin/admin_settings_tab_spec.rb | 2 +- 57 files changed, 232 insertions(+), 334 deletions(-) diff --git a/app/coffeescripts/calendar/EditAppointmentGroupDetails.coffee b/app/coffeescripts/calendar/EditAppointmentGroupDetails.coffee index 54748fb61ea..3b4e895232b 100644 --- a/app/coffeescripts/calendar/EditAppointmentGroupDetails.coffee +++ b/app/coffeescripts/calendar/EditAppointmentGroupDetails.coffee @@ -128,12 +128,9 @@ define [ openHelpDialog: (e) => e.preventDefault() - $("#options_help_dialog").dialog('close').dialog( - autoOpen: false + $("#options_help_dialog").dialog title: I18n.t('affect_reservations', "How will this affect reservations?") width: 400 - ).dialog('open') - saveWithoutPublishingClick: (jsEvent) => jsEvent.preventDefault() diff --git a/app/coffeescripts/conversations/Inbox.coffee b/app/coffeescripts/conversations/Inbox.coffee index f0c983adde6..13ed2126f33 100644 --- a/app/coffeescripts/conversations/Inbox.coffee +++ b/app/coffeescripts/conversations/Inbox.coffee @@ -536,7 +536,7 @@ define [ $(this).closest('li').data('id') $preview.find('> li').last().addClass('last') @$forwardForm.css('max-height', ($(window).height() - 300) + 'px') - .dialog('close').dialog + .dialog position: 'center' height: 'auto' width: 510 @@ -565,7 +565,7 @@ define [ return unless @conversations.active()? @$addForm .attr('action', @conversations.actionUrlFor($(e.currentTarget))) - .dialog('close').dialog + .dialog width: 420 title: I18n.t('title.add_recipients', 'Add Recipients') buttons: [ diff --git a/app/coffeescripts/developer_keys.coffee b/app/coffeescripts/developer_keys.coffee index 0c756de3158..d3e61a6f15b 100644 --- a/app/coffeescripts/developer_keys.coffee +++ b/app/coffeescripts/developer_keys.coffee @@ -65,14 +65,14 @@ define [ $key = $(this).closest(".key") key = $key.data('key') $form = buildForm(key, $key) - $("#edit_dialog").empty().append($form).dialog('close').dialog('open') + $("#edit_dialog").empty().append($form).dialog('open') ) $(".add_key").click((event) -> event.preventDefault() $form = buildForm() - $("#edit_dialog").empty().append($form).dialog('close').dialog('open') + $("#edit_dialog").empty().append($form).dialog('open') ) - $("#edit_dialog").html(developer_key_form({})).dialog('close').dialog({ + $("#edit_dialog").html(developer_key_form({})).dialog({ autoOpen: false, width: 350 }).on('click', '.cancel', () -> diff --git a/app/views/account_authorization_configs/_ldap_settings_test.html.erb b/app/views/account_authorization_configs/_ldap_settings_test.html.erb index 7acd54f9019..0b7b07ad80f 100644 --- a/app/views/account_authorization_configs/_ldap_settings_test.html.erb +++ b/app/views/account_authorization_configs/_ldap_settings_test.html.erb @@ -106,11 +106,10 @@ require([ function testLDAP() { clearTestLDAP(); - $("#test_ldap_dialog").dialog('close').dialog({ - autoOpen: false, + $("#test_ldap_dialog").dialog({ title: <%= jt('#accounts.test_ldap_dialog_title', "Test LDAP Settings") %>, width: 500 - }).dialog('open'); + }); <%= ldap_tests.first.js_function %>(); } function clearTestLDAP() { diff --git a/app/views/accounts/_add_course_or_user.html.erb b/app/views/accounts/_add_course_or_user.html.erb index 3b20143d11c..d3ee6b76152 100644 --- a/app/views/accounts/_add_course_or_user.html.erb +++ b/app/views/accounts/_add_course_or_user.html.erb @@ -122,11 +122,10 @@ require([ $(".add_user_link").click(function(event) { event.preventDefault(); $("#add_user_form :text").val(""); - $("#add_user_dialog").dialog('close').dialog({ - autoOpen: false, + $("#add_user_dialog").dialog({ title: <%= jt('#accounts.add_user_dialog_title', "Add a New User") %>, width: 500 - }).dialog('open'); + }); $("#add_user_form :text:visible:first").focus().select(); }); $("#add_user_form").formSubmit({ @@ -160,11 +159,10 @@ require([ $(".add_course_link").click(function(event) { event.preventDefault(); $("#add_course_form :text").val(""); - $("#add_course_dialog").dialog('close').dialog({ + $("#add_course_dialog").dialog({ title: <%= jt('#accounts.add_course_dialog_title', "Add a New Course") %>, - autoOpen: false, width: 500 - }).dialog('open'); + }); $("#add_course_form :text:visible:first").focus().select(); }); $("#add_course_form").formSubmit({ diff --git a/app/views/content_imports/_question_bank_config.html.erb b/app/views/content_imports/_question_bank_config.html.erb index c8c6f8818ff..eff86b7e7c0 100644 --- a/app/views/content_imports/_question_bank_config.html.erb +++ b/app/views/content_imports/_question_bank_config.html.erb @@ -49,7 +49,7 @@ $("#question_bank_select").change(function() { }); $(".overwrite_questions_description_link").click(function(event) { event.preventDefault(); - $('#overwrite_questions_description').dialog('close').dialog({ + $('#overwrite_questions_description').dialog({ title: 'Overwrite Assessment Data', width: 500 }); diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb index 3db783957f8..7aa22557771 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -105,10 +105,9 @@ require([ $(document).ready(function() { $(".self_unenrollment_link").click(function(event) { - $("#self_unenrollment_dialog").dialog('close').dialog({ - autoOpen: false, + $("#self_unenrollment_dialog").dialog({ title: <%= raw t('titles.drop_course', "Drop this Course").to_json %> - }).dialog('open'); + }); }); $("#self_unenrollment_dialog .action").click(function() { $("#self_unenrollment_dialog a.button").attr('disabled', true); @@ -118,10 +117,9 @@ $(document).ready(function() { $("#self_enrollment_dialog").dialog('close'); }); $(".self_enrollment_link").click(function(event) { - $("#self_enrollment_dialog").dialog('close').dialog({ - autoOpen: false, + $("#self_enrollment_dialog").dialog({ title: <%= raw t('titles.join_course', "Join this Course").to_json %> - }).dialog('open'); + }); }); $("#self_enrollment_dialog .action").click(function() { $("#self_enrollment_dialog a.button").attr('disabled', true); diff --git a/app/views/files/full_index.html.erb b/app/views/files/full_index.html.erb index 9c7041fd4e6..e3902fbdaea 100644 --- a/app/views/files/full_index.html.erb +++ b/app/views/files/full_index.html.erb @@ -524,13 +524,12 @@ window.contexts = <%= raw @contexts.to_json(:permissions => {:user => @current_u INST.downloadFolderFiles = function(url) { var cancelled = false; $("#download_folder_files_dialog .status_box .status").text(<%= jt('#files.messages.gathering_data', "Gathering data...") %>); - $("#download_folder_files_dialog").dialog('close').dialog({ - autoOpen: false, + $("#download_folder_files_dialog").dialog({ title: <%= jt('#files.titles.download_folder_contents', "Download Folder Contents") %>, close: function() { cancelled = true; } - }).dialog('open'); + }); $("#download_folder_files_dialog .progress").progressbar({value: 0}); var checkForChange = function() { if(cancelled || $("#download_folder_files_dialog:visible").length == 0) { return; } diff --git a/app/views/groups/_add_group_category.html.erb b/app/views/groups/_add_group_category.html.erb index 95bb3e426f2..cc46bfbe576 100644 --- a/app/views/groups/_add_group_category.html.erb +++ b/app/views/groups/_add_group_category.html.erb @@ -6,8 +6,7 @@ require([ 'jqueryui/dialog' ], function(I18n, $) { window.addGroupCategory = function(callback) { - $("#add_category_form").dialog('close').dialog({ - autoOpen: false, + $("#add_category_form").dialog({ width: "auto", title: <%= jt('#groups.titles.add_group_category', 'Add Set of Groups') %>, modal: true, @@ -15,7 +14,7 @@ require([ backgroundColor: "#000", opacity: 0.7 } - }).dialog('open'); + }); var callbacks = $("#add_category_form").data('callbacks') || []; callbacks.push(callback); $("#add_category_form").data('callbacks', callbacks); diff --git a/app/views/question_banks/show.html.erb b/app/views/question_banks/show.html.erb index e0b0dad56de..83307b065c5 100644 --- a/app/views/question_banks/show.html.erb +++ b/app/views/question_banks/show.html.erb @@ -327,10 +327,10 @@ $(document).ready(function() { this.elements.$dialog.find('li message').hide(); } - this.elements.$dialog.dialog('close').dialog({ + this.elements.$dialog.dialog({ title: this.messages.move_copy_questions, width: 600 - }).dialog('open'); + }); }, loadData: function(){ this.elements.$questions.append(this.elements.$loadMessage); @@ -368,10 +368,10 @@ $(document).ready(function() { data: template }); $dialog.data('question', $(this).parents(".question_holder")); - $dialog.dialog('close').dialog({ + $dialog.dialog({ width: 600, title: <%= jt('title.move_copy_questions', "Move/Copy Questions") %> - }).dialog('open'); + }); }); $("#move_question_dialog .submit_button").click(function() { var $dialog = $("#move_question_dialog"); diff --git a/app/views/quizzes/statistics.html.erb b/app/views/quizzes/statistics.html.erb index acb9b2e2204..7fb2214476f 100644 --- a/app/views/quizzes/statistics.html.erb +++ b/app/views/quizzes/statistics.html.erb @@ -283,12 +283,11 @@ $(document).ready(function() { answer_text: answer_text, question_name: question_name }}); - $dialog.dialog('close').dialog({ - autoOpen: false, + $dialog.dialog({ title: <%= jt('titles.submitted_users_for_quesiton', "Submitted Users for %{user}", '{\'user\': question_name}') %>, width: 500, height: 300 - }).dialog('open'); + }); } }); }); diff --git a/app/views/shared/_zip_file_import_form.html.erb b/app/views/shared/_zip_file_import_form.html.erb index 510e0311f58..2bd700345eb 100644 --- a/app/views/shared/_zip_file_import_form.html.erb +++ b/app/views/shared/_zip_file_import_form.html.erb @@ -46,14 +46,13 @@ $(document).ready(function() { }).change(); $("#uploading_progressbar").progressbar(); $("#zip_file_import_form").submit(function(){ - $("#uploading_please_wait_dialog").dialog('close').dialog({ + $("#uploading_please_wait_dialog").dialog({ bgiframe: true, width: 400, modal: true, - autoOpen: false, closeOnEscape: false, dialogClass: "ui-dialog-no-close-button" - }).dialog('open'); + }); return true; }); var $frame = $("