diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2013-06-03 17:50:13 -0400 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2013-06-03 17:50:13 -0400 |
commit | ff5872e86f630c8712e88d0b6444ea69422e8ea8 (patch) | |
tree | 8620b2cfecc0268fe61318c9c136e0da1806d98b | |
parent | cdde306208f13e05f944fdcb7c8fdd3ceaeb6bf3 (diff) | |
download | askbot-ff5872e86f630c8712e88d0b6444ea69422e8ea8.tar.gz askbot-ff5872e86f630c8712e88d0b6444ea69422e8ea8.tar.bz2 askbot-ff5872e86f630c8712e88d0b6444ea69422e8ea8.zip |
fixed up CSS and error reporting on adding user to group and removing from
-rw-r--r-- | askbot/media/js/user.js | 3 | ||||
-rw-r--r-- | askbot/media/style/style.css | 30 | ||||
-rw-r--r-- | askbot/media/style/style.less | 44 | ||||
-rw-r--r-- | askbot/templates/user_profile/user_info.html | 2 | ||||
-rw-r--r-- | askbot/views/commands.py | 23 |
5 files changed, 55 insertions, 47 deletions
diff --git a/askbot/media/js/user.js b/askbot/media/js/user.js index 957bfb4c..b5a999a5 100644 --- a/askbot/media/js/user.js +++ b/askbot/media/js/user.js @@ -804,7 +804,7 @@ UserGroup.prototype.decorate = function(element){ this._name = $.trim(element.find('a').html()); var deleter = new DeleteIcon(); deleter.setHandler(this.getDeleteHandler()); - deleter.setContent(gettext('Remove')); + //deleter.setContent(gettext('Remove')); this._element.find('td:last').append(deleter.getElement()); this._delete_icon = deleter; }; @@ -946,6 +946,7 @@ GroupAdderWidget.prototype.toggleState = function(){ GroupAdderWidget.prototype.decorate = function(element){ this._element = element; var input = this.makeElement('input'); + input.attr('type', 'text'); this._input = input; var groupsAc = new AutoCompleter({ diff --git a/askbot/media/style/style.css b/askbot/media/style/style.css index fbbd206a..55769a17 100644 --- a/askbot/media/style/style.css +++ b/askbot/media/style/style.css @@ -3013,6 +3013,7 @@ a:hover.medal { } .user-details td { padding-right: 10px; + vertical-align: top; } .user-about { background-color: #EEEEEE; @@ -3852,6 +3853,9 @@ p.signup_p { padding: 0; margin-top: -3px; } +.user-profile-page .vote-notification h3 { + padding: 10px; +} .user-profile-page ul.tags { margin-left: 5px; } @@ -4006,24 +4010,23 @@ body.anon.lang-es #searchBar { } /* user groups */ +#user-groups input[type="text"] { + height: 21px; + width: 100px; +} #user-groups ul { margin-bottom: 0px; } #user-groups .delete-icon { - float: none; - display: inline; - color: #525252; - padding: 0 3px 0 3px; - background: #ccc; - border-radius: 4px; - line-height: inherit; - -moz-border-radius: 4px; - -khtml-border-radius: 4px; - -webkit-border-radius: 4px; + background: url(../images/close-small.png) no-repeat; + border: none; + display: inline-block; + height: 14px; + margin-top: 4px; + width: 14px; } #user-groups .delete-icon:hover { - color: white; - background: #b32f2f; + background: url(../images/close-small-hover.png) no-repeat; } .question-page .post-update-info a.primary-group-name, a.primary-group-name { @@ -4058,9 +4061,6 @@ img.group-logo { #groups-list .group-name { padding-right: 20px; } -#groups-list td { - padding-bottom: 5px; -} .groups-page #groups-list th, .groups-page #groups-list td { padding-right: 20px; diff --git a/askbot/media/style/style.less b/askbot/media/style/style.less index 4a957dd6..83be895f 100644 --- a/askbot/media/style/style.less +++ b/askbot/media/style/style.less @@ -3133,6 +3133,7 @@ a:hover.medal { } td { padding-right: 10px; + vertical-align: top; } } @@ -4099,6 +4100,9 @@ p.signup_p { padding: 0; margin-top: -3px; } + .vote-notification h3 { + padding: 10px; + } ul.tags { margin-left: 5px; } @@ -4169,24 +4173,25 @@ body.anon.lang-es { } /* user groups */ -#user-groups ul { - margin-bottom: 0px; -} -#user-groups .delete-icon { - float: none; - display: inline; - color: #525252; - padding: 0 3px 0 3px; - background: #ccc; - border-radius: 4px; - line-height:inherit; - -moz-border-radius: 4px; - -khtml-border-radius: 4px; - -webkit-border-radius: 4px; -} -#user-groups .delete-icon:hover { - color: white; - background: #b32f2f; +#user-groups { + input[type="text"] { + height: 21px; + width: 100px; + } + ul { + margin-bottom: 0px; + } + .delete-icon { + background: url(../images/close-small.png) no-repeat; + border: none; + display: inline-block; + height: 14px; + margin-top: 4px; + width: 14px; + } + .delete-icon:hover { + background: url(../images/close-small-hover.png) no-repeat; + } } .question-page .post-update-info a.primary-group-name, @@ -4229,9 +4234,6 @@ img.group-logo { .group-name { padding-right: 20px; } - td { - padding-bottom: 5px; - } } .groups-page #groups-list { diff --git a/askbot/templates/user_profile/user_info.html b/askbot/templates/user_profile/user_info.html index d328dc4e..6c20f1f4 100644 --- a/askbot/templates/user_profile/user_info.html +++ b/askbot/templates/user_profile/user_info.html @@ -58,7 +58,7 @@ {% endif %} {% if settings.GROUPS_ENABLED %} <tr> - <td>{% if user_groups %}{% trans %}groups{% endtrans %}{% endif %}</td> + <td>{% trans %}groups{% endtrans %}</td> <td> <div id="user-groups"> <table id="groups-list"> diff --git a/askbot/views/commands.py b/askbot/views/commands.py index 1ffc6d23..d072cc00 100644 --- a/askbot/views/commands.py +++ b/askbot/views/commands.py @@ -1028,15 +1028,20 @@ def edit_group_membership(request): action = form.cleaned_data['action'] #warning: possible race condition if action == 'add': - group_params = {'name': group_name, 'user': user} - group = models.Group.objects.get_or_create(**group_params) - request.user.edit_group_membership(user, group, 'add') - template = get_template('widgets/group_snippet.html') - return { - 'name': group.name, - 'description': getattr(group.description, 'text', ''), - 'html': template.render({'group': group}) - } + try: + group = models.Group.objects.get(name=group_name) + request.user.edit_group_membership(user, group, 'add') + template = get_template('widgets/group_snippet.html') + return { + 'name': group.name, + 'description': getattr(group.description, 'text', ''), + 'html': template.render({'group': group}) + } + except models.Group.DoesNotExist: + raise exceptions.PermissionDenied( + _('Group %(name)s does not exist') % {'name': group_name} + ) + elif action == 'remove': try: group = models.Group.objects.get(name = group_name) |