Skip to content

Commit

Permalink
Get rid of "join" for non-groups
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhuang committed Jul 2, 2013
1 parent b0acdc2 commit f40427c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
18 changes: 10 additions & 8 deletions deme_django/cms/templates/templatetags/listgridbox.html
Expand Up @@ -75,14 +75,16 @@
jqgrid_list.jqGrid('navButtonAdd',"#jqgrid_pager{{identifier}}",{caption:"Add",title:"Add an item to {% viewable_name collection_item %}",buttonicon:"ui-icon-circle-plus",onClickButton:function(){openDialogBox('addmember{{collection_item.pk}}');}})
{% endifagentcan %}

{% if cur_agent_in_collection %}
{% ifagentcan 'remove_self' collection_item %}
jqgrid_list.jqGrid('navButtonAdd',"#jqgrid_pager{{identifier}}",{caption:"Leave",title:"Remove my membership in {% viewable_name collection_item %}",buttonicon:"ui-icon-person",onClickButton:function(){$('#removeselfform{{identifier}}')[0].submit();}})
{% endifagentcan %}
{% else %}
{% ifagentcan 'add_self' collection_item %}
jqgrid_list.jqGrid('navButtonAdd',"#jqgrid_pager{{identifier}}",{caption:"Join",title:"Become a member of {% viewable_name collection_item %}",buttonicon:"ui-icon-person",onClickButton:function(){$('#addselfform{{identifier}}')[0].submit();}})
{% endifagentcan %}
{% if collection_is_group %}
{% if cur_agent_in_collection %}
{% ifagentcan 'remove_self' collection_item %}
jqgrid_list.jqGrid('navButtonAdd',"#jqgrid_pager{{identifier}}",{caption:"Leave",title:"Remove my membership in {% viewable_name collection_item %}",buttonicon:"ui-icon-person",onClickButton:function(){$('#removeselfform{{identifier}}')[0].submit();}})
{% endifagentcan %}
{% else %}
{% ifagentcan 'add_self' collection_item %}
jqgrid_list.jqGrid('navButtonAdd',"#jqgrid_pager{{identifier}}",{caption:"Join",title:"Become a member of {% viewable_name collection_item %}",buttonicon:"ui-icon-person",onClickButton:function(){$('#addselfform{{identifier}}')[0].submit();}})
{% endifagentcan %}
{% endif %}
{% endif %}
{% endif %}

Expand Down
1 change: 1 addition & 0 deletions deme_django/cms/templatetags/item_tags.py
Expand Up @@ -1294,6 +1294,7 @@ def render(self, context):
post_data['collection'] = collection
col_names.append('Actions')
col_model.append({'name': 'actions', 'index': 'actions', 'sortable': 'false'})
data['collection_is_group'] = collection_item.__class__ is Group
data['cur_agent_in_collection'] = collection_item.child_memberships.filter(active=True, item=data['cur_agent']).exists()
if inactive:
post_data['inactive'] = inactive
Expand Down

0 comments on commit f40427c

Please sign in to comment.