twitter-bootstrap-rails 2.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of twitter-bootstrap-rails might be problematic. Click here for more details.

Files changed (69) hide show
  1. data/README.md +27 -27
  2. data/Rakefile +1 -1
  3. data/lib/generators/bootstrap/install/install_generator.rb +1 -1
  4. data/lib/generators/bootstrap/install/templates/bootstrap.coffee +5 -15
  5. data/lib/generators/bootstrap/install/templates/bootstrap.less +4 -3
  6. data/lib/generators/bootstrap/layout/layout_generator.rb +14 -4
  7. data/lib/generators/bootstrap/layout/templates/layout.html.erb +112 -49
  8. data/lib/generators/bootstrap/layout/templates/layout.html.haml +90 -0
  9. data/lib/generators/bootstrap/layout/templates/layout.html.slim +77 -0
  10. data/lib/generators/bootstrap/themed/templates/_form.html.erb +1 -1
  11. data/lib/generators/bootstrap/themed/templates/_form.html.haml +11 -0
  12. data/lib/generators/bootstrap/themed/templates/_form.html.slim +11 -0
  13. data/lib/generators/bootstrap/themed/templates/edit.html.haml +3 -0
  14. data/lib/generators/bootstrap/themed/templates/edit.html.slim +3 -0
  15. data/lib/generators/bootstrap/themed/templates/index.html.erb +2 -2
  16. data/lib/generators/bootstrap/themed/templates/index.html.haml +25 -0
  17. data/lib/generators/bootstrap/themed/templates/index.html.slim +25 -0
  18. data/lib/generators/bootstrap/themed/templates/new.html.haml +2 -0
  19. data/lib/generators/bootstrap/themed/templates/new.html.slim +2 -0
  20. data/lib/generators/bootstrap/themed/templates/show.html.erb +5 -4
  21. data/lib/generators/bootstrap/themed/templates/show.html.haml +9 -0
  22. data/lib/generators/bootstrap/themed/templates/show.html.slim +9 -0
  23. data/lib/generators/bootstrap/themed/themed_generator.rb +13 -13
  24. data/lib/twitter/bootstrap/rails/version.rb +1 -1
  25. data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings-white.png +0 -0
  26. data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings.png +0 -0
  27. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-alert.js +9 -3
  28. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-button.js +1 -1
  29. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-carousel.js +3 -3
  30. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-collapse.js +6 -4
  31. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-dropdown.js +15 -6
  32. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-modal.js +7 -3
  33. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-popover.js +3 -3
  34. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-scrollspy.js +3 -2
  35. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tab.js +10 -5
  36. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-transition.js +1 -1
  37. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-typeahead.js +39 -20
  38. data/vendor/toolkit/twitter/bootstrap/accordion.less +5 -4
  39. data/vendor/toolkit/twitter/bootstrap/alerts.less +1 -0
  40. data/vendor/toolkit/twitter/bootstrap/bootstrap.less +10 -8
  41. data/vendor/toolkit/twitter/bootstrap/button-groups.less +48 -18
  42. data/vendor/toolkit/twitter/bootstrap/buttons.less +137 -88
  43. data/vendor/toolkit/twitter/bootstrap/carousel.less +12 -5
  44. data/vendor/toolkit/twitter/bootstrap/code.less +44 -0
  45. data/vendor/toolkit/twitter/bootstrap/dropdowns.less +23 -2
  46. data/vendor/toolkit/twitter/bootstrap/forms.less +83 -64
  47. data/vendor/toolkit/twitter/bootstrap/grid.less +8 -0
  48. data/vendor/toolkit/twitter/bootstrap/hero-unit.less +20 -0
  49. data/vendor/toolkit/twitter/bootstrap/labels.less +4 -4
  50. data/vendor/toolkit/twitter/bootstrap/layouts.less +17 -0
  51. data/vendor/toolkit/twitter/bootstrap/mixins.less +202 -38
  52. data/vendor/toolkit/twitter/bootstrap/modals.less +9 -2
  53. data/vendor/toolkit/twitter/bootstrap/navbar.less +70 -29
  54. data/vendor/toolkit/twitter/bootstrap/navs.less +70 -64
  55. data/vendor/toolkit/twitter/bootstrap/pager.less +7 -2
  56. data/vendor/toolkit/twitter/bootstrap/pagination.less +1 -0
  57. data/vendor/toolkit/twitter/bootstrap/popovers.less +25 -25
  58. data/vendor/toolkit/twitter/bootstrap/progress-bars.less +14 -18
  59. data/vendor/toolkit/twitter/bootstrap/reset.less +2 -3
  60. data/vendor/toolkit/twitter/bootstrap/responsive.less +219 -164
  61. data/vendor/toolkit/twitter/bootstrap/scaffolding.less +6 -89
  62. data/vendor/toolkit/twitter/bootstrap/sprites.less +137 -99
  63. data/vendor/toolkit/twitter/bootstrap/tables.less +1 -54
  64. data/vendor/toolkit/twitter/bootstrap/thumbnails.less +2 -0
  65. data/vendor/toolkit/twitter/bootstrap/type.less +12 -42
  66. data/vendor/toolkit/twitter/bootstrap/variables.less +23 -14
  67. metadata +34 -18
  68. data/vendor/toolkit/twitter/bootstrap/patterns.less +0 -30
  69. data/vendor/toolkit/twitter/bootstrap/print.less +0 -18
