<commit_before>{% extends "ServerGroveKbBundle:Admin:layout.html.twig" %}

{% block postheader %}
    {{ parent() }}
    {{ sgkb_breadcrumb.displayBreadcrumb(document, document.getDefaultCategory(), true) }}
{% endblock postheader %}

{% block content %}
<script>
    $(document).ready(function () {
        $('#tsettings').click(function () {
            console.log("ff");
            $('.settings').toggle();
        });

    });
</script>


{% spaceless %}
<form id="article-form" class="exit-control" action="{{ path('sgkb_admin_articles_update', { 'slug': document.slug }) }}" method="post" {{ form_enctype(edit_form) }}>
    <a href="#cheatsheet" role="button" class="btn" data-toggle="modal" style="float: right;">Markdown Cheatsheet</a>

    <h1>
        {% trans %}Article edit{% endtrans %}
    </h1>

    <div class="well">
        <a href="#" id="tsettings" class="btn">{% trans %}Settings{% endtrans %}</a>
    </div>
    <div class="row-fluid settings">
        {{ form_errors(edit_form) }}
        <div class="span6">
            <div>
                {{ form_label(edit_form.categories) }}
                {{ form_widget(edit_form.categories, { 'attr': { 'class': 'input-xxlarge', 'size': 11 } }) }}
            </div>
        </div>
        <div class="span6">
            {% if edit_form.urls is defined %}
            <div>
                {{ form_label(edit_form.urls) }}
                {{ form_widget(edit_form.urls, { 'attr': { 'class': 'input-xxlarge' } }) }}
            </div>
            {% endif %}
            <div class="keywordMgr" ng-controller="ArticleKeywordsCtrl"
                 ng-init="url='{{ path('sgkb_admin_articles_keywords_sync', { 'slug': document.slug, '_format': 'json' }) }}'">
                <label for="article_keywords" class="control-label">{% trans %}Keywords{% endtrans %}</label>

                <div class="input-append">
                    <input id="article_keywords" ng-enter-press="addKeywords()" ng-model="newKeywords" ng-list
                           autocomplete="off" type="text" class="span4"
                           placeholder="{% trans %}A comma separated list of keywords{% endtrans %}"/>
                    <button class="btn" type="button" ng-click="addKeywords()"
                            ng-disabled="newKeywords.length == 0">{% trans %}Add{% endtrans %}</button>
                </div>
                {% for keyword in document.keywords %}
                <init ng-init="keywords.push('{{ keyword }}')"></init>
                {% endfor %}
                <ul class="well well-small">
                    <li class="label label-info" ng-repeat="keyword in keywords">
                        {% raw %}{{ keyword }}{% endraw %}
                        <a href="javascript:void(0)" ng-click="removeKeyword(keyword)">&times;</a>
                    </li>
                </ul>
            </div>
        </div>
    </div>

    {% for locale,translation_form in translation_forms %}
    {% form_theme translation_form _self %}
    <translation ng-controller="{{ locale }}TranslationCtrl">
        <div class="well">
            <button class="btn" type="button" data-toggle="collapse"
                    data-target="#article_edit_{{ locale }}">{% trans with { '%locale%': locale } %}Edit "%locale%" Version{% endtrans %}
                {% if translation_form.isActive.vars.checked|default(false) %}
                <span class="label label-success">{% trans %}Active{% endtrans %}</span>
                {% else %}
                <span class="label label-important">{% trans %}Disabled{% endtrans %}</span>
                {% endif %}
            </button>
            <a href="{{ path('sgkb_articles_view', {
                'slug': document.slug,
                'path': document.getDefaultCategory().getPath(),
                '_locale': locale,
                '_format': 'html'
            }) }}" target="_blank" class="btn  bump-left">{% trans with { '%locale%': locale } %}View this
                article{% endtrans %}</a>
        </div>

        <div class="collapse" id="article_edit_{{ locale }}">
            <h2>{% trans with { '%locale%': locale } %}Article translation for locale "%locale%"{% endtrans %}</h2>
            {{ form_errors(translation_form) }}
            {{ form_row(translation_form.title)}}
            {{ form_row(translation_form.isActive) }}
            {{ form_row(translation_form.contentType) }}
            {{ form_row(translation_form.content) }}
            {{ form_rest(translation_form) }}
        </div>
    </translation>
    <script type="text/javascript">
        /* <![CDATA[ */
        var {{ locale }}TranslationCtrl = getTranslationController('{{ translation_form.content.vars.value|escape('js') }}', '{{ translation_form.vars.contentType|escape('js') }}', '{{ locale }}');
        /* ]]> */
    </script>
    {% endfor %}

    <div class="form-actions">
        <label class="checkbox">
                    <input type="checkbox" name="back_to_list" value="1" checked="checked"/>&nbsp;{% trans %}Return to the list after save{% endtrans %}
                </label>
        <br>
        <button class="btn btn-primary" type="submit">{% trans %}Save{% endtrans %}</button>
        &nbsp;
        <a class="btn" href="{{ path('sgkb_admin_articles_index') }}">{% trans %}Cancel{% endtrans %}</a>
        {{ form_rest(edit_form) }}

    </div>
