Skip to content

Commit

Permalink
Merge branch 'master' of github.com:okfn/ckan
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Hammond committed Sep 19, 2012
2 parents 122cf34 + a6bdf08 commit a087cf8
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 37 deletions.
38 changes: 38 additions & 0 deletions ckan/public/base/less/ckan.less
Expand Up @@ -94,4 +94,42 @@ iframe {
margin-bottom: 16px;
}

.m-top {
margin-top: @gutterSmallX;
}
.m-left {
margin-left: @gutterSmallX;
}
.m-right {
margin-right: @gutterSmallX;
}
.m-bottom {
margin-bottom: @gutterSmallX;
}
.no-margin {
margin: 0;
}
.reduced-margin {
margin: 3px 5px;
}

.p-top {
padding-top: @gutterSmallX;
}
.p-left {
padding-left: @gutterSmallX;
}
.p-right {
padding-right: @gutterSmallX;
}
.p-bottom {
padding-bottom: @gutterSmallX;
}
.no-padding {
padding: 0;
}
.reduced-padding {
padding: 3px 5px;
}

@import "iehacks.less";
3 changes: 3 additions & 0 deletions ckan/public/base/less/forms.less
Expand Up @@ -40,6 +40,9 @@ input[type=checkbox] {
top: 7px;
padding: 0;
margin: 0;
&.checkbox-onown {
top: 0;
}
}

