]> source.dussan.org Git - archiva.git/commitdiff
user roles edit display roles from templates/resources
authorOlivier Lamy <olamy@apache.org>
Thu, 12 Jan 2012 14:12:32 +0000 (14:12 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 12 Jan 2012 14:12:32 +0000 (14:12 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1230555 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/templates/user-edit.html

index b2e3bd57ac0512da7a6c484f8269241f1e0a478a..a3c2aad2320155c9469372b529f0d358a5ce7dc5 100644 (file)
@@ -206,4 +206,11 @@ mapStringArray=function(data){
     }
   }
   return null;
-}
\ No newline at end of file
+}
+
+// extends jquery tmpl to support var def
+$.extend($.tmpl.tag, {
+    "var": {
+        open: "var $1;"
+    }
+});
\ No newline at end of file
index 94f39d6248be920cb2e87ba045f45a5555443179..cd14299f23043dd864c5a728f3f5cd03b44456a2 100644 (file)
       </blockquote>
       <ul>
       {{each $value.globalRoles}}
-        <li><div><input type="checkbox" value="${$value}" data-bind="checked: user.assignedRoles" />&nbsp;${$value}</div></li>
+        <li><input type="checkbox" value="${$value}" data-bind="checked: user.assignedRoles">&nbsp;${$value}</input></li>
       {{/each}}
       </ul>
+
+      {{if roleTemplates}}
+      <table class="bordered-table">
+        <thead>
+          <tr>
+            <th>&nbsp;</th>
+            {{each roleTemplates}}
+              <th>${$value.namePrefix}</th>
+            {{/each}}
+          </tr>
+        </thead>
+        <tbody>
+          {{each resources}}
+            {{var curResource = $value}}
+            <tr>
+              <td>${curResource}</td>
+              {{each roleTemplates}}
+                <td><input type="checkbox" value="${$value.namePrefix}${$value.delimiter}${curResource}" data-bind="checked: user.assignedRoles"/></td>
+              {{/each}}
+            </tr>
+          {{/each}}
+        </tbody>
+      </table>
+      {{/if}}
+
     {{/each}}
 
     <button class="btn" data-bind="click:updateUserRoles">${$.i18n.prop('update')}</button>