##// END OF EJS Templates
settings: simplify handling of form values for hooks and extensions...
settings: simplify handling of form values for hooks and extensions This makes simpler to follow the code path and search for input input field names. The form field names are hardcoded in the template, so generating them programmatically in the controller do not really add any flexibility.

File last commit:

r3198:c20adbaf beta
r3570:8173b0cf beta
Show More
hooks.html
96 lines | 3.0 KiB | text/html | HtmlLexer
Added more advanced hook management into rhodecode admin settings
r1460 ## -*- coding: utf-8 -*-
<%inherit file="/base/base.html"/>
<%def name="title()">
${_('Settings administration')} - ${c.rhodecode_name}
</%def>
<%def name="breadcrumbs_links()">
${h.link_to(_('Admin'),h.url('admin_home'))} &raquo; ${_('Settings')}
</%def>
<%def name="page_nav()">
Mads Kiilerich
html: don't use tabs
r3197 ${self.menu('admin')}
Added more advanced hook management into rhodecode admin settings
r1460 </%def>
<%def name="main()">
<div class="box">
<!-- box / title -->
<div class="title">
White-space cleanup
r1888 ${self.breadcrumbs()}
Added more advanced hook management into rhodecode admin settings
r1460 </div>
<!-- end box / title -->
White-space cleanup
r1888
Added more advanced hook management into rhodecode admin settings
r1460 <h3>${_('Built in hooks - read only')}</h3>
<div class="form">
<div class="fields">
% for hook in c.hooks:
Mads Kiilerich
html: random indentation fixes
r3198 <div class="field">
<div class="label label">
<label for="${hook.ui_key}">${hook.ui_key}</label>
</div>
<div class="input" style="margin-left:280px">
${h.text(hook.ui_key,hook.ui_value,size=60,readonly="readonly")}
</div>
Mads Kiilerich
html: don't use tabs
r3197 </div>
Added more advanced hook management into rhodecode admin settings
r1460 % endfor
Mads Kiilerich
html: don't use tabs
r3197 </div>
Added more advanced hook management into rhodecode admin settings
r1460 </div>
White-space cleanup
r1888
Added more advanced hook management into rhodecode admin settings
r1460 <h3>${_('Custom hooks')}</h3>
${h.form(url('admin_setting', setting_id='hooks'),method='put')}
<div class="form">
<div class="fields">
White-space cleanup
r1888
Added more advanced hook management into rhodecode admin settings
r1460 % for hook in c.custom_hooks:
<div class="field" id="${'id%s' % hook.ui_id }">
<div class="label label">
<label for="${hook.ui_key}">${hook.ui_key}</label>
</div>
White-space cleanup
r1888 <div class="input" style="margin-left:280px">
Added more advanced hook management into rhodecode admin settings
r1460 ${h.hidden('hook_ui_key',hook.ui_key)}
${h.hidden('hook_ui_value',hook.ui_value)}
${h.text('hook_ui_value_new',hook.ui_value,size=60)}
White-space cleanup
r1888 <span class="delete_icon action_button"
Added more advanced hook management into rhodecode admin settings
r1460 onclick="ajaxActionHook(${hook.ui_id},'${'id%s' % hook.ui_id }')">
${_('remove')}
</span>
</div>
</div>
White-space cleanup
r1888 % endfor
Added more advanced hook management into rhodecode admin settings
r1460 <div class="field">
<div class="input" style="margin-left:-180px;position: absolute;">
<div class="input">
${h.text('new_hook_ui_key',size=30)}
</div>
</div>
<div class="input" style="margin-left:280px">
${h.text('new_hook_ui_value',size=60)}
</div>
</div>
<div class="buttons" style="margin-left:280px">
removed deprecated ui-button
r2607 ${h.submit('save',_('Save'),class_="ui-btn large")}
White-space cleanup
r1888 </div>
Added more advanced hook management into rhodecode admin settings
r1460 </div>
</div>
${h.end_form()}
</div>
<script type="text/javascript">
function ajaxActionHook(hook_id,field_id) {
var sUrl = "${h.url('admin_setting', setting_id='hooks')}";
var callback = {
success: function (o) {
var elem = YUD.get(""+field_id);
elem.parentNode.removeChild(elem);
},
failure: function (o) {
alert("${_('Failed to remove hook')}");
},
};
var postData = '_method=delete&hook_id=' + hook_id;
var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
};
</script>
White-space cleanup
r1888
</%def>