This repository has been archived on 2023-02-02. You can view files and clone it, but cannot push or open issues or pull requests.
barkshark-web/barkshark_web/localweb/macro.haml

51 lines
1.6 KiB
Plaintext

-macro config_textbox(label, key, text=''):
%label for='{{key}}' name='{{key}}' -> =label
%input id='{{key}}' name='{{key}}' value='{{text}}'
%script type='application/javascript'
connect_event('{{key}}', 'focusout', handle_save_config);
connect_event('{{key}}', 'keypress', handle_key_enter);
-macro config_checkbox(label, key, enabled):
-if not enabled
%input id='{{key}}' name='{{key}}' type='checkbox'
-else
%input id='{{key}}' name='{{key}}' type='checkbox' checked
%label for='{{key}}' << {{label}}
%script type='application/javascript'
connect_event('{{key}}', 'change', handle_save_config);
-macro config_dropdown(label, key, value, options):
%label for='{{key}}' << {{label}}
%select id='{{key}}' name='{{key}}'
-for option in options:
-if value == option:
%option value='{{option}}' selected << {{option.title()}}
-else
%option value='{{option}}' << {{option.title()}}
%script type='application/javascript'
connect_event('{{key}}', 'change', handle_save_config)
-macro config_number(label, key, value, min=0, max=100):
%label for='{{key}}' << {{label}}
%input type='number' id='{{key}}' name='{{key}}' value='{{value}}' min='{{min}}' max='{{max}}'
%script type='application/javascript'
connect_event('{{key}}', 'focusout', handle_save_config);
connect_event('{{key}}', 'keypress', handle_key_enter);
-macro menu_item(label, path, icon):
%a.menu-item.grid-container href='{{var.local}}{{path}}'
%img.image.grid-item src='{{var.local}}/icon/{{icon}}' title='{{label}}'
%span.menu-item-text.grid-item style='display:none;' -> =label