First version of autocomplete for managing map editors

This commit is contained in:
Yohan Boniface 2013-05-22 16:23:49 +02:00
parent f735fa16e5
commit 96a0c4b16b
3 changed files with 11 additions and 3 deletions

View file

@ -201,6 +201,9 @@ body.content #storage-ui-container {
right: 0;
left: 0;
bottom: inherit;
height: 30%;
*/ background-color: #fff;
height: 30%;*/
background-color: #fff;
}
#id_editors + br + span.helptext {
display: none;
}

View file

@ -11,12 +11,14 @@
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}darline/src/css/form.css">
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}darline/src/css/color/seagreen.css">
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}darline/src/css/debug.css">
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}darline/src/css/autocomplete.css">
<link rel="stylesheet" href="{{ STATIC_URL }}storage/contrib/css/storage.ui.default.css">
<link rel="stylesheet" href="{{ STATIC_URL }}umap/umap.css">
{% endcompress css %}
{% compress js %}
<script src="{{ STATIC_URL }}darline/src/js/core.js"></script>
<script src="{{ STATIC_URL }}darline/src/js/debug.js"></script>
<script src="{{ STATIC_URL }}darline/src/js/autocomplete.js"></script>
{% endcompress js %}
<!-- IE Fix for HTML5 Tags -->
<!--[if lt IE 9]>
@ -47,6 +49,9 @@
D.DOM.toggleClass(this.parentNode, "on");
}
D.Event.on('fieldset.toggle legend', 'click', fn);
D.autoComplete('#id_editors', {
placeholder: "Type editors nick to add..."
}).multiselect();
});
var getMore = function (e) {
D.Event.stop(e);

View file

@ -79,7 +79,7 @@ class UserMaps(DetailView, PaginatorMixin):
context_object_name = "current_user"
def get_context_data(self, **kwargs):
maps = Map.objects.filter(Q(owner=self.object) | Q(editors=self.object)).order_by('-modified_at')[:30]
maps = Map.objects.filter(Q(owner=self.object) | Q(editors=self.object)).distinct().order_by('-modified_at')[:30]
maps = self.paginate(maps)
kwargs.update({
"maps": maps