@@ -0,0 +1,77 @@
1
+ doctype html
2
+ html lang="en"
3
+ head
4
+ meta charset="utf-8"
5
+ title= content_for?(:title) ? yield(:title) : "<%= app_name %>"
6
+ = csrf_meta_tags
7
+
8
+ /! Le HTML5 shim, for IE6-8 support of HTML elements
9
+ /[if lt IE 9]
10
+ = javascript_include_tag "http://html5shim.googlecode.com/svn/trunk/html5.js"
11
+ /! Le styles
12
+ = stylesheet_link_tag "application"
13
+ css:
14
+ body {
15
+ padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
16
+ }
17
+ / Le fav and touch icons
18
+ link href="images/favicon.ico" rel="shortcut icon"
19
+ link href="images/apple-touch-icon.png" rel="apple-touch-icon"
20
+ link href="images/apple-touch-icon-72x72.png" rel="apple-touch-icon" sizes="72x72"
21
+ link href="images/apple-touch-icon-114x114.png" rel="apple-touch-icon" sizes="114x114"
22
+
23
+
24
+ body
25
+ .navbar.navbar-fixed-top
26
+ .navbar-inner
27
+ <%- if layout_type == "fluid" -%>
28
+ .container-fluid
29
+ <%- else -%>
30
+ .container
31
+ <%- end -%>
32
+ a.btn.btn-navbar data-target=".nav-collapse" data-toggle="collapse"
33
+ span.i-bar
34
+ span.i-bar
35
+ span.i-bar
36
+ a.brand href="#"<%= app_name %>
37
+ .<%=container_class%>.nav-collapse
38
+ ul.nav
39
+ li= link_to "Link 1", "/path1"
40
+ li= link_to "Link 2", "/path2"
41
+ li= link_to "Link 3", "/path3"
42
+
43
+ .<%= container_class %>
44
+ <%- if layout_type == "fluid" -%>
45
+
46
+ .row-fluid
47
+ .span3
48
+ .well.sidebar-nav
49
+ ul.nav.nav-list
50
+ li.nav-header Sidebar
51
+ li= link_to "Link 1", "/path1"
52
+ li= link_to "Link 2", "/path2"
53
+ li= link_to "Link 3", "/path3"
54
+ .span9
55
+ = yield
56
+ <% else %>
57
+ .content
58
+ .row
59
+ .span9
60
+ = yield
61
+ .span1 &nbsp;
62
+ .span3
63
+ .well.sidebar-nav
64
+ h3 Sidebar
65
+ ul.nav.nav-list
66
+ li.nav-header Sidebar
67
+ li= link_to "Link 1", "/path1"
68
+ li= link_to "Link 2", "/path2"
69
+ li= link_to "Link 3", "/path3"
70
+ <% end %>
71
+ footer
72
+ p &copy; Company 2012
73
+ /!
74
+ Le javascript
75
+ \==================================================
76
+ /! Placed at the end of the document so the pages load faster
77
+ = javascript_include_tag "application"
@@ -6,7 +6,7 @@
6
6
  </div>
7
7
  </div>
8
8
  <%- end -%>
9
- <div class="actions">
9
+ <div class="form-actions">
10
10
  <button class="btn primary" type="submit">Save</button> or
11
11
  <%%= link_to "Cancel", <%= controller_routing_path %>_path %>
12
12
  </div>
