Changeset - 42c6d8e4a0de
[Not reviewed]
default
0 1 0
Mads Kiilerich - 11 years ago 2015-04-28 16:55:05
madski@unity3d.com
permissions: by default, don't show entities with no access

There might be a lot of entities the user/group don't have access and it is
much more important to be able to see at a glance what the user/group has to
access to than what it doesn't have access to.
1 file changed with 1 insertions and 0 deletions:
0 comments (0 inline, 0 general)
kallithea/templates/base/perms_summary.html
Show inline comments
 
@@ -79,51 +79,52 @@
 
                              <a href="${h.url('edit_repo_perms',repo_name=k,anchor='permissions_manage')}">${_('edit')}</a>
 
                          %elif section == 'repositories_groups':
 
                              <a href="${h.url('edit_repo_group_perms',group_name=k,anchor='permissions_manage')}">${_('edit')}</a>
 
                          %elif section == 'user_groups':
 
                              ##<a href="${h.url('edit_users_group',id=k)}">${_('edit')}</a>
 
                          %endif
 
                      </td>
 
                      %endif
 
                  </tr>
 
                  %endif
 
              %endfor
 
              <tr id="empty_${section}" style="display: none"><td colspan="6">${_('No permission defined')}</td></tr>
 
              </tbody>
 
          %endif
 
         </table>
 
        </div>
 
        %endif
 
     %endfor
 
</div>
 
<script>
 
    $(document).ready(function(){
 
        var show_empty = function(section){
 
            var visible = $('.section_{0} tr.perm_row:visible'.format(section)).length;
 
            console.log(visible)
 
            console.log($('.section_{0} tr.perm_row:visible'.format(section)))
 
            if(visible == 0){
 
                $('#empty_{0}'.format(section)).show();
 
            }
 
            else{
 
                $('#empty_{0}'.format(section)).hide();
 
            }
 
        }
 
        var update_show = function($checkbox){
 
            var section = $checkbox.attr('section');
 

	
 
            var elems = $('.filter_' + section).each(function(el){
 
                var perm_type = $checkbox.attr('perm_type');
 
                var checked = $checkbox.checked;
 
                if(checked){
 
                    $('.'+section+'_'+perm_type).show();
 
                }
 
                else{
 
                    $('.'+section+'_'+perm_type).hide();
 
                }
 
            });
 
            show_empty(section);
 
        }
 
        $('.perm_filter').on('change', function(){update_show($(this));});
 
        $('.perm_filter[value=none]').each(function(){this.checked = false; update_show($(this));});
 
    })
 
</script>
 
</%def>
0 comments (0 inline, 0 general)