Skip to content

Commit

Permalink
[#1455] fix bulk editing
Browse files Browse the repository at this point in the history
  • Loading branch information
kindly committed Jan 27, 2014
1 parent 4fa7b5c commit 515d3c5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
18 changes: 15 additions & 3 deletions ckan/controllers/group.py
Expand Up @@ -387,16 +387,28 @@ def bulk_process(self, id):
except NotAuthorized:
abort(401, _('Unauthorized to read group %s') % id)

# Search within group
action = request.params.get('bulk_action')
#use different form names so that ie7 can be detected
form_names = set(["bulk_action.public", "bulk_action.delete",
"bulk_action.private"])
actions_in_form = set(request.params.keys())
actions = form_names.intersection(actions_in_form)
# If no action then just show the datasets
if not action:
if not actions:
# unicode format (decoded from utf8)
limit = 500
self._read(id, limit)
c.packages = c.page.items
return render(self._bulk_process_template(group_type))

#ie7 puts all buttons in form params but puts submitted one twice
for key, value in dict(request.params.dict_of_lists()).items():
if len(value) == 2:
action = key.split('.')[-1]
break
else:
#normal good browser form submission
action = actions.pop().split('.')[-1]

# process the action first find the datasets to perform the action on.
# they are prefixed by dataset_ in the form data
datasets = []
Expand Down
6 changes: 3 additions & 3 deletions ckan/templates/organization/bulk_process.html
Expand Up @@ -32,17 +32,17 @@ <h3 class="page-heading">
<th></th>
<th class="table-actions">
<div class="btn-group">
<button name="bulk_action" value="public" class="btn" type="submit">
<button name="bulk_action.public" value="public" class="btn" type="submit">
<i class="icon-eye-open"></i>
{{ _('Make public') }}
</button>
<button name="bulk_action" value="private" class="btn" type="submit">
<button name="bulk_action.private" value="private" class="btn" type="submit">
<i class="icon-eye-close"></i>
{{ _('Make private') }}
</button>
</div>
<div class="btn-group">
<button name="bulk_action" value="delete" class="btn btn-danger" type="submit">
<button name="bulk_action.delete" value="delete" class="btn btn-danger" type="submit">
<i class="icon-remove"></i>
{{ _('Delete') }}
</button>
Expand Down

0 comments on commit 515d3c5

Please sign in to comment.