@@ -0,0 +1,11 @@
1
+ <%- columns.each do |column| -%>
2
+ .clearfix
3
+ = f.label :<%= column.name %>, t("activerecord.attributes.<%= model_name.underscore %>.<%= column.name %>", :default => "<%= column.name.humanize %>"), :class => :label
4
+ .input
5
+ = f.<%= column.field_type %> :<%= column.name %>, :class => '<%= column.field_type %>'
6
+ <%- end -%>
7
+
8
+ .form-actions
9
+ %button{:class => "btn primary", :type => "submit"} Save
10
+ or
11
+ = link_to "Cancel", <%= controller_routing_path %>_path
@@ -0,0 +1,11 @@
1
+ <%- columns.each do |column| -%>
2
+ .clearfix
3
+ = f.label :<%= column.name %>, t("activerecord.attributes.<%= model_name.underscore %>.<%= column.name %>", :default => "<%= column.name.humanize %>"), :class => :label
4
+ .input
5
+ = f.<%= column.field_type %> :<%= column.name %>, :class => '<%= column.field_type %>'
6
+ <%- end -%>
7
+
8
+ .form-actions
9
+ button class="btn primary" type="submit" Save
10
+ | or
11
+ = link_to "Cancel", <%= controller_routing_path %>_path
@@ -0,0 +1,3 @@
1
+ = form_for @<%= model_name.underscore %>, :url => <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :html => { :class => "edit_<%= model_name.underscore %>", :id => "edit_<%= model_name.underscore %>" } do |f|
2
+ %input{:name => "_method", :type => "hidden", :value =>"put"}
3
+ = render :partial => "form", :locals => {:f => f}
@@ -0,0 +1,3 @@
1
+ = form_for @<%= model_name.underscore %>, :url => <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :html => { :class => "edit_<%= model_name.underscore %>", :id => "edit_<%= model_name.underscore %>" } do |f|
2
+ input name="_method" type="hidden" value="put"
3
+ = render :partial => "form", :locals => {:f => f}
@@ -1,5 +1,5 @@
1
1
  <h1><%= resource_name.titleize %>s</h1>
2
- <table class="zebra-striped">
2
+ <table class="table table-striped">
3
3
  <thead>
4
4
  <tr>
5
5
  <th>ID</th>
@@ -31,4 +31,4 @@
31
31
  </tbody>
32
32
  </table>
33
33
 
34
- <%%= link_to "New", new_<%= singular_controller_routing_path %>_path, :class => 'btn primary' %>
34
+ <%%= link_to "New", new_<%= singular_controller_routing_path %>_path, :class => 'btn btn-primary' %>
@@ -0,0 +1,25 @@
1
+ %h1 <%= resource_name.titleize %>s
2
+ %table{:class => "table table-striped"}
3
+ %thead
4
+ %tr
5
+ %th ID
6
+ <%- unless columns.empty? -%>
7
+ %th
8
+ = t("activerecord.attributes.<%= singular_controller_routing_path %>.<%= columns.first.name %>", :default => t("activerecord.labels.<%= columns.first.name %>", :default => "<%= columns.first.name.capitalize %>"))
9
+ <%- end -%>
10
+ %th Created at
11
+ %th Actions
12
+ %tbody
13
+ - @<%= plural_resource_name %>.each do |<%= resource_name %>|
14
+ %tr
15
+ %td= <%= resource_name %>.id
16
+ <%- unless columns.empty? -%>
17
+ %td= link_to <%= resource_name %>.<%= columns.first.name %>, <%= singular_controller_routing_path %>_path(<%= resource_name %>)
18
+ <%- end -%>
19
+ %td= <%= resource_name %>.created_at
20
+ %td
21
+ = link_to "Show", <%= singular_controller_routing_path %>_path(<%= resource_name %>)
22
+ = link_to "Edit", edit_<%= singular_controller_routing_path %>_path(<%= resource_name %>)
23
+ = link_to "Destroy", <%= singular_controller_routing_path %>_path(<%= resource_name %>), :method => :delete, :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}"
24
+
25
+ = link_to "New", new_<%= singular_controller_routing_path %>_path, :class => 'btn btn-primary'
@@ -0,0 +1,25 @@
1
+ h1 <%= resource_name.titleize %>s
2
+ table class="table table-striped"
3
+ thead
4
+ tr
5
+ th ID
6
+ <%- unless columns.empty? -%>
7
+ th
8
+ = t("activerecord.attributes.<%= singular_controller_routing_path %>.<%= columns.first.name %>", :default => t("activerecord.labels.<%= columns.first.name %>", :default => "<%= columns.first.name.capitalize %>"))
9
+ <%- end -%>
10
+ th Created at
11
+ th Actions
12
+ tbody
13
+ - @<%= plural_resource_name %>.each do |<%= resource_name %>|
14
+ tr
15
+ td= <%= resource_name %>.id
16
+ <%- unless columns.empty? -%>
17
+ td= link_to <%= resource_name %>.<%= columns.first.name %>, <%= singular_controller_routing_path %>_path(<%= resource_name %>)
18
+ <%- end -%>
19
+ td= <%= resource_name %>.created_at
20
+ td
21
+ = link_to "Show", <%= singular_controller_routing_path %>_path(<%= resource_name %>)
22
+ = link_to "Edit", edit_<%= singular_controller_routing_path %>_path(<%= resource_name %>)
23
+ = link_to "Destroy", <%= singular_controller_routing_path %>_path(<%= resource_name %>), :method => :delete, :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}"
24
+
25
+ = link_to "New", new_<%= singular_controller_routing_path %>_path, :class => 'btn btn-primary'
@@ -0,0 +1,2 @@
1
+ = form_for @<%= model_name.underscore %>, :url => <%= controller_routing_path %>_path, :html => { :class => :form } do |f|
2
+ = render :partial => "form", :locals => {:f => f}
@@ -0,0 +1,2 @@
1
+ = form_for @<%= model_name.underscore %>, :url => <%= controller_routing_path %>_path, :html => { :class => :form } do |f|
2
+ = render :partial => "form", :locals => {:f => f}
@@ -2,8 +2,9 @@
2
2
  <label class="label"><%%= t("activerecord.attributes.<%= singular_controller_routing_path %>.<%= column.name %>", :default => t("activerecord.labels.<%= column.name %>", :default => "<%= column.name.humanize %>")) %>:</label>
