Matteo Scandolo | e5be182 | 2016-05-25 08:53:11 -0700 | [diff] [blame] | 1 | 'use strict'; |
| 2 | |
| 3 | angular.module('xos.subscribers', [ |
| 4 | 'ngResource', |
| 5 | 'ngCookies', |
| 6 | 'ui.router', |
| 7 | 'xos.helpers' |
| 8 | ]) |
| 9 | .config(($stateProvider) => { |
| 10 | $stateProvider |
| 11 | .state('user-list', { |
| 12 | url: '/', |
| 13 | template: '<subscribers-list></subscribers-list>' |
| 14 | }); |
| 15 | }) |
| 16 | .config(function($httpProvider){ |
| 17 | $httpProvider.interceptors.push('NoHyperlinks'); |
| 18 | }) |
| 19 | .directive('subscribersList', function(){ |
| 20 | return { |
| 21 | restrict: 'E', |
| 22 | scope: {}, |
| 23 | bindToController: true, |
| 24 | controllerAs: 'vm', |
| 25 | templateUrl: 'templates/subscribers-list.tpl.html', |
Matteo Scandolo | df23cdb | 2016-05-25 17:37:37 -0700 | [diff] [blame] | 26 | controller: function(){ |
Matteo Scandolo | e5be182 | 2016-05-25 08:53:11 -0700 | [diff] [blame] | 27 | |
Matteo Scandolo | e5be182 | 2016-05-25 08:53:11 -0700 | [diff] [blame] | 28 | this.smartTableConfig = { |
| 29 | resource: 'Subscribers' |
| 30 | }; |
Matteo Scandolo | 741d6b4 | 2016-05-25 16:02:16 -0700 | [diff] [blame] | 31 | |
Matteo Scandolo | df23cdb | 2016-05-25 17:37:37 -0700 | [diff] [blame] | 32 | this.model = { |
| 33 | label: { |
| 34 | name: 'aaa' |
| 35 | }, |
| 36 | empty: {} |
| 37 | } |
| 38 | this.config = { |
Matteo Scandolo | 741d6b4 | 2016-05-25 16:02:16 -0700 | [diff] [blame] | 39 | exclude: ['password', 'last_login'], |
| 40 | formName: 'sampleForm', |
| 41 | actions: [ |
| 42 | { |
| 43 | label: 'Save', |
| 44 | icon: 'ok', // refers to bootstraps glyphicon |
| 45 | cb: (user) => { // receive the model |
| 46 | console.log(user); |
| 47 | }, |
| 48 | class: 'success' |
| 49 | } |
| 50 | ] |
| 51 | }; |
Matteo Scandolo | e5be182 | 2016-05-25 08:53:11 -0700 | [diff] [blame] | 52 | } |
| 53 | }; |
| 54 | }); |