penmanship 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. data/.gitignore +17 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE +22 -0
  4. data/README.md +74 -0
  5. data/Rakefile +2 -0
  6. data/lib/penmanship.rb +15 -0
  7. data/lib/penmanship/action_controller/extension.rb +24 -0
  8. data/lib/penmanship/action_view/extension.rb +43 -0
  9. data/lib/penmanship/version.rb +3 -0
  10. data/penmanship.gemspec +25 -0
  11. data/vendor/assets/images/glyphicons-halflings-white.png +0 -0
  12. data/vendor/assets/images/glyphicons-halflings.png +0 -0
  13. data/vendor/assets/javascripts/README.md +112 -0
  14. data/vendor/assets/javascripts/bootstrap-alert.js +90 -0
  15. data/vendor/assets/javascripts/bootstrap-application.js +184 -0
  16. data/vendor/assets/javascripts/bootstrap-button.js +96 -0
  17. data/vendor/assets/javascripts/bootstrap-carousel.js +169 -0
  18. data/vendor/assets/javascripts/bootstrap-collapse.js +157 -0
  19. data/vendor/assets/javascripts/bootstrap-dropdown.js +100 -0
  20. data/vendor/assets/javascripts/bootstrap-modal.js +218 -0
  21. data/vendor/assets/javascripts/bootstrap-popover.js +98 -0
  22. data/vendor/assets/javascripts/bootstrap-scrollspy.js +151 -0
  23. data/vendor/assets/javascripts/bootstrap-tab.js +135 -0
  24. data/vendor/assets/javascripts/bootstrap-tooltip.js +275 -0
  25. data/vendor/assets/javascripts/bootstrap-transition.js +61 -0
  26. data/vendor/assets/javascripts/bootstrap-typeahead.js +285 -0
  27. data/vendor/assets/javascripts/bootstrap.js +1824 -0
  28. data/vendor/assets/javascripts/bootstrap.min.js +6 -0
  29. data/vendor/assets/javascripts/prettify.js +28 -0
  30. data/vendor/assets/stylesheets/bootstrap-responsive.css +808 -0
  31. data/vendor/assets/stylesheets/bootstrap.css +4960 -0
  32. data/vendor/assets/stylesheets/docs.css +841 -0
  33. data/vendor/assets/stylesheets/prettify.css +30 -0
  34. metadata +142 -0
