Skip to content

Commit

Permalink
Tweaks Organizations work-flow
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmartin committed Nov 27, 2012
1 parent 8e07b4c commit 15bb505
Show file tree
Hide file tree
Showing 11 changed files with 127 additions and 37 deletions.
1 change: 1 addition & 0 deletions ckan/controllers/group.py
Expand Up @@ -331,6 +331,7 @@ def edit(self, id, data=None, errors=None, error_summary=None):

group = context.get("group")
c.group = group
c.group_dict = self._action('group_show')(context, data_dict)

try:
self._check_access('group_update', context)
Expand Down
Binary file added ckan/public/base/images/editing.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions ckan/public/base/less/profile.less
@@ -1,3 +1,10 @@
.editing {
[role="main"],
.main {
background: #EFEFEF url("@{imagePath}/editing.png?2") 0 0 repeat-x;
}
}

.profile {
.empty,
.dataset-list {
Expand Down Expand Up @@ -60,4 +67,12 @@
}
}
}
&.editing {
.module-heading {

}
.module-content {
margin-top: 0;
}
}
}
32 changes: 7 additions & 25 deletions ckan/templates/organization/base_form_page.html
@@ -1,28 +1,10 @@
{% extends "page.html" %}
{% extends "organization/edit_base.html" %}

{% block breadcrumb_content %}
<li>{{ h.nav_link(_('Organizations'), controller='organization', action='index') }}</li>
<li class="active">{% block breadcrumb_link %}{{ h.nav_link(_('Add a Organization'), controller='organization', action='new') }}{% endblock %}</li>
{% endblock %}

{% block primary_content %}
<div class="module">
<div class="module-content">
<h1 class="page-heading">{% block page_heading %}{{ _('Organization Form') }}{% endblock %}</h1>
{% block form %}
{{ c.form | safe }}
{% endblock %}
</div>
</div>
{% endblock %}

{% block secondary_content %}
<div class="module module-narrow module-shallow">
<h2 class="module-heading"><i class="icon-large icon-info-sign"></i> {{ _('What are Organizations?') }}</h2>
<div class="module-content">
{% trans %}
<p>good question<P/>
{% endtrans %}
</div>
{% block primary_content_inner %}
<div class="module-content">
<h1 class="page-heading">{% block page_heading %}{{ _('Organization Form') }}{% endblock %}</h1>
{% block form %}
{{ c.form | safe }}
{% endblock %}
</div>
{% endblock %}
2 changes: 0 additions & 2 deletions ckan/templates/organization/edit.html
Expand Up @@ -2,6 +2,4 @@

{% block subtitle %}{{ _('Edit a Organization') }}{% endblock %}

{% block breadcrumb_link %}{% link_for _('Edit Organization'), controller='organization', action='edit', id=c.group.name %}{% endblock %}

{% block page_heading %}{{ _('Edit a Organization') }}{% endblock %}
52 changes: 52 additions & 0 deletions ckan/templates/organization/edit_base.html
@@ -0,0 +1,52 @@
{% extends "page.html" %}

{% set organization = c.group_dict %}

{% block bodytag %}{{ super() }} class="editing"{% endblock %}

{% block subtitle %}{{ organization.display_name }}{% endblock %}

{% block breadcrumb_content %}
<li>{% link_for _('Organizations'), controller='organization', action='index' %}</li>
{% block breadcrumb_content_inner %}
<li>{% link_for organization.display_name|truncate(35), controller='organization', action='read', id=organization.name %}</li>
<li class="active">{% link_for _('Edit Organization'), controller='organization', action='edit', id=organization.name %}</li>
{% endblock %}
{% endblock %}

