strappit 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2998793a394bf6e698ac50f3ff34389974c4bf8f
4
+ data.tar.gz: d1d570e2d1bd2873881802046a178eb426e56865
5
+ SHA512:
6
+ metadata.gz: 93d4d476dd4a60270c5d4a896f0896f8980093ccb30a52a1f3545751972fedb9ff592b26c80b2682ee40a27aec41e2533d3ddfbe5df8a6e8702adadf78557397
7
+ data.tar.gz: 0bcaf9d1083cf960e9d9afbbb6626f7f45524eb23d6b50b844754dff8424c2ae033b1b90e60817a25edfe7b8bd8c7915452c371270fe45176f1cd6baed949b62
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in strappit.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 John Faucett
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ # Strappit
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'strappit'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install strappit
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,8 @@
1
+ require "strappit/version"
2
+
3
+ module Strappit
4
+ module Rails
5
+ class Engine < ::Rails::Engine
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ module Strappit
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'strappit/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "strappit"
8
+ spec.version = Strappit::VERSION
9
+ spec.authors = ["John Faucett"]
10
+ spec.email = ["jwaterfaucett@gmail.com"]
11
+ spec.description = %q{Bootstrap for your website}
12
+ spec.summary = %q{Use Bootstrap to manage your website designs}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+
24
+ spec.add_dependency "railties", "~> 3.1"
25
+ spec.add_dependency 'bootstrap-sass'
26
+
27
+ end
@@ -0,0 +1,412 @@
1
+ /* ===========================================================
2
+ * bootstrap-modalmanager.js v2.1
3
+ * ===========================================================
4
+ * Copyright 2012 Jordan Schroter.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ * ========================================================== */
18
+
19
+ !function ($) {
20
+
21
+ "use strict"; // jshint ;_;
22
+
23
+ /* MODAL MANAGER CLASS DEFINITION
24
+ * ====================== */
25
+
26
+ var ModalManager = function (element, options) {
27
+ this.init(element, options);
28
+ };
29
+
30
+ ModalManager.prototype = {
31
+
32
+ constructor: ModalManager,
33
+
34
+ init: function (element, options) {
35
+ this.$element = $(element);
36
+ this.options = $.extend({}, $.fn.modalmanager.defaults, this.$element.data(), typeof options == 'object' && options);
37
+ this.stack = [];
38
+ this.backdropCount = 0;
39
+
40
+ if (this.options.resize) {
41
+ var resizeTimeout,
42
+ that = this;
43
+
44
+ $(window).on('resize.modal', function(){
45
+ resizeTimeout && clearTimeout(resizeTimeout);
46
+ resizeTimeout = setTimeout(function(){
47
+ for (var i = 0; i < that.stack.length; i++){
48
+ that.stack[i].isShown && that.stack[i].layout();
49
+ }
50
+ }, 10);
51
+ });
52
+ }
53
+ },
54
+
55
+ createModal: function (element, options) {
56
+ $(element).modal($.extend({ manager: this }, options));
57
+ },
58
+
59
+ appendModal: function (modal) {
60
+ this.stack.push(modal);
61
+
62
+ var that = this;
63
+
64
+ modal.$element.on('show.modalmanager', targetIsSelf(function (e) {
65
+
66
+ var showModal = function(){
67
+ modal.isShown = true;
68
+
69
+ var transition = $.support.transition && modal.$element.hasClass('fade');
70
+
71
+ that.$element
72
+ .toggleClass('modal-open', that.hasOpenModal())
73
+ .toggleClass('page-overflow', $(window).height() < that.$element.height());
74
+
75
+ modal.$parent = modal.$element.parent();
76
+
77
+ modal.$container = that.createContainer(modal);
78
+
79
+ modal.$element.appendTo(modal.$container);
80
+
81
+ that.backdrop(modal, function () {
82
+
83
+ modal.$element.show();
84
+
85
+ if (transition) {
86
+ //modal.$element[0].style.display = 'run-in';
87
+ modal.$element[0].offsetWidth;
88
+ //modal.$element.one($.support.transition.end, function () { modal.$element[0].style.display = 'block' });
89
+ }
90
+
91
+ modal.layout();
92
+
93
+ modal.$element
94
+ .addClass('in')
95
+ .attr('aria-hidden', false);
96
+
97
+ var complete = function () {
98
+ that.setFocus();
99
+ modal.$element.trigger('shown');
100
+ };
101
+
102
+ transition ?
103
+ modal.$element.one($.support.transition.end, complete) :
104
+ complete();
105
+ });
106
+ };
107
+
108
+ modal.options.replace ?
109
+ that.replace(showModal) :
110
+ showModal();
111
+ }));
112
+
113
+ modal.$element.on('hidden.modalmanager', targetIsSelf(function (e) {
114
+
115
+ that.backdrop(modal);
116
+
117
+ if (modal.$backdrop){
118
+ $.support.transition && modal.$element.hasClass('fade') ?
119
+ modal.$backdrop.one($.support.transition.end, function () { that.destroyModal(modal) }) :
120
+ that.destroyModal(modal);
121
+ } else {
122
+ that.destroyModal(modal);
123
+ }
124
+
125
+ }));
126
+
127
+ modal.$element.on('destroy.modalmanager', targetIsSelf(function (e) {
128
+ that.removeModal(modal);
129
+ }));
130
+
131
+ },
132
+
133
+ destroyModal: function (modal) {
134
+
135
+ modal.destroy();
136
+
137
+ var hasOpenModal = this.hasOpenModal();
138
+
139
+ this.$element.toggleClass('modal-open', hasOpenModal);
140
+
141
+ if (!hasOpenModal){
142
+ this.$element.removeClass('page-overflow');
143
+ }
144
+
145
+ this.removeContainer(modal);
146
+
147
+ this.setFocus();
148
+ },
149
+
150
+ hasOpenModal: function () {
151
+ for (var i = 0; i < this.stack.length; i++){
152
+ if (this.stack[i].isShown) return true;
153
+ }
154
+
155
+ return false;
156
+ },
157
+
158
+ setFocus: function () {
159
+ var topModal;
160
+
161
+ for (var i = 0; i < this.stack.length; i++){
162
+ if (this.stack[i].isShown) topModal = this.stack[i];
163
+ }
164
+
165
+ if (!topModal) return;
166
+
167
+ topModal.focus();
168
+
169
+ },
170
+
171
+ removeModal: function (modal) {
172
+ modal.$element.off('.modalmanager');
173
+ if (modal.$backdrop) this.removeBackdrop(modal);
174
+ this.stack.splice(this.getIndexOfModal(modal), 1);
175
+ },
176
+
177
+ getModalAt: function (index) {
178
+ return this.stack[index];
179
+ },
180
+
181
+ getIndexOfModal: function (modal) {
182
+ for (var i = 0; i < this.stack.length; i++){
183
+ if (modal === this.stack[i]) return i;
184
+ }
185
+ },
186
+
187
+ replace: function (callback) {
188
+ var topModal;
189
+
190
+ for (var i = 0; i < this.stack.length; i++){
191
+ if (this.stack[i].isShown) topModal = this.stack[i];
192
+ }
193
+
194
+ if (topModal) {
195
+ this.$backdropHandle = topModal.$backdrop;
196
+ topModal.$backdrop = null;
197
+
198
+ callback && topModal.$element.one('hidden',
199
+ targetIsSelf( $.proxy(callback, this) ));
200
+
201
+ topModal.hide();
202
+ } else if (callback) {
203
+ callback();
204
+ }
205
+ },
206
+
207
+ removeBackdrop: function (modal) {
208
+ modal.$backdrop.remove();
209
+ modal.$backdrop = null;
210
+ },
211
+
212
+ createBackdrop: function (animate) {
213
+ var $backdrop;
214
+
215
+ if (!this.$backdropHandle) {
216
+ $backdrop = $('<div class="modal-backdrop ' + animate + '" />')
217
+ .appendTo(this.$element);
218
+ } else {
219
+ $backdrop = this.$backdropHandle;
220
+ $backdrop.off('.modalmanager');
221
+ this.$backdropHandle = null;
222
+ this.isLoading && this.removeSpinner();
223
+ }
224
+
225
+ return $backdrop;
226
+ },
227
+
228
+ removeContainer: function (modal) {
229
+ modal.$container.remove();
230
+ modal.$container = null;
231
+ },
232
+
233
+ createContainer: function (modal) {
234
+ var $container;
235
+
236
+ $container = $('<div class="modal-scrollable">')
237
+ .css('z-index', getzIndex( 'modal',
238
+ modal ? this.getIndexOfModal(modal) : this.stack.length ))
239
+ .appendTo(this.$element);
240
+
241
+ if (modal && modal.options.backdrop != 'static') {
242
+ $container.on('click.modal', targetIsSelf(function (e) {
243
+ modal.hide();
244
+ }));
245
+ } else if (modal) {
246
+ $container.on('click.modal', targetIsSelf(function (e) {
247
+ modal.attention();
248
+ }));
249
+ }
250
+
251
+ return $container;
252
+
253
+ },
254
+
255
+ backdrop: function (modal, callback) {
256
+ var animate = modal.$element.hasClass('fade') ? 'fade' : '',
257
+ showBackdrop = modal.options.backdrop &&
258
+ this.backdropCount < this.options.backdropLimit;
259
+
260
+ if (modal.isShown && showBackdrop) {
261
+ var doAnimate = $.support.transition && animate && !this.$backdropHandle;
262
+
263
+ modal.$backdrop = this.createBackdrop(animate);
264
+
265
+ modal.$backdrop.css('z-index', getzIndex( 'backdrop', this.getIndexOfModal(modal) ));
266
+
267
+ if (doAnimate) modal.$backdrop[0].offsetWidth; // force reflow
268
+
269
+ modal.$backdrop.addClass('in');
270
+
271
+ this.backdropCount += 1;
272
+
273
+ doAnimate ?
274
+ modal.$backdrop.one($.support.transition.end, callback) :
275
+ callback();
276
+
277
+ } else if (!modal.isShown && modal.$backdrop) {
278
+ modal.$backdrop.removeClass('in');
279
+
280
+ this.backdropCount -= 1;
281
+
282
+ var that = this;
283
+
284
+ $.support.transition && modal.$element.hasClass('fade')?
285
+ modal.$backdrop.one($.support.transition.end, function () { that.removeBackdrop(modal) }) :
286
+ that.removeBackdrop(modal);
287
+
288
+ } else if (callback) {
289
+ callback();
290
+ }
291
+ },
292
+
293
+ removeSpinner: function(){
294
+ this.$spinner && this.$spinner.remove();
295
+ this.$spinner = null;
296
+ this.isLoading = false;
297
+ },
298
+
299
+ removeLoading: function () {
300
+ this.$backdropHandle && this.$backdropHandle.remove();
301
+ this.$backdropHandle = null;
302
+ this.removeSpinner();
303
+ },
304
+
305
+ loading: function (callback) {
306
+ callback = callback || function () { };
307
+
308
+ this.$element
309
+ .toggleClass('modal-open', !this.isLoading || this.hasOpenModal())
310
+ .toggleClass('page-overflow', $(window).height() < this.$element.height());
311
+
312
+ if (!this.isLoading) {
313
+
314
+ this.$backdropHandle = this.createBackdrop('fade');
315
+
316
+ this.$backdropHandle[0].offsetWidth; // force reflow
317
+
318
+ this.$backdropHandle
319
+ .css('z-index', getzIndex('backdrop', this.stack.length))
320
+ .addClass('in');
321
+
322
+ var $spinner = $(this.options.spinner)
323
+ .css('z-index', getzIndex('modal', this.stack.length))
324
+ .appendTo(this.$element)
325
+ .addClass('in');
326
+
327
+ this.$spinner = $(this.createContainer())
328
+ .append($spinner)
329
+ .on('click.modalmanager', $.proxy(this.loading, this));
330
+
331
+ this.isLoading = true;
332
+
333
+ $.support.transition ?
334
+ this.$backdropHandle.one($.support.transition.end, callback) :
335
+ callback();
336
+
337
+ } else if (this.isLoading && this.$backdropHandle) {
338
+ this.$backdropHandle.removeClass('in');
339
+
340
+ var that = this;
341
+ $.support.transition ?
342
+ this.$backdropHandle.one($.support.transition.end, function () { that.removeLoading() }) :
343
+ that.removeLoading();
344
+
345
+ } else if (callback) {
346
+ callback(this.isLoading);
347
+ }
348
+ }
349
+ };
350
+
351
+ /* PRIVATE METHODS
352
+ * ======================= */
353
+
354
+ // computes and caches the zindexes
355
+ var getzIndex = (function () {
356
+ var zIndexFactor,
357
+ baseIndex = {};
358
+
359
+ return function (type, pos) {
360
+
361
+ if (typeof zIndexFactor === 'undefined'){
362
+ var $baseModal = $('<div class="modal hide" />').appendTo('body'),
363
+ $baseBackdrop = $('<div class="modal-backdrop hide" />').appendTo('body');
364
+
365
+ baseIndex['modal'] = +$baseModal.css('z-index');
366
+ baseIndex['backdrop'] = +$baseBackdrop.css('z-index');
367
+ zIndexFactor = baseIndex['modal'] - baseIndex['backdrop'];
368
+
369
+ $baseModal.remove();
370
+ $baseBackdrop.remove();
371
+ $baseBackdrop = $baseModal = null;
372
+ }
373
+
374
+ return baseIndex[type] + (zIndexFactor * pos);
375
+
376
+ }
377
+ }());
378
+
379
+ // make sure the event target is the modal itself in order to prevent
380
+ // other components such as tabsfrom triggering the modal manager.
381
+ // if Boostsrap namespaced events, this would not be needed.
382
+ function targetIsSelf(callback){
383
+ return function (e) {
384
+ if (this === e.target){
385
+ return callback.apply(this, arguments);
386
+ }
387
+ }
388
+ }
389
+
390
+
391
+ /* MODAL MANAGER PLUGIN DEFINITION
392
+ * ======================= */
393
+
394
+ $.fn.modalmanager = function (option, args) {
395
+ return this.each(function () {
396
+ var $this = $(this),
397
+ data = $this.data('modalmanager');
398
+
399
+ if (!data) $this.data('modalmanager', (data = new ModalManager(this, option)));
400
+ if (typeof option === 'string') data[option].apply(data, [].concat(args))
401
+ })
402
+ };
403
+
404
+ $.fn.modalmanager.defaults = {
405
+ backdropLimit: 999,
406
+ resize: true,
407
+ spinner: '<div class="loading-spinner fade" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="bar" style="width: 100%;"></div></div></div>'
408
+ };
409
+
410
+ $.fn.modalmanager.Constructor = ModalManager
411
+
412
+ }(jQuery);
@@ -0,0 +1,373 @@
1
+ /* ===========================================================
2
+ * bootstrap-modal.js v2.1
3
+ * ===========================================================
4
+ * Copyright 2012 Jordan Schroter
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ * ========================================================== */
18
+
19
+
20
+ !function ($) {
21
+
22
+ "use strict"; // jshint ;_;
23
+
24
+ /* MODAL CLASS DEFINITION
25
+ * ====================== */
26
+
27
+ var Modal = function (element, options) {
28
+ this.init(element, options);
29
+ };
30
+
31
+ Modal.prototype = {
32
+
33
+ constructor: Modal,
34
+
35
+ init: function (element, options) {
36
+ this.options = options;
37
+
38
+ this.$element = $(element)
39
+ .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this));
40
+
41
+ this.options.remote && this.$element.find('.modal-body').load(this.options.remote);
42
+
43
+ var manager = typeof this.options.manager === 'function' ?
44
+ this.options.manager.call(this) : this.options.manager;
45
+
46
+ manager = manager.appendModal ?
47
+ manager : $(manager).modalmanager().data('modalmanager');
48
+
49
+ manager.appendModal(this);
50
+ },
51
+
52
+ toggle: function () {
53
+ return this[!this.isShown ? 'show' : 'hide']();
54
+ },
55
+
56
+ show: function () {
57
+ var e = $.Event('show');
58
+
59
+ if (this.isShown) return;
60
+
61
+ this.$element.trigger(e);
62
+
63
+ if (e.isDefaultPrevented()) return;
64
+
65
+ this.escape();
66
+
67
+ this.tab();
68
+
69
+ this.options.loading && this.loading();
70
+ },
71
+
72
+ hide: function (e) {
73
+ e && e.preventDefault();
74
+
75
+ e = $.Event('hide');
76
+
77
+ this.$element.trigger(e);
78
+
79
+ if (!this.isShown || e.isDefaultPrevented()) return (this.isShown = false);
80
+
81
+ this.isShown = false;
82
+
83
+ this.escape();
84
+
85
+ this.tab();
86
+
87
+ this.isLoading && this.loading();
88
+
89
+ $(document).off('focusin.modal');
90
+
91
+ this.$element
92
+ .removeClass('in')
93
+ .removeClass('animated')
94
+ .removeClass(this.options.attentionAnimation)
95
+ .removeClass('modal-overflow')
96
+ .attr('aria-hidden', true);
97
+
98
+ $.support.transition && this.$element.hasClass('fade') ?
99
+ this.hideWithTransition() :
100
+ this.hideModal();
101
+ },
102
+
103
+ layout: function () {
104
+ var prop = this.options.height ? 'height' : 'max-height',
105
+ value = this.options.height || this.options.maxHeight;
106
+
107
+ if (this.options.width){
108
+ this.$element.css('width', this.options.width);
109
+
110
+ var that = this;
111
+ this.$element.css('margin-left', function () {
112
+ if (/%/ig.test(that.options.width)){
113
+ return -(parseInt(that.options.width) / 2) + '%';
114
+ } else {
115
+ return -($(this).width() / 2) + 'px';
116
+ }
117
+ });
118
+ } else {
119
+ this.$element.css('width', '');
120
+ this.$element.css('margin-left', '');
121
+ }
122
+
123
+ this.$element.find('.modal-body')
124
+ .css('overflow', '')
125
+ .css(prop, '');
126
+
127
+ if (value){
128
+ this.$element.find('.modal-body')
129
+ .css('overflow', 'auto')
130
+ .css(prop, value);
131
+ }
132
+
133
+ var modalOverflow = $(window).height() - 10 < this.$element.height();
134
+
135
+ if (modalOverflow || this.options.modalOverflow) {
136
+ this.$element
137
+ .css('margin-top', 0)
138
+ .addClass('modal-overflow');
139
+ } else {
140
+ this.$element
141
+ .css('margin-top', 0 - this.$element.height() / 2)
142
+ .removeClass('modal-overflow');
143
+ }
144
+ },
145
+
146
+ tab: function () {
147
+ var that = this;
148
+
149
+ if (this.isShown && this.options.consumeTab) {
150
+ this.$element.on('keydown.tabindex.modal', '[data-tabindex]', function (e) {
151
+ if (e.keyCode && e.keyCode == 9){
152
+ var $next = $(this),
153
+ $rollover = $(this);
154
+
155
+ that.$element.find('[data-tabindex]:enabled:not([readonly])').each(function (e) {
156
+ if (!e.shiftKey){
157
+ $next = $next.data('tabindex') < $(this).data('tabindex') ?
158
+ $next = $(this) :
159
+ $rollover = $(this);
160
+ } else {
161
+ $next = $next.data('tabindex') > $(this).data('tabindex') ?
162
+ $next = $(this) :
163
+ $rollover = $(this);
164
+ }
165
+ });
166
+
167
+ $next[0] !== $(this)[0] ?
168
+ $next.focus() : $rollover.focus();
169
+
170
+ e.preventDefault();
171
+ }
172
+ });
173
+ } else if (!this.isShown) {
174
+ this.$element.off('keydown.tabindex.modal');
175
+ }
176
+ },
177
+
178
+ escape: function () {
179
+ var that = this;
180
+ if (this.isShown && this.options.keyboard) {
181
+ if (!this.$element.attr('tabindex')) this.$element.attr('tabindex', -1);
182
+
183
+ this.$element.on('keyup.dismiss.modal', function (e) {
184
+ e.which == 27 && that.hide();
185
+ });
186
+ } else if (!this.isShown) {
187
+ this.$element.off('keyup.dismiss.modal')
188
+ }
189
+ },
190
+
191
+ hideWithTransition: function () {
192
+ var that = this
193
+ , timeout = setTimeout(function () {
194
+ that.$element.off($.support.transition.end);
195
+ that.hideModal();
196
+ }, 500);
197
+
198
+ this.$element.one($.support.transition.end, function () {
199
+ clearTimeout(timeout);
200
+ that.hideModal();
201
+ });
202
+ },
203
+
204
+ hideModal: function () {
205
+ var prop = this.options.height ? 'height' : 'max-height';
206
+ var value = this.options.height || this.options.maxHeight;
207
+
208
+ if (value){
209
+ this.$element.find('.modal-body')
210
+ .css('overflow', '')
211
+ .css(prop, '');
212
+ }
213
+
214
+ this.$element
215
+ .hide()
216
+ .trigger('hidden');
217
+ },
218
+
219
+ removeLoading: function () {
220
+ this.$loading.remove();
221
+ this.$loading = null;
222
+ this.isLoading = false;
223
+ },
224
+
225
+ loading: function (callback) {
226
+ callback = callback || function () {};
227
+
228
+ var animate = this.$element.hasClass('fade') ? 'fade' : '';
229
+
230
+ if (!this.isLoading) {
231
+ var doAnimate = $.support.transition && animate;
232
+
233
+ this.$loading = $('<div class="loading-mask ' + animate + '">')
234
+ .append(this.options.spinner)
235
+ .appendTo(this.$element);
236
+
237
+ if (doAnimate) this.$loading[0].offsetWidth; // force reflow
238
+
239
+ this.$loading.addClass('in');
240
+
241
+ this.isLoading = true;
242
+
243
+ doAnimate ?
244
+ this.$loading.one($.support.transition.end, callback) :
245
+ callback();
246
+
247
+ } else if (this.isLoading && this.$loading) {
248
+ this.$loading.removeClass('in');
249
+
250
+ var that = this;
251
+ $.support.transition && this.$element.hasClass('fade')?
252
+ this.$loading.one($.support.transition.end, function () { that.removeLoading() }) :
253
+ that.removeLoading();
254
+
255
+ } else if (callback) {
256
+ callback(this.isLoading);
257
+ }
258
+ },
259
+
260
+ focus: function () {
261
+ var $focusElem = this.$element.find(this.options.focusOn);
262
+
263
+ $focusElem = $focusElem.length ? $focusElem : this.$element;
264
+
265
+ $focusElem.focus();
266
+ },
267
+
268
+ attention: function (){
269
+ // NOTE: transitionEnd with keyframes causes odd behaviour
270
+
271
+ if (this.options.attentionAnimation){
272
+ this.$element
273
+ .removeClass('animated')
274
+ .removeClass(this.options.attentionAnimation);
275
+
276
+ var that = this;
277
+
278
+ setTimeout(function () {
279
+ that.$element
280
+ .addClass('animated')
281
+ .addClass(that.options.attentionAnimation);
282
+ }, 0);
283
+ }
284
+
285
+
286
+ this.focus();
287
+ },
288
+
289
+
290
+ destroy: function () {
291
+ var e = $.Event('destroy');
292
+ this.$element.trigger(e);
293
+ if (e.isDefaultPrevented()) return;
294
+
295
+ this.teardown();
296
+ },
297
+
298
+ teardown: function () {
299
+ if (!this.$parent.length){
300
+ this.$element.remove();
301
+ this.$element = null;
302
+ return;
303
+ }
304
+
305
+ if (this.$parent !== this.$element.parent()){
306
+ this.$element.appendTo(this.$parent);
307
+ }
308
+
309
+ this.$element.off('.modal');
310
+ this.$element.removeData('modal');
311
+ this.$element
312
+ .removeClass('in')
313
+ .attr('aria-hidden', true);
314
+ }
315
+ };
316
+
317
+
318
+ /* MODAL PLUGIN DEFINITION
319
+ * ======================= */
320
+
321
+ $.fn.modal = function (option, args) {
322
+ return this.each(function () {
323
+ var $this = $(this),
324
+ data = $this.data('modal'),
325
+ options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option);
326
+
327
+ if (!data) $this.data('modal', (data = new Modal(this, options)));
328
+ if (typeof option == 'string') data[option].apply(data, [].concat(args));
329
+ else if (options.show) data.show()
330
+ })
331
+ };
332
+
333
+ $.fn.modal.defaults = {
334
+ keyboard: true,
335
+ backdrop: true,
336
+ loading: false,
337
+ show: true,
338
+ width: null,
339
+ height: null,
340
+ maxHeight: null,
341
+ modalOverflow: false,
342
+ consumeTab: true,
343
+ focusOn: null,
344
+ replace: false,
345
+ resize: false,
346
+ attentionAnimation: 'shake',
347
+ manager: 'body',
348
+ spinner: '<div class="loading-spinner" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="bar" style="width: 100%;"></div></div></div>'
349
+ };
350
+
351
+ $.fn.modal.Constructor = Modal;
352
+
353
+
354
+ /* MODAL DATA-API
355
+ * ============== */
356
+
357
+ $(function () {
358
+ $(document).off('click.modal').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
359
+ var $this = $(this),
360
+ href = $this.attr('href'),
361
+ $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))), //strip for ie7
362
+ option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data());
363
+
364
+ e.preventDefault();
365
+ $target
366
+ .modal(option)
367
+ .one('hide', function () {
368
+ $this.focus();
369
+ })
370
+ });
371
+ });
372
+
373
+ }(window.jQuery);
@@ -0,0 +1,214 @@
1
+ /*!
2
+ * Bootstrap Modal
3
+ *
4
+ * Copyright Jordan Schroter
5
+ * Licensed under the Apache License v2.0
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ *
8
+ */
9
+
10
+ .modal-open {
11
+ overflow: hidden;
12
+ }
13
+
14
+
15
+ /* add a scroll bar to stop page from jerking around */
16
+ .modal-open.page-overflow .page-container,
17
+ .modal-open.page-overflow .page-container .navbar-fixed-top,
18
+ .modal-open.page-overflow .page-container .navbar-fixed-bottom,
19
+ .modal-open.page-overflow .modal-scrollable {
20
+ overflow-y: scroll;
21
+ }
22
+
23
+ @media (max-width: 979px) {
24
+ .modal-open.page-overflow .page-container .navbar-fixed-top,
25
+ .modal-open.page-overflow .page-container .navbar-fixed-bottom {
26
+ overflow-y: visible;
27
+ }
28
+ }
29
+
30
+
31
+ .modal-scrollable {
32
+ position: fixed;
33
+ top: 0;
34
+ bottom: 0;
35
+ left: 0;
36
+ right: 0;
37
+ overflow: auto;
38
+ }
39
+
40
+ .modal {
41
+ outline: none;
42
+ position: absolute;
43
+ margin-top: 0;
44
+ top: 50%;
45
+ overflow: visible; /* allow content to popup out (i.e tooltips) */
46
+ }
47
+
48
+ .modal.fade {
49
+ top: -100%;
50
+ -webkit-transition: opacity 0.3s linear, top 0.3s ease-out, bottom 0.3s ease-out, margin-top 0.3s ease-out;
51
+ -moz-transition: opacity 0.3s linear, top 0.3s ease-out, bottom 0.3s ease-out, margin-top 0.3s ease-out;
52
+ -o-transition: opacity 0.3s linear, top 0.3s ease-out, bottom 0.3s ease-out, margin-top 0.3s ease-out;
53
+ transition: opacity 0.3s linear, top 0.3s ease-out, bottom 0.3s ease-out, margin-top 0.3s ease-out;
54
+ }
55
+
56
+ .modal.fade.in {
57
+ top: 50%;
58
+ }
59
+
60
+ .modal-body {
61
+ max-height: none;
62
+ overflow: visible;
63
+ }
64
+
65
+ .modal.modal-absolute {
66
+ position: absolute;
67
+ z-index: 950;
68
+ }
69
+
70
+ .modal .loading-mask {
71
+ position: absolute;
72
+ top: 0;
73
+ bottom: 0;
74
+ left: 0;
75
+ right: 0;
76
+ background: #fff;
77
+ border-radius: 6px;
78
+ }
79
+
80
+ .modal-backdrop.modal-absolute{
81
+ position: absolute;
82
+ z-index: 940;
83
+ }
84
+
85
+ .modal-backdrop,
86
+ .modal-backdrop.fade.in{
87
+ opacity: 0.7;
88
+ filter: alpha(opacity=70);
89
+ background: #fff;
90
+ }
91
+
92
+ .modal.container {
93
+ width: 940px;
94
+ margin-left: -470px;
95
+ }
96
+
97
+ /* Modal Overflow */
98
+
99
+ .modal-overflow.modal {
100
+ top: 1%;
101
+ }
102
+
103
+ .modal-overflow.modal.fade {
104
+ top: -100%;
105
+ }
106
+
107
+ .modal-overflow.modal.fade.in {
108
+ top: 1%;
109
+ }
110
+
111
+ .modal-overflow .modal-body {
112
+ overflow: auto;
113
+ -webkit-overflow-scrolling: touch;
114
+ }
115
+
116
+ /* Responsive */
117
+
118
+ @media (min-width: 1200px) {
119
+ .modal.container {
120
+ width: 1170px;
121
+ margin-left: -585px;
122
+ }
123
+ }
124
+
125
+ @media (max-width: 979px) {
126
+ .modal,
127
+ .modal.container,
128
+ .modal.modal-overflow {
129
+ top: 1%;
130
+ right: 1%;
131
+ left: 1%;
132
+ bottom: auto;
133
+ width: auto !important;
134
+ height: auto !important;
135
+ margin: 0 !important;
136
+ padding: 0 !important;
137
+ }
138
+
139
+ .modal.fade.in,
140
+ .modal.container.fade.in,
141
+ .modal.modal-overflow.fade.in {
142
+ top: 1%;
143
+ bottom: auto;
144
+ }
145
+
146
+ .modal-body,
147
+ .modal-overflow .modal-body {
148
+ position: static;
149
+ margin: 0;
150
+ height: auto !important;
151
+ max-height: none !important;
152
+ overflow: visible !important;
153
+ }
154
+
155
+ .modal-footer,
156
+ .modal-overflow .modal-footer {
157
+ position: static;
158
+ }
159
+ }
160
+
161
+ .loading-spinner {
162
+ position: absolute;
163
+ top: 50%;
164
+ left: 50%;
165
+ margin: -12px 0 0 -12px;
166
+ }
167
+
168
+ /*
169
+ Animate.css - http://daneden.me/animate
170
+ Licensed under the ☺ license (http://licence.visualidiot.com/)
171
+
172
+ Copyright (c) 2012 Dan Eden*/
173
+
174
+ .animated {
175
+ -webkit-animation-duration: 1s;
176
+ -moz-animation-duration: 1s;
177
+ -o-animation-duration: 1s;
178
+ animation-duration: 1s;
179
+ -webkit-animation-fill-mode: both;
180
+ -moz-animation-fill-mode: both;
181
+ -o-animation-fill-mode: both;
182
+ animation-fill-mode: both;
183
+ }
184
+
185
+ @-webkit-keyframes shake {
186
+ 0%, 100% {-webkit-transform: translateX(0);}
187
+ 10%, 30%, 50%, 70%, 90% {-webkit-transform: translateX(-10px);}
188
+ 20%, 40%, 60%, 80% {-webkit-transform: translateX(10px);}
189
+ }
190
+
191
+ @-moz-keyframes shake {
192
+ 0%, 100% {-moz-transform: translateX(0);}
193
+ 10%, 30%, 50%, 70%, 90% {-moz-transform: translateX(-10px);}
194
+ 20%, 40%, 60%, 80% {-moz-transform: translateX(10px);}
195
+ }
196
+
197
+ @-o-keyframes shake {
198
+ 0%, 100% {-o-transform: translateX(0);}
199
+ 10%, 30%, 50%, 70%, 90% {-o-transform: translateX(-10px);}
200
+ 20%, 40%, 60%, 80% {-o-transform: translateX(10px);}
201
+ }
202
+
203
+ @keyframes shake {
204
+ 0%, 100% {transform: translateX(0);}
205
+ 10%, 30%, 50%, 70%, 90% {transform: translateX(-10px);}
206
+ 20%, 40%, 60%, 80% {transform: translateX(10px);}
207
+ }
208
+
209
+ .shake {
210
+ -webkit-animation-name: shake;
211
+ -moz-animation-name: shake;
212
+ -o-animation-name: shake;
213
+ animation-name: shake;
214
+ }
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: strappit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - John Faucett
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-07-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: railties
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '3.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '3.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bootstrap-sass
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Bootstrap for your website
70
+ email:
71
+ - jwaterfaucett@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - Gemfile
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - lib/strappit.rb
82
+ - lib/strappit/version.rb
83
+ - strappit.gemspec
84
+ - vendor/assets/components/modals/modal_manager.js
85
+ - vendor/assets/components/modals/modals.js
86
+ - vendor/assets/components/modals/modals.scss
87
+ homepage: ''
88
+ licenses:
89
+ - MIT
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - '>='
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubyforge_project:
107
+ rubygems_version: 2.0.0
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: Use Bootstrap to manage your website designs
111
+ test_files: []