@@ -0,0 +1,184 @@
1
+ // NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
2
+ // IT'S ALL JUST JUNK FOR OUR DOCS!
3
+ // ++++++++++++++++++++++++++++++++++++++++++
4
+
5
+ !function ($) {
6
+
7
+ $(function(){
8
+
9
+ // Disable certain links in docs
10
+ $('section [href^=#]').click(function (e) {
11
+ e.preventDefault()
12
+ })
13
+
14
+ // make code pretty
15
+ window.prettyPrint && prettyPrint()
16
+
17
+ // add-ons
18
+ $('.add-on :checkbox').on('click', function () {
19
+ var $this = $(this)
20
+ , method = $this.attr('checked') ? 'addClass' : 'removeClass'
21
+ $(this).parents('.add-on')[method]('active')
22
+ })
23
+
24
+ // position static twipsies for components page
25
+ if ($(".twipsies a").length) {
26
+ $(window).on('load resize', function () {
27
+ $(".twipsies a").each(function () {
28
+ $(this)
29
+ .tooltip({
30
+ placement: $(this).attr('title')
31
+ , trigger: 'manual'
32
+ })
33
+ .tooltip('show')
34
+ })
35
+ })
36
+ }
37
+
38
+ // add tipsies to grid for scaffolding
39
+ if ($('#grid-system').length) {
40
+ $('#grid-system').tooltip({
41
+ selector: '.show-grid > div'
42
+ , title: function () { return $(this).width() + 'px' }
43
+ })
44
+ }
45
+
46
+ // fix sub nav on scroll
47
+ var $win = $(window)
48
+ , $nav = $('.subnav')
49
+ , navTop = $('.subnav').length && $('.subnav').offset().top - 40
50
+ , isFixed = 0
51
+
52
+ processScroll()
53
+
54
+ // hack sad times - holdover until rewrite for 2.1
55
+ $nav.on('click', function () {
56
+ if (!isFixed) setTimeout(function () { $win.scrollTop($win.scrollTop() - 47) }, 10)
57
+ })
58
+
59
+ $win.on('scroll', processScroll)
60
+
61
+ function processScroll() {
62
+ var i, scrollTop = $win.scrollTop()
63
+ if (scrollTop >= navTop && !isFixed) {
64
+ isFixed = 1
65
+ $nav.addClass('subnav-fixed')
66
+ } else if (scrollTop <= navTop && isFixed) {
67
+ isFixed = 0
68
+ $nav.removeClass('subnav-fixed')
69
+ }
70
+ }
71
+
72
+ // tooltip demo
73
+ $('.tooltip-demo.well').tooltip({
74
+ selector: "a[rel=tooltip]"
75
+ })
76
+
77
+ $('.tooltip-test').tooltip()
78
+ $('.popover-test').popover()
79
+
80
+ // popover demo
81
+ $("a[rel=popover]")
82
+ .popover()
83
+ .click(function(e) {
84
+ e.preventDefault()
85
+ })
86
+
87
+ // button state demo
88
+ $('#fat-btn')
89
+ .click(function () {
90
+ var btn = $(this)
91
+ btn.button('loading')
92
+ setTimeout(function () {
93
+ btn.button('reset')
94
+ }, 3000)
95
+ })
96
+
97
+ // carousel demo
98
+ $('#myCarousel').carousel()
99
+
100
+ // javascript build logic
101
+ var inputsComponent = $("#components.download input")
102
+ , inputsPlugin = $("#plugins.download input")
103
+ , inputsVariables = $("#variables.download input")
104
+
105
+ // toggle all plugin checkboxes
106
+ $('#components.download .toggle-all').on('click', function (e) {
107
+ e.preventDefault()
108
+ inputsComponent.attr('checked', !inputsComponent.is(':checked'))
109
+ })
110
+
111
+ $('#plugins.download .toggle-all').on('click', function (e) {
112
+ e.preventDefault()
113
+ inputsPlugin.attr('checked', !inputsPlugin.is(':checked'))
114
+ })
115
+
116
+ $('#variables.download .toggle-all').on('click', function (e) {
117
+ e.preventDefault()
118
+ inputsVariables.val('')
119
+ })
120
+
121
+ // request built javascript
122
+ $('.download-btn').on('click', function () {
123
+
124
+ var css = $("#components.download input:checked")
125
+ .map(function () { return this.value })
126
+ .toArray()
127
+ , js = $("#plugins.download input:checked")
128
+ .map(function () { return this.value })
129
+ .toArray()
130
+ , vars = {}
131
+ , img = ['glyphicons-halflings.png', 'glyphicons-halflings-white.png']
132
+
133
+ $("#variables.download input")
134
+ .each(function () {
135
+ $(this).val() && (vars[ $(this).prev().text() ] = $(this).val())
136
+ })
137
+
138
+ $.ajax({
139
+ type: 'POST'
140
+ , url: /\?dev/.test(window.location) ? 'http://localhost:3000' : 'http://bootstrap.herokuapp.com'
141
+ , dataType: 'jsonpi'
142
+ , params: {
143
+ js: js
144
+ , css: css
145
+ , vars: vars
146
+ , img: img
147
+ }
148
+ })
149
+ })
150
+ })
151
+
152
+ // Modified from the original jsonpi https://github.com/benvinegar/jquery-jsonpi
153
+ $.ajaxTransport('jsonpi', function(opts, originalOptions, jqXHR) {
154
+ var url = opts.url;
155
+
156
+ return {
157
+ send: function(_, completeCallback) {
158
+ var name = 'jQuery_iframe_' + jQuery.now()
159
+ , iframe, form
160
+
161
+ iframe = $('<iframe>')
162
+ .attr('name', name)
163
+ .appendTo('head')
164
+
165
+ form = $('<form>')
166
+ .attr('method', opts.type) // GET or POST
167
+ .attr('action', url)
168
+ .attr('target', name)
169
+
170
+ $.each(opts.params, function(k, v) {
171
+
172
+ $('<input>')
173
+ .attr('type', 'hidden')
174
+ .attr('name', k)
175
+ .attr('value', typeof v == 'string' ? v : JSON.stringify(v))
176
+ .appendTo(form)
177
+ })
178
+
179
+ form.appendTo('body').submit()
180
+ }
181
+ }
182
+ })
183
+
184
+ }(window.jQuery)
@@ -0,0 +1,96 @@
1
+ /* ============================================================
2
+ * bootstrap-button.js v2.0.3
3
+ * http://twitter.github.com/bootstrap/javascript.html#buttons
4
+ * ============================================================
5
+ * Copyright 2012 Twitter, Inc.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ * ============================================================ */
19
+
20
+
21
+ !function ($) {
22
+
23
+ "use strict"; // jshint ;_;
24
+
25
+
26
+ /* BUTTON PUBLIC CLASS DEFINITION
27
+ * ============================== */
28
+
29
+ var Button = function (element, options) {
30
+ this.$element = $(element)
31
+ this.options = $.extend({}, $.fn.button.defaults, options)
32
+ }
33
+
34
+ Button.prototype.setState = function (state) {
35
+ var d = 'disabled'
36
+ , $el = this.$element
37
+ , data = $el.data()
38
+ , val = $el.is('input') ? 'val' : 'html'
39
+
40
+ state = state + 'Text'
41
+ data.resetText || $el.data('resetText', $el[val]())
42
+
43
+ $el[val](data[state] || this.options[state])
44
+
45
+ // push to event loop to allow forms to submit
46
+ setTimeout(function () {
47
+ state == 'loadingText' ?
48
+ $el.addClass(d).attr(d, d) :
49
+ $el.removeClass(d).removeAttr(d)
50
+ }, 0)
51
+ }
52
+
53
+ Button.prototype.toggle = function () {
54
+ var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
55
+
56
+ $parent && $parent
57
+ .find('.active')
58
+ .removeClass('active')
59
+
60
+ this.$element.toggleClass('active')
61
+ }
62
+
63
+
64
+ /* BUTTON PLUGIN DEFINITION
65
+ * ======================== */
66
+
67
+ $.fn.button = function (option) {
68
+ return this.each(function () {
69
+ var $this = $(this)
70
+ , data = $this.data('button')
71
+ , options = typeof option == 'object' && option
72
+ if (!data) $this.data('button', (data = new Button(this, options)))
73
+ if (option == 'toggle') data.toggle()
74
+ else if (option) data.setState(option)
75
+ })
76
+ }
77
+
78
+ $.fn.button.defaults = {
79
+ loadingText: 'loading...'
80
+ }
81
+
82
+ $.fn.button.Constructor = Button
83
+
84
+
85
+ /* BUTTON DATA-API
86
+ * =============== */
87
+
88
+ $(function () {
89
+ $('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
90
+ var $btn = $(e.target)
91
+ if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
92
+ $btn.button('toggle')
93
+ })
94
+ })
95
+
96
+ }(window.jQuery);
@@ -0,0 +1,169 @@
1
+ /* ==========================================================
2
+ * bootstrap-carousel.js v2.0.3
3
+ * http://twitter.github.com/bootstrap/javascript.html#carousel
4
+ * ==========================================================
5
+ * Copyright 2012 Twitter, Inc.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ * ========================================================== */
19
+
20
+
21
+ !function ($) {
22
+
23
+ "use strict"; // jshint ;_;
24
+
25
+
26
+ /* CAROUSEL CLASS DEFINITION
27
+ * ========================= */
28
+
29
+ var Carousel = function (element, options) {
30
+ this.$element = $(element)
31
+ this.options = options
32
+ this.options.slide && this.slide(this.options.slide)
33
+ this.options.pause == 'hover' && this.$element
34
+ .on('mouseenter', $.proxy(this.pause, this))
35
+ .on('mouseleave', $.proxy(this.cycle, this))
36
+ }
37
+
38
+ Carousel.prototype = {
39
+
40
+ cycle: function (e) {
41
+ if (!e) this.paused = false
42
+ this.options.interval
43
+ && !this.paused
44
+ && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
45
+ return this
46
+ }
47
+
48
+ , to: function (pos) {
49
+ var $active = this.$element.find('.active')
50
+ , children = $active.parent().children()
51
+ , activePos = children.index($active)
52
+ , that = this
53
+
54
+ if (pos > (children.length - 1) || pos < 0) return
55
+
56
+ if (this.sliding) {
57
+ return this.$element.one('slid', function () {
58
+ that.to(pos)
59
+ })
60
+ }
61
+
62
+ if (activePos == pos) {
63
+ return this.pause().cycle()
64
+ }
65
+
66
+ return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos]))
67
+ }
68
+
69
+ , pause: function (e) {
70
+ if (!e) this.paused = true
71
+ clearInterval(this.interval)
72
+ this.interval = null
73
+ return this
74
+ }
75
+
76
+ , next: function () {
77
+ if (this.sliding) return
78
+ return this.slide('next')
79
+ }
80
+
81
+ , prev: function () {
82
+ if (this.sliding) return
83
+ return this.slide('prev')
84
+ }
85
+
86
+ , slide: function (type, next) {
87
+ var $active = this.$element.find('.active')
88
+ , $next = next || $active[type]()
89
+ , isCycling = this.interval
90
+ , direction = type == 'next' ? 'left' : 'right'
91
+ , fallback = type == 'next' ? 'first' : 'last'
92
+ , that = this
93
+ , e = $.Event('slide')
94
+
95
+ this.sliding = true
96
+
97
+ isCycling && this.pause()
98
+
99
+ $next = $next.length ? $next : this.$element.find('.item')[fallback]()
100
+
101
+ if ($next.hasClass('active')) return
102
+
103
+ if ($.support.transition && this.$element.hasClass('slide')) {
104
+ this.$element.trigger(e)
105
+ if (e.isDefaultPrevented()) return
106
+ $next.addClass(type)
107
+ $next[0].offsetWidth // force reflow
108
+ $active.addClass(direction)
109
+ $next.addClass(direction)
110
+ this.$element.one($.support.transition.end, function () {
111
+ $next.removeClass([type, direction].join(' ')).addClass('active')
112
+ $active.removeClass(['active', direction].join(' '))
113
+ that.sliding = false
114
+ setTimeout(function () { that.$element.trigger('slid') }, 0)
115
+ })
116
+ } else {
117
+ this.$element.trigger(e)
118
+ if (e.isDefaultPrevented()) return
119
+ $active.removeClass('active')
120
+ $next.addClass('active')
121
+ this.sliding = false
122
+ this.$element.trigger('slid')
123
+ }
124
+
125
+ isCycling && this.cycle()
126
+
127
+ return this
128
+ }
129
+
130
+ }
131
+
132
+
133
+ /* CAROUSEL PLUGIN DEFINITION
134
+ * ========================== */
135
+
136
+ $.fn.carousel = function (option) {
137
+ return this.each(function () {
138
+ var $this = $(this)
139
+ , data = $this.data('carousel')
140
+ , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option)
141
+ if (!data) $this.data('carousel', (data = new Carousel(this, options)))
142
+ if (typeof option == 'number') data.to(option)
143
+ else if (typeof option == 'string' || (option = options.slide)) data[option]()
144
+ else if (options.interval) data.cycle()
145
+ })
146
+ }
147
+
148
+ $.fn.carousel.defaults = {
149
+ interval: 5000
150
+ , pause: 'hover'
151
+ }
152
+
153
+ $.fn.carousel.Constructor = Carousel
154
+
155
+
156
+ /* CAROUSEL DATA-API
157
+ * ================= */
158
+
159
+ $(function () {
160
+ $('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
161
+ var $this = $(this), href
162
+ , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
163
+ , options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
164
+ $target.carousel(options)
165
+ e.preventDefault()
166
+ })
167
+ })
168
+
169
+ }(window.jQuery);