padrino-admin 0.11.3 → 0.11.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +7 -0
  2. data/README.rdoc +3 -3
  3. data/lib/padrino-admin/access_control.rb +46 -47
  4. data/lib/padrino-admin/bootstrap-less/alerts.less +29 -55
  5. data/lib/padrino-admin/bootstrap-less/badges.less +13 -15
  6. data/lib/padrino-admin/bootstrap-less/bootstrap.less +17 -21
  7. data/lib/padrino-admin/bootstrap-less/breadcrumbs.less +6 -11
  8. data/lib/padrino-admin/bootstrap-less/button-groups.less +114 -32
  9. data/lib/padrino-admin/bootstrap-less/buttons.less +41 -41
  10. data/lib/padrino-admin/bootstrap-less/carousel.less +43 -18
  11. data/lib/padrino-admin/bootstrap-less/close.less +4 -4
  12. data/lib/padrino-admin/bootstrap-less/code.less +8 -10
  13. data/lib/padrino-admin/bootstrap-less/component-animations.less +10 -4
  14. data/lib/padrino-admin/bootstrap-less/dropdowns.less +78 -51
  15. data/lib/padrino-admin/bootstrap-less/forms.less +183 -274
  16. data/lib/padrino-admin/bootstrap-less/glyphicons.less +232 -0
  17. data/lib/padrino-admin/bootstrap-less/grid.less +230 -88
  18. data/lib/padrino-admin/bootstrap-less/input-groups.less +127 -0
  19. data/lib/padrino-admin/bootstrap-less/jumbotron.less +16 -8
  20. data/lib/padrino-admin/bootstrap-less/labels.less +25 -37
  21. data/lib/padrino-admin/bootstrap-less/list-group.less +34 -35
  22. data/lib/padrino-admin/bootstrap-less/media.less +7 -5
  23. data/lib/padrino-admin/bootstrap-less/mixins.less +321 -108
  24. data/lib/padrino-admin/bootstrap-less/modals.less +24 -20
  25. data/lib/padrino-admin/bootstrap-less/navbar.less +474 -216
  26. data/lib/padrino-admin/bootstrap-less/navs.less +67 -85
  27. data/lib/padrino-admin/bootstrap-less/pager.less +4 -4
  28. data/lib/padrino-admin/bootstrap-less/pagination.less +64 -69
  29. data/lib/padrino-admin/bootstrap-less/panels.less +114 -62
  30. data/lib/padrino-admin/bootstrap-less/popovers.less +18 -18
  31. data/lib/padrino-admin/bootstrap-less/print.less +22 -7
  32. data/lib/padrino-admin/bootstrap-less/progress-bars.less +10 -33
  33. data/lib/padrino-admin/bootstrap-less/responsive-utilities.less +141 -40
  34. data/lib/padrino-admin/bootstrap-less/scaffolding.less +66 -19
  35. data/lib/padrino-admin/bootstrap-less/tables.less +154 -158
  36. data/lib/padrino-admin/bootstrap-less/theme.less +232 -0
  37. data/lib/padrino-admin/bootstrap-less/thumbnails.less +9 -20
  38. data/lib/padrino-admin/bootstrap-less/tooltip.less +3 -3
  39. data/lib/padrino-admin/bootstrap-less/type.less +47 -55
  40. data/lib/padrino-admin/bootstrap-less/utilities.less +2 -2
  41. data/lib/padrino-admin/bootstrap-less/variables.less +289 -93
  42. data/lib/padrino-admin/bootstrap-less/wells.less +2 -2
  43. data/lib/padrino-admin/generators/actions.rb +11 -10
  44. data/lib/padrino-admin/generators/admin_app.rb +11 -11
  45. data/lib/padrino-admin/generators/admin_page.rb +9 -9
  46. data/lib/padrino-admin/generators/orm.rb +6 -7
  47. data/lib/padrino-admin/generators/templates/account/activerecord.rb.tt +7 -7
  48. data/lib/padrino-admin/generators/templates/account/couchrest.rb.tt +16 -16
  49. data/lib/padrino-admin/generators/templates/account/datamapper.rb.tt +7 -7
  50. data/lib/padrino-admin/generators/templates/account/minirecord.rb.tt +7 -7
  51. data/lib/padrino-admin/generators/templates/account/mongoid.rb.tt +8 -8
  52. data/lib/padrino-admin/generators/templates/account/mongomapper.rb.tt +7 -7
  53. data/lib/padrino-admin/generators/templates/account/ohm.rb.tt +9 -9
  54. data/lib/padrino-admin/generators/templates/account/sequel.rb.tt +8 -8
  55. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/affix.js +9 -3
  56. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/alert.js +4 -2
  57. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/bootstrap.min.js +4 -4
  58. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/button.js +9 -5
  59. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/carousel.js +19 -12
  60. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/collapse.js +68 -45
  61. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/dropdown.js +6 -7
  62. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/modal.js +43 -40
  63. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/popover.js +16 -10
  64. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/scrollspy.js +6 -4
  65. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/tab.js +4 -2
  66. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/tooltip.js +78 -48
  67. data/lib/padrino-admin/generators/templates/assets/javascripts/bootstrap/transition.js +10 -1
  68. data/lib/padrino-admin/generators/templates/assets/stylesheets/application.css +1 -0
  69. data/lib/padrino-admin/generators/templates/assets/stylesheets/bootstrap.css +622 -334
  70. data/lib/padrino-admin/generators/templates/erb/app/layouts/error.erb.tt +2 -2
  71. data/lib/padrino-admin/generators/templates/erb/app/sessions/new.erb.tt +9 -9
  72. data/lib/padrino-admin/generators/templates/erb/page/_form.erb.tt +3 -3
  73. data/lib/padrino-admin/generators/templates/erb/page/index.erb.tt +3 -3
  74. data/lib/padrino-admin/generators/templates/haml/app/layouts/error.haml.tt +1 -1
  75. data/lib/padrino-admin/generators/templates/haml/app/sessions/new.haml.tt +9 -7
  76. data/lib/padrino-admin/generators/templates/haml/page/_form.haml.tt +2 -2
  77. data/lib/padrino-admin/generators/templates/haml/page/index.haml.tt +2 -2
  78. data/lib/padrino-admin/generators/templates/page/controller.rb.tt +3 -3
  79. data/lib/padrino-admin/generators/templates/slim/app/layouts/error.slim.tt +1 -1
  80. data/lib/padrino-admin/generators/templates/slim/app/sessions/new.slim.tt +9 -7
  81. data/lib/padrino-admin/generators/templates/slim/page/_form.slim.tt +2 -2
  82. data/lib/padrino-admin/generators/templates/slim/page/index.slim.tt +2 -2
  83. data/lib/padrino-admin/helpers/authentication_helpers.rb +35 -35
  84. data/lib/padrino-admin/helpers/view_helpers.rb +12 -19
  85. data/lib/padrino-admin/utils/crypt.rb +10 -9
  86. data/lib/padrino-admin.rb +4 -5
  87. data/test/fixtures/data_mapper.rb +10 -9
  88. data/test/generators/test_account_model_generator.rb +2 -2
  89. metadata +14 -21