3
3
  <p><%%= @<%= resource_name %>.<%= column.name %> %></p>
4
4
  <%- end -%>
5
- <div class="actions">
6
- <%%= link_to "Back", <%= controller_routing_path %>_path, :class => 'btn primary' %>
7
- <%%= link_to "Edit", edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn primary' %>
8
- <%%= link_to "Delete", <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :method => "delete", :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}", :class => 'btn primary' %>
5
+
6
+ <div class="form-actions">
7
+ <%%= link_to "Back", <%= controller_routing_path %>_path, :class => 'btn' %>
8
+ <%%= link_to "Edit", edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn' %>
9
+ <%%= link_to "Delete", <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :method => "delete", :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}", :class => 'btn' %>
9
10
  </div>
@@ -0,0 +1,9 @@
1
+ <%- columns.each do |column| -%>
2
+ %label{:class => "label"}= t("activerecord.attributes.<%= singular_controller_routing_path %>.<%= column.name %>", :default => t("activerecord.labels.<%= column.name %>", :default => "<%= column.name.humanize %>")) + ":"
3
+ %p= @<%= resource_name %>.<%= column.name %>
4
+ <%- end -%>
5
+
6
+ .form-actions
7
+ = link_to "Back", <%= controller_routing_path %>_path, :class => 'btn'
8
+ = link_to "Edit", edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn'
9
+ = link_to "Delete", <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :method => "delete", :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}", :class => 'btn'
@@ -0,0 +1,9 @@
1
+ <%- columns.each do |column| -%>
2
+ label class="label"= t("activerecord.attributes.<%= singular_controller_routing_path %>.<%= column.name %>", :default => t("activerecord.labels.<%= column.name %>", :default => "<%= column.name.humanize %>")) + ":"
3
+ p= @<%= resource_name %>.<%= column.name %>
4
+ <%- end -%>
5
+
6
+ .form-actions
7
+ = link_to "Back", <%= controller_routing_path %>_path, :class => 'btn'
8
+ = link_to "Edit", edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn'
9
+ = link_to "Delete", <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :method => "delete", :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}", :class => 'btn'
@@ -3,7 +3,7 @@ require 'rails/generators/generated_attribute'
3
3
 
4
4
  module Bootstrap
5
5
  module Generators
6
- class ThemedGenerator < Rails::Generators::Base
6
+ class ThemedGenerator < ::Rails::Generators::Base
7
7
  source_root File.expand_path('../templates', __FILE__)
