-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
154 lines (138 loc) · 6.59 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<title>Task Scheduler</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="Content/bootstrap.min.css" rel="stylesheet" />
</head>
<body>
<!-- Fixed navbar -->
<nav class="navbar navbar-default" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Tash Scheduler</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">User</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Logged In User <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Setting</a></li>
<li><a href="#">Log Out</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<!--section-create-->
<div class="row">
<div class="container">
<div class="padded">
<h2>Create</h2>
<br/>
<!--apply load spinning-->
<form class="form-horizontal" action="#" data-bind="spinning: isBusy">
<div class="form-group">
<label class="col-md-4 control-label"> Name</label>
<div class="col-md-6">
<input type="text" class="form-control" placeholder="User Name" data-bind="value: userName"/>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label"> Contact No.</label>
<div class="col-md-6">
<input type="text" class="form-control" placeholder="Contact No." data-bind="value: contactNo"/>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label"> Email</label>
<div class="col-md-6">
<input type="text" class="form-control" placeholder="Email" data-bind="value: email"/>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label"> Password</label>
<div class="col-md-6">
<input type="text" class="form-control" data-bind="value: password"/>
</div>
</div>
<div class="form-group">
<label class="col-md-4"></label>
<div class="col-md-6 btn-toolbar">
<a class="btn btn-success" data-bind="click: create">
Create
</a>
<a class="btn btn-info" data-bind="click: reset">
Reset
</a>
</div>
</div>
</form>
</div>
</div>
</div>
<script src="Scripts/jquery-2.1.1.min.js" type="text/javascript"></script>
<script src="Scripts/bootstrap.min.js" type="text/javascript"></script>
<script src="Scripts/jquery.mockjax.js" type="text/javascript"></script>
<script src="Scripts/jquery.blockUI.js" type="text/javascript"></script>
<script src="Scripts/spin.min.js" type="text/javascript"></script>
<script src="Scripts/knockout-3.2.0.js" type="text/javascript"></script>
<script src="ko.blockedSpin.js" type="text/javascript"></script>
<script>
/*
* ajax mocking
* https://github.com/jakerella/jquery-mockjax
*/
$(function() {
$.mockjax({
url: "/user/post",
responseTime: 500, //response delay
response: function (settings) {
this.responseText = 'added.';
}
});
});
/*view model*/
function ViewModel() {
var self = this;
self.isBusy = ko.observable(false); //show blocked spiner or not
self.userName = ko.observable();
self.contactNo = ko.observable();
self.email = ko.observable();
self.password = ko.observable();
self.create = function () {
self.isBusy(true); //show spinner
$.ajax({
type: "POST",
url: '/user/post',
success: function() {
self.reset();
self.isBusy(false); //remove spinner
}
});
};
self.reset = function () {
self.userName('');
self.contactNo('');
self.email('');
self.password('');
};
}
$(document).ready(function() {
var vm = ViewModel();
ko.applyBindings(vm);
});
</script>
</body>
</html>