</form>

{% if is_granted("ROLE_ADMIN") %}
    <div class="pull-right" style="margin-top: -64px; margin-right: 20px;"><delete-form action="{{ path('sgkb_admin_articles_delete', {'slug': document.slug}) }}" method="post" button="{% trans %}Delete{% endtrans %}" confirmation="{% trans %}Are you sure you want to delete this article?{% endtrans %}">
        {{ form_widget(delete_form) }}
    </delete-form></div>
{% endif %}

{% render "ServerGroveKbBundle:Admin/Urls:modalForm" %}
{% include "ServerGroveKbBundle:Admin/Articles:image-gallery.html.twig" %}<commit_msg>Fixed access to input values<commit_after>{% extends "ServerGroveKbBundle:Admin:layout.html.twig" %}

{% block postheader %}
    {{ parent() }}
    {{ sgkb_breadcrumb.displayBreadcrumb(document, document.getDefaultCategory(), true) }}
{% endblock postheader %}

{% block content %}
<script>
    $(document).ready(function () {
        $('#tsettings').click(function () {
            console.log("ff");
            $('.settings').toggle();
        });

    });
</script>


{% spaceless %}
<form id="article-form" class="exit-control" action="{{ path('sgkb_admin_articles_update', { 'slug': document.slug }) }}" method="post" {{ form_enctype(edit_form) }}>
    <a href="#cheatsheet" role="button" class="btn" data-toggle="modal" style="float: right;">Markdown Cheatsheet</a>

    <h1>
        {% trans %}Article edit{% endtrans %}
    </h1>

    <div class="well">
        <a href="#" id="tsettings" class="btn">{% trans %}Settings{% endtrans %}</a>
    </div>
    <div class="row-fluid settings">
        {{ form_errors(edit_form) }}
        <div class="span6">
            <div>
                {{ form_label(edit_form.categories) }}
                {{ form_widget(edit_form.categories, { 'attr': { 'class': 'input-xxlarge', 'size': 11 } }) }}
            </div>
        </div>
        <div class="span6">
            {% if edit_form.urls is defined %}
            <div>
                {{ form_label(edit_form.urls) }}
                {{ form_widget(edit_form.urls, { 'attr': { 'class': 'input-xxlarge' } }) }}
            </div>
            {% endif %}
            <div class="keywordMgr" ng-controller="ArticleKeywordsCtrl"
                 ng-init="url='{{ path('sgkb_admin_articles_keywords_sync', { 'slug': document.slug, '_format': 'json' }) }}'">
                <label for="article_keywords" class="control-label">{% trans %}Keywords{% endtrans %}</label>

                <div class="input-append">
                    <input id="article_keywords" ng-enter-press="addKeywords()" ng-model="newKeywords" ng-list
                           autocomplete="off" type="text" class="span4"
                           placeholder="{% trans %}A comma separated list of keywords{% endtrans %}"/>
                    <button class="btn" type="button" ng-click="addKeywords()"
                            ng-disabled="newKeywords.length == 0">{% trans %}Add{% endtrans %}</button>
                </div>
                {% for keyword in document.keywords %}
                <init ng-init="keywords.push('{{ keyword }}')"></init>
                {% endfor %}
                <ul class="well well-small">
                    <li class="label label-info" ng-repeat="keyword in keywords">
                        {% raw %}{{ keyword }}{% endraw %}
                        <a href="javascript:void(0)" ng-click="removeKeyword(keyword)">&times;</a>
                    </li>
                </ul>
            </div>
        </div>
    </div>

    {% for locale,translation_form in translation_forms %}
    {% form_theme translation_form _self %}
    <translation ng-controller="{{ locale }}TranslationCtrl">
        <div class="well">
            <button class="btn" type="button" data-toggle="collapse"
                    data-target="#article_edit_{{ locale }}">{% trans with { '%locale%': locale } %}Edit "%locale%" Version{% endtrans %}
                {% if translation_form.isActive.getVars().checked|default(false) %}
                <span class="label label-success">{% trans %}Active{% endtrans %}</span>
                {% else %}
                <span class="label label-important">{% trans %}Disabled{% endtrans %}</span>
                {% endif %}
            </button>
            <a href="{{ path('sgkb_articles_view', {
                'slug': document.slug,
                'path': document.getDefaultCategory().getPath(),
                '_locale': locale,
                '_format': 'html'
            }) }}" target="_blank" class="btn  bump-left">{% trans with { '%locale%': locale } %}View this
                article{% endtrans %}</a>
        </div>

        <div class="collapse" id="article_edit_{{ locale }}">
            <h2>{% trans with { '%locale%': locale } %}Article translation for locale "%locale%"{% endtrans %}</h2>
            {{ form_errors(translation_form) }}
            {{ form_row(translation_form.title)}}
            {{ form_row(translation_form.isActive) }}
            {{ form_row(translation_form.contentType) }}
            {{ form_row(translation_form.content) }}
            {{ form_rest(translation_form) }}
        </div>
    </translation>
    <script type="text/javascript">
        /* <![CDATA[ */
        var {{ locale }}TranslationCtrl = getTranslationController('{{ translation_form.content.getVars().value|escape('js') }}', '{{ translation_form.getVars().contentType|escape('js') }}', '{{ locale }}');
        /* ]]> */
    </script>
    {% endfor %}

    <div class="form-actions">
        <label class="checkbox">
                    <input type="checkbox" name="back_to_list" value="1" checked="checked"/>&nbsp;{% trans %}Return to the list after save{% endtrans %}
                </label>
        <br>
        <button class="btn btn-primary" type="submit">{% trans %}Save{% endtrans %}</button>
        &nbsp;
        <a class="btn" href="{{ path('sgkb_admin_articles_index') }}">{% trans %}Cancel{% endtrans %}</a>
        {{ form_rest(edit_form) }}

    </div>
</form>

{% if is_granted("ROLE_ADMIN") %}
    <div class="pull-right" style="margin-top: -64px; margin-right: 20px;"><delete-form action="{{ path('sgkb_admin_articles_delete', {'slug': document.slug}) }}" method="post" button="{% trans %}Delete{% endtrans %}" confirmation="{% trans %}Are you sure you want to delete this article?{% endtrans %}">
        {{ form_widget(delete_form) }}
    </delete-form></div>
{% endif %}

{% render "ServerGroveKbBundle:Admin/Urls:modalForm" %}
{% include "ServerGroveKbBundle:Admin/Articles:image-gallery.html.twig" %}
{'fraction_non_alphanumeric': 0.1813149949681315, 'fraction_numerical': 0.0026836632002683663, 'mean_word_length': 2.394534585824082, 'pattern_counts': {'":': 0, '<': 147, '<?xml version=': 0, '>': 147, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4660151', 'n_tokens_mistral': 3632, 'n_tokens_neox': 3326, 'n_words': 684}