From ea79c01aff7241e067e750e0a322a24589ea71ff Mon Sep 17 00:00:00 2001 From: Ivan Filippov Date: Fri, 1 Jul 2016 18:45:42 -0600 Subject: [PATCH] Added SCRIPT_ROOT parameter. Fixes #52. Adds a new javascript parameter that holds the webroot of the app. This allows the the javascript calls to properly identify that they're running in a subfolder/different webroot and direct their queries there. --- app/templates/admin_history.html | 2 +- app/templates/admin_manageuser.html | 6 +++--- app/templates/admin_settings.html | 4 ++-- app/templates/base.html | 4 +++- app/templates/dashboard.html | 2 +- app/templates/domain.html | 4 ++-- app/templates/user_profile.html | 2 +- 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/app/templates/admin_history.html b/app/templates/admin_history.html index 0cd3380..40764d4 100644 --- a/app/templates/admin_history.html +++ b/app/templates/admin_history.html @@ -97,7 +97,7 @@ diff --git a/app/templates/admin_manageuser.html b/app/templates/admin_manageuser.html index 83c8c09..6b6ff64 100644 --- a/app/templates/admin_manageuser.html +++ b/app/templates/admin_manageuser.html @@ -91,7 +91,7 @@ modal.find('.modal-body p').text(info); modal.find('#button_revoke_confirm').click(function() { var postdata = {'action': 'revoke_user_privielges', 'data': username} - applyChanges(postdata, '/admin/manageuser'); + applyChanges(postdata, $SCRIPT_ROOT + '/admin/manageuser'); modal.modal('hide'); }) modal.modal('show'); @@ -104,7 +104,7 @@ modal.find('.modal-body p').text(info); modal.find('#button_delete_confirm').click(function() { var postdata = {'action': 'delete_user', 'data': username} - applyChanges(postdata, '/admin/manageuser', false, true); + applyChanges(postdata, $SCRIPT_ROOT + '/admin/manageuser', false, true); modal.modal('hide'); }) modal.modal('show'); @@ -128,7 +128,7 @@ 'is_admin' : is_admin } }; - applyChanges(postdata, '/admin/manageuser'); + applyChanges(postdata, $SCRIPT_ROOT + '/admin/manageuser'); }); {% endblock %} diff --git a/app/templates/admin_settings.html b/app/templates/admin_settings.html index 65a7ce7..990b672 100644 --- a/app/templates/admin_settings.html +++ b/app/templates/admin_settings.html @@ -76,14 +76,14 @@ }); $(document.body).on('click', '.setting-toggle-button', function() { var setting = $(this).prop('id'); - applyChanges('','/admin/setting/' + setting + '/toggle', false, true) + applyChanges('', $SCRIPT_ROOT + '/admin/setting/' + setting + '/toggle', false, true) }); $(document.body).on('click', '.setting-save-button', function() { var setting = $(this).prop('id'); var value = $(this).parents('tr').find('#value')[0].value; var postdata = {'value': value}; - applyChanges(postdata, '/admin/setting/' + setting + '/edit', false, true) + applyChanges(postdata, $SCRIPT_ROOT + '/admin/setting/' + setting + '/edit', false, true) }); {% endblock %} diff --git a/app/templates/base.html b/app/templates/base.html index 961657d..fd25cc7 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -163,7 +163,9 @@ - + {% block scripts %} diff --git a/app/templates/dashboard.html b/app/templates/dashboard.html index 18063cf..a69b2f5 100644 --- a/app/templates/dashboard.html +++ b/app/templates/dashboard.html @@ -240,7 +240,7 @@ }); $(document.body).on("click", ".button_dnssec", function() { var domain = $(this).prop('id'); - getdnssec('/domain/' + domain + '/dnssec'); + getdnssec($SCRIPT_ROOT + '/domain/' + domain + '/dnssec'); }); {% endblock %} diff --git a/app/templates/domain.html b/app/templates/domain.html index e688c0a..a634d46 100644 --- a/app/templates/domain.html +++ b/app/templates/domain.html @@ -204,7 +204,7 @@ modal.find('.modal-body p').text(info); modal.find('#button_apply_confirm').click(function() { var data = getTableData(table); - applyChanges(data, '/domain/' + domain + '/apply', true); + applyChanges(data, $SCRIPT_ROOT + '/domain/' + domain + '/apply', true); modal.modal('hide'); }) modal.modal('show'); @@ -253,7 +253,7 @@ //handle update_from_master button $(document.body).on("click", ".button_update_from_master", function (e) { var domain = $(this).prop('id'); - applyChanges({'domain': domain}, '/domain/' + domain + '/update'); + applyChanges({'domain': domain}, $SCRIPT_ROOT + '/domain/' + domain + '/update'); }); {% if record_helper_setting %} diff --git a/app/templates/user_profile.html b/app/templates/user_profile.html index 171881c..b69d227 100644 --- a/app/templates/user_profile.html +++ b/app/templates/user_profile.html @@ -165,7 +165,7 @@ 'enable_otp' : enable_otp } }; - applyChanges(postdata, '/user/profile'); + applyChanges(postdata, $SCRIPT_ROOT + '/user/profile'); location.reload(); });