Commit 6d6ece03 by Dányi Bence

webui: hide_group functionality added

parent 607ec44e
...@@ -308,6 +308,48 @@ $(function() { ...@@ -308,6 +308,48 @@ $(function() {
}) })
} }
function hide_group(id){
var hidden_groups=JSON.parse(window.localStorage.getItem('hidden_groups'))||{};
var hidden_groups_for_user=hidden_groups[current_user]||[];
for(var i in hidden_groups_for_user){
var hide=hidden_groups_for_user[i];
if(hide == id) return false;
}
hidden_groups_for_user.push(id);
hidden_groups[current_user]=hidden_groups_for_user;
window.localStorage.setItem('hidden_groups', JSON.stringify(hidden_groups));
$('#group-'+id).hide();
}
function hide_groups(){
var hidden_groups=JSON.parse(window.localStorage.getItem('hidden_groups'))||{};
var hidden_groups_for_user=hidden_groups[current_user]||[];
for(var i in hidden_groups_for_user){
var hide=hidden_groups_for_user[i];
$('#group-'+hide).hide();
}
}
function show_hidden_groups(){
var hidden_groups=JSON.parse(window.localStorage.getItem('hidden_groups'))||{};
hidden_groups[current_user]=[];
window.localStorage.setItem('hidden_groups', JSON.stringify(hidden_groups));
}
hide_groups();
$('.hide-group').click(function(e){
e.preventDefault(); e.stopPropagation();
hide_group($(this).data('id'));
return false;
});
$('#show-hidden-groups').click(function(e){
e.preventDefault(); e.stopPropagation();
show_hidden_groups();
$('#groups > li').each(function(){
$(this).show();
})
})
$('#new-member').click(function() { $('#new-member').click(function() {
$('#new-member-form').toggle(); $('#new-member-form').toggle();
}); });
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<script type="text/javascript" src="{% url django.views.i18n.javascript_catalog %}"></script> <script type="text/javascript" src="{% url django.views.i18n.javascript_catalog %}"></script>
<script type="text/javascript"> <script type="text/javascript">
window.localStorage.clear(); window.localStorage.clear();
var current_user={{user.id}};
</script> </script>
<script src="/static/less.min.js"></script> <script src="/static/less.min.js"></script>
<script src="/static/knockout.min.js"></script> <script src="/static/knockout.min.js"></script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment