<commit_before><%def name="formatting()">
    <div class="formatting">
        ${h.help_link(_("formatting hints"), 'formatting')|n}
    </div>
</%def>


<%def name="headline()">

</%def>


<%def name="admin_controls()">
<div class="admin_controls">
    ${caller.body()}
</div>
</%def>


<%def name="build_infobox()">
<div class="info_box to_hide">
    <a class="close_button only-js">close</a>
    ${caller.body()}
</div>
</%def>


<%def name="flashmessages()">
<% messages = h.sorted_flash_messages() %>
%if messages:
    %for message in messages:
    <div class="alert alert-${message.category}">
        <a class="close only-js" data-dismiss="alert" href="#">x</a>
        ${message}
    </div>
    %endfor
%endif
</%def>


<%def name="savebox(cancel_url, save_text=None, save_value='save', tabindex=99)">
    <%
    save_text = save_text if save_text is not None else _("Save")
    %>
    <div class="savebox">
        <button type="submit" class="btn btn-primary" 
                tabindex="${tabindex}" value="${save_value}">
            ${save_text}
        </button>
        %if cancel_url is not None:
            <span class="cancel">
                ${_("or")} <a href="${cancel_url}">${_("cancel")}</a>
            </span>
        %endif
    </div>
</%def>


<%def name="form_watch(entity, checked=False)">
    %if can.watch.create():
    <%
        if entity:
            checked = checked or (h.find_watch(entity) is not None)
        %>
        <label for="watch">
        <input class="watch" type="checkbox" ${'checked=\"checked\"' if checked else ''} name="watch" id="watch" />
        ${_("Notify me of updates.")}        
        </label>
    %endif
</%def>


<%def name="watch(entity)">
    ## FIXME: turn into an ajax call
    %if c.user:
    <%
    if isinstance(entity, model.Page):
        follow_text = _("Follow Norm")
    elif isinstance(entity, model.Instance):
        follow_text = _("Follow Instance")
    elif isinstance(entity, model.Proposal):
        follow_text = _("Follow Proposal")
    elif isinstance(entity, model.Milestone):
        follow_text = _("Follow Milestone")
    elif isinstance(entity, model.User):
        follow_text = _("Follow User")
    elif isinstance(entity, model.Comment):
        follow_text = _("Follow Comment")
    elif isinstance(entity, model.Tag):
        follow_text = _("Follow Tag")
    else:
        log.error('Unknown entity for watch button: %s' % entity)

    skip = False
    watch = h.find_watch(entity)

    if watch and can.watch.delete(watch):
        css_cls = "active"
        text = _('Following')
        hover_text = _('Unfollow')
        href = h.base_url('/watch/delete?watch=%s&amp;%s' % (watch.id,
                                                             h.url_token()))
    elif not watch and can.watch.create():
        css_cls = ""
        text = hover_text = follow_text
        href = h.base_url('/watch/create?%s&amp;%s' % (h.make_watch(entity),
                                                       h.url_token()))
    else:
        skip = True
    %>
    %if skip:
    <div class="skip_follow">
        <%doc>
        placeholder div to fill the space if we cannot render a widget.
        FIXME: What if a user is authenticated, but is not allowed
        to watch/unwatch
        </%doc>
    </div>
    %else:
    <a class="follow_paper ${css_cls}" href="${href}"
       data-text="${text}" data-hover-text="${hover_text}">${text}</a>
    %endif

    %else:
    ## (not c.user)
    <div class="skip_follow">
        <%doc>
        FIXME: render a replacement with auth instructions. Problem:
        FIXME: How to determinate if login and join the instance is enough?
        </%doc>
    </div>
    %endif
</%def>

<%def name="title()"></%def>


<%def name="vertical_tabs(items, css_class, current_variant=None)">
<nav>
    <div id="sidebar_nav" class="${css_class}"><div>
        <ul>
            %for item in items:
            <li>
                <a href="${item['href']}"
                   data-bind="click: function() {loadVariant('${item['variant']}', '${item['href']}')},
                              css: {current: variants.current.variant() === '${item['variant']}'}"
                   class="${'current' if current_variant == item['variant'] else ''}">
                    <span class="truncate">${item['title']}</span>
                    <span class="count">${item['rendered_score']}</span>
                </a>
            </li>
            %endfor
        </ul>
    </div></div>
</nav>
</%def>


<%def name="social_share_buttons(entity)">
<%
h.need.socialshareprivacy
base_url = h.get_socialshareprivacy_url()
text = "%s - %s: %s" % (h.site.name(), c.instance.label, entity.title)
%>
<div id="socialshareprivacy"></div>
<script type="text/javascript">
$(document).ready(function () {
    adhocracy.helpers.createSocialButtons('#socialshareprivacy', '${text}',
    '${base_url}', '.${h.site.domain()}');
});
</script>

</%def>


