Skip to content

Commit

Permalink
Merge branch 'master' of github.com:okfn/ckan into docs-reorg
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Hammond committed Jan 28, 2014
2 parents 254fca2 + fd1ec8f commit be87f11
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 40 deletions.
5 changes: 4 additions & 1 deletion ckan/controllers/group.py
Expand Up @@ -857,9 +857,12 @@ def admins(self, id):
return render(self._admins_template(c.group_dict['type']))

def about(self, id):
context = {'model': model, 'session': model.Session,
'user': c.user or c.author}
c.group_dict = self._get_group_dict(id)
group_type = c.group_dict['type']
self._setup_template_variables({}, {'id': id}, group_type=group_type)
self._setup_template_variables(context, {'id': id},
group_type=group_type)
return render(self._about_template(group_type))

def _get_group_dict(self, id):
Expand Down
6 changes: 5 additions & 1 deletion ckan/controllers/package.py
Expand Up @@ -1326,7 +1326,11 @@ def groups(self, id):
except NotFound:
abort(404, _('Group not found'))

removed_group = request.POST.get('group_removed')
removed_group = None
for param in request.POST:
if param.startswith('group_remove'):
removed_group = param.split('.')[-1]
break
if removed_group:
data_dict = {"id": removed_group,
"object": id,
Expand Down
11 changes: 9 additions & 2 deletions ckan/controllers/user.py
Expand Up @@ -220,10 +220,17 @@ def _save_new(self, context):
# Redirect to a URL picked up by repoze.who which performs the
# login
login_url = self._get_repoze_handler('login_handler_path')
h.redirect_to('%s?login=%s&password=%s' % (

# We need to pass the logged in URL as came_from parameter
# otherwise we lose the language setting
came_from = h.url_for(controller='user', action='logged_in',
__ckan_no_root=True)
redirect_url = '{0}?login={1}&password={2}&came_from={3}'
h.redirect_to(redirect_url.format(
login_url,
str(data_dict['name']),
quote(data_dict['password1'].encode('utf-8'))))
quote(data_dict['password1'].encode('utf-8')),
came_from))
else:
# #1799 User has managed to register whilst logged in - warn user
# they are not re-logged in as new user.
Expand Down
3 changes: 0 additions & 3 deletions ckan/logic/action/get.py
Expand Up @@ -1448,9 +1448,6 @@ def package_search(context, data_dict):
# the query
abort = data_dict.get('abort_search', False)

if data_dict.get('sort') in (None, 'rank'):
data_dict['sort'] = 'score desc, metadata_modified desc'

if data_dict.get('sort') in (None, 'rank'):
data_dict['sort'] = 'score desc, metadata_modified desc'

Expand Down
1 change: 0 additions & 1 deletion ckan/public/base/javascript/modules/custom-fields.js
Expand Up @@ -83,7 +83,6 @@ this.ckan.module('custom-fields', function (jQuery, _) {
*/
disableField: function (field, disable) {
field.toggleClass('disabled', disable !== false);
field.find(':input:not(:checkbox)').prop('disabled', disable !== false);
},

/* Event handler that fires when the last key in the custom field block
Expand Down
25 changes: 0 additions & 25 deletions ckan/public/base/test/spec/modules/custom-fields.spec.js
Expand Up @@ -135,38 +135,13 @@ describe('ckan.module.CustomFieldsModule()', function () {
assert.isTrue(this.target.hasClass('disabled'));
});

it('should set the disabled property on the input elements', function () {
this.module.disableField(this.target);

this.target.find(':input').each(function () {
if (jQuery(this).is(':checkbox')) {
assert.isFalse(this.disabled, 'checkbox should not be disabled');
} else {
assert.isTrue(this.disabled, 'input should be disabled');
}
});
});

it('should remove a .disable class to the element if disable is false', function () {
this.target.addClass('disable');

this.module.disableField(this.target, false);
assert.isFalse(this.target.hasClass('disabled'));
});

it('should unset the disabled property on the input elements if disable is false', function () {
this.target.find(':input:not(:checkbox)').prop('disabled', true);

this.module.disableField(this.target, false);

this.target.find(':input').each(function () {
if (jQuery(this).is(':checkbox')) {
assert.isFalse(this.disabled, 'checkbox should not be disabled');
} else {
assert.isFalse(this.disabled, 'input should not be disabled');
}
});
});
});

describe('._onChange(event)', function () {
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/group/snippets/group_item.html
Expand Up @@ -36,7 +36,7 @@ <h3 class="media-heading">{{ group.display_name }}</h3>
<span>{{ _('View {name}').format(name=group.display_name) }}</span>
</a>
{% if group.user_member %}
<button name="group_removed" value="{{ group.id }}" type="submit" class="btn btn-danger btn-small media-edit" title="{{ _('Remove dataset from this group') }}">{{ _('Remove') }}</button>
<input name="group_remove.{{ group.id }}" value="{{ _('Remove') }}" type="submit" class="btn btn-danger btn-small media-edit" title="{{ _('Remove dataset from this group') }}"/>
{% endif %}
</li>
{% if position is divisibleby 3 %}
Expand Down
6 changes: 1 addition & 5 deletions doc/maintaining/datastore.rst
Expand Up @@ -229,7 +229,6 @@ The set-up for legacy mode is analogous to the normal set-up as described above

There is no need for a read-only user or special permissions. Therefore the legacy mode can be used for simple set-ups as well.

.. _datapusher:

---------------------------------------------------
DataPusher: Automatically Add Data to the DataStore
Expand All @@ -241,15 +240,12 @@ DataStore. This requires some processing, to extract the data from your files
and to add it to the DataStore in the format the DataStore can handle.

This task of automatically parsing and then adding data to the DataStore is
performed by the `DataPusher <DataPusher_docs>`_, a service that runs asynchronously and can be installed
performed by the `DataPusher`_, a service that runs asynchronously and can be installed
alongside CKAN.

To install this please look at the docs here: http://docs.ckan.org/projects/datapusher


.. _DataPusher_docs: http://docs.ckan.org/projects/datapusher


-----------------
The DataStore API
-----------------
Expand Down
2 changes: 1 addition & 1 deletion doc/maintaining/filestore.rst
Expand Up @@ -18,7 +18,7 @@ organization.

.. seealso::

:ref:`datapusher`
:doc:`datastore`

Resource files linked-to from CKAN or uploaded to CKAN's FileStore can
also be pushed into CKAN's DataStore, which then enables data previews and
Expand Down

0 comments on commit be87f11

Please sign in to comment.