Ernesto Menéndez avatar Ernesto Menéndez committed 4b89810

apps.admin: estilo de mantenimiento de atributos

Comments (0)

Files changed (5)

nxweb/apps/admin/html/js/attribute-controller.js

         Attribute.delete({name:attribute});
         refresh();
     }
+
+    $scope.showCreateWindow = function() {
+        $("#attribute-window").data("kendoWindow").refresh("/window.html#/attribute/").center().open().unbind('close').bind('close', refresh);
+    }
+
+    $scope.showEditWindow = function(id) {
+        $("#attribute-window").data("kendoWindow").refresh("/window.html#/attribute/"+id).center().open().unbind('close').bind('close', refresh);
+    }
+
     refresh();
 }

nxweb/apps/admin/html/js/user-controller.js

 
 function UserListCtrl($scope, $location, Users, User) {
     requireLogin($scope.$parent.logged, $location);
-    refresh_users = function() {
+    refresh = function() {
         Users.get({},
                 function(resp, getHeaders) {
                     $scope.users = resp.data;
     }
 
     $scope.delete = function(uid_a) {
-        User.delete({uid:uid_a}, refresh_users(), refresh_users());
+        User.delete({uid:uid_a});
+        refresh();
     }
 
-    $scope.showCreateUserWindow = function() {
-        $("#window").data("kendoWindow").refresh("/window.html#/user").center().open().unbind('close').bind('close', refresh_users);
+    $scope.showCreateWindow = function() {
+        $("#user-window").data("kendoWindow").refresh("/window.html#/user").center().open().unbind('close').bind('close', refresh);
     }
 
-    $scope.showEditUserWindow = function(uid_a) {
-        $("#window").data("kendoWindow").refresh("/window.html#/user/"+uid_a).center().open().unbind('close').bind('close', refresh_users);
+    $scope.showEditWindow = function(id) {
+        $("#user-window").data("kendoWindow").refresh("/window.html#/user/"+id).center().open().unbind('close').bind('close', refresh);
     }
 
-    refresh_users();
+    refresh();
 }

nxweb/apps/admin/html/partials/attribute-list.html

-<a href="/#/attribute">Create</a>
-<table class="attribute">
-  <tr>
-    <td>Attribute Name</td><td>Values</td><td>Delete</td>
-  </tr>
+<div class="k-content">
+    <div class="k-grid k-widget" tabindex="0" style="height: 540px;">
+        <div class="k-toolbar k-grid-toolbar">
+            <!-- <a href="/#/attribute" class="k-button k-button-icontext k-grid-add"> -->
+            <a ng-click="showCreateWindow()" class="k-button k-button-icontext k-grid-add">
+                <span class="k-icon k-add"></span>
+                Create new attribute
+            </a>
+        </div>
+        <div class="k-grid-header" style="padding-right: 16px;">
+            <div class="k-grid-header-wrap">
+                <table cellspacing="0">
+                    <colgroup><col><col><col></colgroup>
+                    <thead>
+                        <tr>
+                            <th class="k-header">Attribute Name</th>
+                            <th class="k-header">Values</th>
+                            <th class="k-header"></th>
+                        </tr>
+                    </thead>
+                </table>
+            </div>
+        </div>
 
-  <tr ng-repeat="(attribute, values) in attributes">
-    <td><a ng-href="#/attribute/{{attribute}}">{{attribute}}</a></td>
-    <td><p ng-repeat="value in values">{{value}},</p></td>
-    <td><a ng-click="delete(attribute)">X</a></td>
-  </tr>
-</table>
+        <div class="k-grid-content" style="height: 468px;">
+            <table cellspacing="0" id="grid" style="height: auto;" class="k-focusable">
+                <colgroup><col><col><col></colgroup>
+                <tbody>
+                    <tr ng-repeat="(attribute, values) in attributes" ng-class-even="'k-alt'">
+                        <td>
+                            {{attribute}}
+                        </td>
+                        <td>
+                            <!-- <p ng-repeat="value in values">{{value}},</p> -->
+                            {{values.join(', ')}}
+                        </td>
+                        <td>
+                            <!-- <a ng-href="#/attribute/{{attribute}}"" class="k-button k-button-icontext k-grid-edit"> -->
+                            <a ng-click="showEditWindow(attribute)" class="k-button k-button-icontext k-grid-edit">
+                                <span class="k-icon k-edit"></span>
+                                Edit
+                            </a>
+                            <a ng-click="delete(attribute)" class="k-button k-button-icontext k-grid-delete">
+                                <span class="k-icon k-delete"></span>
+                                Delete
+                            </a>
+                        </td>
+                    </tr>
+                </tbody>
+            </table>
+        </div>
+    </div>
+</div>
+
+<div id="attribute-window">
+</div>
+
+<script type="text/javascript">
+    $(document).ready(function() {
+        $("#attribute-window").kendoWindow({
+            iframe: true,
+            modal: true,
+            content: "about:blank",
+            height: "400px",
+            width: "600px",
+            visible: false
+        });
+    });
+</script>

nxweb/apps/admin/html/partials/attribute.html

 <button ng-click="update(name,values)"  ng-disabled="form.$invalid">Save</button>
 
 </form>
-<a href="#/attributes">Back</a>
+<!-- <a href="#/attributes">Back</a> -->
 <p ng-show=message> {{message}} </p>

nxweb/apps/admin/html/partials/user-list.html

     <div class="k-grid k-widget" tabindex="0" style="height: 540px;">
         <div class="k-toolbar k-grid-toolbar">
             <!-- <a href="/#/user" class="k-button k-button-icontext k-grid-add"> -->
-            <a ng-click="showCreateUserWindow()" class="k-button k-button-icontext k-grid-add">
+            <a ng-click="showCreateWindow()" class="k-button k-button-icontext k-grid-add">
                 <span class="k-icon k-add"></span>
                 Create new user
             </a>
                         </td>
                         <td>
                             <!-- <a ng-href="#/user/{{key}}" class="k-button k-button-icontext k-grid-edit"> -->
-                            <a ng-click="showEditUserWindow(key)" class="k-button k-button-icontext k-grid-edit">
+                            <a ng-click="showEditWindow(key)" class="k-button k-button-icontext k-grid-edit">
                                 <span class="k-icon k-edit"></span>
                                 Edit
                             </a>
     </div>
 </div>
 
-<div id="window">
+<div id="user-window">
+    Wait...
 </div>
 
 <script type="text/javascript">
     $(document).ready(function() {
-        $("#window").kendoWindow({
+        $("#user-window").kendoWindow({
             iframe: true,
             modal: true,
+            content: "about:blank",
             height: "400px",
             width: "600px",
             visible: false
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.