diff options
author | Unknwon <u@gogs.io> | 2017-03-19 17:44:46 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-03-19 17:44:46 -0400 |
commit | 2807274e2dca1780443bcbbab946b1551c4c88f5 (patch) | |
tree | 30c58a2e76e6e1338e8fd8e615d08bcd5b22d5bf /public | |
parent | 55a5ad5cdcbe6906f863d0b7f27d1ee500720416 (diff) |
repo/webhook: able to retrigger delivery history (#2187)
Diffstat (limited to 'public')
-rw-r--r-- | public/css/gogs.css | 9 | ||||
-rw-r--r-- | public/js/gogs.js | 138 | ||||
-rw-r--r-- | public/less/_repository.less | 15 |
3 files changed, 91 insertions, 71 deletions
diff --git a/public/css/gogs.css b/public/css/gogs.css index 8bba6016..9a273c80 100644 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -2375,6 +2375,15 @@ footer .ui.language .menu { margin-left: 26px; padding-top: 0; } +.webhook .hook.history.list .right.menu .redelivery.button { + font-size: 12px; + margin-top: 6px; + height: 30px; +} +.webhook .hook.history.list .right.menu .redelivery.button .octicon { + font: normal normal normal 13px/1 Octicons; + width: 12px; +} .user-cards .list { padding: 0; } diff --git a/public/js/gogs.js b/public/js/gogs.js index 6b6a003d..fd6a7d85 100644 --- a/public/js/gogs.js +++ b/public/js/gogs.js @@ -513,20 +513,6 @@ function initRepository() { } } -function initRepositoryCollaboration() { - console.log('initRepositoryCollaboration'); - - // Change collaborator access mode - $('.access-mode.menu .item').click(function () { - var $menu = $(this).parent(); - $.post($menu.data('url'), { - "_csrf": csrf, - "uid": $menu.data('uid'), - "mode": $(this).data('value') - }) - }); -} - function initWikiForm() { var $editArea = $('.repository.wiki textarea#edit_area'); if ($editArea.length > 0) { @@ -828,61 +814,6 @@ function initOrganization() { } } -function initUserSettings() { - console.log('initUserSettings'); - - // Options - if ($('.user.settings.profile').length > 0) { - $('#username').keyup(function () { - var $prompt = $('#name-change-prompt'); - if ($(this).val().toString().toLowerCase() != $(this).data('name').toString().toLowerCase()) { - $prompt.show(); - } else { - $prompt.hide(); - } - }); - } -} - -function initWebhook() { - if ($('.new.webhook').length == 0) { - return; - } - - $('.events.checkbox input').change(function () { - if ($(this).is(':checked')) { - $('.events.fields').show(); - } - }); - $('.non-events.checkbox input').change(function () { - if ($(this).is(':checked')) { - $('.events.fields').hide(); - } - }); - - // Highlight payload on first click - $('.hook.history.list .toggle.button').click(function () { - $($(this).data('target') + ' .nohighlight').each(function () { - var $this = $(this); - $this.removeClass('nohighlight'); - setTimeout(function(){ hljs.highlightBlock($this[0]) }, 500); - }) - }) - - // Test delivery - $('#test-delivery').click(function () { - var $this = $(this); - $this.addClass('loading disabled'); - $.post($this.data('link'), { - "_csrf": csrf - }).done( - setTimeout(function () { - window.location.href = $this.data('redirect'); - }, 5000) - ) - }); -} - function initAdmin() { if ($('.admin').length == 0) { return; @@ -1152,6 +1083,71 @@ function initCodeView() { } } +function initUserSettings() { + console.log('initUserSettings'); + + // Options + if ($('.user.settings.profile').length > 0) { + $('#username').keyup(function () { + var $prompt = $('#name-change-prompt'); + if ($(this).val().toString().toLowerCase() != $(this).data('name').toString().toLowerCase()) { + $prompt.show(); + } else { + $prompt.hide(); + } + }); + } +} + +function initRepositoryCollaboration() { + console.log('initRepositoryCollaboration'); + + // Change collaborator access mode + $('.access-mode.menu .item').click(function () { + var $menu = $(this).parent(); + $.post($menu.data('url'), { + "_csrf": csrf, + "uid": $menu.data('uid'), + "mode": $(this).data('value') + }) + }); +} + +function initWebhookSettings() { + $('.events.checkbox input').change(function () { + if ($(this).is(':checked')) { + $('.events.fields').show(); + } + }); + $('.non-events.checkbox input').change(function () { + if ($(this).is(':checked')) { + $('.events.fields').hide(); + } + }); + + // Highlight payload on first click + $('.hook.history.list .toggle.button').click(function () { + $($(this).data('target') + ' .nohighlight').each(function () { + var $this = $(this); + $this.removeClass('nohighlight'); + setTimeout(function(){ hljs.highlightBlock($this[0]) }, 500); + }) + }) + + // Trigger delivery + $('.delivery.button, .redelivery.button').click(function () { + var $this = $(this); + $this.addClass('loading disabled'); + $.post($this.data('link'), { + "_csrf": csrf + }).done( + setTimeout(function () { + window.location.href = $this.data('redirect'); + }, 5000) + ); + }); +} + $(document).ready(function () { csrf = $('meta[name=_csrf]').attr("content"); suburl = $('meta[name=_suburl]').attr("content"); @@ -1359,7 +1355,6 @@ $(document).ready(function () { initEditForm(); initEditor(); initOrganization(); - initWebhook(); initAdmin(); initCodeView(); @@ -1379,7 +1374,8 @@ $(document).ready(function () { var routes = { 'div.user.settings': initUserSettings, - 'div.repository.settings.collaboration': initRepositoryCollaboration + 'div.repository.settings.collaboration': initRepositoryCollaboration, + 'div.webhook.settings': initWebhookSettings }; var selector; diff --git a/public/less/_repository.less b/public/less/_repository.less index c06fcc45..2a9d490e 100644 --- a/public/less/_repository.less +++ b/public/less/_repository.less @@ -1411,6 +1411,21 @@ } // End of .repository +// Should apply organization webhooks page +.webhook .hook.history.list { + .right.menu { + .redelivery.button { + font-size: 12px; + margin-top: 6px; + height: 30px; + .octicon { + font: normal normal normal 13px/1 Octicons; + width: 12px; + } + } + } +} + &.user-cards { .list { padding: 0; |