Changeset - ce9a226e0867
[Not reviewed]
beta
0 4 0
Mads Kiilerich - 13 years ago 2013-03-28 01:10:45
madski@unity3d.com
sort permission lists by (repository) name

This also exhibits too much code in templates and code/template duplication.
4 files changed with 4 insertions and 4 deletions:
0 comments (0 inline, 0 general)
rhodecode/templates/admin/permissions/permissions.html
Show inline comments
 
@@ -98,49 +98,49 @@
 
</div>
 

	
 
<div style="min-height:780px" class="box box-right">
 
    <!-- box / title -->
 
    <div class="title">
 
        <h5>${_('Default User Permissions')}</h5>
 
    </div>
 

	
 
    ## permissions overview
 
    <div id="perms" class="table">
 
           %for section in sorted(c.perm_user.permissions.keys()):
 
              <div class="perms_section_head">${section.replace("_"," ").capitalize()}</div>
 
              %if not c.perm_user.permissions[section]:
 
                  <span class="empty_data">${_('Nothing here yet')}</span>
 
              %else:
 
              <div id='tbl_list_wrap_${section}' class="yui-skin-sam">
 
               <table id="tbl_list_${section}">
 
                <thead>
 
                    <tr>
 
                    <th class="left">${_('Name')}</th>
 
                    <th class="left">${_('Permission')}</th>
 
                    <th class="left">${_('Edit Permission')}</th>
 
                </thead>
 
                <tbody>
 
                %for k in c.perm_user.permissions[section]:
 
                %for k in sorted(c.perm_user.permissions[section], key=lambda s: s.lower):
 
                     <%
 
                     if section != 'global':
 
                         section_perm = c.perm_user.permissions[section].get(k)
 
                         _perm = section_perm.split('.')[-1]
 
                     else:
 
                         _perm = section_perm = None
 
                     %>
 
                    <tr>
 
                        <td>
 
                            %if section == 'repositories':
 
                                <a href="${h.url('summary_home',repo_name=k)}">${k}</a>
 
                            %elif section == 'repositories_groups':
 
                                <a href="${h.url('repos_group_home',group_name=k)}">${k}</a>
 
                            %else:
 
                                ${h.get_permission_name(k)}
 
                            %endif
 
                        </td>
 
                        <td>
 
                            %if section == 'global':
 
                             ${h.bool2icon(k.split('.')[-1] != 'none')}
 
                            %else:
 
                             <span class="perm_tag ${_perm}">${section_perm}</span>
 
                            %endif
 
                        </td>
rhodecode/templates/admin/users/user_edit.html
Show inline comments
 
@@ -184,49 +184,49 @@
 
            <div class="buttons">
 
              ${h.submit('save',_('Save'),class_="ui-btn large")}
 
              ${h.reset('reset',_('Reset'),class_="ui-btn large")}
 
            </div>
 
        </div>
 
    </div>
 
    ${h.end_form()}
 

	
 
    ## permissions overview
 
    <div id="perms" class="table">
 
           %for section in sorted(c.perm_user.permissions.keys()):
 
              <div class="perms_section_head">${section.replace("_"," ").capitalize()}</div>
 
              %if not c.perm_user.permissions[section]:
 
                  <span class="empty_data">${_('Nothing here yet')}</span>
 
              %else:
 
              <div id='tbl_list_wrap_${section}' class="yui-skin-sam">
 
               <table id="tbl_list_${section}">
 
                <thead>
 
                    <tr>
 
                    <th class="left">${_('Name')}</th>
 
                    <th class="left">${_('Permission')}</th>
 
                    <th class="left">${_('Edit Permission')}</th>
 
                </thead>
 
                <tbody>
 
                %for k in c.perm_user.permissions[section]:
 
                %for k in sorted(c.perm_user.permissions[section], key=lambda s: s.lower):
 
                     <%
 
                     if section != 'global':
 
                         section_perm = c.perm_user.permissions[section].get(k)
 
                         _perm = section_perm.split('.')[-1]
 
                     else:
 
                         _perm = section_perm = None
 
                     %>
 
                    <tr>
 
                        <td>
 
                            %if section == 'repositories':
 
                                <a href="${h.url('summary_home',repo_name=k)}">${k}</a>
 
                            %elif section == 'repositories_groups':
 
                                <a href="${h.url('repos_group_home',group_name=k)}">${k}</a>
 
                            %else:
 
                                ${h.get_permission_name(k)}
 
                            %endif
 
                        </td>
 
                        <td>
 
                            %if section == 'global':
 
                             ${h.bool2icon(k.split('.')[-1] != 'none')}
 
                            %else:
 
                             <span class="perm_tag ${_perm}">${section_perm}</span>
 
                            %endif
 
                        </td>