@@ -1,6 +1,6 @@
1
1
  /* ========================================================================
2
2
  * Bootstrap: button.js v3.0.0
3
- * http://twitter.github.com/bootstrap/javascript.html#buttons
3
+ * http://twbs.github.com/bootstrap/javascript.html#buttons
4
4
  * ========================================================================
5
5
  * Copyright 2013 Twitter, Inc.
6
6
  *
@@ -53,10 +53,13 @@
53
53
  }
54
54
 
55
55
  Button.prototype.toggle = function () {
56
- var $parent = this.$element.closest('[data-toggle="buttons-radio"]')
56
+ var $parent = this.$element.closest('[data-toggle="buttons"]')
57
57
 
58
- if ($parent) {
59
- $parent.find('.active').removeClass('active')
58
+ if ($parent.length) {
59
+ var $input = this.$element.find('input')
60
+ .prop('checked', !this.$element.hasClass('active'))
61
+ .trigger('change')
62
+ if ($input.prop('type') === 'radio') $parent.find('.active').removeClass('active')
60
63
  }
61
64
 
62
65
  this.$element.toggleClass('active')
@@ -71,7 +74,7 @@
71
74
  $.fn.button = function (option) {
72
75
  return this.each(function () {
73
76
  var $this = $(this)
74
- var data = $this.data('button')
77
+ var data = $this.data('bs.button')
75
78
  var options = typeof option == 'object' && option
76
79
 
77
80
  if (!data) $this.data('bs.button', (data = new Button(this, options)))
@@ -100,6 +103,7 @@
100
103
  var $btn = $(e.target)
101
104
  if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
102
105
  $btn.button('toggle')
106
+ e.preventDefault()
103
107
  })
104
108
 
105
109
  }(window.jQuery);
@@ -1,6 +1,6 @@
1
1
  /* ========================================================================
2
2
  * Bootstrap: carousel.js v3.0.0
3
- * http://twitter.github.com/bootstrap/javascript.html#carousel
3
+ * http://twbs.github.com/bootstrap/javascript.html#carousel
4
4
  * ========================================================================
5
5
  * Copyright 2012 Twitter, Inc.
6
6
  *
@@ -41,6 +41,7 @@
41
41
  Carousel.DEFAULTS = {
42
42
  interval: 5000
43
43
  , pause: 'hover'
44
+ , wrap: true
44
45
  }
45
46
 
46
47
  Carousel.prototype.cycle = function (e) {
@@ -105,12 +106,15 @@
105
106
  var fallback = type == 'next' ? 'first' : 'last'
106
107
  var that = this
107
108
 
109
+ if (!$next.length) {
110
+ if (!this.options.wrap) return
111
+ $next = this.$element.find('.item')[fallback]()
112
+ }
113
+
108
114
  this.sliding = true
109
115
 
110
116
  isCycling && this.pause()
111
117
 
112
- $next = $next.length ? $next : this.$element.find('.item')[fallback]()
113
-
114
118
  var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction })
115
119
 
116
120
  if ($next.hasClass('active')) return
@@ -130,12 +134,14 @@
130
134
  $next[0].offsetWidth // force reflow
131
135
  $active.addClass(direction)
132
136
  $next.addClass(direction)
133
- this.$element.one($.support.transition.end, function () {
134
- $next.removeClass([type, direction].join(' ')).addClass('active')
135
- $active.removeClass(['active', direction].join(' '))
136
- that.sliding = false
137
- setTimeout(function () { that.$element.trigger('slid') }, 0)
138
- })
137
+ $active
138
+ .one($.support.transition.end, function () {
139
+ $next.removeClass([type, direction].join(' ')).addClass('active')
140
+ $active.removeClass(['active', direction].join(' '))
141
+ that.sliding = false
142
+ setTimeout(function () { that.$element.trigger('slid') }, 0)
143
+ })
144
+ .emulateTransitionEnd(600)
139
145
  } else {
140
146
  this.$element.trigger(e)
141
147
  if (e.isDefaultPrevented()) return
@@ -160,7 +166,7 @@
160
166
  return this.each(function () {
161
167
  var $this = $(this)
162
168
  var data = $this.data('bs.carousel')
163
- var options = $.extend({}, Carousel.DEFAULTS, typeof option == 'object' && option)
169
+ var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
164
170
  var action = typeof option == 'string' ? option : options.slide
165
171
 
166
172
  if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
@@ -189,12 +195,13 @@
189
195
  var $this = $(this), href
190
196
  var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
191
197
  var options = $.extend({}, $target.data(), $this.data())
192
- var slideIndex
198
+ var slideIndex = $this.attr('data-slide-to')
199
+ if (slideIndex) options.interval = false
193
200
 
194
201
  $target.carousel(options)
195
202
 
196
203
  if (slideIndex = $this.attr('data-slide-to')) {
197
- $target.data('bs.carousel').pause().to(slideIndex).cycle()
204
+ $target.data('bs.carousel').to(slideIndex)
198
205
  }
199
206
 
200
207
  e.preventDefault()
@@ -1,6 +1,6 @@
1
1
  /* ========================================================================
2
2
  * Bootstrap: collapse.js v3.0.0
3
- * http://twitter.github.com/bootstrap/javascript.html#collapse
3
+ * http://twbs.github.com/bootstrap/javascript.html#collapse
4
4
  * ========================================================================
5
5
  * Copyright 2012 Twitter, Inc.
6
6
  *
@@ -44,63 +44,81 @@
44
44
  Collapse.prototype.show = function () {
45
45
  if (this.transitioning || this.$element.hasClass('in')) return
46
46
 
47
- var dimension = this.dimension()
48
- var scroll = $.camelCase(['scroll', dimension].join('-'))
49
- var actives = this.$parent && this.$parent.find('> .accordion-group > .in')
47
+ var startEvent = $.Event('show.bs.collapse')
48
+ this.$element.trigger(startEvent)
49
+ if (startEvent.isDefaultPrevented()) return
50
+
51
+ var actives = this.$parent && this.$parent.find('> .panel > .in')
50
52
 
51
53
  if (actives && actives.length) {
52
- var hasData = actives.data('collapse')
54
+ var hasData = actives.data('bs.collapse')
53
55
  if (hasData && hasData.transitioning) return
54
56
  actives.collapse('hide')
55
- hasData || actives.data('collapse', null)
57
+ hasData || actives.data('bs.collapse', null)
58
+ }
59
+
60
+ var dimension = this.dimension()
61
+
62
+ this.$element
63
+ .removeClass('collapse')
64
+ .addClass('collapsing')
65
+ [dimension](0)
66
+
67
+ this.transitioning = 1
68
+
69
+ var complete = function () {
70
+ this.$element
71
+ .removeClass('collapsing')
72
+ .addClass('in')
73
+ [dimension]('auto')
74
+ this.transitioning = 0
75
+ this.$element.trigger('shown.bs.collapse')
56
76
  }
57
77
 
58
- this.$element[dimension](0)
59
- this.transition('addClass', $.Event('show.bs.collapse'), 'shown.bs.collapse')
78
+ if (!$.support.transition) return complete.call(this)
60
79
 
61
- if ($.support.transition) this.$element[dimension](this.$element[0][scroll])
80
+ var scrollSize = $.camelCase(['scroll', dimension].join('-'))
81
+
82
+ this.$element
83
+ .one($.support.transition.end, $.proxy(complete, this))
84
+ .emulateTransitionEnd(350)
85
+ [dimension](this.$element[0][scrollSize])
62
86
  }
63
87
 
64
88
  Collapse.prototype.hide = function () {
65
89
  if (this.transitioning || !this.$element.hasClass('in')) return
66
- var dimension = this.dimension()
67
- this.reset(this.$element[dimension]())
68
- this.transition('removeClass', $.Event('hide.bs.collapse'), 'hidden')
69
- this.$element[dimension](0)
70
- }
71
90
 
72
- Collapse.prototype.reset = function (size) {
91
+ var startEvent = $.Event('hide.bs.collapse')
92
+ this.$element.trigger(startEvent)
93
+ if (startEvent.isDefaultPrevented()) return
94
+
73
95
  var dimension = this.dimension()
74
96
 
75
97
  this.$element
76
- .removeClass('collapse')
77
- [dimension](size || 'auto')
78
- [0].offsetWidth
98
+ [dimension](this.$element[dimension]())
99
+ [0].offsetHeight
79
100
 
80
- this.$element[size != null ? 'addClass' : 'removeClass']('collapse')
101
+ this.$element
102
+ .addClass('collapsing')
103
+ .removeClass('collapse')
104
+ .removeClass('in')
81
105
 
82
- return this
83
- }
106
+ this.transitioning = 1
84
107
 
85
- Collapse.prototype.transition = function (method, startEvent, completeEvent) {
86
- var that = this
87
108
  var complete = function () {
88
- if (startEvent.type == 'show') that.reset()
89
- that.transitioning = 0
90
- that.$element.trigger(completeEvent)
109
+ this.transitioning = 0
110
+ this.$element
111
+ .trigger('hidden.bs.collapse')
112
+ .removeClass('collapsing')
113
+ .addClass('collapse')
91
114
  }
92
115
 
93
- this.$element.trigger(startEvent)
94
-
95
- if (startEvent.isDefaultPrevented()) return
96
-
97
- this.transitioning = 1
116
+ if (!$.support.transition) return complete.call(this)
98
117
 
99
- this.$element[method]('in')
100
-
101
- $.support.transition && this.$element.hasClass('collapse') ?
102
- this.$element.one($.support.transition.end, complete) :
103
- complete()
118
+ this.$element
119
+ [dimension](0)
120
+ .one($.support.transition.end, $.proxy(complete, this))
121
+ .emulateTransitionEnd(350)
104
122
  }
105
123
 
106
124
  Collapse.prototype.toggle = function () {
@@ -116,10 +134,10 @@
116
134
  $.fn.collapse = function (option) {
117
135
  return this.each(function () {
118
136
  var $this = $(this)
119
- var data = $this.data('collapse')
137
+ var data = $this.data('bs.collapse')
120
138
  var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
121
139
 
122
- if (!data) $this.data('collapse', (data = new Collapse(this, options)))
140
+ if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
123
141
  if (typeof option == 'string') data[option]()
124
142
  })
125
143
  }
@@ -140,17 +158,22 @@
140
158
  // =================
141
159
 
142
160
  $(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) {
143
- var $this = $(this), href
144
- var target = $this.attr('data-target')
161
+ var $this = $(this), href
162
+ var target = $this.attr('data-target')
145
163
  || e.preventDefault()
146
164
  || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
147
- var option = $(target).data('collapse') ? 'toggle' : $this.data()
148
- var parent = $this.attr('data-parent')
165
+ var $target = $(target)
166
+ var data = $target.data('bs.collapse')
167
+ var option = data ? 'toggle' : $this.data()
168
+ var parent = $this.attr('data-parent')
149
169
  var $parent = parent && $(parent)
150
170
 
151
- if ($parent) $parent.find('[data-toggle=collapse][data-parent=' + parent + ']').not($this).addClass('collapsed')
152
- $this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
153
- $(target).collapse(option)
171
+ if (!data || !data.transitioning) {
172
+ if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed')
173
+ $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
174
+ }
175
+
176
+ $target.collapse(option)
154
177
  })
155
178
 
156
179
  }(window.jQuery);
@@ -1,6 +1,6 @@
1
1
  /* ========================================================================
2
2
  * Bootstrap: dropdown.js v3.0.0
3
- * http://twitter.github.com/bootstrap/javascript.html#dropdowns
3
+ * http://twbs.github.com/bootstrap/javascript.html#dropdowns
4
4
  * ========================================================================
5
5
  * Copyright 2012 Twitter, Inc.
6
6
  *
@@ -40,9 +40,9 @@
40
40
  clearMenus()
41
41
 
42
42
  if (!isActive) {
43
- if ('ontouchstart' in document.documentElement) {
43
+ if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
44
44
  // if mobile we we use a backdrop because click events don't delegate
45
- $('<div class="dropdown-backdrop"/>').insertBefore($(this)).on('click', clearMenus)
45
+ $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
46
46
  }
47
47
 
48
48
  $parent.trigger(e = $.Event('show.bs.dropdown'))
@@ -52,9 +52,9 @@
52
52
  $parent
53
53
  .toggleClass('open')
54
54
  .trigger('shown.bs.dropdown')
55
- }
56
55
 
57
- $this.focus()
56
+ $this.focus()
57
+ }
58
58
 
59
59
  return false
60
60
  }
@@ -92,7 +92,7 @@
92
92
 
93
93
  function clearMenus() {
94
94
  $(backdrop).remove()
95
- $(toggle).each(function (e) {
95
+ $(toggle).each(function (e) {
96
96
  var $parent = getParent($(this))
97
97
  if (!$parent.hasClass('open')) return
98
98
  $parent.trigger(e = $.Event('hide.bs.dropdown'))
@@ -145,7 +145,6 @@
145
145
  // APPLY TO STANDARD DROPDOWN ELEMENTS
146
146
  // ===================================
147
147
 
148
-
149
148
  $(document)
150
149
  .on('click.bs.dropdown.data-api', clearMenus)
151
150
  .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
@@ -1,6 +1,6 @@
1
1
  /* ========================================================================
2
2
  * Bootstrap: modal.js v3.0.0
3
- * http://twitter.github.com/bootstrap/javascript.html#modals
3
+ * http://twbs.github.com/bootstrap/javascript.html#modals
4
4
  * ========================================================================
5
5
  * Copyright 2012 Twitter, Inc.
6
6
  *
@@ -25,11 +25,11 @@
25
25
 
26
26
  var Modal = function (element, options) {
27
27
  this.options = options
28
- this.$element = $(element).delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
28
+ this.$element = $(element)
29
29
  this.$backdrop =
30
30
  this.isShown = null
31
31
 
32
- if (this.options.remote) this.$element.find('.modal-body').load(this.options.remote)
32
+ if (this.options.remote) this.$element.load(this.options.remote)
33
33
  }
34
34
 
35
35
  Modal.DEFAULTS = {
@@ -38,13 +38,13 @@
38
38
  , show: true
39
39
  }
40
40
 
41
- Modal.prototype.toggle = function () {
42
- return this[!this.isShown ? 'show' : 'hide']()
41
+ Modal.prototype.toggle = function (_relatedTarget) {
42
+ return this[!this.isShown ? 'show' : 'hide'](_relatedTarget)
43
43
  }
44
44
 
45
- Modal.prototype.show = function () {
45
+ Modal.prototype.show = function (_relatedTarget) {
46
46
  var that = this
47
- var e = $.Event('show.bs.modal')
47
+ var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
48
48
 
49
49
  this.$element.trigger(e)
50
50
 
@@ -54,6 +54,8 @@
54
54
 
55
55
  this.escape()
56
56
 
57
+ this.$element.on('click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
58
+
57
59
  this.backdrop(function () {
58
60
  var transition = $.support.transition && that.$element.hasClass('fade')
59
61
 
@@ -73,9 +75,15 @@
73
75
 
74
76
  that.enforceFocus()
75
77
 
78
+ var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
79
+
76
80
  transition ?
77
- that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown.bs.modal') }) :
78
- that.$element.focus().trigger('shown.bs.modal')
81
+ that.$element.find('.modal-dialog') // wait for modal to slide in
82
+ .one($.support.transition.end, function () {
83
+ that.$element.focus().trigger(e)
84
+ })
85
+ .emulateTransitionEnd(300) :
86
+ that.$element.focus().trigger(e)
79
87
  })
80
88
  }
81
89
 
@@ -97,9 +105,12 @@
97
105
  this.$element
98
106
  .removeClass('in')
99
107
  .attr('aria-hidden', true)
108
+ .off('click.dismiss.modal')
100
109
 
101
110
  $.support.transition && this.$element.hasClass('fade') ?
102
- this.hideWithTransition() :
111
+ this.$element
112
+ .one($.support.transition.end, $.proxy(this.hideModal, this))
113
+ .emulateTransitionEnd(300) :
103
114
  this.hideModal()
104
115
  }
105
116
 
@@ -123,19 +134,6 @@
123
134
  }
124
135
  }
125
136
 
126
- Modal.prototype.hideWithTransition = function () {
127
- var that = this
128
- var timeout = setTimeout(function () {
129
- that.$element.off($.support.transition.end)
130
- that.hideModal()
131
- }, 500)
132
-
133
- this.$element.one($.support.transition.end, function () {
134
- clearTimeout(timeout)
135
- that.hideModal()
136
- })
137
- }
138
-
139
137
  Modal.prototype.hideModal = function () {
140
138
  var that = this
141
139
  this.$element.hide()
@@ -160,11 +158,12 @@
160
158
  this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
161
159
  .appendTo(document.body)
162
160
 
163
- this.$backdrop.click(
164
- this.options.backdrop == 'static' ?
165
- $.proxy(this.$element[0].focus, this.$element[0])
166
- : $.proxy(this.hide, this)
167
- )
161
+ this.$element.on('click.dismiss.modal', $.proxy(function (e) {
162
+ if (e.target !== e.currentTarget) return
163
+ this.options.backdrop == 'static'
164
+ ? this.$element[0].focus.call(this.$element[0])
165
+ : this.hide.call(this)
166
+ }, this))
168
167
 
169
168
  if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
170
169
 
@@ -173,14 +172,18 @@
173
172
  if (!callback) return
174
173
 
175
174
  doAnimate ?
176
- this.$backdrop.one($.support.transition.end, callback) :
175
+ this.$backdrop
176
+ .one($.support.transition.end, callback)
177
+ .emulateTransitionEnd(150) :
177
178
  callback()
178
179
 
179
180
  } else if (!this.isShown && this.$backdrop) {
180
181
  this.$backdrop.removeClass('in')
181
182
 
182
183
  $.support.transition && this.$element.hasClass('fade')?
183
- this.$backdrop.one($.support.transition.end, callback) :
184
+ this.$backdrop
185
+ .one($.support.transition.end, callback)
186
+ .emulateTransitionEnd(150) :
184
187
  callback()
185
188
 
186
189
  } else if (callback) {
@@ -194,15 +197,15 @@
194
197
 
195
198
  var old = $.fn.modal
196
199
 
197
- $.fn.modal = function (option) {
200
+ $.fn.modal = function (option, _relatedTarget) {
198
201
  return this.each(function () {
199
202
  var $this = $(this)
200
203
  var data = $this.data('bs.modal')
201
204
  var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
202
205
 
203
206
  if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
204
- if (typeof option == 'string') data[option]()
205
- else if (options.show) data.show()
207
+ if (typeof option == 'string') data[option](_relatedTarget)
208
+ else if (options.show) data.show(_relatedTarget)
206
209
  })
207
210
  }
208
211
 
@@ -225,19 +228,19 @@
225
228
  var $this = $(this)
226
229
  var href = $this.attr('href')
227
230
  var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
228
- var option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data())
231
+ var option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
229
232
 
230
233
  e.preventDefault()
231
234
 
232
235
  $target
233
- .modal(option)
236
+ .modal(option, this)
234
237
  .one('hide', function () {
235
- $this.focus()
238
+ $this.is(':visible') && $this.focus()
236
239
  })
237
- })
240
+ })
238
241
 
239
- var $body = $(document.body)
240
- .on('bs.modal.shown', '.modal', function () { $body.addClass('modal-open') })
241
- .on('bs.modal.hidden', '.modal', function () { $body.removeClass('modal-open') })
242
+ $(document)
243
+ .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
244
+ .on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })
242
245
 
243
246
  }(window.jQuery);
@@ -1,6 +1,6 @@
1
1
  /* ========================================================================
2
2
  * Bootstrap: popover.js v3.0.0
3
- * http://twitter.github.com/bootstrap/javascript.html#popovers
3
+ * http://twbs.github.com/bootstrap/javascript.html#popovers
4
4
  * ========================================================================
5
5
  * Copyright 2012 Twitter, Inc.
6
6
  *
@@ -27,6 +27,8 @@
27
27
  this.init('popover', element, options)
28
28
  }
29
29
 
30
+ if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
31
+
30
32
  Popover.DEFAULTS = $.extend({} , $.fn.tooltip.Constructor.DEFAULTS, {
31
33
  placement: 'right'
32
34
  , trigger: 'click'
@@ -56,7 +58,9 @@
56
58
 
57
59
  $tip.removeClass('fade top bottom left right in')
58
60
 
59
- $tip.find('.popover-title:empty').hide()
61
+ // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
62
+ // this manually by checking the contents.
63
+ if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
60
64
  }
61
65
 
62
66
  Popover.prototype.hasContent = function () {
@@ -64,11 +68,17 @@
64
68
  }
65
69
 
66
70
  Popover.prototype.getContent = function () {
67
- var content = typeof this.options.content == 'function' ?
68
- this.options.content.call(this.$element[0]) :
69
- this.options.content
71
+ var $e = this.$element
72
+ var o = this.options
73
+
74
+ return $e.attr('data-content')
75
+ || (typeof o.content == 'function' ?
76
+ o.content.call($e[0]) :
77
+ o.content)
78
+ }
70
79
 
71
- return content || this.$element.attr('data-content')
80
+ Popover.prototype.arrow = function () {
81
+ return this.$arrow = this.$arrow || this.tip().find('.arrow')
72
82
  }
73
83
 
74
84
  Popover.prototype.tip = function () {
@@ -76,10 +86,6 @@
76
86
  return this.$tip
77
87
  }
78
88
 
79
- Popover.prototype.destroy = function () {
80
- this.hide().$element.off('.' + this.type).removeData(this.type)
81
- }
82
-
83
89
 
84
90
  // POPOVER PLUGIN DEFINITION
85
91
  // =========================
@@ -1,6 +1,6 @@
1
1
  /* ========================================================================
2
2
  * Bootstrap: scrollspy.js v3.0.0
3
- * http://twitter.github.com/bootstrap/javascript.html#scrollspy
3
+ * http://twbs.github.com/bootstrap/javascript.html#scrollspy
4
4
  * ========================================================================
5
5
  * Copyright 2012 Twitter, Inc.
6
6
  *
@@ -26,10 +26,10 @@
26
26
  function ScrollSpy(element, options) {
27
27
  var href
28
28
  var process = $.proxy(this.process, this)
29
- var $element = $(element).is('body') ? $(window) : $(element)
30
29
 
30
+ this.$element = $(element).is('body') ? $(window) : $(element)
31
31
  this.$body = $('body')
32
- this.$scrollElement = $element.on('scroll.bs.scroll-spy.data-api', process)
32
+ this.$scrollElement = this.$element.on('scroll.bs.scroll-spy.data-api', process)
33
33
  this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
34
34
  this.selector = (this.options.target
35
35
  || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
@@ -47,6 +47,8 @@
47
47
  }
48
48
 
49
49
  ScrollSpy.prototype.refresh = function () {
50
+ var offsetMethod = this.$element[0] == window ? 'offset' : 'position'
51
+
50
52
  this.offsets = $([])
51
53
  this.targets = $([])
52
54
 
@@ -60,7 +62,7 @@
60
62
 
61
63
  return ($href
62
64
  && $href.length
63
- && [[ $href.position().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null
65
+ && [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null
64
66
  })
65
67
  .sort(function (a, b) { return a[0] - b[0] })
66
68
  .each(function () {
@@ -1,6 +1,6 @@
1
1
  /* ========================================================================
2
2
  * Bootstrap: tab.js v3.0.0
3
- * http://twitter.github.com/bootstrap/javascript.html#tabs
3
+ * http://twbs.github.com/bootstrap/javascript.html#tabs
4
4
  * ========================================================================
5
5
  * Copyright 2012 Twitter, Inc.
6
6
  *
@@ -88,7 +88,9 @@
88
88
  }
89
89
 
90
90
  transition ?
91
- $active.one($.support.transition.end, next) :
91
+ $active
92
+ .one($.support.transition.end, next)
93
+ .emulateTransitionEnd(150) :
92
94
  next()
93
95
 
94
96
  $active.removeClass('in')