bootstrap_admin 0.0.15 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +129 -31
  3. data/app/assets/stylesheets/bootstrap_overrides.css.scss +1 -0
  4. data/app/helpers/bootstrap_admin/menu_helper.rb +1 -1
  5. data/app/helpers/bootstrap_admin_helper.rb +22 -4
  6. data/app/views/defaults/_form.html.haml +1 -1
  7. data/app/views/defaults/_paginator.html.haml +3 -2
  8. data/app/views/defaults/edit.html.haml +1 -1
  9. data/app/views/defaults/new.html.haml +1 -1
  10. data/bootstrap_admin.gemspec +3 -2
  11. data/config/initializers/simple_form.rb +1 -1
  12. data/lib/bootstrap_admin/controller_helpers.rb +5 -2
  13. data/lib/bootstrap_admin/version.rb +1 -1
  14. data/lib/bootstrap_admin.rb +7 -0
  15. data/lib/generators/bootstrap_admin/{USAGE → install/USAGE} +0 -0
  16. data/lib/generators/bootstrap_admin/{install_generator.rb → install/install_generator.rb} +5 -0
  17. data/lib/generators/bootstrap_admin/{templates → install/templates}/bootstrap_admin.rb +0 -0
  18. data/lib/generators/bootstrap_admin/{templates → install/templates}/bootstrap_admin_menu.yml +0 -0
  19. data/lib/generators/bootstrap_admin/{templates → install/templates}/en_bootstrap_admin.yml +0 -0
  20. data/lib/generators/bootstrap_admin/override_views/USAGE +24 -0
  21. data/lib/generators/bootstrap_admin/override_views/override_views_generator.rb +61 -0
  22. data/vendor/assets/javascripts/bootstrap.js +379 -124
  23. data/vendor/assets/javascripts/bootstrap.min.js +2 -2
  24. data/vendor/assets/stylesheets/bootstrap-responsive.css +26 -5
  25. data/vendor/assets/stylesheets/bootstrap-responsive.min.css +4 -4
  26. data/vendor/assets/stylesheets/bootstrap.css +510 -236
  27. data/vendor/assets/stylesheets/bootstrap.min.css +4 -4
  28. metadata +39 -36
@@ -1,8 +1,8 @@
1
1
  /* ===================================================
2
- * bootstrap-transition.js v2.2.1
3
- * http://twitter.github.com/bootstrap/javascript.html#transitions
2
+ * bootstrap-transition.js v2.3.2
3
+ * http://getbootstrap.com/2.3.2/javascript.html#transitions
4
4
  * ===================================================
5
- * Copyright 2012 Twitter, Inc.
5
+ * Copyright 2013 Twitter, Inc.
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -58,10 +58,10 @@
58
58
  })
59
59
 
60
60
  }(window.jQuery);/* ==========================================================
61
- * bootstrap-alert.js v2.2.1
62
- * http://twitter.github.com/bootstrap/javascript.html#alerts
61
+ * bootstrap-alert.js v2.3.2
62
+ * http://getbootstrap.com/2.3.2/javascript.html#alerts
63
63
  * ==========================================================
64
- * Copyright 2012 Twitter, Inc.
64
+ * Copyright 2013 Twitter, Inc.
65
65
  *
66
66
  * Licensed under the Apache License, Version 2.0 (the "License");
67
67
  * you may not use this file except in compliance with the License.
@@ -127,6 +127,8 @@
127
127
  /* ALERT PLUGIN DEFINITION
128
128
  * ======================= */
129
129
 
