-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
159 lines (128 loc) · 4.73 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
(function () {
'use strict';
/************************************************************
* Load Javascripts Asynchronously **************************
************************************************************/
// Create global var for attaching PHI modules.
window.PHI = {};
requirejs.config({
// Map out all "modules" to paths
paths: {
// Load Angular
'angular': '../../vendor-bower/angular/angular.min',
// Load Common Angular Components
'dirComComps': 'framework/directives/dir-common-components',
'dirComInputs': 'framework/directives/dir-common-inputs',
'dirEventDel': 'framework/directives/dir-event-delegation',
// Bower dependencies
'jquery': '../../vendor-bower/jquery/jquery.min',
// UI/Ix jQuery framework
'navigation': 'framework/components/navigation/navigation',
'overlay': 'framework/components/overlay/overlay',
'tabs': 'framework/components/tabs/tabs',
'alerts': 'framework/components/alerts/alerts',
'datepicker': 'framework/components/date-picker/kalendae',
'accordion': 'framework/components/accordion/accordion'
},
// Declare all dependencies
shim: {
// Angular component dependencies
'dirComComps': ['angular'],
'dirComInputs': ['angular'],
'dirEventDel': ['angular'],
// Phi UI/Ix dependencies
'navigation': ['jquery'],
'overlay': ['jquery'],
'tabs': ['jquery'],
'alerts': ['jquery'],
'accordion': ['jquery']
}
});
require(['dirComComps', 'dirComInputs', 'dirEventDel'],
function () {
angular.module('phi-demo', ['phi-common-components', 'phi-common-inputs', 'phi-event-delegation']).
controller('Ctrlr', ['$scope', 'dataService', function ($scope, dataService) {
$scope.sexes = ['Male', 'Female', 'Other'];
$scope.states = [
{value: "AL", text: "Alabama"},
{value: "AK", text: "Alaska"},
{value: "AZ", text: "Arizona"},
{value: "AR", text: "Arkansas"},
{value: "CA", text: "California"},
{value: "CO", text: "Colorado"},
{value: "CT", text: "Connecticut"},
{value: "DE", text: "Delaware"},
{value: "DC", text: "District Of Columbia"},
{value: "FL", text: "Florida"},
{value: "GA", text: "Georgia"},
{value: "HI", text: "Hawaii"},
{value: "ID", text: "Idaho"},
{value: "IL", text: "Illinois"},
{value: "IN", text: "Indiana"},
{value: "IA", text: "Iowa"},
{value: "KS", text: "Kansas"},
{value: "KY", text: "Kentucky"},
{value: "LA", text: "Louisiana"},
{value: "ME", text: "Maine"},
{value: "MD", text: "Maryland"},
{value: "MA", text: "Massachusetts"},
{value: "MI", text: "Michigan"},
{value: "MN", text: "Minnesota"},
{value: "MS", text: "Mississippi"},
{value: "MO", text: "Missouri"},
{value: "MT", text: "Montana"},
{value: "NE", text: "Nebraska"},
{value: "NV", text: "Nevada"},
{value: "NH", text: "New Hampshire"},
{value: "NJ", text: "New Jersey"},
{value: "NM", text: "New Mexico"},
{value: "NP", text: "Neehr Perfect"},
{value: "NY", text: "New York"},
{value: "NC", text: "North Carolina"},
{value: "ND", text: "North Dakota"},
{value: "OH", text: "Ohio"},
{value: "OK", text: "Oklahoma"},
{value: "OR", text: "Oregon"},
{value: "PA", text: "Pennsylvania"},
{value: "RI", text: "Rhode Island"},
{value: "SC", text: "South Carolina"},
{value: "SD", text: "South Dakota"},
{value: "TN", text: "Tennessee"},
{value: "TX", text: "Texas"},
{value: "UT", text: "Utah"},
{value: "VT", text: "Vermont"},
{value: "VA", text: "Virginia"},
{value: "WA", text: "Washington"},
{value: "WV", text: "West Virginia"},
{value: "WI", text: "Wisconsin"},
{value: "WY", text: "Wyoming"}
];
$scope.save = function () {
dataService.save($scope.user);
$scope.savedData = dataService.get();
};
}]);
angular.bootstrap(document, ['phi-demo']);
}
);
// Load in jQuery plugins
require(['navigation', 'overlay', 'tabs', 'alerts', 'datepicker', 'accordion'],
function (navigation, overlay, tabs, alerts, datepicker, accordion) {
// Kalendae plugin initialization
$('body').on('click.useCalendar', '.useCalendar', function () {
console.log('hello');
var parent = this.parentNode,
input = parent.getElementsByTagName('input')[0],
$input = $(input);
if (!($input.hasClass('hasCalendar'))) {
new Kalendae.Input(input, {
attachTo: input
});
$input.focus().addClass('hasCalendar');
} else {
$input.focus();
}
});
}
);
}());