{% extends g.theme.master %}
{% block extra_css %}
<link rel="stylesheet" type="text/css" media="screen" href="{{g.forge_static('css/forge/accordion.css')}}" />
{% endblock %}
{% block title %}{{neighborhood.name}} / Permissions{% endblock %}
{% block header %}Permissions for {{neighborhood.name}}{% endblock %}
{% block nav_menu %}
{% include 'jinja_master/neigh_nav_menu.html' %}
{% endblock %}
{% block top_nav %}
{% include 'jinja_master/neigh_top_nav.html' %}
{% endblock %}
{% block content %}
<p>The ACL determines neighborhood-level permissions.</p>
<div id="acl-admin">
{% for permission, users in neighborhood.acl.iteritems() %}
<h3><a href="#" id="permission_{{permission}}">Permission: {{permission}}</a></h3>
<div>
<form method="POST" action="update_acl">
<input type="hidden" name="permission" value="{{permission}}"/>
{% for uid in users %}
<input type="hidden" name="user-{{loop.index0}}.id" value="{{uid}}"/>
{% endfor %}
<table>
<thead>
<tr><th>Username</th><th></th></tr>
</thead>
<tbody>
{% for u in h.make_users(users) %}
<tr>
<td>{{u.username}}</td>
<td><input type="submit" value="Remove" name="user-{{loop.index0}}.delete" /></td>
</tr>
{% endfor %}
<tr>
<td>
<input name="new.username"/>
</td>
<td>
<input type="submit" name="new.add" value="Add Permission"/>
</td>
</tr>
</tbody>
</table>
</form>
</div>
{% endfor %}
</div>
{% endblock %}
{% block extra_js %}
<script type="text/javascript">
$(function () {
$("#acl-admin").accordion({
autoHeight: false,
navigation: true,
change: function(event,ui) {
var hid = ui.newHeader.children('a').attr('id');
if (hid === undefined) {
$.cookie('neighborhood-acl-admin', null);
} else {
$.cookie('neighborhood-acl-admin', hid, { path: '/', expires: 2 });
}
}
});
});
$(document).ready(function () {
if($.cookie('neighborhood-acl-admin')) {
$('#acl-admin').accordion('option', 'animated', false)
.accordion('activate', $('#' + $.cookie('neighborhood-acl-admin')).parent('h3'))
.accordion('option', 'animated', 'slide');
}
});
</script>
{% endblock %}