8
8
  argument :controller_path, :type => :string
9
9
  argument :model_name, :type => :string, :required => false
@@ -15,12 +15,8 @@ module Bootstrap
15
15
  initialize_views_variables
16
16
  end
17
17
 
18
- def copy_views
18
+ def copy_views
19
19
  generate_views
20
- gsub_file(File.join('app/views/layouts', "#{layout}.html.erb"), /\<ul\s+class=\"nav\">.*\<\/ul\>/mi) do |match|
21
- match.gsub!(/\<\/ul\>/, "")
22
- %|#{match} <li class="<%= controller.controller_path == '#{@controller_file_path}' ? 'active' : '' %>"><a href="<%= #{controller_routing_path}_path %>">#{plural_model_name}</a></li></ul>|
23
- end
24
20
  end
25
21
 
26
22
  protected
@@ -59,9 +55,9 @@ module Bootstrap
59
55
  def columns
60
56
  begin
61
57
  excluded_column_names = %w[id created_at updated_at]
62
- Kernel.const_get(@model_name).columns.reject{|c| excluded_column_names.include?(c.name) }.collect{|c| Rails::Generators::GeneratedAttribute.new(c.name, c.type)}
58
+ Kernel.const_get(@model_name).columns.reject{|c| excluded_column_names.include?(c.name) }.collect{|c| ::Rails::Generators::GeneratedAttribute.new(c.name, c.type)}
63
59
  rescue NoMethodError
64
- Kernel.const_get(@model_name).fields.collect{|c| c[1]}.reject{|c| excluded_column_names.include?(c.name) }.collect{|c| Rails::Generators::GeneratedAttribute.new(c.name, c.type.to_s)}
60
+ Kernel.const_get(@model_name).fields.collect{|c| c[1]}.reject{|c| excluded_column_names.include?(c.name) }.collect{|c| ::Rails::Generators::GeneratedAttribute.new(c.name, c.type.to_s)}
65
61
  end
66
62
  end
67
63
 
@@ -76,11 +72,11 @@ module Bootstrap
76
72
 
77
73
  def generate_views
78
74
  views = {
79
- 'index.html.erb' => File.join('app/views', @controller_file_path, "index.html.erb"),
80
- 'new.html.erb' => File.join('app/views', @controller_file_path, "new.html.erb"),
81
- 'edit.html.erb' => File.join('app/views', @controller_file_path, "edit.html.erb"),
82
- '_form.html.erb' => File.join('app/views', @controller_file_path, "_form.html.erb"),
83
- 'show.html.erb' => File.join('app/views', @controller_file_path, "show.html.erb")}
75
+ "index.html.#{ext}" => File.join('app/views', @controller_file_path, "index.html.#{ext}"),
76
+ "new.html.#{ext}" => File.join('app/views', @controller_file_path, "new.html.#{ext}"),
77
+ "edit.html.#{ext}" => File.join('app/views', @controller_file_path, "edit.html.#{ext}"),
78
+ "_form.html.#{ext}" => File.join('app/views', @controller_file_path, "_form.html.#{ext}"),
79
+ "show.html.#{ext}" => File.join('app/views', @controller_file_path, "show.html.#{ext}")}
84
80
  selected_views = views
85
81
  options.engine == generate_erb(selected_views)
86
82
  end
@@ -91,6 +87,10 @@ module Bootstrap
91
87
  end
92
88
  end
93
89
 
90
+ def ext
91
+ ::Rails.application.config.generators.options[:rails][:template_engine] || :erb
92
+ end
93
+
94
94
  end
95
95
  end
96
96
  end
@@ -1,7 +1,7 @@
1
1
  module Twitter
2
2
  module Bootstrap
3
3
  module Rails
4
- VERSION = "2.0"
4
+ VERSION = "2.0.1"
5
5
  end
6
6
  end
7
7
  end
@@ -36,9 +36,15 @@
36
36
 
37
37
  , close: function ( e ) {
38
38
  var $this = $(this)
39
- , selector = $this.attr('data-target') || $this.attr('href')
40
- , $parent = $(selector)
39
+ , selector = $this.attr('data-target')
40
+ , $parent
41
41
 
42
+ if (!selector) {
43
+ selector = $this.attr('href')
44
+ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
45
+ }
46
+
47
+ $parent = $(selector)
42
48
  $parent.trigger('close')
43
49
 
44
50
  e && e.preventDefault()
@@ -82,4 +88,4 @@
82
88
  $('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
83
89
  })
