]> source.dussan.org Git - archiva.git/commitdiff
fix impl of role edit view when operations or resources are not array but a single one
authorOlivier Lamy <olamy@apache.org>
Wed, 28 Dec 2011 17:11:22 +0000 (17:11 +0000)
committerOlivier Lamy <olamy@apache.org>
Wed, 28 Dec 2011 17:11:22 +0000 (17:11 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1225238 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/templates/roles-tmpl.html

index 8a856b61ac2306e557b18fe9476cfbb9bc03b692..cffcae2624357ebcc84fa2db1d744fe8c1f1f2b6 100644 (file)
   <div class="page-header">
     <h3>${$.i18n.prop('role.parents')}</h3>
   </div>
-  <ul>
-  {{each parentRoleNames}}
-    <li>${$value}</li>
-  {{/each}}
-  </ul>
+  {{if childRoleNames}}
+    <ul>
+      {{if $.isArray(childRoleNames)}}
+        {{each parentRoleNames}}
+          <li>${$value}</li>
+        {{/each}}
+      {{else}}
+        <li>${childRoleNames}</li>
+      {{/if}}
+    </ul>
+  {{/if}}
 
   <div class="page-header">
     <h3>${$.i18n.prop('role.childs')}</h3>
   </div>
-  <ul>
-    {{each childRoleNames}}
-      <li>${$value}</li>
-    {{/each}}
-  </ul>
+  {{if childRoleNames}}
+    <ul>
+      {{if $.isArray(childRoleNames)}}
+        {{each childRoleNames}}
+          <li>${$value}</li>
+        {{/each}}
+      {{else}}
+        <li>${childRoleNames}</li>
+      {{/if}}
+    </ul>
+  {{/if}}
 
   {{if permissions}}
     <div class="page-header">
         </tr>
       </thead>
       <tbody>
-        {{each permissions}}
+        {{if $.isArray(permissions)}}
+          {{each permissions}}
+            <tr>
+              <td>${$value.name}</td>
+              <td>${$value.operation.name}</td>
+              <td>${$value.resource.identifier}</td>
+            </tr>
+          {{/each}}
+        {{else}}
           <tr>
-            <td>${$value.name}</td>
-            <td>${$value.operation.name}</td>
-            <td>${$value.resource.identifier}</td>
+            <td>${permissions.name}</td>
+            <td>${permissions.operation.name}</td>
+            <td>${permissions.resource.identifier}</td>
           </tr>
-        {{/each}}
+        {{/if}}
       </tbody>
     </table>
   {{/if}}