Files @ 4304595d246c
Branch filter:

Location: kallithea/kallithea/templates/admin/settings/settings_hooks.html

Mads Kiilerich
style: in preparation for Bootstrap, refactor to use Bootstrap compatible form class names

Based on work by Dominik Ruf.

Mostly:

sed -i \
-e 's,<table>,<table class="table">,g' \
-e 's,<div class="fields">,<div class="form-horizontal">,g' \
-e 's,<div class="field">,<div class="form-group">,g' \
-e 's,<label for="\([^"]*\)">,<label class="control-label" for="\1">,g' \
`hg mani`

cat kallithea/public/css/style.css | \
sed -e '/\.fields\>/{p;s/\.fields/.form-horizontal/g}' | \
sed -e '/\.fields\>/s/ {$/,/g' | \
sed -e '/\.field\>/{p;s/\.field\>/.form-group/g}' | \
sed -e '/\.field\>/s/ {$/,/g' | \
sed -e '/\.fields\>.*\.form-group\>/d' | \
sed -e '/\.form-horizontal\>.*\.field\>/d ' | \
cat - > kallithea/public/css/style.css.tmp
mv kallithea/public/css/style.css.tmp kallithea/public/css/style.css
<h4>${_('Built-in Mercurial Hooks (Read-Only)')}</h4>
<div class="form">
    <div class="form-horizontal">
      % for hook in c.hooks:
        <div class="form-group">
            <div class="label label">
                <label class="control-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>
        </div>
      % endfor
    </div>
    <span class="help-block">${_('Hooks can be used to trigger actions on certain events such as push / pull. They can trigger Python functions or external applications.')}</span>
</div>

% if c.visual.allow_custom_hooks_settings:
<h4>${_('Custom Hooks')}</h4>
${h.form(url('admin_settings_hooks'), method='post')}
<div class="form">
    <div class="form-horizontal">

      % for hook in c.custom_hooks:
      <div class="field"  id="${'id%s' % hook.ui_id }">
        <div class="label label">
            <label class="control-label" for="${hook.ui_key}">${hook.ui_key}</label>
        </div>
        <div class="input" style="margin-left:280px">
            ${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)}
            <span class="action_button"
                onclick="delete_hook(${hook.ui_id},'${'id%s' % hook.ui_id }')">
            <i class="icon-minus-circled" style="color:#FF4444"></i>
            ${_('Delete')}
            </span>
        </div>
      </div>
      % endfor

      <div class="form-group">
        <div class="input" style="margin-left:-135px;position: absolute;">
          <div class="input">
             ${h.text('new_hook_ui_key',size=20)}
          </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">
         ${h.submit('save',_('Save'),class_="btn btn-default")}
      </div>
    </div>
</div>
${h.end_form()}
% endif

<script type="text/javascript">
function delete_hook(hook_id, field_id) {
    var sUrl = "${h.url('admin_settings_hooks_delete')}";
    var success = function (o) {
            $('#' + field_id).remove();
        };
    var failure = function (o) {
            alert("${_('Failed to remove hook')}");
        };
    var postData = {'hook_id': hook_id};
    ajaxPOST(sUrl, postData, success, failure);
};
</script>