84
90
 
85
- }( window.jQuery )
91
+ }( window.jQuery )
@@ -95,4 +95,4 @@
95
95
  })
96
96
  })
97
97
 
98
- }( window.jQuery )
98
+ }( window.jQuery )
@@ -143,12 +143,12 @@
143
143
 
144
144
  $(function () {
145
145
  $('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
146
- var $this = $(this)
147
- , $target = $($this.attr('data-target') || $this.attr('href'))
146
+ var $this = $(this), href
147
+ , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
148
148
  , options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
149
149
  $target.carousel(options)
150
150
  e.preventDefault()
151
151
  })
152
152
  })
153
153
 
154
- }( window.jQuery )
154
+ }( window.jQuery )
@@ -71,7 +71,7 @@
71
71
 
72
72
  this.$element
73
73
  .removeClass('collapse')
74
- [dimension](size || '')
74
+ [dimension](size || 'auto')
75
75
  [0].offsetWidth
76
76
 
77
77
  this.$element.addClass('collapse')
@@ -124,11 +124,13 @@
124
124
 
125
125
  $(function () {
126
126
  $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) {
127
- var $this = $(this)
128
- , target = $this.attr('data-target') || e.preventDefault() || $this.attr('href')
127
+ var $this = $(this), href
128
+ , target = $this.attr('data-target')
129
+ || e.preventDefault()
130
+ || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
129
131
  , option = $(target).data('collapse') ? 'toggle' : $this.data()
130
132
  $(target).collapse(option)
131
133
  })
132
134
  })
133
135
 
134
- }( window.jQuery )
136
+ }( window.jQuery )
@@ -27,7 +27,10 @@
27
27
 
28
28
  var toggle = '[data-toggle="dropdown"]'
29
29
  , Dropdown = function ( element ) {
30
- $(element).bind('click', this.toggle)
30
+ var $el = $(element).on('click.dropdown.data-api', this.toggle)
31
+ $('html').on('click.dropdown.data-api', function () {
32
+ $el.parent().removeClass('open')
33
+ })
31
34
  }
32
35
 
33
36
  Dropdown.prototype = {
@@ -36,15 +39,21 @@
36
39
 
37
40
  , toggle: function ( e ) {
38
41
  var $this = $(this)
39
- , selector = $this.attr('data-target') || $this.attr('href')
40
- , $parent = $(selector)
42
+ , selector = $this.attr('data-target')
43
+ , $parent
41
44
  , isActive
42
45
 
46
+ if (!selector) {
47
+ selector = $this.attr('href')
48
+ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
49
+ }
50
+
51
+ $parent = $(selector)
43
52
  $parent.length || ($parent = $this.parent())
53
+
44
54
  isActive = $parent.hasClass('open')
45
55
 
46
56
  clearMenus()
47
-
48
57
  !isActive && $parent.toggleClass('open')
49
58
 
50
59
  return false
@@ -76,8 +85,8 @@
76
85
  * =================================== */
77
86
 
78
87
  $(function () {
79
- $(window).on('click.dropdown.data-api', clearMenus)
88
+ $('html').on('click.dropdown.data-api', clearMenus)
80
89
  $('body').on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
81
90
  })
82
91
 
83
- }( window.jQuery )
92
+ }( window.jQuery )
@@ -44,6 +44,8 @@
44
44
 
45
45
  if (this.isShown) return
46
46
 
47
+ $('body').addClass('modal-open')
48
+
47
49
  this.isShown = true
48
50
  this.$element.trigger('show')
49
51
 
@@ -77,6 +79,8 @@
77
79
  var that = this
78
80
  this.isShown = false
79
81
 
82
+ $('body').removeClass('modal-open')
83
+
80
84
  escape.call(this)
81
85
 
82
86
  this.$element
@@ -193,8 +197,8 @@
193
197
 
194
198
  $(function () {
195
199
  $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
196
- var $this = $(this)
197
- , $target = $($this.attr('data-target') || $this.attr('href'))
200
+ var $this = $(this), href
201
+ , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
198
202
  , option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
199
203
 
200
204
  e.preventDefault()
@@ -202,4 +206,4 @@
202
206
  })
203
207
  })
204
208
 
205
- }( window.jQuery )
209
+ }( window.jQuery )