|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | + <head> |
| 4 | + <title>angular-crud-grid</title> |
| 5 | + |
| 6 | + <link href='//cdnjs.cloudflare.com/ajax/libs/toastr.js/2.0.1/css/toastr.min.css' rel='stylesheet' type='text/css'> |
| 7 | + |
| 8 | + <link href='//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.1.1/css/bootstrap.css' rel='stylesheet' type='text/css'> |
| 9 | + |
| 10 | + <link href='http://daneden.github.io/animate.css/animate.min.css' rel='stylesheet' type='text/css'> |
| 11 | + |
| 12 | + <!-- <link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.1.1/css/bootstrap-theme.css" rel='stylesheet' type='text/css'> --> |
| 13 | + |
| 14 | + <!-- grid CSS must be defined after Bootstrap css because of --> |
| 15 | + <link href='./dist/crud-grid.css' rel='stylesheet' type='text/css'> |
| 16 | + |
| 17 | + <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script> |
| 18 | + <script src="//cdnjs.cloudflare.com/ajax/libs/toastr.js/2.0.1/js/toastr.min.js"></script> <!-- optional --> |
| 19 | + <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.20/angular.min.js"></script> |
| 20 | + <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.20/angular-animate.min.js"></script> |
| 21 | + <script src="//cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.10.0/ui-bootstrap-tpls.min.js"></script> |
| 22 | + |
| 23 | + <style type="text/css"> |
| 24 | + body { |
| 25 | + padding-top: 60px; |
| 26 | + padding-bottom: 20px; |
| 27 | + } |
| 28 | + |
| 29 | + .navbar { |
| 30 | + margin-bottom: 20px; |
| 31 | + } |
| 32 | + |
| 33 | + |
| 34 | + /* .blink-add, .blink-remove { |
| 35 | + color:#555555; |
| 36 | + -o-transition:.7s; |
| 37 | + -ms-transition:.7s; |
| 38 | + -moz-transition:.7s; |
| 39 | + -webkit-transition:.7s; |
| 40 | + transition:2s; |
| 41 | + } |
| 42 | +
|
| 43 | + .blink, |
| 44 | + .blink-add.blink-add-active { |
| 45 | + color:#ffffff; |
| 46 | + background-color:#333333; |
| 47 | + } |
| 48 | +
|
| 49 | + .blink-remove.blink-remove-active { |
| 50 | +
|
| 51 | + }*/ |
| 52 | + |
| 53 | +/* |
| 54 | + .blink:hover { |
| 55 | + color:#ffffff; |
| 56 | + background-color:#333333; |
| 57 | + }*/ |
| 58 | + |
| 59 | + |
| 60 | + </style> |
| 61 | + |
| 62 | + <script src="./dist/crud-grid.js"></script> |
| 63 | + |
| 64 | + <script> |
| 65 | + |
| 66 | + angular.module('demo', ['angular.crud.grid', 'ui.bootstrap']) // ui.bootstrap is MANDATORY dependency for crud grid |
| 67 | + |
| 68 | + .controller('DemoController1', function($scope,$log, DemoNotificationService) { |
| 69 | + $log.debug('>> DemoController1 <<'); |
| 70 | + $scope.gridReadOnly = false; //may be determine using an external Authorization service |
| 71 | + $scope.notificationService = DemoNotificationService; |
| 72 | + }) |
| 73 | + |
| 74 | + .controller('DemoController2', function($scope) { |
| 75 | + |
| 76 | + }) |
| 77 | + .factory('DemoNotificationService', function ($log) { |
| 78 | + toastr.options.closeButton = true; |
| 79 | + return { |
| 80 | + notify: function(operation, status, data) { |
| 81 | + $log.debug('## notify - operation:', operation, ' ## status: ', status, ' ## data: ', data); |
| 82 | + if (operation == 'ADD') { |
| 83 | + if (status == 201) { |
| 84 | + toastr.success('Record added OK', "Success"); |
| 85 | + } else { |
| 86 | + toastr.error('Error adding record', "Error"); |
| 87 | + } |
| 88 | + } else if (operation == 'UPDATE') { |
| 89 | + if (status == 204) { |
| 90 | + toastr.success('Record updated', "Success"); |
| 91 | + } else if (status == 409) { |
| 92 | + toastr.info('Could not update this record because it is being used in some existing TPP rules', "Info"); |
| 93 | + } else { |
| 94 | + toastr.error('Error updating record', "Error"); |
| 95 | + } |
| 96 | + } else if (operation == 'DELETE') { |
| 97 | + if (status == 204) { |
| 98 | + toastr.success('Record deleted', "Success"); |
| 99 | + } else if (status == 409) { |
| 100 | + toastr.info('Could not delete this record because it is being used in some existing TPP rules', "Info"); |
| 101 | + } else { |
| 102 | + toastr.error('Error deleting record', "Error"); |
| 103 | + } |
| 104 | + } else if (operation == "FORM_INVALID") { |
| 105 | + toastr.warning('Invalid input! Please check again and complete highlighted fields', "Warning"); |
| 106 | + } else throw new Error('unknown opration type', result); |
| 107 | + |
| 108 | + } |
| 109 | + }; |
| 110 | + }); |
| 111 | + |
| 112 | + </script> |
| 113 | + <head> |
| 114 | + |
| 115 | + <body ng-app="demo"> |
| 116 | + |
| 117 | + |
| 118 | + <div class="container"> |
| 119 | + |
| 120 | + <!-- Static navbar --> |
| 121 | + <div class="navbar navbar-default navbar-fixed-top" role="navigation"> |
| 122 | + <div class="navbar-header"> |
| 123 | + <div class="navbar-brand ">< angular-crud-grid > built for <a href="http://projects.spring.io/spring-data-rest/">Spring Data REST</a> backend - DEMO</div> |
| 124 | + |
| 125 | + <a href="https://github.com/flado/angular-crud-grid"> |
| 126 | + <img style="position: absolute; top: 0px; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub"> |
| 127 | + </a> |
| 128 | + </div> |
| 129 | + </div> |
| 130 | + |
| 131 | + <div ng-controller="DemoController1"> |
| 132 | + <div ng-form="myForm"> |
| 133 | + <div crud-grid read-only = "gridReadOnly" |
| 134 | + notification-service = "notificationService" |
| 135 | + grid-options="{ |
| 136 | + baseUrl: 'api', |
| 137 | + resourceName: 'stream', |
| 138 | + columnDefs: [ |
| 139 | + {field: 'key', displayName: 'ID', width:'col-md-1', readOnly: true}, |
| 140 | + {field: 'code', displayName: 'Stream Number', width:'col-md-2', searchable: true, required: true, validPattern: '/^[0-9]{1,10}$/' }, |
| 141 | + {field: 'desc', displayName: 'Description', searchable: true, required: true, validPattern: '/^[_ \'0-9A-Za-z/]{1,50}$/' } |
| 142 | + ], |
| 143 | + orderBy: [{ field: 'id', sort: 'asc' }], |
| 144 | + searchFilterUrl: '/findByCodeOrDesc', |
| 145 | + itemsPerPage: 5 }"></div> |
| 146 | + </div> |
| 147 | + </div> |
| 148 | + |
| 149 | + </div> |
| 150 | + |
| 151 | + |
| 152 | + <!-- |
| 153 | + <p> |
| 154 | + <input type="button" value="set" ng-click="myCssVar='animated flash'"> |
| 155 | + <input type="button" value="clear" ng-click="myCssVar=''"> |
| 156 | + <br> |
| 157 | + <table> |
| 158 | + <tbody> |
| 159 | + <tr > |
| 160 | + <div> |
| 161 | + <td ng-class="myCssVar">Col 1</td> |
| 162 | + <td ng-class="myCssVar">Col 2</td> |
| 163 | + <td ng-class="myCssVar">Col 3</td> |
| 164 | + </div> |
| 165 | + </tr> |
| 166 | + </tbody> |
| 167 | +
|
| 168 | + </table> |
| 169 | + <br/> |
| 170 | + <span >CSS-Animated Text</span> |
| 171 | + </p> |
| 172 | +
|
| 173 | + --> |
| 174 | + |
| 175 | + |
| 176 | + </body> |
| 177 | +</html> |
0 commit comments