From 054892aea2d273590aa39b622bb4c5c979990b47 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 8 May 2018 19:58:38 +1000 Subject: [PATCH] Cleaner handling of default modal param --- InvenTree/static/script/inventree/modals.js | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/InvenTree/static/script/inventree/modals.js b/InvenTree/static/script/inventree/modals.js index 32de32da8c..624ba23997 100644 --- a/InvenTree/static/script/inventree/modals.js +++ b/InvenTree/static/script/inventree/modals.js @@ -96,11 +96,7 @@ function openModal(modal, title='', content='') { function launchDeleteForm(url, options = {}) { - var modal = '#modal-delete'; - - if (options.modal) { - modal = options.modal; - } + var modal = options.modal || '#modal-delete'; $(modal).on('shown.bs.modal', function() { $(modal + ' .modal-form-content').scrollTop(0); @@ -164,11 +160,7 @@ function injectModalForm(modal, form_html) { function handleModalForm(url, options) { - var modal = '#modal-form'; - - if (options.modal) { - modal = options.modal; - } + var modal = options.modal || '#modal-form'; var form = $(modal).find('.js-modal-form'); @@ -232,11 +224,7 @@ function handleModalForm(url, options) { */ function launchModalForm(url, options = {}) { - var modal = '#modal-form'; - - if (options.modal) { - modal = options.modal; - } + var modal = options.modal || '#modal-form'; // Form the ajax request to retrieve the django form data ajax_data = {