$def with (props, track_prefix=None) $# @typedef {Object} DropdownLink $# @property {string} text of link $# @property {string|null} href of link for HTTP get request $# @property {string|null} post when set will be used instead of href and should use HTTP POST request. $# @property {string|null} `track` event label for google analytics $# $# @param {Object} props template properties $# @param {string} props.name unique identifying name for dropdown and distinguishing it from other dropdowns $# @param {string} props.label for menu, also used as alt text for dropdown icon when props.image is set $# @param {string|null} props.image URL for image (optional) $# @param {DropdownLink[]} props.links $ singleton = len(props.get('links', [])) == 1 $ is_privileged_user = ctx.user and (ctx.user.is_admin() or ctx.user.is_usergroup_member('/usergroup/super-librarians'))
$if singleton: $ link = props['links'][0] $ tracker = 'data-ol-link-track=%s|%s' % (track_prefix, link['track']) if (track_prefix and link.get('track')) else '' $(props['label']) $else:
$if props['name'] == 'hamburger' and ctx.user: $if is_privileged_user and cached_get_counts_by_mode(mode='open') > 0:
$(cached_get_counts_by_mode(mode='open'))
$(props['label']) $elif 'image' in props: $(props['label']) $elif 'label' in props: $(props['label']) $_('Menu')
$if 'show_mask' in props: