anjlab-bootstrap-rails 3.0.0.0.alpha1 → 3.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -27
- data/Rakefile +11 -35
- data/{vendor → app}/assets/javascripts/twitter/bootstrap.js +6 -6
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/affix.js +9 -3
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/alert.js +4 -2
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/button.js +6 -4
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/carousel.js +22 -12
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/collapse.js +69 -43
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/dropdown.js +22 -13
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/modal.js +37 -38
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/popover.js +11 -5
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/scrollspy.js +6 -4
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/tab.js +4 -2
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/tooltip.js +49 -38
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/transition.js +10 -1
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap.scss +0 -0
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_accordion.scss +7 -10
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_alerts.scss +11 -34
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_badges.scss +8 -15
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_bootstrap.scss +0 -1
- data/app/assets/stylesheets/twitter/bootstrap/_breadcrumbs.scss +23 -0
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_button-groups.scss +23 -22
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_buttons.scss +21 -24
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_carousel.scss +46 -32
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_close.scss +3 -3
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_code.scss +6 -12
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_component-animations.scss +10 -4
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_dropdowns.scss +46 -101
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_forms.scss +139 -179
- data/app/assets/stylesheets/twitter/bootstrap/_grid.scss +155 -0
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_jumbotron.scss +1 -4
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_labels.scss +7 -31
- data/app/assets/stylesheets/twitter/bootstrap/_list-group.scss +89 -0
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_media.scss +8 -6
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_mixins.scss +152 -131
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_modals.scss +11 -12
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_navbar.scss +90 -66
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_navs.scss +56 -68
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_normalize.scss +0 -0
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_pager.scss +4 -3
- data/app/assets/stylesheets/twitter/bootstrap/_pagination.scss +108 -0
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_panels.scss +8 -2
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_popovers.scss +22 -20
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_print.scss +26 -0
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_progress-bars.scss +5 -18
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_responsive-utilities.scss +25 -25
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_scaffolding.scss +24 -8
- data/app/assets/stylesheets/twitter/bootstrap/_tables.scss +211 -0
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_thumbnails.scss +2 -3
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_tooltip.scss +26 -2
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_type.scss +31 -49
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_utilities.scss +0 -0
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_variables.scss +201 -54
- data/{vendor → app}/assets/stylesheets/twitter/bootstrap/_wells.scss +0 -0
- data/bootstrap-rails.gemspec +0 -1
- data/lib/bootstrap-rails/version.rb +1 -1
- metadata +54 -60
- data/vendor/assets/fonts/twitter/glyphiconshalflings-regular.eot +0 -0
- data/vendor/assets/fonts/twitter/glyphiconshalflings-regular.otf +0 -0
- data/vendor/assets/fonts/twitter/glyphiconshalflings-regular.svg +0 -175
- data/vendor/assets/fonts/twitter/glyphiconshalflings-regular.ttf +0 -0
- data/vendor/assets/fonts/twitter/glyphiconshalflings-regular.woff +0 -0
- data/vendor/assets/stylesheets/twitter/bootstrap/_breadcrumbs.scss +0 -28
- data/vendor/assets/stylesheets/twitter/bootstrap/_glyphicons.scss +0 -200
- data/vendor/assets/stylesheets/twitter/bootstrap/_grid.scss +0 -65
- data/vendor/assets/stylesheets/twitter/bootstrap/_list-group.scss +0 -96
- data/vendor/assets/stylesheets/twitter/bootstrap/_pagination.scss +0 -87
- data/vendor/assets/stylesheets/twitter/bootstrap/_tables.scss +0 -242
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93eb1f78519c959376535845631eda96564eccd0
|
4
|
+
data.tar.gz: 5633ec827387a80e54b8abb0e9974a9c65732495
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb4349be7d58d73e33be08fde9e2598b8d7f2864d2f920cf162a7284b9c2a962b9e48c4b9d5a31febe10115cb5b16e298f8ac5199c6e3d1b87df7643f33f76c3
|
7
|
+
data.tar.gz: ab5385af14c3d07ce73e84696fca7efa99ceb1c8c9f265aa8dd22192f38e78ae0dfba3ac147b712cf9f69479af5e2366ea7f2b63f09cfccfb0e4375d5afefd28
|
data/README.md
CHANGED
@@ -1,26 +1,22 @@
|
|
1
|
-
# Twitter Bootstrap
|
1
|
+
# Twitter Bootstrap v3.0.0.alpha1 for Rails 3/4
|
2
2
|
Bootstrap is a toolkit from Twitter designed to kickstart development of webapps and sites.
|
3
3
|
It includes base CSS and HTML for typography, forms, buttons, tables, grids, navigation, and more.
|
4
4
|
|
5
|
-
|
5
|
+
For glyphicons use [bootstrap-glyphicons gem](https://github.com/anjlab/bootstrap-glyphicons)
|
6
6
|
|
7
|
+
Note: if you are looking for bootstrapped date and time pickers please take a look at [anjlab-widgets](https://github.com/anjlab/anjlab-widgets) gem.
|
7
8
|
|
8
9
|
anjlab-bootstrap-rails project integrates Bootstrap CSS (with Sass flavour) and JS toolkits for Rails 3 projects
|
9
10
|
|
10
11
|
<a href="http://spellhub.com/projects/project/69"><img src="http://spellhub.com/projects/status/69" height="18"></a>
|
11
12
|
|
12
13
|
## Rails > 3.1
|
13
|
-
|
14
|
-
|
15
|
-
``` ruby
|
16
|
-
gem 'anjlab-bootstrap-rails', '>= 2.3', :require => 'bootstrap-rails'
|
17
|
-
```
|
18
|
-
|
19
|
-
or you can install from latest build;
|
14
|
+
You can install from latest build just for testing right now;
|
20
15
|
|
21
16
|
``` ruby
|
22
17
|
gem 'anjlab-bootstrap-rails', :require => 'bootstrap-rails',
|
23
|
-
:
|
18
|
+
:github => 'anjlab/bootstrap-rails',
|
19
|
+
:branch => '3.0.0'
|
24
20
|
```
|
25
21
|
|
26
22
|
and run bundle install.
|
@@ -35,20 +31,17 @@ Add necessary stylesheet file to app/assets/stylesheets/application.css
|
|
35
31
|
|
36
32
|
You can override bootstrap variables:
|
37
33
|
|
38
|
-
|
39
|
-
|
34
|
+
1. rename application.css to application.css.scss
|
35
|
+
2. override vars above `@import "twitter/bootstrap";`
|
40
36
|
|
41
37
|
```scss
|
42
|
-
// change colors
|
43
|
-
$linkColor: red;
|
44
38
|
|
45
|
-
// change
|
46
|
-
$
|
47
|
-
$gridGutterWidth: 10px;
|
39
|
+
// change colors
|
40
|
+
$link-color: red;
|
48
41
|
|
49
42
|
// import original bootstrap
|
50
43
|
@import "twitter/bootstrap";
|
51
|
-
|
44
|
+
|
52
45
|
```
|
53
46
|
NOTE: restart `pow` if you are using it.
|
54
47
|
|
@@ -76,16 +69,10 @@ Add necessary javascript(s) files to app/assets/javascripts/application.js
|
|
76
69
|
//= require twitter/bootstrap/affix
|
77
70
|
```
|
78
71
|
|
79
|
-
##
|
80
|
-
|
81
|
-
- [Twitter Bootstrap Upgrade](http://twitter.github.com/bootstrap/upgrading.html)
|
82
|
-
- rm -rf tmp/cache
|
72
|
+
## Extending
|
83
73
|
|
84
|
-
|
74
|
+
- [Example of grid shortcuts and medium column classes](https://gist.github.com/yury/5662144)
|
85
75
|
|
86
|
-
- Fork this repo if you want fix rails integration bug
|
87
|
-
- Fork [Sass repo](https://github.com/yury/bootstrap) if you want fix SASS bug
|
88
|
-
|
89
76
|
## Thanks
|
90
77
|
Thanks Twitter for Bootstrap
|
91
78
|
http://twitter.github.com/bootstrap
|
@@ -94,7 +81,7 @@ Inspired by Seyhun Akyürek and his [twitter-bootstrap-rails gem](https://github
|
|
94
81
|
|
95
82
|
|
96
83
|
## License
|
97
|
-
Copyright (c)
|
84
|
+
Copyright (c) 2013 AnjLab
|
98
85
|
|
99
86
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
100
87
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
data/Rakefile
CHANGED
@@ -11,70 +11,46 @@ namespace :twitter do
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
BS_FONTS = FileList["bootstrap/fonts/*.*"]
|
15
|
-
ASSETS_FONTS = BS_FONTS.pathmap("vendor/assets/fonts/twitter/%f")
|
16
|
-
ASSETS_FONTS.zip(BS_FONTS).each do |target, source|
|
17
|
-
file target => [source] { cp source, target, verbose: true }
|
18
|
-
end
|
19
|
-
|
20
14
|
BS_JS = FileList["bootstrap/js/*.*"]
|
21
|
-
ASSETS_JS = BS_JS.pathmap("
|
15
|
+
ASSETS_JS = BS_JS.pathmap("app/assets/javascripts/twitter/bootstrap/%f")
|
22
16
|
ASSETS_JS.zip(BS_JS).each do |target, source|
|
23
17
|
file target => [source] { cp source, target, verbose: true }
|
24
18
|
end
|
25
19
|
|
26
20
|
BS_SCSS = FileList["bootstrap/scss/*.*"]
|
27
|
-
ASSETS_SCSS = BS_SCSS.pathmap("
|
21
|
+
ASSETS_SCSS = BS_SCSS.pathmap("app/assets/stylesheets/twitter/bootstrap/_%f")
|
28
22
|
ASSETS_SCSS.zip(BS_SCSS).each do |target, source|
|
29
23
|
target.gsub!(/__/, '_')
|
30
24
|
file target => [source] { cp source, target, verbose: true }
|
31
25
|
end
|
32
26
|
|
33
|
-
desc "Update Twitter's Bootstrap Fonts"
|
34
|
-
task :fonts => ASSETS_FONTS
|
35
|
-
|
36
27
|
desc "Update Twitter's Bootstrap JS"
|
37
28
|
task :js => ASSETS_JS do
|
38
29
|
js = {}
|
39
30
|
ASSETS_JS.pathmap("%f").each { |f| js[f] = 1 }
|
40
31
|
|
41
32
|
# dependencies
|
42
|
-
|
43
|
-
js[
|
44
|
-
js["popover.js"] = 3
|
33
|
+
order = %w{transition.js alert.js button.js carousel.js collapse.js dropdown.js modal.js tooltip.js popover.js scrollspy.js tab.js affix.js}
|
34
|
+
order.each_with_index {|o, i| js[o] = i }
|
45
35
|
|
46
36
|
list = js.to_a.sort {|a,b| a[1] <=> b[1]}.map{|p| p[0]}
|
47
|
-
File.write "
|
37
|
+
File.write "app/assets/javascripts/twitter/bootstrap.js", list.map {|f| "//= require twitter/bootstrap/#{f}"}.join("\n")
|
48
38
|
end
|
49
39
|
|
50
40
|
desc "Update Twitter's Bootstrap SCSS"
|
51
41
|
task :scss => ASSETS_SCSS do
|
52
|
-
File.write "
|
53
|
-
end
|
54
|
-
|
55
|
-
desc "Update Twitter's icons"
|
56
|
-
task :icons do
|
57
|
-
vars_path = 'vendor/assets/stylesheets/twitter/bootstrap/_variables.scss'
|
58
|
-
variables = File.read vars_path
|
59
|
-
variables.sub!(/^\$glyphicons-font-path:\s+".*"\s!default;/, "$glyphicons-font-path: \"twitter\" !default;")
|
60
|
-
File.write(vars_path, variables)
|
61
|
-
|
62
|
-
glyphicons_path = 'vendor/assets/stylesheets/twitter/bootstrap/_glyphicons.scss'
|
63
|
-
glyphicons = File.read glyphicons_path
|
64
|
-
glyphicons.gsub!(/url\('\#{\$glyphicons-font-path\}\//, "font-url('\#{$glyphicons-font-path}/")
|
65
|
-
File.write(glyphicons_path, glyphicons)
|
42
|
+
File.write "app/assets/stylesheets/twitter/bootstrap.scss", '@import "twitter/bootstrap/bootstrap";'
|
66
43
|
end
|
67
44
|
|
68
|
-
desc "Clean
|
45
|
+
desc "Clean gem assets files"
|
69
46
|
task :clean do
|
70
|
-
FileUtils.rm_rf '
|
71
|
-
FileUtils.mkpath '
|
72
|
-
FileUtils.mkpath '
|
73
|
-
FileUtils.mkpath 'vendor/assets/stylesheets/twitter/bootstrap'
|
47
|
+
FileUtils.rm_rf 'app/assets'
|
48
|
+
FileUtils.mkpath 'app/assets/javascripts/twitter/bootstrap'
|
49
|
+
FileUtils.mkpath 'app/assets/stylesheets/twitter/bootstrap'
|
74
50
|
end
|
75
51
|
|
76
52
|
desc "Update Twitter's Bootstrap Assets"
|
77
|
-
task :assets => [:pull, :clean, :
|
53
|
+
task :assets => [:pull, :clean, :scss, :js]
|
78
54
|
|
79
55
|
end
|
80
56
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
//= require twitter/bootstrap/transition.js
|
2
|
-
//= require twitter/bootstrap/
|
2
|
+
//= require twitter/bootstrap/alert.js
|
3
3
|
//= require twitter/bootstrap/button.js
|
4
4
|
//= require twitter/bootstrap/carousel.js
|
5
5
|
//= require twitter/bootstrap/collapse.js
|
6
6
|
//= require twitter/bootstrap/dropdown.js
|
7
|
-
//= require twitter/bootstrap/
|
8
|
-
//= require twitter/bootstrap/tab.js
|
9
|
-
//= require twitter/bootstrap/scrollspy.js
|
10
|
-
//= require twitter/bootstrap/affix.js
|
7
|
+
//= require twitter/bootstrap/modal.js
|
11
8
|
//= require twitter/bootstrap/tooltip.js
|
12
|
-
//= require twitter/bootstrap/popover.js
|
9
|
+
//= require twitter/bootstrap/popover.js
|
10
|
+
//= require twitter/bootstrap/scrollspy.js
|
11
|
+
//= require twitter/bootstrap/tab.js
|
12
|
+
//= require twitter/bootstrap/affix.js
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* ========================================================================
|
2
2
|
* Bootstrap: affix.js v3.0.0
|
3
|
-
* http://
|
3
|
+
* http://twbs.github.com/bootstrap/javascript.html#affix
|
4
4
|
* ========================================================================
|
5
5
|
* Copyright 2012 Twitter, Inc.
|
6
6
|
*
|
@@ -36,6 +36,8 @@
|
|
36
36
|
this.checkPosition()
|
37
37
|
}
|
38
38
|
|
39
|
+
Affix.RESET = 'affix affix-top affix-bottom'
|
40
|
+
|
39
41
|
Affix.DEFAULTS = {
|
40
42
|
offset: 0
|
41
43
|
}
|
@@ -53,7 +55,6 @@
|
|
53
55
|
var offset = this.options.offset
|
54
56
|
var offsetTop = offset.top
|
55
57
|
var offsetBottom = offset.bottom
|
56
|
-
var reset = 'affix affix-top affix-bottom'
|
57
58
|
|
58
59
|
if (typeof offset != 'object') offsetBottom = offsetTop = offset
|
59
60
|
if (typeof offsetTop == 'function') offsetTop = offset.top()
|
@@ -64,11 +65,16 @@
|
|
64
65
|
offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
|
65
66
|
|
66
67
|
if (this.affixed === affix) return
|
68
|
+
if (this.unpin) this.$element.css('top', '')
|
67
69
|
|
68
70
|
this.affixed = affix
|
69
71
|
this.unpin = affix == 'bottom' ? position.top - scrollTop : null
|
70
72
|
|
71
|
-
this.$element.removeClass(
|
73
|
+
this.$element.removeClass(Affix.RESET).addClass('affix' + (affix ? '-' + affix : ''))
|
74
|
+
|
75
|
+
if (affix == 'bottom') {
|
76
|
+
this.$element.offset({ top: document.body.offsetHeight - offsetBottom - this.$element.height() })
|
77
|
+
}
|
72
78
|
}
|
73
79
|
|
74
80
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* ========================================================================
|
2
2
|
* Bootstrap: alert.js v3.0.0
|
3
|
-
* http://
|
3
|
+
* http://twbs.github.com/bootstrap/javascript.html#alerts
|
4
4
|
* ========================================================================
|
5
5
|
* Copyright 2013 Twitter, Inc.
|
6
6
|
*
|
@@ -56,7 +56,9 @@
|
|
56
56
|
}
|
57
57
|
|
58
58
|
$.support.transition && $parent.hasClass('fade') ?
|
59
|
-
$parent
|
59
|
+
$parent
|
60
|
+
.one($.support.transition.end, removeElement)
|
61
|
+
.emulateTransitionEnd(150) :
|
60
62
|
removeElement()
|
61
63
|
}
|
62
64
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* ========================================================================
|
2
2
|
* Bootstrap: button.js v3.0.0
|
3
|
-
* http://
|
3
|
+
* http://twbs.github.com/bootstrap/javascript.html#buttons
|
4
4
|
* ========================================================================
|
5
5
|
* Copyright 2013 Twitter, Inc.
|
6
6
|
*
|
@@ -53,10 +53,11 @@
|
|
53
53
|
}
|
54
54
|
|
55
55
|
Button.prototype.toggle = function () {
|
56
|
-
var $parent = this.$element.closest('[data-toggle="buttons
|
56
|
+
var $parent = this.$element.closest('[data-toggle="buttons"]')
|
57
57
|
|
58
|
-
if ($parent) {
|
59
|
-
$
|
58
|
+
if ($parent.length) {
|
59
|
+
var $input = this.$element.find('input').prop('checked', !this.$element.hasClass('active'))
|
60
|
+
if ($input.prop('type') === 'radio') $parent.find('.active').removeClass('active')
|
60
61
|
}
|
61
62
|
|
62
63
|
this.$element.toggleClass('active')
|
@@ -100,6 +101,7 @@
|
|
100
101
|
var $btn = $(e.target)
|
101
102
|
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
|
102
103
|
$btn.button('toggle')
|
104
|
+
e.preventDefault()
|
103
105
|
})
|
104
106
|
|
105
107
|
}(window.jQuery);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* ========================================================================
|
2
2
|
* Bootstrap: carousel.js v3.0.0
|
3
|
-
* http://
|
3
|
+
* http://twbs.github.com/bootstrap/javascript.html#carousel
|
4
4
|
* ========================================================================
|
5
5
|
* Copyright 2012 Twitter, Inc.
|
6
6
|
*
|
@@ -130,12 +130,14 @@
|
|
130
130
|
$next[0].offsetWidth // force reflow
|
131
131
|
$active.addClass(direction)
|
132
132
|
$next.addClass(direction)
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
133
|
+
$active
|
134
|
+
.one($.support.transition.end, function () {
|
135
|
+
$next.removeClass([type, direction].join(' ')).addClass('active')
|
136
|
+
$active.removeClass(['active', direction].join(' '))
|
137
|
+
that.sliding = false
|
138
|
+
setTimeout(function () { that.$element.trigger('slid') }, 0)
|
139
|
+
})
|
140
|
+
.emulateTransitionEnd(600)
|
139
141
|
} else {
|
140
142
|
this.$element.trigger(e)
|
141
143
|
if (e.isDefaultPrevented()) return
|
@@ -160,7 +162,7 @@
|
|
160
162
|
return this.each(function () {
|
161
163
|
var $this = $(this)
|
162
164
|
var data = $this.data('bs.carousel')
|
163
|
-
var options = $.extend({}, Carousel.DEFAULTS, typeof option == 'object' && option)
|
165
|
+
var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
164
166
|
var action = typeof option == 'string' ? option : options.slide
|
165
167
|
|
166
168
|
if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
|
@@ -185,19 +187,27 @@
|
|
185
187
|
// CAROUSEL DATA-API
|
186
188
|
// =================
|
187
189
|
|
188
|
-
$(document).on('click.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
|
189
|
-
var $this
|
190
|
+
$(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
|
191
|
+
var $this = $(this), href
|
190
192
|
var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
191
193
|
var options = $.extend({}, $target.data(), $this.data())
|
192
|
-
var slideIndex
|
194
|
+
var slideIndex = $this.attr('data-slide-to')
|
195
|
+
if (slideIndex) options.interval = false
|
193
196
|
|
194
197
|
$target.carousel(options)
|
195
198
|
|
196
199
|
if (slideIndex = $this.attr('data-slide-to')) {
|
197
|
-
$target.data('bs
|
200
|
+
$target.data('bs.carousel').to(slideIndex)
|
198
201
|
}
|
199
202
|
|
200
203
|
e.preventDefault()
|
201
204
|
})
|
202
205
|
|
206
|
+
$(window).on('load', function () {
|
207
|
+
$('[data-ride="carousel"]').each(function () {
|
208
|
+
var $carousel = $(this)
|
209
|
+
$carousel.carousel($carousel.data())
|
210
|
+
})
|
211
|
+
})
|
212
|
+
|
203
213
|
}(window.jQuery);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* ========================================================================
|
2
2
|
* Bootstrap: collapse.js v3.0.0
|
3
|
-
* http://
|
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
|
48
|
-
|
47
|
+
var startEvent = $.Event('show.bs.collapse')
|
48
|
+
this.$element.trigger(startEvent)
|
49
|
+
if (startEvent.isDefaultPrevented()) return
|
50
|
+
|
49
51
|
var actives = this.$parent && this.$parent.find('> .accordion-group > .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
|
-
|
59
|
-
this.transition('addClass', $.Event('show.bs.collapse'), 'shown.bs.collapse')
|
78
|
+
if (!$.support.transition) return complete.call(this)
|
60
79
|
|
61
|
-
|
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
|
-
|
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
|
-
|
77
|
-
[
|
78
|
-
[0].offsetWidth
|
98
|
+
[dimension](this.$element[dimension]())
|
99
|
+
[0].offsetHeight
|
79
100
|
|
80
|
-
this.$element
|
101
|
+
this.$element
|
102
|
+
.addClass('collapsing')
|
103
|
+
.removeClass('collapse')
|
104
|
+
.removeClass('in')
|
81
105
|
|
82
|
-
|
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
|
-
|
89
|
-
|
90
|
-
|
109
|
+
this.transitioning = 0
|
110
|
+
this.$element
|
111
|
+
.trigger('hidden.bs.collapse')
|
112
|
+
.removeClass('collapsing')
|
113
|
+
.addClass('collapse')
|
91
114
|
}
|
92
115
|
|
93
|
-
|
94
|
-
|
95
|
-
if (startEvent.isDefaultPrevented()) return
|
96
|
-
|
97
|
-
this.transitioning = 1
|
98
|
-
|
99
|
-
this.$element[method]('in')
|
116
|
+
if (!$.support.transition) return complete.call(this)
|
100
117
|
|
101
|
-
|
102
|
-
|
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
|
}
|
@@ -139,15 +157,23 @@
|
|
139
157
|
// COLLAPSE DATA-API
|
140
158
|
// =================
|
141
159
|
|
142
|
-
$(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
|
143
|
-
var $this
|
144
|
-
var target
|
160
|
+
$(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) {
|
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
|
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')
|
169
|
+
var $parent = parent && $(parent)
|
170
|
+
|
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
|
+
}
|
148
175
|
|
149
|
-
$
|
150
|
-
$(target).collapse(option)
|
176
|
+
$target.collapse(option)
|
151
177
|
})
|
152
178
|
|
153
179
|
}(window.jQuery);
|