rhodecode/templates/admin/users/user_edit_my_account.html
Show inline comments
 
@@ -35,49 +35,49 @@
 
             <span><a id="show_perms" class="link-white current" href="#perms">${_('My permissions')}</a> </span>
 
           </li>
 
           <li>
 
             <span><a id="show_my" class="link-white" href="#my">${_('My repos')}</a> </span>
 
           </li>
 
           <li>
 
             <span><a id="show_pullrequests" class="link-white" href="#pullrequests">${_('My pull requests')}</a> </span>
 
           </li>
 
         </ul>
 
    </div>
 
    <!-- end box / title -->
 
    <div id="perms_container">
 
        <div id="perms" class="table">
 
           %for section in sorted(c.rhodecode_user.permissions.keys()):
 
            <div class="perms_section_head">${section.replace("_"," ").capitalize()}</div>
 

	
 
            <div id='tbl_list_wrap_${section}' class="yui-skin-sam">
 
            <table id="tbl_list_${section}">
 
              <thead>
 
                  <tr>
 
                  <th class="left">${_('Name')}</th>
 
                  <th class="left">${_('Permission')}</th>
 
              </thead>
 
              <tbody>
 
            %for k in c.rhodecode_user.permissions[section]:
 
            %for k in sorted(c.rhodecode_user.permissions[section], key=lambda s: s.lower):
 
           <%
 
           if section != 'global':
 
               section_perm = c.rhodecode_user.permissions[section].get(k)
 
               _perm = section_perm.split('.')[-1]
 
           else:
 
               _perm = section_perm = None
 
           %>
 
            %if _perm not in ['none']:
 
                <tr>
 
                    <td>
 
                        %if section == 'repositories':
 
                            <a href="${h.url('summary_home',repo_name=k)}">${k}</a>
 
                        %elif section == 'repositories_groups':
 
                            <a href="${h.url('repos_group_home',group_name=k)}">${k}</a>
 
                        %else:
 
                            ${k}
 
                        %endif
 
                    </td>
 
                    <td>
 
                        %if section == 'global':
 
                         ${h.bool2icon(True)}
 
                        %else:
 
                        <span class="perm_tag ${_perm}">${section_perm}</span>
 
                        %endif
rhodecode/templates/admin/users_groups/users_group_edit.html
Show inline comments
 
@@ -165,49 +165,49 @@ ${h.end_form()}
 
    </div>
 
</div>
 

	
 
<div class="box box-left">
 
    <!-- box / title -->
 
    <div class="title">
 
        <h5>${_('Permissions defined for this group')}</h5>
 
    </div>
 
 ## permissions overview
 
    <div id="perms" class="table">
 
       %for section in sorted(c.users_group.permissions.keys()):
 
          <div class="perms_section_head">${section.replace("_"," ").capitalize()}</div>
 
          %if not c.users_group.permissions:
 
              <span class="empty_data">${_('No permissions set yet')}</span>
 
          %else:
 
          <div id='tbl_list_wrap_${section}' class="yui-skin-sam">
 
           <table id="tbl_list_repository">
 
            <thead>
 
                <tr>
 
                <th class="left">${_('Name')}</th>
 
                <th class="left">${_('Permission')}</th>
 
                <th class="left">${_('Edit Permission')}</th>
 
            </thead>
 
            <tbody>
 
            %for k in c.users_group.permissions[section]:
 
            %for k in sorted(c.users_group.permissions[section], key=lambda s: s.lower):
 
                 <%
 
                     section_perm = c.users_group.permissions[section].get(k)
 
                     _perm = section_perm.split('.')[-1]
 
                 %>
 
                <tr>
 
                    <td>
 
                        %if section == 'repositories':
 
                            <a href="${h.url('summary_home',repo_name=k)}">${k}</a>
 
                        %elif section == 'repositories_groups':
 
                            <a href="${h.url('repos_group_home',group_name=k)}">${k}</a>
 
                        %endif
 
                    </td>
 
                    <td>
 
                         <span class="perm_tag ${_perm}">${section_perm}</span>
 
                    </td>
 
                    <td>
 
                        %if section == 'repositories':
 
                            <a href="${h.url('edit_repo',repo_name=k,anchor='permissions_manage')}">${_('edit')}</a>
 
                        %elif section == 'repositories_groups':
 
                            <a href="${h.url('edit_repos_group',group_name=k,anchor='permissions_manage')}">${_('edit')}</a>
 
                        %else:
 
                            --
 
                        %endif
 
                    </td>
0 comments (0 inline, 0 general)