diff --git a/openslides/participant/static/javascript/participant.js b/openslides/participant/static/javascript/participant.js
index 2048f2dd5..f02e6c3f6 100644
--- a/openslides/participant/static/javascript/participant.js
+++ b/openslides/participant/static/javascript/participant.js
@@ -15,12 +15,10 @@ $(function() {
dataType: 'json',
success: function(data) {
if (data.active) {
- newclass = 'active';
+ link.addClass('active');
} else {
- newclass = 'inactive';
+ link.removeClass('active');
}
- link.removeClass('active inactive').addClass(newclass);
- link.attr('href', data.link);
}
});
});
diff --git a/openslides/participant/static/styles/participant.css b/openslides/participant/static/styles/participant.css
index 49487e00e..3d2820f49 100644
--- a/openslides/participant/static/styles/participant.css
+++ b/openslides/participant/static/styles/participant.css
@@ -4,16 +4,7 @@
* :copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
* :license: GNU GPL, see LICENSE for more details.
*/
-
-a.status_link.active span {
- background-image: url(../images/icons/on.png);
- background-repeat: no-repeat;
- background-position: center;
- width: 16px;
- height: 16px;
- display: inline-block;
-}
-a.status_link.inactive span {
+a.status_link span {
background-image: url(../images/icons/off.png);
background-repeat: no-repeat;
background-position: center;
@@ -21,3 +12,6 @@ a.status_link.inactive span {
height: 16px;
display: inline-block;
}
+a.status_link.active span {
+ background-image: url(../images/icons/on.png);
+}
diff --git a/openslides/participant/templates/participant/overview.html b/openslides/participant/templates/participant/overview.html
index e13f4a4ca..eedfbec34 100644
--- a/openslides/participant/templates/participant/overview.html
+++ b/openslides/participant/templates/participant/overview.html
@@ -87,8 +87,8 @@
-
diff --git a/openslides/participant/urls.py b/openslides/participant/urls.py
index f13033f73..2aef5ef59 100644
--- a/openslides/participant/urls.py
+++ b/openslides/participant/urls.py
@@ -41,16 +41,9 @@ urlpatterns = patterns('participant.views',
name='user_delete',
),
- url(r'^(?P\d+)/active/$',
- 'user_set_active',
- {'active': True},
- name='user_active',
- ),
-
- url(r'^(?P\d+)/inactive/$',
- 'user_set_active',
- {'active': False},
- name='user_inactive',
+ url(r'^(?P\d+)/status/$',
+ 'user_set_status',
+ name='user_status',
),
url(r'^import$',
diff --git a/openslides/participant/views.py b/openslides/participant/views.py
index d74bb3751..40368b544 100644
--- a/openslides/participant/views.py
+++ b/openslides/participant/views.py
@@ -198,21 +198,26 @@ def user_delete(request, user_id):
@permission_required('participant.can_manage_participant')
@template('confirm.html')
-def user_set_active(request, user_id, active=True):
+def user_set_status(request, user_id):
try:
user = User.objects.get(pk=user_id)
- user.is_active = active
+ if user.is_active:
+ user.is_active = False
+ else:
+ user.is_active = True
user.save()
except User.DoesNotExist:
- messages.error(request, _('Participant %d does not exist.') % int(user_id))
+ messages.error(request, _('Participant ID %d does not exist.') % int(user_id))
+ return redirect(reverse('user_overview'))
if request.is_ajax():
- if active:
- link = reverse('user_inactive', args=[user.id])
- else:
- link = reverse('user_active', args=[user.id])
- return ajax_request({'active': active,
- 'link': link})
+ link = reverse('user_status', args=[user.id])
+ return ajax_request({'active': user.is_active})
+ # set success messages for page reload only (= not ajax request)
+ if user.is_active:
+ messages.success(request, _('%s is now present.') % user)
+ else:
+ messages.success(request, _('%s is now absent.') % user)
return redirect(reverse('user_overview'))
@permission_required('participant.can_manage_participant')
|