<%def name="head()">
  <meta charset="utf-8" />
    <title>${'self.title() - ' if self.title() else ''} - 
            %if c.instance:
                 ${c.instance.label} 
            %endif
                ${h.site.name()}
    </title>

    <meta http-equiv="X-XRDS-Location" 
          content="${h.base_url('/openid/xrds', absolute=True)}" />

    %for key, value in c.html_meta.items():
    <meta name="${key}" content="${value}" />
    %endfor

    <!-- template -->

    <%
    h.need.stylesheets
    h.need.modernizr
    h.need.jquery
    h.need.jquerytools<commit_msg>Strip dash from frontpage title (Port of https://github.com/hhucn/adhocracy.hhu_theme/issues/117 )<commit_after><%def name="formatting()">
    <div class="formatting">
        ${h.help_link(_("formatting hints"), 'formatting')|n}
    </div>
</%def>


<%def name="headline()">

</%def>


<%def name="admin_controls()">
<div class="admin_controls">
    ${caller.body()}
</div>
</%def>


<%def name="build_infobox()">
<div class="info_box to_hide">
    <a class="close_button only-js">close</a>
    ${caller.body()}
</div>
</%def>


<%def name="flashmessages()">
<% messages = h.sorted_flash_messages() %>
%if messages:
    %for message in messages:
    <div class="alert alert-${message.category}">
        <a class="close only-js" data-dismiss="alert" href="#">x</a>
        ${message}
    </div>
    %endfor
%endif
</%def>


<%def name="savebox(cancel_url, save_text=None, save_value='save', tabindex=99)">
    <%
    save_text = save_text if save_text is not None else _("Save")
    %>
    <div class="savebox">
        <button type="submit" class="btn btn-primary" 
                tabindex="${tabindex}" value="${save_value}">
            ${save_text}
        </button>
        %if cancel_url is not None:
            <span class="cancel">
                ${_("or")} <a href="${cancel_url}">${_("cancel")}</a>
            </span>
        %endif
    </div>
</%def>


<%def name="form_watch(entity, checked=False)">
    %if can.watch.create():
    <%
        if entity:
            checked = checked or (h.find_watch(entity) is not None)
        %>
        <label for="watch">
        <input class="watch" type="checkbox" ${'checked=\"checked\"' if checked else ''} name="watch" id="watch" />
        ${_("Notify me of updates.")}        
        </label>
    %endif
</%def>


<%def name="watch(entity)">
    ## FIXME: turn into an ajax call
    %if c.user:
    <%
    if isinstance(entity, model.Page):
        follow_text = _("Follow Norm")
    elif isinstance(entity, model.Instance):
        follow_text = _("Follow Instance")
    elif isinstance(entity, model.Proposal):
        follow_text = _("Follow Proposal")
    elif isinstance(entity, model.Milestone):
        follow_text = _("Follow Milestone")
    elif isinstance(entity, model.User):
        follow_text = _("Follow User")
    elif isinstance(entity, model.Comment):
        follow_text = _("Follow Comment")
    elif isinstance(entity, model.Tag):
        follow_text = _("Follow Tag")
    else:
        log.error('Unknown entity for watch button: %s' % entity)

    skip = False
    watch = h.find_watch(entity)

    if watch and can.watch.delete(watch):
        css_cls = "active"
        text = _('Following')
        hover_text = _('Unfollow')
        href = h.base_url('/watch/delete?watch=%s&amp;%s' % (watch.id,
                                                             h.url_token()))
    elif not watch and can.watch.create():
        css_cls = ""
        text = hover_text = follow_text
        href = h.base_url('/watch/create?%s&amp;%s' % (h.make_watch(entity),
                                                       h.url_token()))
    else:
        skip = True
    %>
    %if skip:
    <div class="skip_follow">
        <%doc>
        placeholder div to fill the space if we cannot render a widget.
        FIXME: What if a user is authenticated, but is not allowed
        to watch/unwatch
        </%doc>
    </div>
    %else:
    <a class="follow_paper ${css_cls}" href="${href}"
       data-text="${text}" data-hover-text="${hover_text}">${text}</a>
    %endif

    %else:
    ## (not c.user)
    <div class="skip_follow">
        <%doc>
        FIXME: render a replacement with auth instructions. Problem:
        FIXME: How to determinate if login and join the instance is enough?
        </%doc>
    </div>
    %endif
</%def>

<%def name="title()"></%def>


<%def name="vertical_tabs(items, css_class, current_variant=None)">
<nav>
    <div id="sidebar_nav" class="${css_class}"><div>
        <ul>
            %for item in items:
            <li>
                <a href="${item['href']}"
                   data-bind="click: function() {loadVariant('${item['variant']}', '${item['href']}')},
                              css: {current: variants.current.variant() === '${item['variant']}'}"
                   class="${'current' if current_variant == item['variant'] else ''}">
                    <span class="truncate">${item['title']}</span>
                    <span class="count">${item['rendered_score']}</span>
                </a>
            </li>
            %endfor
        </ul>
    </div></div>
</nav>
</%def>


<%def name="social_share_buttons(entity)">
<%
h.need.socialshareprivacy
base_url = h.get_socialshareprivacy_url()
text = "%s - %s: %s" % (h.site.name(), c.instance.label, entity.title)
%>
<div id="socialshareprivacy"></div>
<script type="text/javascript">
$(document).ready(function () {
    adhocracy.helpers.createSocialButtons('#socialshareprivacy', '${text}',
    '${base_url}', '.${h.site.domain()}');
});
</script>

</%def>


<%def name="head()">
  <meta charset="utf-8" />
    <title>${'self.title() - ' if self.title() else ''}
            %if c.instance:
                 ${c.instance.label} -
            %endif
                ${h.site.name()}
    </title>

    <meta http-equiv="X-XRDS-Location" 
          content="${h.base_url('/openid/xrds', absolute=True)}" />

    %for key, value in c.html_meta.items():
    <meta name="${key}" content="${value}" />
    %endfor

    <!-- template -->

    <%
    h.need.stylesheets
    h.need.modernizr
    h.need.jquery
    h.need.jquerytools
{'fraction_non_alphanumeric': 0.18118998474378534, 'fraction_numerical': 0.0008076819527954769, 'mean_word_length': 2.369821590565467, 'pattern_counts': {'":': 0, '<': 179, '<?xml version=': 0, '>': 177, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6627552', 'n_tokens_mistral': 3615, 'n_tokens_neox': 3485, 'n_words': 777}