-
Notifications
You must be signed in to change notification settings - Fork 0
/
jqui.php
693 lines (574 loc) · 18.7 KB
/
jqui.php
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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
<?php
//initilize the page
require_once("inc/init.php");
//require UI configuration (nav, ribbon, etc.)
require_once("inc/config.ui.php");
/*---------------- PHP Custom Scripts ---------
YOU CAN SET CONFIGURATION VARIABLES HERE BEFORE IT GOES TO NAV, RIBBON, ETC.
E.G. $page_title = "Custom Title" */
$page_title = "jQuery UI";
/* ---------------- END PHP Custom Scripts ------------- */
//include header
//you can add your custom css in $page_css array.
//Note: all css files are inside css/ folder
$page_css[] = "your_style.css";
include("inc/header.php");
//include left panel (navigation)
//follow the tree in inc/config.ui.php
$page_nav["ui_elements"]["sub"]["jquery_ui"]["active"] = true;
include("inc/nav.php");
?>
<!-- ==========================CONTENT STARTS HERE ========================== -->
<!-- MAIN PANEL -->
<div id="main" role="main">
<?php
//configure ribbon (breadcrumbs) array("name"=>"url"), leave url empty if no url
//$breadcrumbs["New Crumb"] => "http://url.com"
$breadcrumbs["UI Elements"] = "";
include("inc/ribbon.php");
?>
<!-- MAIN CONTENT -->
<div id="content">
<div class="row">
<div class="col-xs-12 col-sm-7 col-md-7 col-lg-4">
<h1 class="page-title txt-color-blueDark"><i class="fa fa-desktop fa-fw "></i>
UI Elements
<span>>
JQuery UI
</span>
</h1>
</div>
<div class="col-xs-12 col-sm-5 col-md-5 col-lg-8">
<ul id="sparks" class="">
<li class="sparks-info">
<h5> My Income <span class="txt-color-blue">$47,171</span></h5>
<div class="sparkline txt-color-blue hidden-mobile hidden-md hidden-sm">
1300, 1877, 2500, 2577, 2000, 2100, 3000, 2700, 3631, 2471, 2700, 3631, 2471
</div>
</li>
<li class="sparks-info">
<h5> Site Traffic <span class="txt-color-purple"><i class="fa fa-arrow-circle-up" data-rel="bootstrap-tooltip" title="Increased"></i> 45%</span></h5>
<div class="sparkline txt-color-purple hidden-mobile hidden-md hidden-sm">
110,150,300,130,400,240,220,310,220,300, 270, 210
</div>
</li>
<li class="sparks-info">
<h5> Site Orders <span class="txt-color-greenDark"><i class="fa fa-shopping-cart"></i> 2447</span></h5>
<div class="sparkline txt-color-greenDark hidden-mobile hidden-md hidden-sm">
110,150,300,130,400,240,220,310,220,300, 270, 210
</div>
</li>
</ul>
</div>
</div>
<!-- row -->
<div class="row">
<div class="col-sm-6 col-md-6 col-lg-6">
<div class="well well-sm well-light">
<h3>Dialogue</h3>
<a href="#" id="dialog_link" class="btn btn-info"> Open Dialog </a>
<a href="#" id="modal_link" class="btn bg-color-purple txt-color-white"> Open Modal Dialog </a>
</div>
<div class="well well-sm well-light">
<h3>Jquery Tabs
<br>
<small>Simple Tabs</small></h3>
<div id="tabs">
<ul>
<li>
<a href="#tabs-a">First</a>
</li>
<li>
<a href="#tabs-b">Second</a>
</li>
<li>
<a href="#tabs-c">Third</a>
</li>
</ul>
<div id="tabs-a">
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
</p>
</div>
<div id="tabs-b">
<p>
Phasellus mattis tincidunt nibh. Cras orci urna, blandit id, pretium vel, aliquet ornare, felis. Maecenas scelerisque sem non nisl. Fusce sed lorem in enim dictum bibendum.
</p>
</div>
<div id="tabs-c">
<p>
Nam dui erat, auctor a, dignissim quis, sollicitudin eu, felis. Pellentesque nisi urna, interdum eget, sagittis et, consequat vestibulum, lacus. Mauris porttitor ullamcorper augue.
</p>
</div>
</div>
<hr class="simple">
<h3>Dynamic Tabs
<br>
<small>Click button to add another tab</small></h3>
<p>
<button id="add_tab" class="btn btn-primary">
Add Tab
</button>
</p>
<div id="tabs2">
<ul>
<li>
<a href="#tabs-1">Nunc tincidunt</a>
</li>
</ul>
<div id="tabs-1">
<p>
Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.
</p>
</div>
</div>
<!-- Demo -->
<div id="addtab" title="<div class='widget-header'><h4><i class='fa fa-plus'></i> Add another tab</h4></div>">
<form>
<fieldset>
<input name="authenticity_token" type="hidden">
<div class="form-group">
<label>Tab Title</label>
<input class="form-control" id="tab_title" value="" placeholder="Text field" type="text">
</div>
<div class="form-group">
<label>Content</label>
<textarea class="form-control" name="tab_content" id="tab_content" placeholder="Tab Content" rows="3"></textarea>
</div>
</fieldset>
</form>
</div>
</div>
<div class="well well-sm well-light">
<h3>Slider
<br>
<small>Horizontal Slider with tooltip</small></h3>
<input type="text" class="slider slider-primary" id="g1" value=""
data-slider-max="500"
data-slider-value="185"
data-slider-selection = "before"
data-slider-handle="round">
<input type="text" class="slider slider-success" id="g2" value=""
data-slider-max="1000"
data-slider-step="1"
data-slider-value="[150,760]"
data-slider-handle="squar">
<h3>Usage <small>Its so simple...</small> </h3>
<pre>
<code><strong><input class="slider slider-primary" data-slider-min="10" .. /></strong></code>
data-slider-min="10" <span class="text-muted"> // slider min value</span>
data-slider-max="500" <span class="text-muted"> // slider max value</span>
data-slider-value="315" <span class="text-muted"> // handler position on slider</span>
data-slider-handle="round" <span class="text-muted"> // round or square</span> </pre>
</div>
<div class="well well-sm well-light">
<h3>Spinner</h3>
<div class="row">
<div class="col-sm-6 col-md-6 col-lg-6">
<div class="form-group">
<label>Spinner Right</label>
<input class="form-control" id="spinner-decimal" name="spinner-decimal" value="7.99">
</div>
</div>
<div class="col-sm-6 col-md-6 col-lg-6">
<div class="form-group">
<label>Spinner Left</label>
<input class="form-control spinner-left" id="spinner" name="spinner" value="1" type="text">
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-6 col-lg-6">
<div class="well well-sm well-light">
<h3>Menu <br> <small>Easy Menu List</small></h3>
<ul id="menu">
<li>
<a href="javascript:void(0);" class="ui-state-disabled">Aberdeen (disabled)</a>
</li>
<li>
<a href="javascript:void(0);">Ada</a>
</li>
<li>
<a href="javascript:void(0);">Adamsville</a>
</li>
<li>
<a href="javascript:void(0);">Addyston</a>
</li>
<li>
<a href="javascript:void(0);">Delphi</a>
<ul>
<li>
<a href="javascript:void(0);">Ada</a>
</li>
<li>
<a href="javascript:void(0);">Saarland</a>
</li>
<li>
<a href="javascript:void(0);">Salzburg</a>
</li>
</ul>
</li>
<li>
<a href="javascript:void(0);">Saarland</a>
</li>
<li>
<a href="javascript:void(0);">Salzburg</a>
<ul>
<li>
<a href="javascript:void(0);">Delphi</a>
<ul>
<li>
<a href="javascript:void(0);" class="ui-state-disabled">Ada</a>
</li>
<li>
<a href="javascript:void(0);">Saarland</a>
</li>
<li>
<a href="javascript:void(0);">Salzburg</a>
</li>
</ul>
</li>
<li>
<a href="?Delphi">Delphi</a>
<ul>
<li>
<a href="javascript:void(0);">Ada</a>
</li>
<li>
<a href="javascript:void(0);">Saarland</a>
</li>
<li>
<a href="javascript:void(0);">Salzburg</a>
</li>
</ul>
</li>
<li>
<a href="javascript:void(0);">Perch</a>
</li>
</ul>
</li>
</ul>
</div>
<div class="well well-sm well-light">
<h3>Auto Complete
<br>
<small>Type something to reveal autocompelete tags</small></h3>
<input class="form-control" placeholder="Type something..." type="text"
data-autocomplete='[
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"]'>
<p class="note">
Usage: data-autocomplete= ' ["this", "message", "bold", "text"] '
</p>
<h3>Auto Complete Ajax
<br>
<small>Fetches data from JSON url</small></h3>
<input class="form-control" placeholder="City..." type="text" id="city">
<div id="log" class="font-xs margin-top-10 text-danger"></div>
</div>
<div class="well well-sm well-light">
<h3>Accordion
<br>
<small>With fontawesome icons</small></h3>
<div id="accordion">
<div>
<h4>First</h4>
<div class="padding-10">
Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris.
Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo.
Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat.
Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.
</div>
</div>
<div>
<h4>Second</h4>
<div class="padding-10">
Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris.
Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo.
Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat.
Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.
</div>
</div>
<div>
<h4>Third</h4>
<div class="padding-10">
Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris.
Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo.
Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat.
Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.
</div>
</div>
</div>
</div>
<div class="well well-sm well-light">
<h3>Progress Bar
<br>
<small>Default progress bar.</small></h3>
<div id="progressbar"></div>
</div>
</div>
</div>
<!-- end row -->
<!-- ui-dialog -->
<div id="dialog_simple" title="Dialog Simple Title">
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
</p>
</div>
<div id="dialog-message" title="Dialog Simple Title">
<p>
This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.
</p>
<div class="hr hr-12 hr-double"></div>
Currently using
<b>36% of your storage space</b>
<div class="progress progress-striped active no-margin">
<div class="progress-bar progress-primary" role="progressbar" style="width: 36%"></div>
</div>
</div><!-- #dialog-message -->
</div>
<!-- END MAIN CONTENT -->
</div>
<!-- END MAIN PANEL -->
<!-- ==========================CONTENT ENDS HERE ========================== -->
<?php
//include required scripts
include("inc/scripts.php");
?>
<!-- PAGE RELATED PLUGIN(S)
<script src="..."></script>-->
<script type="text/javascript">
$(document).ready(function() {
// menu
$("#menu").menu();
/*
* AUTO COMPLETE AJAX
*/
function log(message) {
$("<div>").text(message).prependTo("#log");
$("#log").scrollTop(0);
}
$("#city").autocomplete({
source : function(request, response) {
$.ajax({
url : "http://ws.geonames.org/searchJSON",
dataType : "jsonp",
data : {
featureClass : "P",
style : "full",
maxRows : 12,
name_startsWith : request.term
},
success : function(data) {
response($.map(data.geonames, function(item) {
return {
label : item.name + (item.adminName1 ? ", " + item.adminName1 : "") + ", " + item.countryName,
value : item.name
}
}));
}
});
},
minLength : 2,
select : function(event, ui) {
log(ui.item ? "Selected: " + ui.item.label : "Nothing selected, input was " + this.value);
}
});
/*
* Spinners
*/
$("#spinner").spinner();
$("#spinner-decimal").spinner({
step : 0.01,
numberFormat : "n"
});
$("#spinner-currency").spinner({
min : 5,
max : 2500,
step : 25,
start : 1000,
numberFormat : "C"
});
/*
* CONVERT DIALOG TITLE TO HTML
* REF: http://stackoverflow.com/questions/14488774/using-html-in-a-dialogs-title-in-jquery-ui-1-10
*/
$.widget("ui.dialog", $.extend({}, $.ui.dialog.prototype, {
_title : function(title) {
if (!this.options.title) {
title.html(" ");
} else {
title.html(this.options.title);
}
}
}));
/*
* DIALOG SIMPLE
*/
// Dialog click
$('#dialog_link').click(function() {
$('#dialog_simple').dialog('open');
return false;
});
$('#dialog_simple').dialog({
autoOpen : false,
width : 600,
resizable : false,
modal : true,
title : "<div class='widget-header'><h4><i class='fa fa-warning'></i> Empty the recycle bin?</h4></div>",
buttons : [{
html : "<i class='fa fa-trash-o'></i> Delete all items",
"class" : "btn btn-danger",
click : function() {
$(this).dialog("close");
}
}, {
html : "<i class='fa fa-times'></i> Cancel",
"class" : "btn btn-default",
click : function() {
$(this).dialog("close");
}
}]
});
/*
* DIALOG HEADER ICON
*/
// Modal Link
$('#modal_link').click(function() {
$('#dialog-message').dialog('open');
return false;
});
$("#dialog-message").dialog({
autoOpen : false,
modal : true,
title : "<div class='widget-header'><h4><i class='icon-ok'></i> jQuery UI Dialog</h4></div>",
buttons : [{
html : "Cancel",
"class" : "btn btn-default",
click : function() {
$(this).dialog("close");
}
}, {
html : "<i class='fa fa-check'></i> OK",
"class" : "btn btn-primary",
click : function() {
$(this).dialog("close");
}
}]
});
/*
* Remove focus from buttons
*/
$('.ui-dialog :button').blur();
/*
* Just Tabs
*/
$('#tabs').tabs();
/*
* Simple tabs adding and removing
*/
$('#tabs2').tabs();
// Dynamic tabs
var tabTitle = $("#tab_title"), tabContent = $("#tab_content"), tabTemplate = "<li style='position:relative;'> <span class='air air-top-left delete-tab' style='top:7px; left:7px;'><button class='btn btn-xs font-xs btn-default hover-transparent'><i class='fa fa-times'></i></button></span></span><a href='#{href}'> #{label}</a></li>", tabCounter = 2;
var tabs = $("#tabs2").tabs();
// modal dialog init: custom buttons and a "close" callback reseting the form inside
var dialog = $("#addtab").dialog({
autoOpen : false,
width : 600,
resizable : false,
modal : true,
buttons : [{
html : "<i class='fa fa-times'></i> Cancel",
"class" : "btn btn-default",
click : function() {
$(this).dialog("close");
}
}, {
html : "<i class='fa fa-plus'></i> Add",
"class" : "btn btn-danger",
click : function() {
addTab();
$(this).dialog("close");
}
}]
});
// addTab form: calls addTab function on submit and closes the dialog
var form = dialog.find("form").submit(function(event) {
addTab();
dialog.dialog("close");
event.preventDefault();
});
// actual addTab function: adds new tab using the input from the form above
function addTab() {
var label = tabTitle.val() || "Tab " + tabCounter, id = "tabs-" + tabCounter, li = $(tabTemplate.replace(/#\{href\}/g, "#" + id).replace(/#\{label\}/g, label)), tabContentHtml = tabContent.val() || "Tab " + tabCounter + " content.";
tabs.find(".ui-tabs-nav").append(li);
tabs.append("<div id='" + id + "'><p>" + tabContentHtml + "</p></div>");
tabs.tabs("refresh");
tabCounter++;
// clear fields
$("#tab_title").val("");
$("#tab_content").val("");
}
// addTab button: just opens the dialog
$("#add_tab").button().click(function() {
dialog.dialog("open");
});
// close icon: removing the tab on click
$("#tabs2").on("click", 'span.delete-tab', function() {
var panelId = $(this).closest("li").remove().attr("aria-controls");
$("#" + panelId).remove();
tabs.tabs("refresh");
});
/*
* ACCORDION
*/
//jquery accordion
var accordionIcons = {
header: "fa fa-plus", // custom icon class
activeHeader: "fa fa-minus" // custom icon class
};
$("#accordion").accordion({
autoHeight : false,
heightStyle : "content",
collapsible : true,
animate : 300,
icons: accordionIcons,
header : "h4",
})
/*
* PROGRESS BAR
*/
$("#progressbar").progressbar({
value: 25,
create: function( event, ui ) {
$(this).removeClass("ui-corner-all").addClass('progress').find(">:first-child").removeClass("ui-corner-left").addClass('progress-bar progress-bar-success');
}
});
})
</script>
<?php
//include footer
include("inc/footer.php");
?>