{% block actions_content %}
{% if h.check_access('organization_update', {'id': c.group.id}) %}
<li><a href="{% url_for controller='organization', action='read', id=organization.name %}" class="btn">{{ _('View organization') }} <i class="icon-arrow-right"></i></a></li>
{% endif %}
{# <li>{% link_for _('History'), controller='organization', action='history', id=organization.name, class_='btn', icon='undo' %}</li> #}
{% endblock %}

{% block primary_content %}
<section class="module">
{% block primary_content_header %}
<header class="module-content page-header">
<ul class="nav nav-tabs">
<li{% if c.action == 'edit' %} class="active"{% endif %}>
{% link_for _('Info'), controller='organization', action='edit', id=organization.name, icon='info-sign' %}
</li>
{% if h.check_access('organization_member_create', {'id': organization.id}) %}
<li{% if c.action == 'members' or c.action =='member_new' %} class="active"{% endif %}>
{% link_for _('Members'), controller='organization', action='members', id=organization.name, icon='group' %}
</li>
{% endif %}
</ul>
</header>
{% endblock %}
{% block primary_content_inner %}
{% endblock %}
</section>
{% endblock %}

{% block secondary_content %}
{% snippet 'snippets/organization.html', organization=organization %}
{% endblock %}

{% block links %}
{{ super() }}
{% include "organization/snippets/feeds.html" %}
{% endblock %}
17 changes: 15 additions & 2 deletions ckan/templates/organization/member_new.html
@@ -1,4 +1,4 @@
{% extends "organization/read_base.html" %}
{% extends "organization/edit_base.html" %}
{% import 'macros/form.html' as form %}

{% block subtitle %}{{ _('Members') }} - {{ c.group_dict.display_name }}{% endblock %}
Expand All @@ -19,7 +19,20 @@ <h1 class="page-heading">{{ _('Add Member') }}</h1>
{% endif %}
{% set format_attrs = {'data-module': 'autocomplete'} %}
{{ form.select('role', label=_('Role'), options=c.roles, selected='', error='', attrs=format_attrs) }}
<button class="btn btn-primary" type="submit" name="submit" >{{ _('Add') }}</button>
<div class="form-actions">
{% if c.user_name %}
<a href="{% url_for controller='organization', action='members', id=c.group_dict.id %}" class="btn">
{{ _('Cancel') }}
</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>
{% endblock %}
19 changes: 12 additions & 7 deletions ckan/templates/organization/members.html
@@ -1,11 +1,14 @@
{% extends "organization/read_base.html" %}
{% extends "organization/edit_base.html" %}

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

{% block primary_content_inner %}
<div class="module-content">
<h1 class="hide-heading">{{ _('Members') }}</h1>
<table class="table table-bordered">
<col width="70" />
<col width="40" />
<col width="15" />
<thead>
<tr>
<th>{{ _('User') }}</th>
Expand All @@ -20,19 +23,21 @@ <h1 class="hide-heading">{{ _('Members') }}</h1>
{{ h.linked_user(user_id, maxlength=20) }}
</td>
<td>{{ role }}</td>
{% set locale = h.dump_json({'content': _('Are you sure you want to delete this member?')}) %}
<td>
{% set locale = h.dump_json({'content': _('Are you sure you want to delete this member?')}) %}
<div class="btn-group pull-right">
{% link_for _('Edit'), controller='organization', action='member_new', id=c.group_dict.id, class_='btn', icon='wrench', user=user_id %}
<a class="btn btn-danger" href="{% url_for controller='organization', action='member_delete', id=c.group_dict.id, user=user_id %}" data-module="confirm-action" data-module-i18n="{{ locale }}">{% block delete_button_text %}<i class="icon-remove"></i> {{ _('Delete') }}{% endblock %}</a>
<a class="btn btn-small" href="{% url_for controller='organization', action='member_new', id=c.group_dict.id, user=user_id %}" title="{{ _('Edit') }}">
<i class="icon-wrench"></i>
</a>
<a class="btn btn-danger btn-small" href="{% url_for controller='organization', action='member_delete', id=c.group_dict.id, user=user_id %}" data-module="confirm-action" data-module-i18n="{{ locale }}" title="{{ _('Delete') }}">{% block delete_button_text %}<i class="icon-remove"></i>{% endblock %}</a>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<p>
{% link_for _('Add member'), controller='organization', action='member_new', id=c.group_dict.id, class_='btn btn-success', icon='plus' %}
</p>
<div class="form-actions">
{% link_for _('Add member'), controller='organization', action='member_new', id=c.group_dict.id, class_='btn btn-primary' %}
</div>
</div>
{% endblock %}
4 changes: 3 additions & 1 deletion ckan/templates/organization/read_base.html
Expand Up @@ -10,13 +10,14 @@
{% block actions_content %}
{% if h.check_access('organization_update', {'id': c.group.id}) %}
<li>{% link_for _('Add Dataset to Organization'), controller='package', action='new', group=c.group_dict.id, class_='btn', icon='plus' %}</li>
<li>{% link_for _('Edit'), controller='organization', action='edit', id=c.group_dict.name, class_='btn', icon='wrench' %}</li>
<li>{% link_for _('Edit'), controller='organization', action='edit', id=c.group_dict.name, class_='btn btn-primary', icon='wrench' %}</li>
{% endif %}
{# <li>{% link_for _('History'), controller='organization', action='history', id=c.group_dict.name, class_='btn', icon='undo' %}</li> #}
{% endblock %}

{% block primary_content %}
<section class="module">
{#
{% block primary_content_header %}
<header class="module-content page-header">
<ul class="nav nav-tabs">
Expand All @@ -34,6 +35,7 @@
</ul>
</header>
{% endblock %}
#}
{% block primary_content_inner %}
{% endblock %}
</section>
Expand Down
20 changes: 20 additions & 0 deletions ckan/templates/organization/snippets/info.html
@@ -0,0 +1,20 @@
{#
Displays a sidebard module with information for given organization

org - The organization dict.

Example:

{% snippet "organization/snippets/info.html", org=org %}

#}
{% if organization and h.check_access('organization_update', {'id':organization.id }) %}
<section class="module module-narrow package-info">
<h2 class="module-heading"><i class="icon-sitemap"></i> {{ _("Edit Organization") }}</h2>
<ul class="unstyled nav nav-simple">
<li class="nav-item{% if action == 'edit' %} active{% endif %}">
{% link_for _("Edit Organization"), controller='organization', action='edit', id=organization.name %}
</li>
</ul>
</section>
{% endif %}
2 changes: 2 additions & 0 deletions ckan/templates/organization/snippets/organization_form.html
Expand Up @@ -49,6 +49,7 @@
{% endfor %}
{% endblock %}

{#
{% block dataset_fields %}
{% if data.packages %}
<div class="control-group">
Expand All @@ -68,6 +69,7 @@
{% set dataset_attrs = {'data-module': 'autocomplete', 'data-module-source': '/dataset/autocomplete?q=?'} %}
{{ form.input(dataset_name, label=_('Add Dataset'), id="field-dataset", value=data[dataset_name], classes=['control-medium'], attrs=dataset_attrs) }}
{% endblock %}
#}

<div class="form-actions">
{% block delete_button %}
Expand Down

0 comments on commit 15bb505

Please sign in to comment.