asset_box 0.1.0

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.
Files changed (211) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +60 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +7 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +6 -0
  7. data/Gemfile.lock +35 -0
  8. data/LICENSE.txt +21 -0
  9. data/README.md +43 -0
  10. data/Rakefile +6 -0
  11. data/asset_box.gemspec +42 -0
  12. data/assets/fonts/bootstrap/glyphicons-halflings-regular.eot +0 -0
  13. data/assets/fonts/bootstrap/glyphicons-halflings-regular.svg +288 -0
  14. data/assets/fonts/bootstrap/glyphicons-halflings-regular.ttf +0 -0
  15. data/assets/fonts/bootstrap/glyphicons-halflings-regular.woff +0 -0
  16. data/assets/fonts/bootstrap/glyphicons-halflings-regular.woff2 +0 -0
  17. data/assets/fonts/font-awesome/fa-brands-400.eot +0 -0
  18. data/assets/fonts/font-awesome/fa-brands-400.svg +3717 -0
  19. data/assets/fonts/font-awesome/fa-brands-400.ttf +0 -0
  20. data/assets/fonts/font-awesome/fa-brands-400.woff +0 -0
  21. data/assets/fonts/font-awesome/fa-brands-400.woff2 +0 -0
  22. data/assets/fonts/font-awesome/fa-regular-400.eot +0 -0
  23. data/assets/fonts/font-awesome/fa-regular-400.svg +801 -0
  24. data/assets/fonts/font-awesome/fa-regular-400.ttf +0 -0
  25. data/assets/fonts/font-awesome/fa-regular-400.woff +0 -0
  26. data/assets/fonts/font-awesome/fa-regular-400.woff2 +0 -0
  27. data/assets/fonts/font-awesome/fa-solid-900.eot +0 -0
  28. data/assets/fonts/font-awesome/fa-solid-900.svg +5028 -0
  29. data/assets/fonts/font-awesome/fa-solid-900.ttf +0 -0
  30. data/assets/fonts/font-awesome/fa-solid-900.woff +0 -0
  31. data/assets/fonts/font-awesome/fa-solid-900.woff2 +0 -0
  32. data/assets/images/bootstrap/bg.png +0 -0
  33. data/assets/images/bootstrap/bg_2.png +0 -0
  34. data/assets/images/bootstrap/bg_3.png +0 -0
  35. data/assets/images/bootstrap/bg_4.png +0 -0
  36. data/assets/images/bootstrap/bg_5.png +0 -0
  37. data/assets/images/bootstrap/dark_dots.png +0 -0
  38. data/assets/images/bootstrap/light_dots.png +0 -0
  39. data/assets/images/bootstrap/line.png +0 -0
  40. data/assets/images/bootstrap/line_detail.png +0 -0
  41. data/assets/images/bootstrap/note_dot.png +0 -0
  42. data/assets/images/bootstrap/timer-piece.png +0 -0
  43. data/assets/javascripts/app/bootstrap-datepicker.js +1395 -0
  44. data/assets/javascripts/app/bootstrap-fileupload.min.js +7 -0
  45. data/assets/javascripts/app/bootstrap-modal.js +378 -0
  46. data/assets/javascripts/app/bootstrap-modalmanager.js +423 -0
  47. data/assets/javascripts/app/bootstrap-switch.min.js +22 -0
  48. data/assets/javascripts/app/daterangepicker.js +1635 -0
  49. data/assets/javascripts/app/debounce.js +1492 -0
  50. data/assets/javascripts/app/jquery.appear.js +101 -0
  51. data/assets/javascripts/app/jquery.inputlimiter.1.3.1.min.js +11 -0
  52. data/assets/javascripts/app/jquery.mousewheel.js +84 -0
  53. data/assets/javascripts/app/jquery.serialScroll.min.js +7 -0
  54. data/assets/javascripts/app/moment.min.js +7 -0
  55. data/assets/javascripts/app/perfect-scrollbar.js +584 -0
  56. data/assets/javascripts/app/subview.js +392 -0
  57. data/assets/javascripts/app/velocity.min.js +8 -0
  58. data/assets/javascripts/asset_box.js +16 -0
  59. data/assets/javascripts/bootstrap-sprockets.js +12 -0
  60. data/assets/javascripts/bootstrap.js +2580 -0
  61. data/assets/javascripts/bootstrap.min.js +6 -0
  62. data/assets/javascripts/bootstrap/affix.js +164 -0
  63. data/assets/javascripts/bootstrap/alert.js +95 -0
  64. data/assets/javascripts/bootstrap/button.js +125 -0
  65. data/assets/javascripts/bootstrap/carousel.js +246 -0
  66. data/assets/javascripts/bootstrap/collapse.js +212 -0
  67. data/assets/javascripts/bootstrap/dropdown.js +165 -0
  68. data/assets/javascripts/bootstrap/modal.js +358 -0
  69. data/assets/javascripts/bootstrap/popover.js +123 -0
  70. data/assets/javascripts/bootstrap/scrollspy.js +172 -0
  71. data/assets/javascripts/bootstrap/tab.js +155 -0
  72. data/assets/javascripts/bootstrap/tooltip.js +677 -0
  73. data/assets/javascripts/bootstrap/transition.js +59 -0
  74. data/assets/stylesheets/_asset_box.scss +760 -0
  75. data/assets/stylesheets/_bootstrap-compass.scss +9 -0
  76. data/assets/stylesheets/_bootstrap-mincer.scss +19 -0
  77. data/assets/stylesheets/_bootstrap-sprockets.scss +9 -0
  78. data/assets/stylesheets/_bootstrap.scss +56 -0
  79. data/assets/stylesheets/_bootstrap_login.scss +166 -0
  80. data/assets/stylesheets/_font-awesome-compass.scss +5 -0
  81. data/assets/stylesheets/_font-awesome-sprockets.scss +5 -0
  82. data/assets/stylesheets/_font-awesome.scss +17 -0
  83. data/assets/stylesheets/_font-awesome_v4-shims.scss +6 -0
  84. data/assets/stylesheets/_load_bootstrap.scss +12 -0
  85. data/assets/stylesheets/app/_base.scss +136 -0
  86. data/assets/stylesheets/app/_buttons.scss +1149 -0
  87. data/assets/stylesheets/app/_calendar.scss +343 -0
  88. data/assets/stylesheets/app/_ckeditor.scss +123 -0
  89. data/assets/stylesheets/app/_date-picker.scss +193 -0
  90. data/assets/stylesheets/app/_daterangepicker.scss +269 -0
  91. data/assets/stylesheets/app/_dropdown-menu.scss +137 -0
  92. data/assets/stylesheets/app/_error.scss +84 -0
  93. data/assets/stylesheets/app/_file-upload.scss +16 -0
  94. data/assets/stylesheets/app/_footer.scss +59 -0
  95. data/assets/stylesheets/app/_form-elements.scss +273 -0
  96. data/assets/stylesheets/app/_gallery.scss +205 -0
  97. data/assets/stylesheets/app/_header.scss +158 -0
  98. data/assets/stylesheets/app/_horizontal-menu.scss +169 -0
  99. data/assets/stylesheets/app/_icons.scss +47 -0
  100. data/assets/stylesheets/app/_inputlimiter.scss +34 -0
  101. data/assets/stylesheets/app/_invoice.scss +53 -0
  102. data/assets/stylesheets/app/_lock-screen.scss +72 -0
  103. data/assets/stylesheets/app/_login.scss +105 -0
  104. data/assets/stylesheets/app/_main-container.scss +297 -0
  105. data/assets/stylesheets/app/_messages.scss +311 -0
  106. data/assets/stylesheets/app/_pageslide_left.scss +283 -0
  107. data/assets/stylesheets/app/_pageslide_right.scss +350 -0
  108. data/assets/stylesheets/app/_pagination.scss +254 -0
  109. data/assets/stylesheets/app/_panels.scss +589 -0
  110. data/assets/stylesheets/app/_perfect-scrollbar.scss +111 -0
  111. data/assets/stylesheets/app/_slidingbar.scss +42 -0
  112. data/assets/stylesheets/app/_subview.scss +342 -0
  113. data/assets/stylesheets/app/_tables.scss +68 -0
  114. data/assets/stylesheets/app/_tabs.scss +251 -0
  115. data/assets/stylesheets/app/_tags-input.scss +46 -0
  116. data/assets/stylesheets/app/_theme-style8.scss +308 -0
  117. data/assets/stylesheets/app/_timeline.scss +359 -0
  118. data/assets/stylesheets/app/_user-profile.scss +99 -0
  119. data/assets/stylesheets/app/_utilities.scss +643 -0
  120. data/assets/stylesheets/bootstrap/_alerts.scss +73 -0
  121. data/assets/stylesheets/bootstrap/_badges.scss +68 -0
  122. data/assets/stylesheets/bootstrap/_breadcrumbs.scss +28 -0
  123. data/assets/stylesheets/bootstrap/_button-groups.scss +244 -0
  124. data/assets/stylesheets/bootstrap/_buttons.scss +168 -0
  125. data/assets/stylesheets/bootstrap/_carousel.scss +271 -0
  126. data/assets/stylesheets/bootstrap/_close.scss +37 -0
  127. data/assets/stylesheets/bootstrap/_code.scss +69 -0
  128. data/assets/stylesheets/bootstrap/_component-animations.scss +38 -0
  129. data/assets/stylesheets/bootstrap/_dropdowns.scss +213 -0
  130. data/assets/stylesheets/bootstrap/_forms.scss +607 -0
  131. data/assets/stylesheets/bootstrap/_glyphicons.scss +307 -0
  132. data/assets/stylesheets/bootstrap/_grid.scss +94 -0
  133. data/assets/stylesheets/bootstrap/_input-groups.scss +171 -0
  134. data/assets/stylesheets/bootstrap/_jumbotron.scss +54 -0
  135. data/assets/stylesheets/bootstrap/_labels.scss +66 -0
  136. data/assets/stylesheets/bootstrap/_list-group.scss +128 -0
  137. data/assets/stylesheets/bootstrap/_media.scss +66 -0
  138. data/assets/stylesheets/bootstrap/_mixins.scss +40 -0
  139. data/assets/stylesheets/bootstrap/_modals.scss +150 -0
  140. data/assets/stylesheets/bootstrap/_navbar.scss +656 -0
  141. data/assets/stylesheets/bootstrap/_navs.scss +242 -0
  142. data/assets/stylesheets/bootstrap/_normalize.scss +427 -0
  143. data/assets/stylesheets/bootstrap/_pager.scss +54 -0
  144. data/assets/stylesheets/bootstrap/_pagination.scss +86 -0
  145. data/assets/stylesheets/bootstrap/_panels.scss +271 -0
  146. data/assets/stylesheets/bootstrap/_popovers.scss +126 -0
  147. data/assets/stylesheets/bootstrap/_print.scss +99 -0
  148. data/assets/stylesheets/bootstrap/_progress-bars.scss +87 -0
  149. data/assets/stylesheets/bootstrap/_responsive-embed.scss +35 -0
  150. data/assets/stylesheets/bootstrap/_responsive-utilities.scss +179 -0
  151. data/assets/stylesheets/bootstrap/_scaffolding.scss +161 -0
  152. data/assets/stylesheets/bootstrap/_tables.scss +234 -0
  153. data/assets/stylesheets/bootstrap/_theme.scss +295 -0
  154. data/assets/stylesheets/bootstrap/_thumbnails.scss +38 -0
  155. data/assets/stylesheets/bootstrap/_tooltip.scss +112 -0
  156. data/assets/stylesheets/bootstrap/_type.scss +298 -0
  157. data/assets/stylesheets/bootstrap/_utilities.scss +55 -0
  158. data/assets/stylesheets/bootstrap/_variables.scss +874 -0
  159. data/assets/stylesheets/bootstrap/_wells.scss +29 -0
  160. data/assets/stylesheets/bootstrap/mixins/_alerts.scss +15 -0
  161. data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +12 -0
  162. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +18 -0
  163. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +61 -0
  164. data/assets/stylesheets/bootstrap/mixins/_center-block.scss +7 -0
  165. data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +22 -0
  166. data/assets/stylesheets/bootstrap/mixins/_forms.scss +88 -0
  167. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +56 -0
  168. data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +81 -0
  169. data/assets/stylesheets/bootstrap/mixins/_grid.scss +122 -0
  170. data/assets/stylesheets/bootstrap/mixins/_hide-text.scss +21 -0
  171. data/assets/stylesheets/bootstrap/mixins/_image.scss +28 -0
  172. data/assets/stylesheets/bootstrap/mixins/_labels.scss +12 -0
  173. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +32 -0
  174. data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +10 -0
  175. data/assets/stylesheets/bootstrap/mixins/_nav-vertical-align.scss +9 -0
  176. data/assets/stylesheets/bootstrap/mixins/_opacity.scss +7 -0
  177. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +24 -0
  178. data/assets/stylesheets/bootstrap/mixins/_panels.scss +24 -0
  179. data/assets/stylesheets/bootstrap/mixins/_progress-bar.scss +10 -0
  180. data/assets/stylesheets/bootstrap/mixins/_reset-filter.scss +8 -0
  181. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +18 -0
  182. data/assets/stylesheets/bootstrap/mixins/_resize.scss +6 -0
  183. data/assets/stylesheets/bootstrap/mixins/_responsive-visibility.scss +17 -0
  184. data/assets/stylesheets/bootstrap/mixins/_size.scss +10 -0
  185. data/assets/stylesheets/bootstrap/mixins/_tab-focus.scss +9 -0
  186. data/assets/stylesheets/bootstrap/mixins/_table-row.scss +28 -0
  187. data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +12 -0
  188. data/assets/stylesheets/bootstrap/mixins/_text-overflow.scss +8 -0
  189. data/assets/stylesheets/bootstrap/mixins/_vendor-prefixes.scss +222 -0
  190. data/assets/stylesheets/font-awesome/_animated.scss +20 -0
  191. data/assets/stylesheets/font-awesome/_bordered-pulled.scss +20 -0
  192. data/assets/stylesheets/font-awesome/_core.scss +21 -0
  193. data/assets/stylesheets/font-awesome/_fixed-width.scss +6 -0
  194. data/assets/stylesheets/font-awesome/_icons.scss +1462 -0
  195. data/assets/stylesheets/font-awesome/_larger.scss +23 -0
  196. data/assets/stylesheets/font-awesome/_list.scss +18 -0
  197. data/assets/stylesheets/font-awesome/_mixins.scss +56 -0
  198. data/assets/stylesheets/font-awesome/_path.scss +56 -0
  199. data/assets/stylesheets/font-awesome/_rotated-flipped.scss +24 -0
  200. data/assets/stylesheets/font-awesome/_screen-reader.scss +5 -0
  201. data/assets/stylesheets/font-awesome/_shims.scss +2066 -0
  202. data/assets/stylesheets/font-awesome/_stacked.scss +31 -0
  203. data/assets/stylesheets/font-awesome/_variables.scss +1482 -0
  204. data/bin/console +14 -0
  205. data/bin/setup +8 -0
  206. data/lib/asset_box.rb +89 -0
  207. data/lib/asset_box/rails/engine.rb +22 -0
  208. data/lib/asset_box/rails/helpers.rb +17 -0
  209. data/lib/asset_box/rails/railtie.rb +13 -0
  210. data/lib/asset_box/version.rb +3 -0
  211. metadata +301 -0
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Bootstrap.js by @mdo and @fat, extended by @ArnoldDaniels.
3
+ * plugins: bootstrap-fileupload.js
4
+ * Copyright 2012 Twitter, Inc.
5
+ * http://www.apache.org/licenses/LICENSE-2.0.txt
6
+ */
7
+ !function(e){var t=function(t,n){this.$element=e(t),this.type=this.$element.data("uploadtype")||(this.$element.find(".thumbnail").length>0?"image":"file"),this.$input=this.$element.find(":file");if(this.$input.length===0)return;this.name=this.$input.attr("name")||n.name,this.$hidden=this.$element.find('input[type=hidden][name="'+this.name+'"]'),this.$hidden.length===0&&(this.$hidden=e('<input type="hidden" />'),this.$element.prepend(this.$hidden)),this.$preview=this.$element.find(".fileupload-preview");var r=this.$preview.css("height");this.$preview.css("display")!="inline"&&r!="0px"&&r!="none"&&this.$preview.css("line-height",r),this.original={exists:this.$element.hasClass("fileupload-exists"),preview:this.$preview.html(),hiddenVal:this.$hidden.val()},this.$remove=this.$element.find('[data-dismiss="fileupload"]'),this.$element.find('[data-trigger="fileupload"]').on("click.fileupload",e.proxy(this.trigger,this)),this.listen()};t.prototype={listen:function(){this.$input.on("change.fileupload",e.proxy(this.change,this)),e(this.$input[0].form).on("reset.fileupload",e.proxy(this.reset,this)),this.$remove&&this.$remove.on("click.fileupload",e.proxy(this.clear,this))},change:function(e,t){if(t==="clear")return;var n=e.target.files!==undefined?e.target.files[0]:e.target.value?{name:e.target.value.replace(/^.+\\/,"")}:null;if(!n){this.clear();return}this.$hidden.val(""),this.$hidden.attr("name",""),this.$input.attr("name",this.name);if(this.type==="image"&&this.$preview.length>0&&(typeof n.type!="undefined"?n.type.match("image.*"):n.name.match(/\.(gif|png|jpe?g)$/i))&&typeof FileReader!="undefined"){var r=new FileReader,i=this.$preview,s=this.$element;r.onload=function(e){i.html('<img src="'+e.target.result+'" '+(i.css("max-height")!="none"?'style="max-height: '+i.css("max-height")+';"':"")+" />"),s.addClass("fileupload-exists").removeClass("fileupload-new")},r.readAsDataURL(n)}else this.$preview.text(n.name),this.$element.addClass("fileupload-exists").removeClass("fileupload-new")},clear:function(e){this.$hidden.val(""),this.$hidden.attr("name",this.name),this.$input.attr("name","");if(navigator.userAgent.match(/msie/i)){var t=this.$input.clone(!0);this.$input.after(t),this.$input.remove(),this.$input=t}else this.$input.val("");this.$preview.html(""),this.$element.addClass("fileupload-new").removeClass("fileupload-exists"),e&&(this.$input.trigger("change",["clear"]),e.preventDefault())},reset:function(e){this.clear(),this.$hidden.val(this.original.hiddenVal),this.$preview.html(this.original.preview),this.original.exists?this.$element.addClass("fileupload-exists").removeClass("fileupload-new"):this.$element.addClass("fileupload-new").removeClass("fileupload-exists")},trigger:function(e){this.$input.trigger("click"),e.preventDefault()}},e.fn.fileupload=function(n){return this.each(function(){var r=e(this),i=r.data("fileupload");i||r.data("fileupload",i=new t(this,n)),typeof n=="string"&&i[n]()})},e.fn.fileupload.Constructor=t,e(document).on("click.fileupload.data-api",'[data-provides="fileupload"]',function(t){var n=e(this);if(n.data("fileupload"))return;n.fileupload(n.data());var r=e(t.target).closest('[data-dismiss="fileupload"],[data-trigger="fileupload"]');r.length>0&&(r.trigger("click.fileupload"),t.preventDefault())})}(window.jQuery)
@@ -0,0 +1,378 @@
1
+ /* ===========================================================
2
+ * bootstrap-modal.js v2.2.5
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
+ var that = this;
37
+
38
+ this.options = options;
39
+
40
+ this.$element = $(element)
41
+ .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this));
42
+
43
+ this.options.remote && this.$element.find('.modal-body').load(this.options.remote, function () {
44
+ var e = $.Event('loaded');
45
+ that.$element.trigger(e);
46
+ });
47
+
48
+ var manager = typeof this.options.manager === 'function' ?
49
+ this.options.manager.call(this) : this.options.manager;
50
+
51
+ manager = manager.appendModal ?
52
+ manager : $(manager).modalmanager().data('modalmanager');
53
+
54
+ manager.appendModal(this);
55
+ },
56
+
57
+ toggle: function () {
58
+ return this[!this.isShown ? 'show' : 'hide']();
59
+ },
60
+
61
+ show: function () {
62
+ var e = $.Event('show');
63
+
64
+ if (this.isShown) return;
65
+
66
+ this.$element.trigger(e);
67
+
68
+ if (e.isDefaultPrevented()) return;
69
+
70
+ this.escape();
71
+
72
+ this.tab();
73
+
74
+ this.options.loading && this.loading();
75
+ },
76
+
77
+ hide: function (e) {
78
+ e && e.preventDefault();
79
+
80
+ e = $.Event('hide');
81
+
82
+ this.$element.trigger(e);
83
+
84
+ if (!this.isShown || e.isDefaultPrevented()) return;
85
+
86
+ this.isShown = false;
87
+
88
+ this.escape();
89
+
90
+ this.tab();
91
+
92
+ this.isLoading && this.loading();
93
+
94
+ $(document).off('focusin.modal');
95
+
96
+ this.$element
97
+ .removeClass('in')
98
+ .removeClass('animated')
99
+ .removeClass(this.options.attentionAnimation)
100
+ .removeClass('modal-overflow')
101
+ .attr('aria-hidden', true);
102
+
103
+ $.support.transition && this.$element.hasClass('fade') ?
104
+ this.hideWithTransition() :
105
+ this.hideModal();
106
+ },
107
+
108
+ layout: function () {
109
+ var prop = this.options.height ? 'height' : 'max-height',
110
+ value = this.options.height || this.options.maxHeight;
111
+
112
+ if (this.options.width){
113
+ this.$element.css('width', this.options.width);
114
+
115
+ var that = this;
116
+ this.$element.css('margin-left', function () {
117
+ if (/%/ig.test(that.options.width)){
118
+ return -(parseInt(that.options.width) / 2) + '%';
119
+ } else {
120
+ return -($(this).width() / 2) + 'px';
121
+ }
122
+ });
123
+ } else {
124
+ this.$element.css('width', '');
125
+ this.$element.css('margin-left', '');
126
+ }
127
+
128
+ this.$element.find('.modal-body')
129
+ .css('overflow', '')
130
+ .css(prop, '');
131
+
132
+ if (value){
133
+ this.$element.find('.modal-body')
134
+ .css('overflow', 'auto')
135
+ .css(prop, value);
136
+ }
137
+
138
+ var modalOverflow = $(window).height() - 10 < this.$element.height();
139
+
140
+ if (modalOverflow || this.options.modalOverflow) {
141
+ this.$element
142
+ .css('margin-top', 0)
143
+ .addClass('modal-overflow');
144
+ } else {
145
+ this.$element
146
+ .css('margin-top', 0 - this.$element.height() / 2)
147
+ .removeClass('modal-overflow');
148
+ }
149
+ },
150
+
151
+ tab: function () {
152
+ var that = this;
153
+
154
+ if (this.isShown && this.options.consumeTab) {
155
+ this.$element.on('keydown.tabindex.modal', '[data-tabindex]', function (e) {
156
+ if (e.keyCode && e.keyCode == 9){
157
+ var elements = [],
158
+ tabindex = Number($(this).data('tabindex'));
159
+
160
+ that.$element.find('[data-tabindex]:enabled:visible:not([readonly])').each(function (ev) {
161
+ elements.push(Number($(this).data('tabindex')));
162
+ });
163
+ elements.sort(function(a,b){return a-b});
164
+
165
+ var arrayPos = $.inArray(tabindex, elements);
166
+ if (!e.shiftKey){
167
+ arrayPos < elements.length-1 ?
168
+ that.$element.find('[data-tabindex='+elements[arrayPos+1]+']').focus() :
169
+ that.$element.find('[data-tabindex='+elements[0]+']').focus();
170
+ } else {
171
+ arrayPos == 0 ?
172
+ that.$element.find('[data-tabindex='+elements[elements.length-1]+']').focus() :
173
+ that.$element.find('[data-tabindex='+elements[arrayPos-1]+']').focus();
174
+ }
175
+
176
+ e.preventDefault();
177
+ }
178
+ });
179
+ } else if (!this.isShown) {
180
+ this.$element.off('keydown.tabindex.modal');
181
+ }
182
+ },
183
+
184
+ escape: function () {
185
+ var that = this;
186
+ if (this.isShown && this.options.keyboard) {
187
+ if (!this.$element.attr('tabindex')) this.$element.attr('tabindex', -1);
188
+
189
+ this.$element.on('keyup.dismiss.modal', function (e) {
190
+ e.which == 27 && that.hide();
191
+ });
192
+ } else if (!this.isShown) {
193
+ this.$element.off('keyup.dismiss.modal')
194
+ }
195
+ },
196
+
197
+ hideWithTransition: function () {
198
+ var that = this
199
+ , timeout = setTimeout(function () {
200
+ that.$element.off($.support.transition.end);
201
+ that.hideModal();
202
+ }, 500);
203
+
204
+ this.$element.one($.support.transition.end, function () {
205
+ clearTimeout(timeout);
206
+ that.hideModal();
207
+ });
208
+ },
209
+
210
+ hideModal: function () {
211
+ var prop = this.options.height ? 'height' : 'max-height';
212
+ var value = this.options.height || this.options.maxHeight;
213
+
214
+ if (value){
215
+ this.$element.find('.modal-body')
216
+ .css('overflow', '')
217
+ .css(prop, '');
218
+ }
219
+
220
+ this.$element
221
+ .hide()
222
+ .trigger('hidden');
223
+ },
224
+
225
+ removeLoading: function () {
226
+ this.$loading.remove();
227
+ this.$loading = null;
228
+ this.isLoading = false;
229
+ },
230
+
231
+ loading: function (callback) {
232
+ callback = callback || function () {};
233
+
234
+ var animate = this.$element.hasClass('fade') ? 'fade' : '';
235
+
236
+ if (!this.isLoading) {
237
+ var doAnimate = $.support.transition && animate;
238
+
239
+ this.$loading = $('<div class="loading-mask ' + animate + '">')
240
+ .append(this.options.spinner)
241
+ .appendTo(this.$element);
242
+
243
+ if (doAnimate) this.$loading[0].offsetWidth; // force reflow
244
+
245
+ this.$loading.addClass('in');
246
+
247
+ this.isLoading = true;
248
+
249
+ doAnimate ?
250
+ this.$loading.one($.support.transition.end, callback) :
251
+ callback();
252
+
253
+ } else if (this.isLoading && this.$loading) {
254
+ this.$loading.removeClass('in');
255
+
256
+ var that = this;
257
+ $.support.transition && this.$element.hasClass('fade')?
258
+ this.$loading.one($.support.transition.end, function () { that.removeLoading() }) :
259
+ that.removeLoading();
260
+
261
+ } else if (callback) {
262
+ callback(this.isLoading);
263
+ }
264
+ },
265
+
266
+ focus: function () {
267
+ var $focusElem = this.$element.find(this.options.focusOn);
268
+
269
+ $focusElem = $focusElem.length ? $focusElem : this.$element;
270
+
271
+ $focusElem.focus();
272
+ },
273
+
274
+ attention: function (){
275
+ // NOTE: transitionEnd with keyframes causes odd behaviour
276
+
277
+ if (this.options.attentionAnimation){
278
+ this.$element
279
+ .removeClass('animated')
280
+ .removeClass(this.options.attentionAnimation);
281
+
282
+ var that = this;
283
+
284
+ setTimeout(function () {
285
+ that.$element
286
+ .addClass('animated')
287
+ .addClass(that.options.attentionAnimation);
288
+ }, 0);
289
+ }
290
+
291
+
292
+ this.focus();
293
+ },
294
+
295
+
296
+ destroy: function () {
297
+ var e = $.Event('destroy');
298
+
299
+ this.$element.trigger(e);
300
+
301
+ if (e.isDefaultPrevented()) return;
302
+
303
+ this.$element
304
+ .off('.modal')
305
+ .removeData('modal')
306
+ .removeClass('in')
307
+ .attr('aria-hidden', true);
308
+
309
+ if (this.$parent !== this.$element.parent()) {
310
+ this.$element.appendTo(this.$parent);
311
+ } else if (!this.$parent.length) {
312
+ // modal is not part of the DOM so remove it.
313
+ this.$element.remove();
314
+ this.$element = null;
315
+ }
316
+
317
+ this.$element.trigger('destroyed');
318
+ }
319
+ };
320
+
321
+
322
+ /* MODAL PLUGIN DEFINITION
323
+ * ======================= */
324
+
325
+ $.fn.modal = function (option, args) {
326
+ return this.each(function () {
327
+ var $this = $(this),
328
+ data = $this.data('modal'),
329
+ options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option);
330
+
331
+ if (!data) $this.data('modal', (data = new Modal(this, options)));
332
+ if (typeof option == 'string') data[option].apply(data, [].concat(args));
333
+ else if (options.show) data.show()
334
+ })
335
+ };
336
+
337
+ $.fn.modal.defaults = {
338
+ keyboard: true,
339
+ backdrop: true,
340
+ loading: false,
341
+ show: true,
342
+ width: null,
343
+ height: null,
344
+ maxHeight: null,
345
+ modalOverflow: false,
346
+ consumeTab: true,
347
+ focusOn: null,
348
+ replace: false,
349
+ resize: false,
350
+ attentionAnimation: 'shake',
351
+ manager: 'body',
352
+ 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>',
353
+ backdropTemplate: '<div class="modal-backdrop" />'
354
+ };
355
+
356
+ $.fn.modal.Constructor = Modal;
357
+
358
+
359
+ /* MODAL DATA-API
360
+ * ============== */
361
+
362
+ $(function () {
363
+ $(document).off('click.modal').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
364
+ var $this = $(this),
365
+ href = $this.attr('href'),
366
+ $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))), //strip for ie7
367
+ option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data());
368
+
369
+ e.preventDefault();
370
+ $target
371
+ .modal(option)
372
+ .one('hide', function () {
373
+ $this.focus();
374
+ })
375
+ });
376
+ });
377
+
378
+ }(window.jQuery);
@@ -0,0 +1,423 @@
1
+ /* ===========================================================
2
+ * bootstrap-modalmanager.js v2.2.5
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
+ modal.$element.show();
83
+
84
+ if (transition) {
85
+ //modal.$element[0].style.display = 'run-in';
86
+ modal.$element[0].offsetWidth;
87
+ //modal.$element.one($.support.transition.end, function () { modal.$element[0].style.display = 'block' });
88
+ }
89
+
90
+ modal.layout();
91
+
92
+ modal.$element
93
+ .addClass('in')
94
+ .attr('aria-hidden', false);
95
+
96
+ var complete = function () {
97
+ that.setFocus();
98
+ modal.$element.trigger('shown');
99
+ };
100
+
101
+ transition ?
102
+ modal.$element.one($.support.transition.end, complete) :
103
+ complete();
104
+ });
105
+ };
106
+
107
+ modal.options.replace ?
108
+ that.replace(showModal) :
109
+ showModal();
110
+ }));
111
+
112
+ modal.$element.on('hidden.modalmanager', targetIsSelf(function (e) {
113
+ that.backdrop(modal);
114
+ // handle the case when a modal may have been removed from the dom before this callback executes
115
+ if (!modal.$element.parent().length) {
116
+ that.destroyModal(modal);
117
+ } else if (modal.$backdrop){
118
+ var transition = $.support.transition && modal.$element.hasClass('fade');
119
+
120
+ // trigger a relayout due to firebox's buggy transition end event
121
+ if (transition) { modal.$element[0].offsetWidth; }
122
+ $.support.transition && modal.$element.hasClass('fade') ?
123
+ modal.$backdrop.one($.support.transition.end, function () { modal.destroy(); }) :
124
+ modal.destroy();
125
+ } else {
126
+ modal.destroy();
127
+ }
128
+
129
+ }));
130
+
131
+ modal.$element.on('destroyed.modalmanager', targetIsSelf(function (e) {
132
+ that.destroyModal(modal);
133
+ }));
134
+ },
135
+
136
+ getOpenModals: function () {
137
+ var openModals = [];
138
+ for (var i = 0; i < this.stack.length; i++){
139
+ if (this.stack[i].isShown) openModals.push(this.stack[i]);
140
+ }
141
+
142
+ return openModals;
143
+ },
144
+
145
+ hasOpenModal: function () {
146
+ return this.getOpenModals().length > 0;
147
+ },
148
+
149
+ setFocus: function () {
150
+ var topModal;
151
+
152
+ for (var i = 0; i < this.stack.length; i++){
153
+ if (this.stack[i].isShown) topModal = this.stack[i];
154
+ }
155
+
156
+ if (!topModal) return;
157
+
158
+ topModal.focus();
159
+ },
160
+
161
+ destroyModal: function (modal) {
162
+ modal.$element.off('.modalmanager');
163
+ if (modal.$backdrop) this.removeBackdrop(modal);
164
+ this.stack.splice(this.getIndexOfModal(modal), 1);
165
+
166
+ var hasOpenModal = this.hasOpenModal();
167
+
168
+ this.$element.toggleClass('modal-open', hasOpenModal);
169
+
170
+ if (!hasOpenModal){
171
+ this.$element.removeClass('page-overflow');
172
+ }
173
+
174
+ this.removeContainer(modal);
175
+
176
+ this.setFocus();
177
+ },
178
+
179
+ getModalAt: function (index) {
180
+ return this.stack[index];
181
+ },
182
+
183
+ getIndexOfModal: function (modal) {
184
+ for (var i = 0; i < this.stack.length; i++){
185
+ if (modal === this.stack[i]) return i;
186
+ }
187
+ },
188
+
189
+ replace: function (callback) {
190
+ var topModal;
191
+
192
+ for (var i = 0; i < this.stack.length; i++){
193
+ if (this.stack[i].isShown) topModal = this.stack[i];
194
+ }
195
+
196
+ if (topModal) {
197
+ this.$backdropHandle = topModal.$backdrop;
198
+ topModal.$backdrop = null;
199
+
200
+ callback && topModal.$element.one('hidden',
201
+ targetIsSelf( $.proxy(callback, this) ));
202
+
203
+ topModal.hide();
204
+ } else if (callback) {
205
+ callback();
206
+ }
207
+ },
208
+
209
+ removeBackdrop: function (modal) {
210
+ modal.$backdrop.remove();
211
+ modal.$backdrop = null;
212
+ },
213
+
214
+ createBackdrop: function (animate, tmpl) {
215
+ var $backdrop;
216
+
217
+ if (!this.$backdropHandle) {
218
+ $backdrop = $(tmpl)
219
+ .addClass(animate)
220
+ .appendTo(this.$element);
221
+ } else {
222
+ $backdrop = this.$backdropHandle;
223
+ $backdrop.off('.modalmanager');
224
+ this.$backdropHandle = null;
225
+ this.isLoading && this.removeSpinner();
226
+ }
227
+
228
+ return $backdrop;
229
+ },
230
+
231
+ removeContainer: function (modal) {
232
+ modal.$container.remove();
233
+ modal.$container = null;
234
+ },
235
+
236
+ createContainer: function (modal) {
237
+ var $container;
238
+
239
+ $container = $('<div class="modal-scrollable">')
240
+ .css('z-index', getzIndex('modal', this.getOpenModals().length))
241
+ .appendTo(this.$element);
242
+
243
+ if (modal && modal.options.backdrop != 'static') {
244
+ $container.on('click.modal', targetIsSelf(function (e) {
245
+ modal.hide();
246
+ }));
247
+ } else if (modal) {
248
+ $container.on('click.modal', targetIsSelf(function (e) {
249
+ modal.attention();
250
+ }));
251
+ }
252
+
253
+ return $container;
254
+
255
+ },
256
+
257
+ backdrop: function (modal, callback) {
258
+ var animate = modal.$element.hasClass('fade') ? 'fade' : '',
259
+ showBackdrop = modal.options.backdrop &&
260
+ this.backdropCount < this.options.backdropLimit;
261
+
262
+ if (modal.isShown && showBackdrop) {
263
+ var doAnimate = $.support.transition && animate && !this.$backdropHandle;
264
+
265
+ modal.$backdrop = this.createBackdrop(animate, modal.options.backdropTemplate);
266
+
267
+ modal.$backdrop.css('z-index', getzIndex( 'backdrop', this.getOpenModals().length ));
268
+
269
+ if (doAnimate) modal.$backdrop[0].offsetWidth; // force reflow
270
+
271
+ modal.$backdrop.addClass('in');
272
+
273
+ this.backdropCount += 1;
274
+
275
+ doAnimate ?
276
+ modal.$backdrop.one($.support.transition.end, callback) :
277
+ callback();
278
+
279
+ } else if (!modal.isShown && modal.$backdrop) {
280
+ modal.$backdrop.removeClass('in');
281
+
282
+ this.backdropCount -= 1;
283
+
284
+ var that = this;
285
+
286
+ $.support.transition && modal.$element.hasClass('fade')?
287
+ modal.$backdrop.one($.support.transition.end, function () { that.removeBackdrop(modal) }) :
288
+ that.removeBackdrop(modal);
289
+
290
+ } else if (callback) {
291
+ callback();
292
+ }
293
+ },
294
+
295
+ removeSpinner: function(){
296
+ this.$spinner && this.$spinner.remove();
297
+ this.$spinner = null;
298
+ this.isLoading = false;
299
+ },
300
+
301
+ removeLoading: function () {
302
+ this.$backdropHandle && this.$backdropHandle.remove();
303
+ this.$backdropHandle = null;
304
+ this.removeSpinner();
305
+ },
306
+
307
+ loading: function (callback) {
308
+ callback = callback || function () { };
309
+
310
+ this.$element
311
+ .toggleClass('modal-open', !this.isLoading || this.hasOpenModal())
312
+ .toggleClass('page-overflow', $(window).height() < this.$element.height());
313
+
314
+ if (!this.isLoading) {
315
+
316
+ this.$backdropHandle = this.createBackdrop('fade', this.options.backdropTemplate);
317
+
318
+ this.$backdropHandle[0].offsetWidth; // force reflow
319
+
320
+ var openModals = this.getOpenModals();
321
+
322
+ this.$backdropHandle
323
+ .css('z-index', getzIndex('backdrop', openModals.length + 1))
324
+ .addClass('in');
325
+
326
+ var $spinner = $(this.options.spinner)
327
+ .css('z-index', getzIndex('modal', openModals.length + 1))
328
+ .appendTo(this.$element)
329
+ .addClass('in');
330
+
331
+ this.$spinner = $(this.createContainer())
332
+ .append($spinner)
333
+ .on('click.modalmanager', $.proxy(this.loading, this));
334
+
335
+ this.isLoading = true;
336
+
337
+ $.support.transition ?
338
+ this.$backdropHandle.one($.support.transition.end, callback) :
339
+ callback();
340
+
341
+ } else if (this.isLoading && this.$backdropHandle) {
342
+ this.$backdropHandle.removeClass('in');
343
+
344
+ var that = this;
345
+ $.support.transition ?
346
+ this.$backdropHandle.one($.support.transition.end, function () { that.removeLoading() }) :
347
+ that.removeLoading();
348
+
349
+ } else if (callback) {
350
+ callback(this.isLoading);
351
+ }
352
+ }
353
+ };
354
+
355
+ /* PRIVATE METHODS
356
+ * ======================= */
357
+
358
+ // computes and caches the zindexes
359
+ var getzIndex = (function () {
360
+ var zIndexFactor,
361
+ baseIndex = {};
362
+
363
+ return function (type, pos) {
364
+
365
+ if (typeof zIndexFactor === 'undefined'){
366
+ var $baseModal = $('<div class="modal hide" />').appendTo('body'),
367
+ $baseBackdrop = $('<div class="modal-backdrop hide" />').appendTo('body');
368
+
369
+ baseIndex['modal'] = +$baseModal.css('z-index');
370
+ baseIndex['backdrop'] = +$baseBackdrop.css('z-index');
371
+ zIndexFactor = baseIndex['modal'] - baseIndex['backdrop'];
372
+
373
+ $baseModal.remove();
374
+ $baseBackdrop.remove();
375
+ $baseBackdrop = $baseModal = null;
376
+ }
377
+
378
+ return baseIndex[type] + (zIndexFactor * pos);
379
+
380
+ }
381
+ }());
382
+
383
+ // make sure the event target is the modal itself in order to prevent
384
+ // other components such as tabsfrom triggering the modal manager.
385
+ // if Boostsrap namespaced events, this would not be needed.
386
+ function targetIsSelf(callback){
387
+ return function (e) {
388
+ if (e && this === e.target){
389
+ return callback.apply(this, arguments);
390
+ }
391
+ }
392
+ }
393
+
394
+
395
+ /* MODAL MANAGER PLUGIN DEFINITION
396
+ * ======================= */
397
+
398
+ $.fn.modalmanager = function (option, args) {
399
+ return this.each(function () {
400
+ var $this = $(this),
401
+ data = $this.data('modalmanager');
402
+
403
+ if (!data) $this.data('modalmanager', (data = new ModalManager(this, option)));
404
+ if (typeof option === 'string') data[option].apply(data, [].concat(args))
405
+ })
406
+ };
407
+
408
+ $.fn.modalmanager.defaults = {
409
+ backdropLimit: 999,
410
+ resize: true,
411
+ 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>',
412
+ backdropTemplate: '<div class="modal-backdrop" />'
413
+ };
414
+
415
+ $.fn.modalmanager.Constructor = ModalManager
416
+
417
+ // ModalManager handles the modal-open class so we need
418
+ // to remove conflicting bootstrap 3 event handlers
419
+ $(function () {
420
+ $(document).off('show.bs.modal').off('hidden.bs.modal');
421
+ });
422
+
423
+ }(jQuery);