Afform - Add 'Placement' colum to admin screen
[civicrm-core.git] / ext / afform / admin / ang / afAdmin.js
1 (function(angular, $, _) {
2 "use strict";
3 angular.module('afAdmin', CRM.angRequires('afAdmin'))
4
5 .config(function($routeProvider) {
6 $routeProvider.when('/', {
7 controller: 'afAdminList',
8 reloadOnSearch: false,
9 templateUrl: '~/afAdmin/afAdminList.html',
10 resolve: {
11 // Load data for lists
12 afforms: function(crmApi4) {
13 return crmApi4('Afform', 'get', {
14 select: ['name', 'title', 'type', 'server_route', 'has_local', 'has_base', 'is_dashlet', 'contact_summary:label'],
15 orderBy: {title: 'ASC'}
16 });
17 }
18 }
19 });
20 $routeProvider.when('/create/:type/:entity', {
21 controller: 'afAdminGui',
22 template: '<af-gui-editor mode="create" data="$ctrl.data" entity="$ctrl.entity"></af-gui-editor>',
23 resolve: {
24 // Load data for gui editor
25 data: function($route, crmApi4) {
26 return crmApi4('Afform', 'loadAdminData', {
27 definition: {type: $route.current.params.type},
28 entity: $route.current.params.entity
29 }, 0);
30 }
31 }
32 });
33 $routeProvider.when('/edit/:name', {
34 controller: 'afAdminGui',
35 template: '<af-gui-editor mode="edit" data="$ctrl.data"></af-gui-editor>',
36 resolve: {
37 // Load data for gui editor
38 data: function($route, crmApi4) {
39 return crmApi4('Afform', 'loadAdminData', {
40 definition: {name: $route.current.params.name}
41 }, 0);
42 }
43 }
44 });
45 $routeProvider.when('/clone/:name', {
46 controller: 'afAdminGui',
47 template: '<af-gui-editor mode="clone" data="$ctrl.data"></af-gui-editor>',
48 resolve: {
49 // Load data for gui editor
50 data: function($route, crmApi4) {
51 return crmApi4('Afform', 'loadAdminData', {
52 definition: {name: $route.current.params.name}
53 }, 0);
54 }
55 }
56 });
57 });
58
59 })(angular, CRM.$, CRM._);