<%inherit file="/instance/settings.html" />
<%namespace name="forms" file="/forms.html"/>
<%namespace name="components" file="/components.html"/>


<%block name="settings_content">
<form name="create_instance" class="well" method="POST">

    ${components.flashmessages()}
    <h2>${c.settings_menu.current['label']}</h2>
    <input type="hidden" name="_method" value="PUT" />
    ${h.field_token()|n}

    <fieldset>
        ${forms.checkbox(_("Allow editing of comments by default"), 'editable_comments_default', autofocus=True)}
        ${forms.checkbox(_("Allow editing of proposals by default"), 'editable_proposals_default')}
        ${forms.checkbox(_("Require to propose a variant"), 'require_selection', help=_("If norms are activated, this option will ensure that users change at least one norm with each proposal."))}
        ${forms.checkbox(_("Hide global categories"), 'hide_global_categories', help=_("Members of your instance only see the catagories you created."))}
        ${forms.checkbox(_("Display page index as tiles"), 'page_index_as_tiles')}
    </fieldset>
    <fieldset>
        ${forms.checkbox(_("Hide this instance"), 'hidden', help=_("Select whether this instance will be shown in public listings."))}
        ${forms.checkbox(_("Freeze this instance"), 'frozen', help=_("This will prevent members from making any more changes or contributions to the existing discussion."))}
    </fieldset>

    %if c.votedetail_all_userbadges is not None:
    <h4>${_('Break down Voting Result by Badge')}</h4>

    <p>${_('Display how the users with the selected badges feel about the issue.')}</p>

    <div>
    ${tiles.badge.badge_selector(c.votedetail_all_userbadges, 'votedetail_badges')}
    </div>
    %endif

    <fieldset>
        <legend>${_('Embed latest events')}</legend>
        <div class="help-block">${_('To display the latest events from your %(site_name)s instance you can add this embed code to your website.') % {'site_name': h.config.get('adhocracy.site.name')}}</div>
        <textarea readonly="readonly" name="embed_code"></textarea>
    </fieldset>

    %if h.has_permission('global.admin'):
    <%forms:textarea label="${_('Extra CSS')}" name="css" value=""
    help="${_('You can add css that will be used to style the instance.')}">
    ${components.formatting()}
    </%forms:textarea>

    %if c.instance and c.instance.allow_thumbnailbadges:
        ${forms.input(_("Status badge image width"), 'thumbnailbadges_width')}
        ${forms.input(_("Status badge image height"), 'thumbnailbadges_height')}
    %else:
        <input type="hidden" name="thumbnailbadges_width" value="" />
        <input type="hidden" name="thumbnailbadges_height" value="" />
    %endif
    ${forms.checkbox(_("Authenticate this instance"), 'is_authenticated', help=_("Activates additional feature, e.g. massinvite und massmessage"))}
    %endif

    ${components.savebox(h.base_url("/instance/%s" % c.page_instance.key))}

</form>
</%block>