select {
Expand Down
83 changes: 49 additions & 34 deletions ckan/templates/admin/authz.html
Expand Up @@ -6,9 +6,15 @@
{% endblock %}

{% macro authz_form_table(id, roles, users, user_role_dict) %}
<table class="table table-bordered table-striped table-condensed">
<table class="table table-bordered table-striped">
<colgroup>
<col width="50%">
{% for role in roles %}
<col width="15%">
{% endfor %}
</colgroup>
<tr>
<th> User </th>
<th>{{ _('User') }}</th>
{% for role in roles %}
<th> {{ role }} </th>
{% endfor %}
Expand All @@ -20,15 +26,11 @@
</td>
{% for role in roles %}
<td>
<input type="hidden" name="{{ h.literal( '%s$%s' % (user,role)) }}" value="submitted"/>
<input type="hidden" name="{{ h.literal( '%s$%s' % (user, role)) }}" value="submitted"/>
{% if user_role_dict[(user,role)] %}
<input type="checkbox"
name="{{ h.literal( '%s$%s' % (user,role)) }}"
checked='checked'/>
<input type="checkbox" name="{{ h.literal( '%s$%s' % (user, role)) }}" checked='checked' class="checkbox-onown"/>
{% else %}
<input type="checkbox"
name="{{ h.literal( '%s$%s' % (user,role)) }}"
/>
<input type="checkbox" name="{{ h.literal( '%s$%s' % (user, role)) }}" class="checkbox-onown"/>
{% endif %}
</td>
{% endfor %}
Expand All @@ -39,31 +41,43 @@


{% macro authz_add_table(roles) %}
<table class="table table-bordered table-striped table-condensed">
<table class="table table-bordered table-striped">
<colgroup>
<col width="50%">
{% for role in roles %}
<col width="15%">
{% endfor %}
</colgroup>
<tr>
<th>User</th>
<th>{{ _('User') }}</th>
{% for role in roles %}
<th> {{ role }} </th>
{% endfor %}
</tr>
<tr>
<td>
<input type="textbox" name="new_user_name" class="autocomplete-user" />
<td class="control-full">
<input type="text" name="new_user_name" class="autocomplete-user no-margin reduced-padding" />
</td>
{% for role in roles %}
<td>
<input type="hidden" name="{{ h.literal( '%s' % role) }}" value="submitted"/>
<input type="checkbox" name="{{ h.literal( '%s' % role) }}"/>
<input type="checkbox" name="{{ h.literal( '%s' % role) }}" class="checkbox-onown"/>
</td>
{% endfor %}
</tr>
</table>
{% endmacro %}

{% macro authz_form_group_table(id, roles, users, user_role_dict) %}
<table class="table table-bordered table-striped table-condensed">
<table class="table table-bordered table-striped">
<colgroup>
<col width="50%">
{% for role in roles %}
<col width="15%">
{% endfor %}
</colgroup>
<tr>
<th>User Group</th>
<th>{{ _('User Group') }}</th>
{% for role in roles %}
<th> {{ role }} </th>
{% endfor %}
Expand All @@ -75,15 +89,11 @@
</td>
{% for role in roles %}
<td>
<input type="hidden" name="${ h.literal( '%s$%s' % (user,role)) }" value="submitted"/>
<input type="hidden" name="${ h.literal( '%s$%s' % (user, role)) }" value="submitted"/>
{% if user_role_dict[(user,role)] %}
<input type="checkbox"
name="{{ h.literal( '%s$%s' % (user,role)) }}"
checked='checked'/>
<input type="checkbox" name="{{ h.literal( '%s$%s' % (user, role)) }}" checked='checked' class="checkbox-onown"/>
{% else %}
<input type="checkbox"
name="{{ h.literal( '%s$%s' % (user,role)) }}"
/>
<input type="checkbox" name="{{ h.literal( '%s$%s' % (user, role)) }}" />
{% endif %}
</td>
{% endfor %}
Expand All @@ -94,21 +104,27 @@


{% macro authz_add_group_table(roles) %}
<table class="table table-bordered table-striped table-condensed">
<table class="table table-bordered table-striped">
<colgroup>
<col width="50%">
{% for role in roles %}
<col width="15%">
{% endfor %}
</colgroup>
<tr>
<th>User Group</th>
{% for role in roles %}
<th> {{ role }} </th>
{% endfor %}
</tr>
<tr>
<td>
<input type="textbox" name="new_user_name" class="autocomplete-authzgroup" />
<td class="control-full">
<input type="text" name="new_user_name" class="autocomplete-authzgroup no-margin reduced-padding" />
</td>
{% for role in roles %}
<td>
<input type="hidden" name="{{ h.literal( '%s' % role) }}" value="submitted"/>
<input type="checkbox" name="{{ h.literal( '%s' % role) }}"/>
<input type="checkbox" name="{{ h.literal( '%s' % role) }}" class="checkbox-onown"/>
</td>
{% endfor %}
</tr>
Expand All @@ -118,20 +134,19 @@
{% block primary %}
<article class="module">
<div class="module-content">
<h1 class="page-heading">{{ _('Administration - Authorization') }}</h1>
<h3>Update Existing Roles</h3>
{% snippet 'admin/snippets/header.html', action=c.action %}

<h3 class="m-bottom">{{ _('Update Existing Roles') }}</h3>
<form id="theform" method="POST">
{{ authz_form_table('theform', c.roles, c.users, c.user_role_dict) }}
<button type="submit" name="save" class="btn btn-primary">
Save Changes
</button>
<button type="submit" name="save" class="btn btn-primary">{{ _('Save Changes') }}</button>
<div class="clear"></div>
</form>

<h3>Add Roles for Any User</h3>
<h3 class="m-bottom">{{ _('Add Roles for Any User') }}</h3>
<form id="addform" method="POST">
{{ authz_add_table(c.roles) }}
<button type="submit" name="add" class="btn btn-primary">Add Role</button>
<button type="submit" name="add" class="btn btn-primary">{{ _('Add Role') }}</button>
<div class="clear"></div>
</form>

Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/admin/config.html
Expand Up @@ -7,7 +7,7 @@
{% block primary %}
<article class="module">
<div class="module-content">
<h1 class="page-heading">{{ _('Configuration Settings') }}</h1>
{% snippet 'admin/snippets/header.html', action=c.action %}

<form method='post' action="" class="form-horizontal">
{{ autoform.generate(form_items, data, errors) }}
Expand Down
3 changes: 1 addition & 2 deletions ckan/templates/admin/index.html
Expand Up @@ -8,8 +8,7 @@
{% block primary %}
<article class="module">
<div class="module-content">
<h1 class="page-heading">{{ _('Current Sysadmins') }}</h1>
<p>{% set url=h.url_for(controller='admin', action='authz') %}{% trans %}You can change sysadmins on the <a href="{{ url }}">authorization page</a>.{% endtrans %}</p>
{% snippet 'admin/snippets/header.html', action=c.action %}
<ul>
{% for user in c.sysadmins %}
<li py:for="user in c.sysadmins">
Expand Down
13 changes: 13 additions & 0 deletions ckan/templates/admin/snippets/header.html
@@ -0,0 +1,13 @@
<h1 class="page-heading">{{ _('Administration') }}</h1>

<ul class="nav nav-tabs">
<li{% if action == 'index' %} class="active"{% endif %}>
<a href="{{ h.url_for(controller='admin', action='index') }}">{{ _('Sysadmins') }}</a>
</li>
<li{% if action == 'authz' %} class="active"{% endif %}>
<a href="{{ h.url_for(controller='admin', action='authz') }}">{{ _('User Roles') }}</a>
</li>
<li{% if action == 'config' %} class="active"{% endif %}>
<a href="{{ h.url_for(controller='admin', action='config') }}">{{ _('Config settings') }}</a>
</li>
</ul>

0 comments on commit a087cf8

Please sign in to comment.