Skip to content

Commit

Permalink
[#1392] Fixes member add page within groups
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmartin committed Dec 17, 2013
1 parent 19496ce commit 9207caf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 22 deletions.
31 changes: 10 additions & 21 deletions ckan/templates/group/member_new.html
Expand Up @@ -50,29 +50,18 @@ <h1 class="page-heading">
{{ form.select('role', label=_('Role'), options=c.roles, selected=c.user_role, error='', attrs=format_attrs) }}
<div class="form-actions">
{% if user %}
<input type="hidden" name="username" value="{{ user.name }}" />
{% set format_attrs = {'disabled': true} %}
{{ form.input('username', label=_('User'), value=user.name, classes=['control-medium'], attrs=format_attrs) }}
{% set locale = h.dump_json({'content': _('Are you sure you want to delete this member?')}) %}
<a href="{% url_for controller='group', action='member_delete', id=c.group_dict.id, user=user.id %}" class="btn btn-danger pull-left" data-module="confirm-action" data-module-i18n="{{ locale }}">{{ _('Delete') }}</a>
<button class="btn btn-primary" type="submit" name="submit" >
{{ _('Save') }}
</button>
{% else %}
{% set format_attrs = {'data-module': 'autocomplete', 'data-module-source': '/api/2/util/user/autocomplete?q=?'} %}
{{ form.input('username', id='field-username', label=_('User'), placeholder=_('Username'), value='', error='', classes=['control-medium'], attrs=format_attrs) }}
<button class="btn btn-primary" type="submit" name="submit" >
{{ _('Add Member') }}
</button>
{% endif %}
{% set format_attrs = {'data-module': 'autocomplete'} %}
{{ form.select('role', label=_('Role'), options=c.roles, selected=c.user_role, error='', attrs=format_attrs) }}
<div class="form-actions">
{% if user %}
{% set locale = h.dump_json({'content': _('Are you sure you want to delete this member?')}) %}
<a href="{% url_for controller='group', action='member_delete', id=c.group_dict.id, user=user.id %}" class="btn btn-danger pull-left" data-module="confirm-action" data-module-i18n="{{ locale }}">{{ _('Delete') }}</a>
<button class="btn btn-primary" type="submit" name="submit" >
{{ _('Save') }}
</button>
{% else %}
<button class="btn btn-primary" type="submit" name="submit" >
{{ _('Add') }}
</button>
{% endif %}
</div>
</form>
</div>
</form>
{% endblock %}
{% endblock %}

Expand Down
5 changes: 4 additions & 1 deletion ckan/templates/group/members.html
Expand Up @@ -2,8 +2,11 @@

{% block subtitle %}{{ _('Members') }} - {{ c.group_dict.display_name }} - {{ _('Groups') }}{% endblock %}

{% block page_primary_action %}
{% link_for _('Add Member'), controller='group', action='member_new', id=c.group_dict.id, class_='btn btn-primary', icon='plus-sign-alt' %}
{% endblock %}

{% block primary_content_inner %}
{% link_for _('Add Member'), controller='group', action='member_new', id=c.group_dict.id, class_='btn pull-right', icon='plus-sign-alt' %}
<h3 class="page-heading">{{ _('{0} members'.format(c.members|length)) }}</h3>
<table class="table table-header table-hover table-bordered">
<col width="70" />
Expand Down

0 comments on commit 9207caf

Please sign in to comment.