<div class="dashnex-metabox">

    {% if not post.ID %}
        <div class="unpublished">
            You should save post before assigning it to Site Manager Keywords.
        </div>
    {% else %}

        {% if categoryKeywords| length == 0 %}
            <div class="empty">
                There is no empty Site Manager Keywords available. Go to DashNex Site Manager to add more keywords.
            </div>
            <input id="keyword-id" type="hidden" name="dashnex_post_metabox[keyword_id]" value="{{ assignedTo.id }}" />
        {% else %}

            <div class="unassign-box {{ assignedTo ? '': 'hide' }}" data-method="post" data-action="dashnex-metabox-post-save"
                    data-post-id="{{ post.ID }}" data-name="dashnex-post-metabox">

                <div id="major-publishing-actions">

                    <div class="message">
                        Assigned to <strong class="keyword">{{ assignedTo.keyword }}</strong> keyword.
                    </div>
                    <div id="publishing-action">
                        <span class="spinner"></span>
                        <a href="#" class="button button-primary button-large" id="unassign">Unassign</a>
                    </div>
                    <div class="clear"></div>
                </div>
            </div>

            <div class="assign-box {{ assignedTo ? 'hide': '' }}" data-method="post" data-action="dashnex-metabox-post-save"
                 data-post-id="{{ post.ID }}" data-name="dashnex-post-metabox">

                <input id="keyword-id" type="hidden" name="dashnex_post_metabox[keyword_id]"
                       value="{{ assignedTo.id }}">

                <div id="keywords" init="{{ keywords | json_encode }}" ></div>

                <div id="major-publishing-actions">

                    <div id="publishing-action">
                        <span class="spinner"></span>
                        <a href="#" class="button button-primary button-large" id="assign">Assign</a>
                    </div>
                    <div class="clear"></div>
                </div>
            </div>
        {% endif %}
    {% endif %}
</div>

