forked from totaljs/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.js
More file actions
41 lines (36 loc) · 851 Bytes
/
default.js
File metadata and controls
41 lines (36 loc) · 851 Bytes
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
exports.install = function() {
F.route('/', view_registration);
F.route('/', json_registration, ['post']);
};
function codelist(controller) {
controller.repository.country = ['', 'SK', 'CZ', 'EN', 'DE', 'AU', 'HU', 'PL', 'FR'];
controller.repository.type = [
{ id: 0, name: '' },
{ id: 1, name: 'Developer' },
{ id: 2, name: 'Webdesigner' },
{ id: 3, name: 'Copywriter' },
{ id: 4, name: 'Consultant' }
];
}
function view_registration() {
var self = this;
var model = {
type: 0,
name: '',
email: '@',
password: '',
phone: '+421',
country: 'SK',
terms: true
};
codelist(self);
self.view('registration', model);
}
// THIS IS BAD EXAMPLE (SEND FORM VIA XHR)
// METHOD: POST
function json_registration() {
var self = this;
codelist(self);
self.repository.isSuccess = true;
self.view('registration', self.body);
}