diff options
Diffstat (limited to 'askbot/skins/common/media/js/post.js')
-rw-r--r-- | askbot/skins/common/media/js/post.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/askbot/skins/common/media/js/post.js b/askbot/skins/common/media/js/post.js index 294c5f41..7df01c83 100644 --- a/askbot/skins/common/media/js/post.js +++ b/askbot/skins/common/media/js/post.js @@ -2354,9 +2354,8 @@ UserGroupProfileEditor.prototype.decorate = function(element){ logo_changer.decorate(change_logo_btn); }; -var GroupJoinButton = function(group_id){ +var GroupJoinButton = function(){ TwoStateToggle.call(this); - this._group_id = group_id; }; inherits(GroupJoinButton, TwoStateToggle); @@ -2375,7 +2374,8 @@ GroupJoinButton.prototype.getHandler = function(){ url: askbot['urls']['join_or_leave_group'], success: function(data){ if (data['success']){ - me.setOn(data['is_member']); + var new_state = data['is_member'] ? 'on-state':'off-state'; + me.setState(new_state); } else { showMessage(me.getElement(), data['message']); } @@ -2384,6 +2384,11 @@ GroupJoinButton.prototype.getHandler = function(){ }; }; +GroupJoinButton.prototype.decorate = function(elem) { + GroupJoinButton.superClass_.decorate.call(this, elem); + this._group_id = this._element.data('groupId'); +}; + $(document).ready(function() { $('[id^="comments-for-"]').each(function(index, element){ var comments = new PostCommentsWidget(); |