anjlab-bootstrap-rails 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Bootstrap
2
2
  module Rails
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
@@ -51,9 +51,10 @@
51
51
  /* ALERT CLASS DEFINITION
52
52
  * ====================== */
53
53
 
54
- var Alert = function ( content, selector ) {
54
+ var Alert = function ( content, options ) {
55
+ this.settings = $.extend({}, $.fn.alert.defaults, options)
55
56
  this.$element = $(content)
56
- .delegate(selector || '.close', 'click', this.close)
57
+ .delegate(this.settings.selector, 'click', this.close)
57
58
  }
58
59
 
59
60
  Alert.prototype = {
@@ -92,13 +93,19 @@
92
93
  return $this.data('alert')[options]()
93
94
  }
94
95
 
95
- $(this).data('alert', new Alert( this ))
96
+ $(this).data('alert', new Alert( this, options ))
96
97
 
97
98
  })
98
99
  }
99
100
 
101
+ $.fn.alert.defaults = {
102
+ selector: '.close'
103
+ }
104
+
100
105
  $(document).ready(function () {
101
- new Alert($('body'), '.alert-message[data-alert] .close')
106
+ new Alert($('body'), {
107
+ selector: '.alert-message[data-alert] .close'
108
+ })
102
109
  })
103
110
 
104
111
  }( window.jQuery || window.ender );
@@ -53,12 +53,10 @@
53
53
  * ============================= */
54
54
 
55
55
  var Modal = function ( content, options ) {
56
- this.settings = $.extend({}, $.fn.modal.defaults)
56
+ this.settings = $.extend({}, $.fn.modal.defaults, options)
57
57
  this.$element = $(content)
58
58
  .delegate('.close', 'click.modal', $.proxy(this.hide, this))
59
59
 
60
- $.extend( this.settings, options )
61
-
62
60
  if ( this.settings.show ) {
63
61
  this.show()
64
62
  }
@@ -21,24 +21,33 @@
21
21
  !function( $ ){
22
22
 
23
23
  function activate ( element, container ) {
24
- container.find('> .active').removeClass('active')
24
+ container
25
+ .find('> .active')
26
+ .removeClass('active')
27
+ .find('> .dropdown-menu > .active')
28
+ .removeClass('active')
29
+
25
30
  element.addClass('active')
31
+
32
+ if ( element.parent('.dropdown-menu') ) {
33
+ element.closest('li.dropdown').addClass('active')
34
+ }
26
35
  }
27
36
 
28
37
  function tab( e ) {
29
38
  var $this = $(this)
30
- , $ul = $this.closest('ul')
39
+ , $ul = $this.closest('ul:not(.dropdown-menu)')
31
40
  , href = $this.attr('href')
32
41
  , previous
33
42
 
34
- if (/^#\w+/.test(href)) {
43
+ if ( /^#\w+/.test(href) ) {
35
44
  e.preventDefault()
36
45
 
37
- if ($this.parent('li').hasClass('active')) {
46
+ if ( $this.parent('li').hasClass('active') ) {
38
47
  return
39
48
  }
40
49
 
41
- previous = $ul.find('.active a')[0]
50
+ previous = $ul.find('.active a').last()[0]
42
51
  $href = $(href)
43
52
 
44
53
  activate($this.parent('li'), $ul)
@@ -90,7 +90,8 @@
90
90
 
91
91
  actualWidth = $tip[0].offsetWidth
92
92
  actualHeight = $tip[0].offsetHeight
93
- placement = _.maybeCall(this.options.placement, this.$element[0])
93
+
94
+ placement = maybeCall(this.options.placement, this, [ $tip[0], this.$element[0] ])
94
95
 
95
96
  switch (placement) {
96
97
  case 'below':
@@ -193,15 +194,10 @@
193
194
  /* TWIPSY PRIVATE METHODS
194
195
  * ====================== */
195
196
 
196
- var _ = {
197
-
198
- maybeCall: function ( thing, ctx ) {
199
- return (typeof thing == 'function') ? (thing.call(ctx)) : thing
200
- }
201
-
197
+ function maybeCall ( thing, ctx, args ) {
198
+ return typeof thing == 'function' ? thing.apply(ctx, args) : thing
202
199
  }
203
200
 
204
-
205
201
  /* TWIPSY PLUGIN DEFINITION
206
202
  * ======================== */
207
203
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anjlab-bootstrap-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-05 00:00:00.000000000 Z
12
+ date: 2011-10-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
16
- requirement: &70215300536040 !ruby/object:Gem::Requirement
16
+ requirement: &70146283683400 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '3.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70215300536040
24
+ version_requirements: *70146283683400
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: thor
27
- requirement: &70215300548220 !ruby/object:Gem::Requirement
27
+ requirement: &70146283682680 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0.14'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70215300548220
35
+ version_requirements: *70146283682680
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &70215300547200 !ruby/object:Gem::Requirement
38
+ requirement: &70146283682040 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70215300547200
46
+ version_requirements: *70146283682040
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rails
49
- requirement: &70215300545640 !ruby/object:Gem::Requirement
49
+ requirement: &70146283681320 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '3.0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70215300545640
57
+ version_requirements: *70146283681320
58
58
  description: Twitter Bootstrap CSS (with SASS flavour) and JS toolkits for Rails 3
59
59
  projects
60
60
  email: