| {#- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| -#} |
| {% extends g.theme.master %} |
| |
| {% block title %}{{c.project.name}} / Webhooks{% endblock %} |
| {% block header %}Webhooks{% endblock %} |
| |
| {% block content %} |
| {% for hook in webhooks %} |
| <h1>{{ hook.type }}</h1> |
| <p><a href="{{admin_url}}/{{hook.type}}">Create</a></p> |
| {% if configured_hooks[hook.type] %} |
| <table> |
| {% for wh in configured_hooks[hook.type] %} |
| <tr> |
| <td title="{{wh.hook_url}}">{{ wh.hook_url|truncate(40, True) }}</td> |
| <td>{{ wh.secret or '' }}</td> |
| <td><a href="{{wh.url()}}">Edit</a></td> |
| <td> |
| {{ g.icons['delete'].render( |
| href='{}/{}/delete'.format(admin_url, hook.type), |
| extra_css='delete-link', |
| show_title=True, |
| **{'data-id': h.really_unicode(wh._id)}) }} |
| </td> |
| </tr> |
| {% endfor %} |
| </table> |
| {% endif %} |
| {% endfor %} |
| {% endblock %} |
| |
| {% block extra_js %} |
| <script type="text/javascript"> |
| $(function() { |
| $('.delete-link').click(function(e) { |
| e.preventDefault(); |
| var id = $(this).attr('data-id'); |
| var csrf = $.cookie('_session_id'); |
| var data = {'webhook': id, '_session_id': csrf}; |
| var url = $(this).attr('href'); |
| var $tr = $(this).parents('tr'); |
| $.post(url, data, function(data) { |
| if (data['status'] === 'ok') { |
| $tr.remove(); |
| } else { |
| console.log(data); |
| } |
| }); |
| }); |
| }); |
| </script> |
| {% endblock %} |