{# Generic renderer for boxes / portlets #}

{%- set color_map = dict(blue="info", green="success", orange="warning", red="danger",
                         primary="primary", info="info", success="success", 
                         warning="warning", danger="danger") %}

{%- macro m_box(title, color="info") %}
<!-- begin box "{{ title }}" -->
  <div class="panel panel-{{ color_map.get(color, 'default') }}">
    {%- if title %}
      <div class="panel-heading">
        <h5 class="panel-title">{{ title }}</h5>
      </div>
    {%- endif %}

    <div class="panel-body">
        {{ caller() }}
    </div>
  </div>
<!-- end box "{{ title }}" -->
{%- endmacro %}

{%- macro m_box_menu(title=None, color="green") %}
<!-- begin menu box "{{ title }}" -->
  <div class="panel panel-{{ color_map.get(color, 'default') }}">
    <div class="panel-heading">
      <h5 class="panel-title">{{ title or _('Menu') }}</h5>
    </div>

    <div class="panel-body">
      {{ caller() }}
    </div>
  </div>
<!-- end menu box "{{ title }}" -->
{%- endmacro %}

{%- macro m_box_content(title=None, color="blue") %}
<!-- begin box "{{ title }}" -->
  <div class="panel panel-{{ color_map.get(color, 'default') }}">
    {%- if title %}
      <div class="panel-heading">
        <h5 class="panel-title">{{ title }}</h5>
      </div>
    {%- endif %}

    <div class="panel-body">
      {{ caller() }}
    </div>
  </div>
  <div class="clearfix"></div> 
<!-- end box "{{ title }}" -->
{%- endmacro %}