130
+ var old = $.fn.alert
131
+
130
132
  $.fn.alert = function (option) {
131
133
  return this.each(function () {
132
134
  var $this = $(this)
@@ -139,16 +141,25 @@
139
141
  $.fn.alert.Constructor = Alert
140
142
 
141
143
 
144
+ /* ALERT NO CONFLICT
145
+ * ================= */
146
+
147
+ $.fn.alert.noConflict = function () {
148
+ $.fn.alert = old
149
+ return this
150
+ }
151
+
152
+
142
153
  /* ALERT DATA-API
143
154
  * ============== */
144
155
 
145
156
  $(document).on('click.alert.data-api', dismiss, Alert.prototype.close)
146
157
 
147
158
  }(window.jQuery);/* ============================================================
148
- * bootstrap-button.js v2.2.1
149
- * http://twitter.github.com/bootstrap/javascript.html#buttons
159
+ * bootstrap-button.js v2.3.2
160
+ * http://getbootstrap.com/2.3.2/javascript.html#buttons
150
161
  * ============================================================
151
- * Copyright 2012 Twitter, Inc.
162
+ * Copyright 2013 Twitter, Inc.
152
163
  *
153
164
  * Licensed under the Apache License, Version 2.0 (the "License");
154
165
  * you may not use this file except in compliance with the License.
@@ -210,6 +221,8 @@
210
221
  /* BUTTON PLUGIN DEFINITION
211
222
  * ======================== */
212
223
 
224
+ var old = $.fn.button
225
+
213
226
  $.fn.button = function (option) {
214
227
  return this.each(function () {
215
228
  var $this = $(this)
@@ -228,6 +241,15 @@
228
241
  $.fn.button.Constructor = Button
229
242
 
230
243
 
244
+ /* BUTTON NO CONFLICT
245
+ * ================== */
246
+
247
+ $.fn.button.noConflict = function () {
248
+ $.fn.button = old
249
+ return this
250
+ }
251
+
252
+
231
253
  /* BUTTON DATA-API
232
254
  * =============== */
233
255
 
@@ -238,10 +260,10 @@
238
260
  })
239
261
 
240
262
  }(window.jQuery);/* ==========================================================
241
- * bootstrap-carousel.js v2.2.1
242
- * http://twitter.github.com/bootstrap/javascript.html#carousel
263
+ * bootstrap-carousel.js v2.3.2
264
+ * http://getbootstrap.com/2.3.2/javascript.html#carousel
243
265
  * ==========================================================
244
- * Copyright 2012 Twitter, Inc.
266
+ * Copyright 2013 Twitter, Inc.
245
267
  *
246
268
  * Licensed under the Apache License, Version 2.0 (the "License");
247
269
  * you may not use this file except in compliance with the License.
@@ -267,8 +289,8 @@
267
289
 
268
290
  var Carousel = function (element, options) {
269
291
  this.$element = $(element)
292
+ this.$indicators = this.$element.find('.carousel-indicators')
270
293
  this.options = options
271
- this.options.slide && this.slide(this.options.slide)
272
294
  this.options.pause == 'hover' && this.$element
273
295
  .on('mouseenter', $.proxy(this.pause, this))
274
296
  .on('mouseleave', $.proxy(this.cycle, this))
@@ -278,19 +300,24 @@
278
300
 
279
301
  cycle: function (e) {
280
302
  if (!e) this.paused = false
303
+ if (this.interval) clearInterval(this.interval);
281
304
  this.options.interval
282
305
  && !this.paused
283
306
  && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
284
307
  return this
285
308
  }
286
309
 
310
+ , getActiveIndex: function () {
311
+ this.$active = this.$element.find('.item.active')
312
+ this.$items = this.$active.parent().children()
313
+ return this.$items.index(this.$active)
314
+ }
315
+
287
316
  , to: function (pos) {
288
- var $active = this.$element.find('.item.active')
289
- , children = $active.parent().children()
290
- , activePos = children.index($active)
317
+ var activeIndex = this.getActiveIndex()
291
318
  , that = this
292
319
 
293
- if (pos > (children.length - 1) || pos < 0) return
320
+ if (pos > (this.$items.length - 1) || pos < 0) return
294
321
 
295
322
  if (this.sliding) {
296
323
  return this.$element.one('slid', function () {
@@ -298,18 +325,18 @@
298
325
  })
299
326
  }
300
327
 
301
- if (activePos == pos) {
328
+ if (activeIndex == pos) {
302
329
  return this.pause().cycle()
303
330
  }
304
331
 
305
- return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos]))
332
+ return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
306
333
  }
307
334
 
308
335
  , pause: function (e) {
309
336
  if (!e) this.paused = true
310
337
  if (this.$element.find('.next, .prev').length && $.support.transition.end) {
311
338
  this.$element.trigger($.support.transition.end)
312
- this.cycle()
339
+ this.cycle(true)
313
340
  }
314
341
  clearInterval(this.interval)
315
342
  this.interval = null
@@ -343,10 +370,19 @@
343
370
 
344
371
  e = $.Event('slide', {
345
372
  relatedTarget: $next[0]
373
+ , direction: direction
346
374
  })
347
375
 
348
376
  if ($next.hasClass('active')) return
349
377
 
378
+ if (this.$indicators.length) {
379
+ this.$indicators.find('.active').removeClass('active')
380
+ this.$element.one('slid', function () {
381
+ var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()])
382
+ $nextIndicator && $nextIndicator.addClass('active')
383
+ })
384
+ }
385
+
350
386
  if ($.support.transition && this.$element.hasClass('slide')) {
351
387
  this.$element.trigger(e)
352
388
  if (e.isDefaultPrevented()) return
@@ -380,6 +416,8 @@
380
416
  /* CAROUSEL PLUGIN DEFINITION
381
417
  * ========================== */
382
418
 
419
+ var old = $.fn.carousel
420
+
383
421
  $.fn.carousel = function (option) {
384
422
  return this.each(function () {
385
423
  var $this = $(this)
@@ -389,7 +427,7 @@
389
427
  if (!data) $this.data('carousel', (data = new Carousel(this, options)))
390
428
  if (typeof option == 'number') data.to(option)
391
429
  else if (action) data[action]()
392
- else if (options.interval) data.cycle()
430
+ else if (options.interval) data.pause().cycle()
393
431
  })
394
432
  }
395
433
 
@@ -401,22 +439,37 @@
401
439
  $.fn.carousel.Constructor = Carousel
402
440
 
403
441
 
442
+ /* CAROUSEL NO CONFLICT
443
+ * ==================== */
444
+
445
+ $.fn.carousel.noConflict = function () {
446
+ $.fn.carousel = old
447
+ return this
448
+ }
449
+
404
450
  /* CAROUSEL DATA-API
405
451
  * ================= */
406
452
 
407
- $(document).on('click.carousel.data-api', '[data-slide]', function (e) {
453
+ $(document).on('click.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
408
454
  var $this = $(this), href
409
455
  , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
410
456
  , options = $.extend({}, $target.data(), $this.data())
457
+ , slideIndex
458
+
411
459
  $target.carousel(options)
460
+
461
+ if (slideIndex = $this.attr('data-slide-to')) {
462
+ $target.data('carousel').pause().to(slideIndex).cycle()
463
+ }
464
+
412
465
  e.preventDefault()
413
466
  })
414
467
 
415
468
  }(window.jQuery);/* =============================================================
416
- * bootstrap-collapse.js v2.2.1
417
- * http://twitter.github.com/bootstrap/javascript.html#collapse
469
+ * bootstrap-collapse.js v2.3.2
470
+ * http://getbootstrap.com/2.3.2/javascript.html#collapse
418
471
  * =============================================================
419
- * Copyright 2012 Twitter, Inc.
472
+ * Copyright 2013 Twitter, Inc.
420
473
  *
421
474
  * Licensed under the Apache License, Version 2.0 (the "License");
422
475
  * you may not use this file except in compliance with the License.
@@ -466,7 +519,7 @@
466
519
  , actives
467
520
  , hasData
468
521
 
469
- if (this.transitioning) return
522
+ if (this.transitioning || this.$element.hasClass('in')) return
470
523
 
471
524
  dimension = this.dimension()
472
525
  scroll = $.camelCase(['scroll', dimension].join('-'))
@@ -486,7 +539,7 @@
486
539
 
487
540
  , hide: function () {
488
541
  var dimension
489
- if (this.transitioning) return
542
+ if (this.transitioning || !this.$element.hasClass('in')) return
490
543
  dimension = this.dimension()
491
544
  this.reset(this.$element[dimension]())
492
545
  this.transition('removeClass', $.Event('hide'), 'hidden')
@@ -534,14 +587,16 @@
534
587
  }
535
588
 
536
589
 
537
- /* COLLAPSIBLE PLUGIN DEFINITION
538
- * ============================== */
590
+ /* COLLAPSE PLUGIN DEFINITION
591
+ * ========================== */
592
+
593
+ var old = $.fn.collapse
539
594
 
540
595
  $.fn.collapse = function (option) {
541
596
  return this.each(function () {
542
597
  var $this = $(this)
543
598
  , data = $this.data('collapse')
544
- , options = typeof option == 'object' && option
599
+ , options = $.extend({}, $.fn.collapse.defaults, $this.data(), typeof option == 'object' && option)
545
600
  if (!data) $this.data('collapse', (data = new Collapse(this, options)))
546
601
  if (typeof option == 'string') data[option]()
547
602
  })
@@ -554,9 +609,18 @@
554
609
  $.fn.collapse.Constructor = Collapse
555
610
 
556
611
 
557
- /* COLLAPSIBLE DATA-API
612
+ /* COLLAPSE NO CONFLICT
558
613
  * ==================== */
559
614
 
615
+ $.fn.collapse.noConflict = function () {
616
+ $.fn.collapse = old
617
+ return this
618
+ }
619
+
620
+
621
+ /* COLLAPSE DATA-API
622
+ * ================= */
623
+
560
624
  $(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
561
625
  var $this = $(this), href
562
626
  , target = $this.attr('data-target')
@@ -568,10 +632,10 @@
568
632
  })
569
633
 
570
634
  }(window.jQuery);/* ============================================================
571
- * bootstrap-dropdown.js v2.2.1
572
- * http://twitter.github.com/bootstrap/javascript.html#dropdowns
635
+ * bootstrap-dropdown.js v2.3.2
636
+ * http://getbootstrap.com/2.3.2/javascript.html#dropdowns
573
637
  * ============================================================
574
- * Copyright 2012 Twitter, Inc.
638
+ * Copyright 2013 Twitter, Inc.
575
639
  *
576
640
  * Licensed under the Apache License, Version 2.0 (the "License");
577
641
  * you may not use this file except in compliance with the License.
@@ -621,10 +685,15 @@
621
685
  clearMenus()
622
686
 
623
687
  if (!isActive) {
688
+ if ('ontouchstart' in document.documentElement) {
689
+ // if mobile we we use a backdrop because click events don't delegate
690
+ $('<div class="dropdown-backdrop"/>').insertBefore($(this)).on('click', clearMenus)
691
+ }
624
692
  $parent.toggleClass('open')
625
- $this.focus()
626
693
  }
627
694
 
695
+ $this.focus()
696
+
628
697
  return false
629
698
  }
630
699
 
@@ -649,9 +718,12 @@
649
718
 
650
719
  isActive = $parent.hasClass('open')
651
720
 
652
- if (!isActive || (isActive && e.keyCode == 27)) return $this.click()
721
+ if (!isActive || (isActive && e.keyCode == 27)) {
722
+ if (e.which == 27) $parent.find(toggle).focus()
723
+ return $this.click()
724
+ }
653
725
 
654
- $items = $('[role=menu] li:not(.divider) a', $parent)
726
+ $items = $('[role=menu] li:not(.divider):visible a', $parent)
655
727
 
656
728
  if (!$items.length) return
657
729
 
@@ -669,6 +741,7 @@
669
741
  }
670
742
 
671
743
  function clearMenus() {
744
+ $('.dropdown-backdrop').remove()
672
745
  $(toggle).each(function () {
673
746
  getParent($(this)).removeClass('open')
674
747
  })
@@ -683,8 +756,9 @@
683
756
  selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
684
757
  }
685
758
 
686
- $parent = $(selector)
687
- $parent.length || ($parent = $this.parent())
759
+ $parent = selector && $(selector)
760
+
761
+ if (!$parent || !$parent.length) $parent = $this.parent()
688
762
 
689
763
  return $parent
690
764
  }
@@ -693,6 +767,8 @@
693
767
  /* DROPDOWN PLUGIN DEFINITION
694
768
  * ========================== */
695
769
 
770
+ var old = $.fn.dropdown
771
+
696
772
  $.fn.dropdown = function (option) {
697
773
  return this.each(function () {
698
774
  var $this = $(this)
@@ -705,20 +781,30 @@
705
781
  $.fn.dropdown.Constructor = Dropdown
706
782
 
707
783
 
784
+ /* DROPDOWN NO CONFLICT
785
+ * ==================== */
786
+
787
+ $.fn.dropdown.noConflict = function () {
788
+ $.fn.dropdown = old
789
+ return this
790
+ }
791
+
792
+
708
793
  /* APPLY TO STANDARD DROPDOWN ELEMENTS
709
794
  * =================================== */
710
795
 
711
796
  $(document)
712
- .on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
713
- .on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
714
- .on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
715
- .on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
716
-
717
- }(window.jQuery);/* =========================================================
718
- * bootstrap-modal.js v2.2.1
719
- * http://twitter.github.com/bootstrap/javascript.html#modals
797
+ .on('click.dropdown.data-api', clearMenus)
798
+ .on('click.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
799
+ .on('click.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
800
+ .on('keydown.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
801
+
802
+ }(window.jQuery);
803
+ /* =========================================================
804
+ * bootstrap-modal.js v2.3.2
805
+ * http://getbootstrap.com/2.3.2/javascript.html#modals
720
806
  * =========================================================
721
- * Copyright 2012 Twitter, Inc.
807
+ * Copyright 2013 Twitter, Inc.
722
808
  *
723
809
  * Licensed under the Apache License, Version 2.0 (the "License");
724
810
  * you may not use this file except in compliance with the License.
@@ -776,8 +862,7 @@
776
862
  that.$element.appendTo(document.body) //don't move modals dom position
777
863
  }
778
864
 
779
- that.$element
780
- .show()
865
+ that.$element.show()
781
866
 
782
867
  if (transition) {
783
868
  that.$element[0].offsetWidth // force reflow
@@ -855,16 +940,17 @@
855
940
  })
856
941
  }
857
942
 
858
- , hideModal: function (that) {
859
- this.$element
860
- .hide()
861
- .trigger('hidden')
862
-
863
- this.backdrop()
943
+ , hideModal: function () {
944
+ var that = this
945
+ this.$element.hide()
946
+ this.backdrop(function () {
947
+ that.removeBackdrop()
948
+ that.$element.trigger('hidden')
949
+ })
864
950
  }
865
951
 
866
952
  , removeBackdrop: function () {
867
- this.$backdrop.remove()
953
+ this.$backdrop && this.$backdrop.remove()
868
954
  this.$backdrop = null
869
955
  }
870
956
 
@@ -888,6 +974,8 @@
888
974
 
889
975
  this.$backdrop.addClass('in')
890
976
 
977
+ if (!callback) return
978
+
891
979
  doAnimate ?
892
980
  this.$backdrop.one($.support.transition.end, callback) :
893
981
  callback()
@@ -896,8 +984,8 @@
896
984
  this.$backdrop.removeClass('in')
897
985
 
898
986
  $.support.transition && this.$element.hasClass('fade')?
899
- this.$backdrop.one($.support.transition.end, $.proxy(this.removeBackdrop, this)) :
900
- this.removeBackdrop()
987
+ this.$backdrop.one($.support.transition.end, callback) :
988
+ callback()
901
989
 
902
990
  } else if (callback) {
903
991
  callback()
@@ -909,6 +997,8 @@
909
997
  /* MODAL PLUGIN DEFINITION
910
998
  * ======================= */
911
999
 
1000
+ var old = $.fn.modal
1001
+
912
1002
  $.fn.modal = function (option) {
913
1003
  return this.each(function () {
914
1004
  var $this = $(this)
@@ -929,6 +1019,15 @@
929
1019
  $.fn.modal.Constructor = Modal
930
1020
 
931
1021
 
1022
+ /* MODAL NO CONFLICT
1023
+ * ================= */
1024
+
1025
+ $.fn.modal.noConflict = function () {
1026
+ $.fn.modal = old
1027
+ return this
1028
+ }
1029
+
1030
+
932
1031
  /* MODAL DATA-API
933
1032
  * ============== */
934
1033
 
@@ -949,11 +1048,11 @@
949
1048
 
950
1049
  }(window.jQuery);
951
1050
  /* ===========================================================
952
- * bootstrap-tooltip.js v2.2.1
953
- * http://twitter.github.com/bootstrap/javascript.html#tooltips
1051
+ * bootstrap-tooltip.js v2.3.2
1052
+ * http://getbootstrap.com/2.3.2/javascript.html#tooltips
954
1053
  * Inspired by the original jQuery.tipsy by Jason Frame
955
1054
  * ===========================================================
956
- * Copyright 2012 Twitter, Inc.
1055
+ * Copyright 2013 Twitter, Inc.
957
1056
  *
958
1057
  * Licensed under the Apache License, Version 2.0 (the "License");
959
1058
  * you may not use this file except in compliance with the License.
@@ -988,19 +1087,27 @@
988
1087
  , init: function (type, element, options) {
989
1088
  var eventIn
990
1089
  , eventOut
1090
+ , triggers
1091
+ , trigger
1092
+ , i
991
1093
 
992
1094
  this.type = type
993
1095
  this.$element = $(element)
994
1096
  this.options = this.getOptions(options)
995
1097
  this.enabled = true
996
1098
 
997
- if (this.options.trigger == 'click') {
998
- this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
999
- } else if (this.options.trigger != 'manual') {
1000
- eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus'
1001
- eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur'
1002
- this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
1003
- this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
1099
+ triggers = this.options.trigger.split(' ')
1100
+
1101
+ for (i = triggers.length; i--;) {
1102
+ trigger = triggers[i]
1103
+ if (trigger == 'click') {
1104
+ this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
1105
+ } else if (trigger != 'manual') {
1106
+ eventIn = trigger == 'hover' ? 'mouseenter' : 'focus'
1107
+ eventOut = trigger == 'hover' ? 'mouseleave' : 'blur'
1108
+ this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
1109
+ this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
1110
+ }
1004
1111
  }
1005
1112
 
1006
1113
  this.options.selector ?
@@ -1009,7 +1116,7 @@
1009
1116
  }
1010
1117
 
1011
1118
  , getOptions: function (options) {
1012
- options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data())
1119
+ options = $.extend({}, $.fn[this.type].defaults, this.$element.data(), options)
1013
1120
 
1014
1121
  if (options.delay && typeof options.delay == 'number') {
1015
1122
  options.delay = {
@@ -1022,7 +1129,15 @@
1022
1129
  }
1023
1130
 
1024
1131
  , enter: function (e) {
1025
- var self = $(e.currentTarget)[this.type](this._options).data(this.type)
1132
+ var defaults = $.fn[this.type].defaults
1133
+ , options = {}
1134
+ , self
1135
+
1136
+ this._options && $.each(this._options, function (key, value) {
1137
+ if (defaults[key] != value) options[key] = value
1138
+ }, this)
1139
+
1140
+ self = $(e.currentTarget)[this.type](options).data(this.type)
1026
1141
 
1027
1142
  if (!self.options.delay || !self.options.delay.show) return self.show()
1028
1143
 
@@ -1047,14 +1162,16 @@
1047
1162
 
1048
1163
  , show: function () {
1049
1164
  var $tip
1050
- , inside
1051
1165
  , pos
1052
1166
  , actualWidth
1053
1167
  , actualHeight
1054
1168
  , placement
1055
1169
  , tp
1170
+ , e = $.Event('show')
1056
1171
 
1057
1172
  if (this.hasContent() && this.enabled) {
1173
+ this.$element.trigger(e)
1174
+ if (e.isDefaultPrevented()) return
1058
1175
  $tip = this.tip()
1059
1176
  this.setContent()
1060
1177
 
@@ -1066,19 +1183,18 @@
1066
1183
  this.options.placement.call(this, $tip[0], this.$element[0]) :
1067
1184
  this.options.placement
1068
1185
 
1069
- inside = /in/.test(placement)
1070
-
1071
1186
  $tip
1072
1187
  .detach()
1073
1188
  .css({ top: 0, left: 0, display: 'block' })
1074
- .insertAfter(this.$element)
1075
1189
 
1076
- pos = this.getPosition(inside)
1190
+ this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
1191
+
1192
+ pos = this.getPosition()
1077
1193
 
1078
1194
  actualWidth = $tip[0].offsetWidth
1079
1195
  actualHeight = $tip[0].offsetHeight
1080
1196
 
1081
- switch (inside ? placement.split(' ')[1] : placement) {
1197
+ switch (placement) {
1082
1198
  case 'bottom':
1083
1199
  tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
1084
1200
  break
@@ -1093,11 +1209,56 @@
1093
1209
  break
1094
1210
  }
1095
1211
 
1096
- $tip
1097
- .offset(tp)
1098
- .addClass(placement)
1099
- .addClass('in')
1212
+ this.applyPlacement(tp, placement)
1213
+ this.$element.trigger('shown')
1214
+ }
1215
+ }
1216
+
1217
+ , applyPlacement: function(offset, placement){
1218
+ var $tip = this.tip()
1219
+ , width = $tip[0].offsetWidth
1220
+ , height = $tip[0].offsetHeight
1221
+ , actualWidth
1222
+ , actualHeight
1223
+ , delta
1224
+ , replace
1225
+
1226
+ $tip
1227
+ .offset(offset)
1228
+ .addClass(placement)
1229
+ .addClass('in')
1230
+
1231
+ actualWidth = $tip[0].offsetWidth
1232
+ actualHeight = $tip[0].offsetHeight
1233
+
1234
+ if (placement == 'top' && actualHeight != height) {
1235
+ offset.top = offset.top + height - actualHeight
1236
+ replace = true
1100
1237
  }
1238
+
1239
+ if (placement == 'bottom' || placement == 'top') {
1240
+ delta = 0
1241
+
1242
+ if (offset.left < 0){
1243
+ delta = offset.left * -2
1244
+ offset.left = 0
1245
+ $tip.offset(offset)
1246
+ actualWidth = $tip[0].offsetWidth
1247
+ actualHeight = $tip[0].offsetHeight
1248
+ }
1249
+
1250
+ this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
1251
+ } else {
1252
+ this.replaceArrow(actualHeight - height, actualHeight, 'top')
1253
+ }
1254
+
1255
+ if (replace) $tip.offset(offset)
1256
+ }
1257
+
1258
+ , replaceArrow: function(delta, dimension, position){
1259
+ this
1260
+ .arrow()
1261
+ .css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
1101
1262
  }
1102
1263
 
1103
1264
  , setContent: function () {
@@ -1111,6 +1272,10 @@
1111
1272
  , hide: function () {
1112
1273
  var that = this
1113
1274
  , $tip = this.tip()
1275
+ , e = $.Event('hide')
1276
+
1277
+ this.$element.trigger(e)
1278
+ if (e.isDefaultPrevented()) return
1114
1279
 
1115
1280
  $tip.removeClass('in')
1116
1281
 
@@ -1129,13 +1294,15 @@
1129
1294
  removeWithAnimation() :
1130
1295
  $tip.detach()
1131
1296
 
1297
+ this.$element.trigger('hidden')
1298
+
1132
1299
  return this
1133
1300
  }
1134
1301
 
1135
1302
  , fixTitle: function () {
1136
1303
  var $e = this.$element
1137
1304
  if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
1138
- $e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
1305
+ $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
1139
1306
  }
1140
1307
  }
1141
1308
 
@@ -1143,11 +1310,12 @@
1143
1310
  return this.getTitle()
1144
1311
  }
1145
1312
 
1146
- , getPosition: function (inside) {
1147
- return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), {
1148
- width: this.$element[0].offsetWidth
1149
- , height: this.$element[0].offsetHeight
1150
- })
1313
+ , getPosition: function () {
1314
+ var el = this.$element[0]
1315
+ return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
1316
+ width: el.offsetWidth
1317
+ , height: el.offsetHeight
1318
+ }, this.$element.offset())
1151
1319
  }
1152
1320
 
1153
1321
  , getTitle: function () {
@@ -1165,6 +1333,10 @@
1165
1333
  return this.$tip = this.$tip || $(this.options.template)
1166
1334
  }
1167
1335
 
1336
+ , arrow: function(){
1337
+ return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow")
1338
+ }
1339
+
1168
1340
  , validate: function () {
1169
1341
  if (!this.$element[0].parentNode) {
1170
1342
  this.hide()
@@ -1186,8 +1358,8 @@
1186
1358
  }
1187
1359
 
1188
1360
  , toggle: function (e) {
1189
- var self = $(e.currentTarget)[this.type](this._options).data(this.type)
1190
- self[self.tip().hasClass('in') ? 'hide' : 'show']()
1361
+ var self = e ? $(e.currentTarget)[this.type](this._options).data(this.type) : this
1362
+ self.tip().hasClass('in') ? self.hide() : self.show()
1191
1363
  }
1192
1364
 
1193
1365
  , destroy: function () {
@@ -1200,6 +1372,8 @@
1200
1372
  /* TOOLTIP PLUGIN DEFINITION
1201
1373
  * ========================= */
1202
1374
 
1375
+ var old = $.fn.tooltip
1376
+
1203
1377
  $.fn.tooltip = function ( option ) {
1204
1378
  return this.each(function () {
1205
1379
  var $this = $(this)
@@ -1217,17 +1391,28 @@
1217
1391
  , placement: 'top'
1218
1392
  , selector: false
1219
1393
  , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
1220
- , trigger: 'hover'
1394
+ , trigger: 'hover focus'
1221
1395
  , title: ''
1222
1396
  , delay: 0
1223
1397
  , html: false
1398
+ , container: false
1224
1399
  }
1225
1400
 
1226
- }(window.jQuery);/* ===========================================================
1227
- * bootstrap-popover.js v2.2.1
1228
- * http://twitter.github.com/bootstrap/javascript.html#popovers
1401
+
1402
+ /* TOOLTIP NO CONFLICT
1403
+ * =================== */
1404
+
1405
+ $.fn.tooltip.noConflict = function () {
1406
+ $.fn.tooltip = old
1407
+ return this
1408
+ }
1409
+
1410
+ }(window.jQuery);
1411
+ /* ===========================================================
1412
+ * bootstrap-popover.js v2.3.2
1413
+ * http://getbootstrap.com/2.3.2/javascript.html#popovers
1229
1414
  * ===========================================================
1230
- * Copyright 2012 Twitter, Inc.
1415
+ * Copyright 2013 Twitter, Inc.
1231
1416
  *
1232
1417
  * Licensed under the Apache License, Version 2.0 (the "License");
1233
1418
  * you may not use this file except in compliance with the License.
@@ -1269,7 +1454,7 @@
1269
1454
  , content = this.getContent()
1270
1455
 
1271
1456
  $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
1272
- $tip.find('.popover-content > *')[this.options.html ? 'html' : 'text'](content)
1457
+ $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)
1273
1458
 
1274
1459
  $tip.removeClass('fade top bottom left right in')
1275
1460
  }
@@ -1283,8 +1468,8 @@
1283
1468
  , $e = this.$element
1284
1469
  , o = this.options
1285
1470
 
1286
- content = $e.attr('data-content')
1287
- || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
1471
+ content = (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
1472
+ || $e.attr('data-content')
1288
1473
 
1289
1474
  return content
1290
1475
  }
@@ -1306,6 +1491,8 @@
1306
1491
  /* POPOVER PLUGIN DEFINITION
1307
1492
  * ======================= */
1308
1493
 
1494
+ var old = $.fn.popover
1495
+
1309
1496
  $.fn.popover = function (option) {
1310
1497
  return this.each(function () {
1311
1498
  var $this = $(this)
@@ -1322,14 +1509,24 @@
1322
1509
  placement: 'right'
1323
1510
  , trigger: 'click'
1324
1511
  , content: ''
1325
- , template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'
1512
+ , template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
1326
1513
  })
1327
1514
 
1328
- }(window.jQuery);/* =============================================================
1329
- * bootstrap-scrollspy.js v2.2.1
1330
- * http://twitter.github.com/bootstrap/javascript.html#scrollspy
1515
+
1516
+ /* POPOVER NO CONFLICT
1517
+ * =================== */
1518
+
1519
+ $.fn.popover.noConflict = function () {
1520
+ $.fn.popover = old
1521
+ return this
1522
+ }
1523
+
1524
+ }(window.jQuery);
1525
+ /* =============================================================
1526
+ * bootstrap-scrollspy.js v2.3.2
1527
+ * http://getbootstrap.com/2.3.2/javascript.html#scrollspy
1331
1528
  * =============================================================
1332
- * Copyright 2012 Twitter, Inc.
1529
+ * Copyright 2013 Twitter, Inc.
1333
1530
  *
1334
1531
  * Licensed under the Apache License, Version 2.0 (the "License");
1335
1532
  * you may not use this file except in compliance with the License.
@@ -1386,7 +1583,7 @@
1386
1583
  , $href = /^#\w/.test(href) && $(href)
1387
1584
  return ( $href
1388
1585
  && $href.length
1389
- && [[ $href.position().top, href ]] ) || null
1586
+ && [[ $href.position().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]] ) || null
1390
1587
  })
1391
1588
  .sort(function (a, b) { return a[0] - b[0] })
1392
1589
  .each(function () {
@@ -1448,6 +1645,8 @@
1448
1645
  /* SCROLLSPY PLUGIN DEFINITION
1449
1646
  * =========================== */
1450
1647
 
1648
+ var old = $.fn.scrollspy
1649
+
1451
1650
  $.fn.scrollspy = function (option) {
1452
1651
  return this.each(function () {
1453
1652
  var $this = $(this)
@@ -1465,6 +1664,15 @@
1465
1664
  }
1466
1665
 
1467
1666
 
1667
+ /* SCROLLSPY NO CONFLICT
1668
+ * ===================== */
1669
+
1670
+ $.fn.scrollspy.noConflict = function () {
1671
+ $.fn.scrollspy = old
1672
+ return this
1673
+ }
1674
+
1675
+
1468
1676
  /* SCROLLSPY DATA-API
1469
1677
  * ================== */
1470
1678
 
@@ -1476,10 +1684,10 @@
1476
1684
  })
1477
1685
 
1478
1686
  }(window.jQuery);/* ========================================================
1479
- * bootstrap-tab.js v2.2.1
1480
- * http://twitter.github.com/bootstrap/javascript.html#tabs
1687
+ * bootstrap-tab.js v2.3.2
1688
+ * http://getbootstrap.com/2.3.2/javascript.html#tabs
1481
1689
  * ========================================================
1482
- * Copyright 2012 Twitter, Inc.
1690
+ * Copyright 2013 Twitter, Inc.
1483
1691
  *
1484
1692
  * Licensed under the Apache License, Version 2.0 (the "License");
1485
1693
  * you may not use this file except in compliance with the License.
@@ -1587,6 +1795,8 @@
1587
1795
  /* TAB PLUGIN DEFINITION
1588
1796
  * ===================== */
1589
1797
 
1798
+ var old = $.fn.tab
1799
+
1590
1800
  $.fn.tab = function ( option ) {
1591
1801
  return this.each(function () {
1592
1802
  var $this = $(this)
@@ -1599,6 +1809,15 @@
1599
1809
  $.fn.tab.Constructor = Tab
1600
1810
 
1601
1811
 
1812
+ /* TAB NO CONFLICT
1813
+ * =============== */
1814
+
1815
+ $.fn.tab.noConflict = function () {
1816
+ $.fn.tab = old
1817
+ return this
1818
+ }
1819
+
1820
+
1602
1821
  /* TAB DATA-API
1603
1822
  * ============ */
1604
1823
 
@@ -1608,10 +1827,10 @@
1608
1827
  })
1609
1828
 
1610
1829
  }(window.jQuery);/* =============================================================
1611
- * bootstrap-typeahead.js v2.2.1
1612
- * http://twitter.github.com/bootstrap/javascript.html#typeahead
1830
+ * bootstrap-typeahead.js v2.3.2
1831
+ * http://getbootstrap.com/2.3.2/javascript.html#typeahead
1613
1832
  * =============================================================
1614
- * Copyright 2012 Twitter, Inc.
1833
+ * Copyright 2013 Twitter, Inc.
1615
1834
  *
1616
1835
  * Licensed under the Apache License, Version 2.0 (the "License");
1617
1836
  * you may not use this file except in compliance with the License.
@@ -1642,8 +1861,8 @@
1642
1861
  this.sorter = this.options.sorter || this.sorter
1643
1862
  this.highlighter = this.options.highlighter || this.highlighter
1644
1863
  this.updater = this.options.updater || this.updater
1645
- this.$menu = $(this.options.menu).appendTo('body')
1646
1864
  this.source = this.options.source
1865
+ this.$menu = $(this.options.menu)
1647
1866
  this.shown = false
1648
1867
  this.listen()
1649
1868
  }
@@ -1665,16 +1884,18 @@
1665
1884
  }
1666
1885
 
1667
1886
  , show: function () {
1668
- var pos = $.extend({}, this.$element.offset(), {
1887
+ var pos = $.extend({}, this.$element.position(), {
1669
1888
  height: this.$element[0].offsetHeight
1670
1889
  })
1671
1890
 
1672
- this.$menu.css({
1673
- top: pos.top + pos.height
1674
- , left: pos.left
1675
- })
1891
+ this.$menu
1892
+ .insertAfter(this.$element)
1893
+ .css({
1894
+ top: pos.top + pos.height
1895
+ , left: pos.left
1896
+ })
1897
+ .show()
1676
1898
 
1677
- this.$menu.show()
1678
1899
  this.shown = true
1679
1900
  return this
1680
1901
  }
@@ -1779,6 +2000,7 @@
1779
2000
 
1780
2001
  , listen: function () {
1781
2002
  this.$element
2003
+ .on('focus', $.proxy(this.focus, this))
1782
2004
  .on('blur', $.proxy(this.blur, this))
1783
2005
  .on('keypress', $.proxy(this.keypress, this))
1784
2006
  .on('keyup', $.proxy(this.keyup, this))
@@ -1790,6 +2012,7 @@
1790
2012
  this.$menu
1791
2013
  .on('click', $.proxy(this.click, this))
1792
2014
  .on('mouseenter', 'li', $.proxy(this.mouseenter, this))
2015
+ .on('mouseleave', 'li', $.proxy(this.mouseleave, this))
1793
2016
  }
1794
2017
 
1795
2018
  , eventSupported: function(eventName) {
@@ -1826,7 +2049,7 @@
1826
2049
  }
1827
2050
 
1828
2051
  , keydown: function (e) {
1829
- this.suppressKeyPressRepeat = !~$.inArray(e.keyCode, [40,38,9,13,27])
2052
+ this.suppressKeyPressRepeat = ~$.inArray(e.keyCode, [40,38,9,13,27])
1830
2053
  this.move(e)
1831
2054
  }
1832
2055
 
@@ -1863,28 +2086,41 @@
1863
2086
  e.preventDefault()
1864
2087
  }
1865
2088
 
2089
+ , focus: function (e) {
2090
+ this.focused = true
2091
+ }
2092
+
1866
2093
  , blur: function (e) {
1867
- var that = this
1868
- setTimeout(function () { that.hide() }, 150)
2094
+ this.focused = false
2095
+ if (!this.mousedover && this.shown) this.hide()
1869
2096
  }
1870
2097
 
1871
2098
  , click: function (e) {
1872
2099
  e.stopPropagation()
1873
2100
  e.preventDefault()
1874
2101
  this.select()
2102
+ this.$element.focus()
1875
2103
  }
1876
2104
 
1877
2105
  , mouseenter: function (e) {
2106
+ this.mousedover = true
1878
2107
  this.$menu.find('.active').removeClass('active')
1879
2108
  $(e.currentTarget).addClass('active')
1880
2109
  }
1881
2110
 
2111
+ , mouseleave: function (e) {
2112
+ this.mousedover = false
2113
+ if (!this.focused && this.shown) this.hide()
2114
+ }
2115
+
1882
2116
  }
1883
2117
 
1884
2118
 
1885
2119
  /* TYPEAHEAD PLUGIN DEFINITION
1886
2120
  * =========================== */
1887
2121
 
2122
+ var old = $.fn.typeahead
2123
+
1888
2124
  $.fn.typeahead = function (option) {
1889
2125
  return this.each(function () {
1890
2126
  var $this = $(this)
@@ -1906,22 +2142,30 @@
1906
2142
  $.fn.typeahead.Constructor = Typeahead
1907
2143
 
1908
2144
 
1909
- /* TYPEAHEAD DATA-API
2145
+ /* TYPEAHEAD NO CONFLICT
2146
+ * =================== */
2147
+
2148
+ $.fn.typeahead.noConflict = function () {
2149
+ $.fn.typeahead = old
2150
+ return this
2151
+ }
2152
+
2153
+
2154
+ /* TYPEAHEAD DATA-API
1910
2155
  * ================== */
1911
2156
 
1912
2157
  $(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
1913
2158
  var $this = $(this)
1914
2159
  if ($this.data('typeahead')) return
1915
- e.preventDefault()
1916
2160
  $this.typeahead($this.data())
1917
2161
  })
1918
2162
 
1919
2163
  }(window.jQuery);
1920
2164
  /* ==========================================================
1921
- * bootstrap-affix.js v2.2.1
1922
- * http://twitter.github.com/bootstrap/javascript.html#affix
2165
+ * bootstrap-affix.js v2.3.2
2166
+ * http://getbootstrap.com/2.3.2/javascript.html#affix
1923
2167
  * ==========================================================
1924
- * Copyright 2012 Twitter, Inc.
2168
+ * Copyright 2013 Twitter, Inc.
1925
2169
  *
1926
2170
  * Licensed under the Apache License, Version 2.0 (the "License");
1927
2171
  * you may not use this file except in compliance with the License.
@@ -1987,6 +2231,8 @@
1987
2231
  /* AFFIX PLUGIN DEFINITION
1988
2232
  * ======================= */
1989
2233
 
2234
+ var old = $.fn.affix
2235
+
1990
2236
  $.fn.affix = function (option) {
1991
2237
  return this.each(function () {
1992
2238
  var $this = $(this)
@@ -2004,6 +2250,15 @@
2004
2250
  }
2005
2251
 
2006
2252
 
2253
+ /* AFFIX NO CONFLICT
2254
+ * ================= */
2255
+
2256
+ $.fn.affix.noConflict = function () {
2257
+ $.fn.affix = old
2258
+ return this
2259
+ }
2260
+
2261
+
2007
2262
  /* AFFIX DATA-API
2008
2263
  * ============== */
2009
2264