{% extends 'AdminBundle:Admin:adminLayout.html.twig' %} {% set type_name = entity.type.name %} {% block breadcrumb %} {{ backendHelpers.breadcrumb({ ("content_management.titles.content_management"|trans) : (path(paths.home)), (("content_type." ~ type_name ~ ".admin._index")|trans) : (path(paths.index)), (("content_type." ~ type_name ~ ".admin._edit")|trans({'%title%': entity.title})) : '' }) }} {% endblock %} {% block content %} {{ backendHelpers.pageTitle( ("content_type." ~ type_name ~ ".admin._edit")|trans({'%title%': entity.title}) ) }}
{{ backendHelpers.addActionButton(path(paths.show, { 'id': entity.id }), paths.show, ('admin.titles.show'|trans), 'btn-info', 'icon-zoom-in' )}} {{ backendHelpers.addActionButton(path(paths.new), paths.new, ('admin.titles.add'|trans), 'btn-success', 'icon-plus' )}} {{ backendHelpers.addActionButton(path(paths.index), paths.index, ('admin.titles.list'|trans), 'btn-light', 'icon-list' )}}
{%if form_errors(edit_form)%} {{ form_errors(edit_form) }} {%endif%}
{% set form = edit_form %}

{{ 'content_management.titles.basic'|trans }}

{{ form_row(form.title) }} {{ form_row(form.summary) }} {{ form_row(form.source) }}

{{ 'content_management.titles.organization'|trans }}

{% if form.authors is defined %} {{ form_row(form.authors) }} {% endif %} {{ form_row(form.tags) }} {% if form.categories is defined %} {{ form_row(form.categories) }} {% endif %} {% if form.collection is defined %} {{ form_row(form.collection) }} {{ form_row(form.view_order) }} {% endif %} {{ form_row(form.aggregates) }}
{% if form.properties is defined %}

{{ 'content_management.titles.properties'|trans }}

{{ form_errors(form.properties) }} {{ form_widget(form.properties) }}
{% endif %} {% if form.content is defined %}

{{ 'content_management.titles.main'|trans }}

{{ form_errors(form.content) }} {{ form_widget(form.content) }}
{% endif %} {% if form.resources is defined %}

{{ 'content_management.titles.resources'|trans }}

{{ form_errors(form.resources) }} {{ form_widget(form.resources) }}
{% endif %} {% if form.is_published is defined %}

{{ 'content_management.titles.pub_info'|trans }}

{{ form_row(form.is_published) }} {% if form.published_at is defined %} {{ form_row(form.published_at) }} {% endif %}
{% endif %} {{ form_rest(edit_form) }}
{% if service_exists('rawafed.workflow_manager') %} {{ render(controller("RawafedPublishWorkflowBundle:Workflow:workflowControls", {'item':entity, 'itemHandler':'rawafed.content.'~ entity.type.getListName() ~'.job_handler', 'job' : jobListItem})) }} {% endif %}
{% endblock %} {% block bottomScripts %} {{ parent() }} {% endblock %} {% block js_files %} .script('contentmanagement/js/jquery.tagsinput-1.3.6.min.js') {% if service_exists('rawafed.workflow_manager') %} .script('rawafedpublishworkflow/js/state-actions-form.js') {% endif %} {% endblock %} {% block js_document_ready %} $('#entry_tags').tagsInput({ 'width': '100%', 'height': '33px', 'defaultText': '{{ 'content_management.titles.add_tag'|trans }}', 'onAddTag': function(tag) { var container = $('#entry_tags'); var index = $('#entry_tags input[type="hidden"]').length; var _prototype = ''; var newForm = _prototype.replace(/__name__/g, index); container.append(newForm); }, 'onRemoveTag': function(tag) { $('input[name^="entry[tags]"]').each(function() { if($(this).val() == tag) { $(this).remove(); } }); } }); $('#entry_tags input[type="hidden"]').each(function(idx, e){ $('#entry_tags').addTag($(e).val()); }); if(!$('#entry_aggregates input').length) { $('#entry_aggregates').parent().hide(); } $('#entry_authors').on('change', function(){ updateCollectionsList(); }); function updateCollectionsList() { if(!$('#entry_authors').val()) return; var ids = $.map($('#entry_authors').val(), function(v) { return '&ids[]=' + v; }); var url = '{{ path('contentmanagement_' ~ (type_name|replace({ '-': '' })) ~ '_collections', { 'x': 'y' }) }}' + ids.join(''); $.get(url, function(data) { $("#entry_collection > option").each(function() { if(!(this.value in data)) { $('#entry_collection option[value="' + this.value + '"]').remove(); } }); $.each(data, function(key, value) { if(!$('#entry_collection option[value="' + key + '"]').length) { $('#entry_collection').append($('').attr('value', key).text(value)); } }); $('#entry_collection').trigger('liszt:updated'); }); } {% endblock %}