diff options
author | Unknwon <joe2010xtmf@163.com> | 2014-08-14 14:12:21 +0800 |
---|---|---|
committer | Unknwon <joe2010xtmf@163.com> | 2014-08-14 14:12:21 +0800 |
commit | 5acc948562547b393ba1e89b012e7421143c6dd8 (patch) | |
tree | 657653112b206fb01ff184bd30cb680b5b5a21fa /public/ng/js | |
parent | 2935ee440c82a7f998a74159255cc38924f6e0bc (diff) | |
download | gitea-5acc948562547b393ba1e89b012e7421143c6dd8.tar.gz gitea-5acc948562547b393ba1e89b012e7421143c6dd8.zip |
Page: `/org/:orgname/settings`
Diffstat (limited to 'public/ng/js')
-rw-r--r-- | public/ng/js/gogs.js | 80 |
1 files changed, 49 insertions, 31 deletions
diff --git a/public/ng/js/gogs.js b/public/ng/js/gogs.js index 473997e9ee..ad8df99716 100644 --- a/public/ng/js/gogs.js +++ b/public/ng/js/gogs.js @@ -225,6 +225,30 @@ function initCore() { Gogs.renderCodeView(); } +function initUserSetting() { + // Confirmation of change username in user profile page. + $('#user-profile-form').submit(function (e) { + var $username = $('#username'); + if (($username.data('uname') != $username.val()) && !confirm('Username has been changed, do you want to continue?')) { + e.preventDefault(); + return true; + } + }); + + // Show add SSH key panel. + $('#ssh-add').click(function () { + $('#user-ssh-add-form').removeClass("hide"); + }); + + // Confirmation of delete account. + $('#delete-account-button').click(function (e) { + if (!confirm('This account is going to be deleted, do you want to continue?')) { + e.preventDefault(); + return true; + } + }); +} + function initRepoCreate() { // Owner switch menu click. $('#repo-create-owner-list').on('click', 'li', function () { @@ -286,21 +310,43 @@ function initRepoSetting() { }); } +function initOrgSetting() { + // Options. + // Confirmation of changing organization name. + $('#org-setting-form').submit(function (e) { + var $orgname = $('#orgname'); + if (($orgname.data('orgname') != $orgname.val()) && !confirm('Organization name has been changed, do you want to continue?')) { + e.preventDefault(); + return true; + } + }); + // Confirmation of delete organization. + $('#delete-org-button').click(function (e) { + if (!confirm('This organization is going to be deleted, do you want to continue?')) { + e.preventDefault(); + return true; + } + }); +} + $(document).ready(function () { initCore(); + if ($('#user-profile-setting').length) { + initUserSetting(); + } if ($('#repo-create-form').length || $('#repo-migrate-form').length) { initRepoCreate(); } if ($('#repo-setting').length) { initRepoSetting(); } + if ($('#org-setting').length) { + initOrgSetting(); + } Tabs('#dashboard-sidebar-menu'); homepage(); - settingsProfile(); - settingsSSHKeys(); - settingsDelete(); // Fix language drop-down menu height. var l = $('#footer-lang li').length; @@ -328,32 +374,4 @@ function homepage() { } $('#promo-form').attr('action', '/user/sign_up'); }); -} - -function settingsProfile() { - // Confirmation of change username in user profile page. - $('#user-profile-form').submit(function (e) { - var $username = $('#username'); - if (($username.data('uname') != $username.val()) && !confirm('Username has been changed, do you want to continue?')) { - e.preventDefault(); - return true; - } - }); -} - -function settingsSSHKeys() { - // Show add SSH key panel. - $('#ssh-add').click(function () { - $('#user-ssh-add-form').removeClass("hide"); - }); -} - -function settingsDelete() { - // Confirmation of delete account. - $('#delete-account-button').click(function (e) { - if (!confirm('This account is going to deleted, do you want to continue?')) { - e.preventDefault(); - return true; - } - }); }
\ No newline at end of file |