{% extends "admin/admin/list.html" %}
{% load i18n %}
{% load l10n %}
{% load url from future %}
{% from "admin/macros.html" import page_title %}
{% import "_forms.html" as form_theme with context %}

{% block title %}{{ page_title(parent=_(action.role.name), title=_("Role Forum Permissions")) }}{% endblock %}

{% block table_head scoped %}
  <th>{% trans %}Forum{% endtrans %}</th>
  <th class="span3">{% trans %}Role{% endtrans %}</th>
{% endblock %}

{% block table_row scoped %}
  <td class="lead-cell" style="padding-left: {{ 8 + ((item.level - 1) * 24) }}px;">
  	<i class="icon-{{ forum_icon(item.type) }}"></i> <strong>{{ item.name }}</strong>
  </td>
  <td>
  	{{ form_theme.field_widget(table_form['forum_' + item.pk|string], attrs={'form': 'table_form'}, width=3) }}
  </td>
{% endblock %}

{% macro forum_icon(forum_type) -%}
{%- if forum_type == 'category' -%}
folder-open
{%- elif forum_type == 'forum' -%}
list
{%- else -%}
globe
{%- endif -%}
{%- endmacro %}