-
Notifications
You must be signed in to change notification settings - Fork 25
/
index.html
263 lines (259 loc) · 14 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
<!DOCTYPE html>
<html ng-app="app">
<head>
<title>An Offline DB demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8">
<!--angularjs bootstrap library-->
<link rel="stylesheet" href="./stylesheets/bootstrap-combined.min.css">
<!--customized css-->
<link rel="stylesheet" href="./stylesheets/style.css">
<!--angularjs library-->
<script src="javascripts/angular-1.1.5.min.js"></script>
<!--angularjs bootstrap js library-->
<script src="javascripts/bootstrap-ui-tpls-0.6.0.js"></script>
<!--main app-->
<script src="javascripts/app.js"></script>
<!--indexedDB access services-->
<script src="javascripts/indexDBService.js"></script>
<!--image resize services-->
<script src="javascripts/imageResizeService.js"></script>
<!--instant search filters-->
<script src="javascripts/searchFilters.js"></script>
</head>
<body ng-csp ng-controller="AppCtrl">
<!--top menu-->
<div class="navbar navbar-fixed-top">
<header>
<h1 class="title">
{{flags.title}}
<span class="particle particle--c" ng-show="flags.isViewLoading"></span>
<span class="particle particle--a" ng-show="flags.isViewLoading"></span>
<span class="particle particle--b" ng-show="flags.isViewLoading"></span>
</h1>
<a id="forkme_banner" href="https://github.com/coderLMN/offlineDB">View on GitHub</a>
</header>
<!--message bar-->
<div ng-show="message.type" class="alert {{message.type}} text-center" type="success">
<button class="pull-right btn btn-primary btn-mini" ng-click="closeMessage()"><i class="icon-remove icon-white"></i></button>
<span>{{message.text}}</span>
</div>
</div>
<!--bootstrap carousel effect -->
<div class="row-fluid" id="top">
<div class=" well">
<carousel interval="5000">
<slide ng-repeat="slide in slides " active="slide.active">
<img ng-src="{{imgBuf[slide.imageAll[0]]}}" alt="{{slide.imageAll[0]}}" style="margin:auto;" class="img-polaroid img-carousel" ng-click="openSlide({{slide.timeStamp}})">
<div class="carousel-caption" >
<h4>{{slide.name}} :</h4>
<p class="lead"> {{slide.text.substring(0,120)}}
<strong ng-show="{{slide.text.length >120}}"> ...</strong>
</p>
</div>
</slide>
</carousel>
</div>
</div>
<!--data records list and search criteria-->
<div class="row-fluid">
<div class="offset1 span10">
<div class="form-horizontal row-fluid alert-info">
<p class="text-info"> <i class="icon-search"></i> Query (Matches: {{ filtered.length }} items)
<button class="btn btn-success pull-right" ng-click="addSlide(-1)">
<i class="icon-plus icon-white"></i> Add
</button>
</p>
<!--show search criteria only when there is at least one slide-->
<h3 ng-show="slides.length"><small>
<span class="span6">
<i class="icon-calendar"></i> Date :
<input type="text" class="input-medium" datepicker-popup="yyyy-MM-dd" ng-model="date.start" is-open="isOpenStart" ng-required="false" ng-click="datePickStart()" placeholder="From Date"/>
-
<input type="text" class="input-medium" datepicker-popup="yyyy-MM-dd" ng-model="date.end" is-open="isOpenEnd" ng-required="false" ng-click="datePickEnd()" placeholder="To Date"/>
</span>
<span class="span6">
<i class="icon-gift"></i> Price : $
<input class="input-medium" type="number" ng-model="cost.startPrice">
-
<input class="input-medium" type="number" ng-model="cost.endPrice">
</span>
</small></h3>
</div>
<!--paginated data table, with text search items and sort event handler in its head-->
<table class="table table-condensed table-striped table-bordered jumbotron">
<thead>
<tr class="navbar">
<th><h5><i class="icon-edit icon-white"></i> Name<input type="search" ng-model="name" placeholder="Search" class="pull-right input-small" ></h5></th>
<th class="text-center"><h5>Photo</h5></th>
<th><h5>Location <input type="search" ng-model="location" placeholder="Search" class="pull-right input-small" > </h5></th>
<th><h5>Description <input type="search" ng-model="term" placeholder="Search" class="pull-right input-small" > </h5></th>
<th ng-click="sort('date');" class="pointer"><h5><i class="icon-chevron-down icon-white"></i> Date</h5></th>
<th ng-click="sort('price');" class="pointer"><h5 class="pull-right"><i class="icon-chevron-down icon-white"></i> Price( $ )</h5></th>
<th class=" label-warning pointer" ng-click="toggleRemove()"><h5 class="pull-right">Remove</h5></th>
</tr>
</thead>
<tbody>
<!--a chain of filters are deployed here to enable a combined search-->
<tr ng-repeat="slide in filtered = ( slides | filter: {text: term, name: name, location:location} | period: this.date | cost: this.cost )| startFrom:(currentPage-1)*pageSize | limitTo:pageSize"
ng-animate="'animate'"
ng-class-odd="''" ng-class-even="''">
<td ng-dblclick="addSlide({{slide.timeStamp}})" class="pointer" title="Double Click to edit the record.">
<!--highlight all the text matches the value of input: name-->
<h4 ng-bind-html-unsafe="'{{slide.name}}' | highlight:name "></h4>
</td>
<td class="img pointer">
<img ng-src="{{imgBuf[slide.imageAll[0]]}}" alt="{{slide.imageAll[0]}}" width="160" class="img-rounded img-list" ng-click="openSlide({{slide.timeStamp}})">
</td>
<td>
<p class="lead" ng-bind-html-unsafe="'{{slide.location}}' | highlight:location "></p>
</td>
<td class="text">
<p class="lead" ng-bind-html-unsafe="'{{slide.text}}' | highlight:term "></p>
</td>
<td>
<p class="lead">
{{slide.date}}
</p>
</td>
<td>
<!--round floats to integers-->
<p class="lead pull-right">
{{slide.price |number:0}}
</p>
</td>
<td>
<!--remove icons are hidden by default-->
<p class="lead pointer pull-right">
<i class="icon-trash pointer" ng-show="flags.showRemoveIcon" ng-click="removeSlide({{slide.timeStamp}})"></i>
</p>
</td>
</tr>
</tbody>
<tfoot class="navbar">
<!--pagination with angularjs bootstrap lib-->
<tr>
<td colspan="7">
<pagination total-items="filtered.length" page="currentPage" items-per-page="pageSize"
max-size="maxSize" class="pagination pull-right" boundary-links="true" rotate="false"
num-pages="numPages">
</pagination>
</td>
</tr>
</tfoot>
</table>
<!--return to top-->
<span ng-click="toTop()" class="pull-right btn-link"> <i class="icon-arrow-up"></i> Back to top</span>
</div>
</div>
<!--template for create a new slide-->
<script type="text/ng-template" id="newSlide.html">
<div class="text-center modal-header">
<h1><small>
<div class="row-fluid">
<span>Add A Slide</span>
<button class="pull-right btn btn-primary" ng-click="cancel()"><i class="icon-remove icon-white"></i></button>
</div>
</small></h1>
</div>
<div class="modal-body well">
<br>
<div class="row-fluid">
<div class="span4 offset1">
Date : <input type="text" ng-model="newSlide.date" datepicker-popup="yyyy-MM-dd" is-open="newDateOpen" ng-required="true" ng-click="newDatePick()" placeholder="Date"/><br>
Name : <input type="text" ng-model="newSlide.name" placeholder="Name" ng-required="true"/> <br>
Photo : <input type="file" accept="image/*" onchange="angular.element(this).scope().selectFile(this)" />
<br>(Total: {{ newSlide.imageAll.length }} )
</div>
<div class="span5 offset1">
Price( $ ): <input type="number" ng-model="newSlide.price" placeholder="Price ( $ )" ng-required="true"/><br>
Location : <input type="text" ng-model="newSlide.location" placeholder="Location" ng-required="true"/> <br>
<div ng-show="duplicateImg" class="alert alert-error text-center" type="error">
<button class="pull-right btn btn-primary btn-mini" ng-click="clearError()"><i class="icon-remove icon-white"></i></button>
<span>Duplicated Photo : It has been selected.</span>
</div>
<div ng-show="addImgBuf" class="alert alert-warning text-center" type="warning">
<button class="pull-right btn btn-primary btn-mini" ng-click="clearExists()"><i class="icon-remove icon-white"></i></button>
<span>New Photo : The photo is new or modified, now create standard-sized image in DB.</span>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span10 offset1">
<div ng-show="newSlide.imageAll">
<hr>
<span ng-repeat="img in newSlide.imageAll">
<img ng-src="{{imgBuf[img]}}" width="100" class="img-rounded img-list" alt="{{img}}" title="Click to remove this image from the list" ng-click="cancelImg('{{img}}')">
</span>
<hr>
</div>
<div>
Description : <textarea ng-model="newSlide.text" placeholder="Description" ng-required="true"></textarea> <br>
<button class="btn disabled" disabled ng-hide="newSlide.date && newSlide.name && newSlide.price &&newSlide.location && newSlide.imageAll && newSlide.text">Save</button>
<button class="btn btn-primary" ng-show="newSlide.date && newSlide.name && newSlide.price && newSlide.imageAll &&newSlide.location && newSlide.text" ng-click="ok()">Save</button>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<div class="row">
<div class="span1 offset1">
<p class="pull-right"><strong>Tips:</strong></p>
</div>
<div class="span9">
<p class="lead pull-left">①All the data items are mandatory. ②Click the image to remove it from the list.</p>
</div>
</div>
</div>
</script>
<!--template for show a existing slide-->
<script type="text/ng-template" id="showSlide.html">
<div class="modal-header">
<h1><small class="text-center">
<div class="row-fluid">
<span class="span3">{{record.date}}</span>
<span class="span4">{{record.name}} : {{record.location}}</span>
<span class="span4">¥ {{record.price}}</span>
<button class="pull-right btn btn-primary" ng-click="exit()"><i class="icon-remove icon-white"></i></button>
</div>
</small></h1>
</div>
<div class="modal-body">
<carousel interval="5000">
<slide ng-repeat="img in record.imageAll " active="slide.active">
<img ng-src="{{imgBuf[img]}}" style="margin:auto;" class="img-polaroid img-carousel-big">
<div class="carousel-caption" >
<h4>{{img}}</h4>
</div>
</slide>
</carousel>
</div>
<div class="modal-footer">
<p class="lead"> {{record.text}}</p>
</div>
</script>
<!--information-->
<footer class="alert alert-warning" id="bottom">
<div class="row">
<div class="offset1 span5">
<h4>
<small>
This is a demo AngularJS App written by coderLMN. (Oct. 2013)<br>
</small>
</h4>
</div>
<div class="offset1 span5">
<h4>
<small>
<button ng-click="clearDB()" ng-show="slides.length" ng-hide="flags.isViewLoading"class="btn btn-danger pull-right" ><i class="icon-remove-sign icon-white"></i> Clear Data</button>
</small>
</h4>
</div>
<!--play music with html5 audio tag-->
<audio autoplay loop>
<source src="./music/mozart.mp3" type="audio/mp3">
</audio>
</div>
</footer>
</body>
</html>