{% extends template('page') %}

{% block pPageTitle %}
	{# Overloading the default template's title to show the brick's title #}
	{% if oBrick is defined and oBrick is not null and oBrick.GetTitle() != '' %}
		{{ oBrick.GetTitle()|dict_s }} - {{ constant('ITOP_APPLICATION_SHORT') }}
	{% else %}
		{{ parent() }}
	{% endif %}
{% endblock %}

{% block pPageBodyClass %}{{ parent() }} {% if oBrick is defined and oBrick is not null %}page_brick_of_id_{{ oBrick.GetId() }}{% endif %}{% endblock %}

{% block pMainHeader %}
    <div class="ipb-page--main-header--information">
        <div class="ipb-page--main-header--information--title">
            <span>{% block pMainHeaderTitle %}{% endblock %}</span><span>{% block pMainHeaderTitleAdditionalPart %}{% endblock %}</span>
        </div>
        {% block pMainHeaderSubtitle %}
            {% if sBrickSubtitle is defined and sBrickSubtitle is not null %}
                <div class="ipb-page--main-header--information--subtitle">{{ sBrickSubtitle }}</div>
            {% endif %}
        {% endblock %}
    </div>
    <div class="ipb-page--main-header--actions">
        {% block pMainHeaderActions %}
        {% endblock %}
    </div>
{% endblock %}

{% block pMainContent %}
	{% block pMainContentHolder%}
	{% endblock %}
{% endblock %}

{% block pPageLiveScriptHelpers %}
    {{ parent() }}

	// Helpers used for brick's opening target
	var SetActionUrl = function(oElem, sUrl)
	{
		oElem.attr('href', sUrl);
	};
	var SetActionOpeningTarget = function(oElem, sMode)
	{
		if(sMode === '{{ constant('Combodo\\iTop\\Portal\\Brick\\PortalBrick::ENUM_OPENING_TARGET_MODAL') }}')
		{
			oElem.attr('data-toggle', 'modal').attr('data-target', '#modal-for-all');
		}
		else if(sMode === '{{ constant('Combodo\\iTop\\Portal\\Brick\\PortalBrick::ENUM_OPENING_TARGET_SELF') }}')
		{
			oElem.attr('target', '_self');
		}
		else if(sMode === '{{ constant('Combodo\\iTop\\Portal\\Brick\\PortalBrick::ENUM_OPENING_TARGET_NEW') }}')
		{
			oElem.attr('target', '_blank');
		}
	};
{% endblock %}