kuhsaft 2.3.1 → 2.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c60f8ceefd0183f0e24eee551f4560d802969351
4
- data.tar.gz: bc32915f907f3630621dea9ca3283d5961f0fdb9
3
+ metadata.gz: 14bb5aeb1a5309483829aab10bf7bceac2e38b3c
4
+ data.tar.gz: 5dded00a1779710696198f876f92fb1ba42af761
5
5
  SHA512:
6
- metadata.gz: 5196609fd60806c055d1501f725d3347e5f875da67f952d3a4b249739cea4c80c82ba72665bd7a81e68c085ab1124b9d3eb0ace015cd9335aa609909480cb37c
7
- data.tar.gz: a226eaf1a6674895c40d81655b82df983c174618cbc15693b5b7f5873e3cb84e7dcbc24c158180e471d74b44754f7529572cf1fb27a89a2b296871ac95f40e9e
6
+ metadata.gz: 0daea3d88813548db540a8bc18c36cdc482caf6e18fc3b0f62946fa77ba9d092030d9f2866a51c4336c17c497ca159151106ce1f947d7b651f77ae4342b0092e
7
+ data.tar.gz: fdfd8ce2ab6565e7848e6ecb63faaac81cb362b5dd3245003dbb265797d94bd0e463d0d3e695c61f3141ec664c73e8bf4d49ccbcf9c69846e2d43e170058e110
@@ -9,6 +9,8 @@
9
9
  #= require jquery.remotipart
10
10
  #= require jquery.ui.all
11
11
  #= require bootstrap
12
+ #= require bootstrap-modal-v2
13
+ #= require bootstrap-modalmanager
12
14
  #= require ckeditor-jquery
13
15
  #= require jquery.nestable
14
16
  #= require_tree .
@@ -174,11 +174,13 @@ form
174
174
  top: 7px
175
175
  right: 15px
176
176
 
177
- textarea.ckeditor
178
- height: 263px
179
- display: block !important
180
- visibility: show !important
181
- position: absolute
177
+ .control-group.text
178
+ height: 310px
179
+
180
+ textarea
181
+ height: 263px
182
+ width: 98%
182
183
 
183
184
  @import nestable
184
185
  @import bootstrap-responsive
186
+ @import bootstrap_modal
@@ -1,34 +1,33 @@
1
- #brick-form.modal.hide.fade{ :tabindex => '-1', :role => 'dialog' }
2
- .modal-header
3
- %button.close{ 'data-dismiss' => 'modal' }
4
- ×
5
- %h3= t('.create_new', :brick => @brick.backend_label)
1
+ .modal-header
2
+ %button.close{ 'data-dismiss' => 'modal' }
3
+ ×
4
+ %h3= t('.create_new', :brick => @brick.backend_label)
6
5
 
7
- = simple_form_for @brick, :as => :brick, :url => kuhsaft.cms_bricks_path, :method => :post, :remote => true, :html => { :id => nil }, :wrapper => :bootstrap do |form|
8
- .modal-body
9
- = form.hidden_field :position, :class => 'position-field'
10
- = form.hidden_field :type
11
- = form.hidden_field :brick_list_id
12
- = form.hidden_field :brick_list_type
6
+ = simple_form_for @brick, :as => :brick, :url => kuhsaft.cms_bricks_path, :method => :post, :remote => true, :html => { :id => nil }, :wrapper => :bootstrap do |form|
7
+ .modal-body
8
+ = form.hidden_field :position, :class => 'position-field'
9
+ = form.hidden_field :type
10
+ = form.hidden_field :brick_list_id
11
+ = form.hidden_field :brick_list_type
13
12
 
14
- - brick_content = render(@brick.to_edit_partial_path, :brick => @brick, :form => form)
13
+ - brick_content = render(@brick.to_edit_partial_path, :brick => @brick, :form => form)
15
14
 
16
- - unless @brick.available_display_styles.empty?
17
- #display-styles.btn-group.pull-right
18
- .btn.btn-small
19
- %i.icon-tint
20
- %a.btn.btn-small.dropdown-toggle{ 'data-toggle' => 'dropdown', 'href' => '#' }
21
- %span.caret
22
- %ul.dropdown-menu.pull-right
23
- %li
24
- = form.input :display_styles, :collection => @brick.translated_available_display_styles, :as => :check_boxes
15
+ - unless @brick.available_display_styles.empty?
16
+ #display-styles.btn-group.pull-right
17
+ .btn.btn-small
18
+ %i.icon-tint
19
+ %a.btn.btn-small.dropdown-toggle{ 'data-toggle' => 'dropdown', 'href' => '#' }
20
+ %span.caret
21
+ %ul.dropdown-menu.pull-right
22
+ %li
23
+ = form.input :display_styles, :collection => @brick.translated_available_display_styles, :as => :check_boxes
25
24
 
26
- - if brick_content.present?
27
- = brick_content
28
- - else
29
- = t('.no_content')
25
+ - if brick_content.present?
26
+ = brick_content
27
+ - else
28
+ = t('.no_content')
30
29
 
31
- .modal-footer
32
- .clearfix
33
- .pull-right
34
- = form.button :submit, t('.save'), :class => 'btn-success'
30
+ .modal-footer
31
+ .clearfix
32
+ .pull-right
33
+ = form.button :submit, t('.save'), :class => 'btn-success'
@@ -7,8 +7,4 @@ initSubmitLinks(newlyInsertedBrick)
7
7
 
8
8
  $(newlyInsertedBrick).find('textarea.ckeditor').each(function (index, elem) { initCKEditor(elem.id) })
9
9
 
10
- $("#form-container #brick-form").modal('hide')
11
-
12
- -# Toggle collapse-bricks-nav
13
- var showCollapseBricksNav = "#{@brick.brick_list.bricks.present?}" == 'true'
14
- toggleCollapseBricksNav(showCollapseBricksNav)
10
+ $("#brick-form").modal('hide')
@@ -1,11 +1,13 @@
1
- $("#form-container #brick-form").modal('hide')
2
- $("#form-container #brick-form").remove()
1
+ - if @brick.errors.any?
2
+ $("#brick-form").modal('attention')
3
3
 
4
- $("#form-container").append("#{j(render('kuhsaft/cms/bricks/new', :brick => @brick, :format => :html))}")
4
+ $("#brick-form").empty()
5
5
 
6
- $("#form-container").find('textarea.ckeditor').each(function (index, elem) { initCKEditor(elem.id) })
6
+ $("#brick-form").append("#{j(render('kuhsaft/cms/bricks/new', :brick => @brick, :format => :html))}")
7
+
8
+ $("#brick-form").find('textarea.ckeditor').each(function (index, elem) { initCKEditor(elem.id) })
9
+
10
+ $("#brick-form").modal('show')
7
11
 
8
12
  -# Stop propagation of display styles dropdown
9
13
  stopPropagationOfDisplayStyles($('#display-styles ul'))
10
-
11
- $("#brick-form").modal()
@@ -23,7 +23,7 @@
23
23
  = form.button :submit, class: 'btn btn-primary'
24
24
 
25
25
  - unless hide_content_tab?(@page)
26
- #form-container
26
+ #brick-form.modal.hide.fade{ :tabindex => '-1', :role => 'dialog' }
27
27
  #page-content.tab-pane{ class: content_tab_active(@page) }
28
28
  - if @page.persisted?
29
29
  .clearfix
@@ -1,3 +1,3 @@
1
1
  module Kuhsaft
2
- VERSION = '2.3.1'
2
+ VERSION = '2.3.2'
3
3
  end
@@ -0,0 +1,376 @@
1
+ /* ===========================================================
2
+ * bootstrap-modal.js v2.2.4
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 CLASS DEFINITION
24
+ * ====================== */
25
+
26
+ var Modal = function (element, options) {
27
+ this.init(element, options);
28
+ };
29
+
30
+ Modal.prototype = {
31
+
32
+ constructor: Modal,
33
+
34
+ init: function (element, options) {
35
+ var that = this;
36
+
37
+ this.options = options;
38
+
39
+ this.$element = $(element)
40
+ .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this));
41
+
42
+ this.options.remote && this.$element.find('.modal-body').load(this.options.remote, function () {
43
+ var e = $.Event('loaded');
44
+ that.$element.trigger(e);
45
+ });
46
+
47
+ var manager = typeof this.options.manager === 'function' ?
48
+ this.options.manager.call(this) : this.options.manager;
49
+
50
+ manager = manager.appendModal ?
51
+ manager : $(manager).modalmanager().data('modalmanager');
52
+
53
+ manager.appendModal(this);
54
+ },
55
+
56
+ toggle: function () {
57
+ return this[!this.isShown ? 'show' : 'hide']();
58
+ },
59
+
60
+ show: function () {
61
+ var e = $.Event('show');
62
+
63
+ if (this.isShown) return;
64
+
65
+ this.$element.trigger(e);
66
+
67
+ if (e.isDefaultPrevented()) return;
68
+
69
+ this.escape();
70
+
71
+ this.tab();
72
+
73
+ this.options.loading && this.loading();
74
+ },
75
+
76
+ hide: function (e) {
77
+ e && e.preventDefault();
78
+
79
+ e = $.Event('hide');
80
+
81
+ this.$element.trigger(e);
82
+
83
+ if (!this.isShown || e.isDefaultPrevented()) return;
84
+
85
+ this.isShown = false;
86
+
87
+ this.escape();
88
+
89
+ this.tab();
90
+
91
+ this.isLoading && this.loading();
92
+
93
+ $(document).off('focusin.modal');
94
+
95
+ this.$element
96
+ .removeClass('in')
97
+ .removeClass('animated')
98
+ .removeClass(this.options.attentionAnimation)
99
+ .removeClass('modal-overflow')
100
+ .attr('aria-hidden', true);
101
+
102
+ $.support.transition && this.$element.hasClass('fade') ?
103
+ this.hideWithTransition() :
104
+ this.hideModal();
105
+ },
106
+
107
+ layout: function () {
108
+ var prop = this.options.height ? 'height' : 'max-height',
109
+ value = this.options.height || this.options.maxHeight;
110
+
111
+ if (this.options.width){
112
+ this.$element.css('width', this.options.width);
113
+
114
+ var that = this;
115
+ this.$element.css('margin-left', function () {
116
+ if (/%/ig.test(that.options.width)){
117
+ return -(parseInt(that.options.width) / 2) + '%';
118
+ } else {
119
+ return -($(this).width() / 2) + 'px';
120
+ }
121
+ });
122
+ } else {
123
+ this.$element.css('width', '');
124
+ this.$element.css('margin-left', '');
125
+ }
126
+
127
+ this.$element.find('.modal-body')
128
+ .css('overflow', '')
129
+ .css(prop, '');
130
+
131
+ if (value){
132
+ this.$element.find('.modal-body')
133
+ .css('overflow', 'auto')
134
+ .css(prop, value);
135
+ }
136
+
137
+ var modalOverflow = $(window).height() - 10 < this.$element.height();
138
+
139
+ if (modalOverflow || this.options.modalOverflow) {
140
+ this.$element
141
+ .css('margin-top', 0)
142
+ .addClass('modal-overflow');
143
+ } else {
144
+ this.$element
145
+ .css('margin-top', 0 - this.$element.height() / 2)
146
+ .removeClass('modal-overflow');
147
+ }
148
+ },
149
+
150
+ tab: function () {
151
+ var that = this;
152
+
153
+ if (this.isShown && this.options.consumeTab) {
154
+ this.$element.on('keydown.tabindex.modal', '[data-tabindex]', function (e) {
155
+ if (e.keyCode && e.keyCode == 9){
156
+ var $next = $(this),
157
+ $rollover = $(this);
158
+
159
+ that.$element.find('[data-tabindex]:enabled:not([readonly])').each(function (e) {
160
+ if (!e.shiftKey){
161
+ $next = $next.data('tabindex') < $(this).data('tabindex') ?
162
+ $next = $(this) :
163
+ $rollover = $(this);
164
+ } else {
165
+ $next = $next.data('tabindex') > $(this).data('tabindex') ?
166
+ $next = $(this) :
167
+ $rollover = $(this);
168
+ }
169
+ });
170
+
171
+ $next[0] !== $(this)[0] ?
172
+ $next.focus() : $rollover.focus();
173
+
174
+ e.preventDefault();
175
+ }
176
+ });
177
+ } else if (!this.isShown) {
178
+ this.$element.off('keydown.tabindex.modal');
179
+ }
180
+ },
181
+
182
+ escape: function () {
183
+ var that = this;
184
+ if (this.isShown && this.options.keyboard) {
185
+ if (!this.$element.attr('tabindex')) this.$element.attr('tabindex', -1);
186
+
187
+ this.$element.on('keyup.dismiss.modal', function (e) {
188
+ e.which == 27 && that.hide();
189
+ });
190
+ } else if (!this.isShown) {
191
+ this.$element.off('keyup.dismiss.modal')
192
+ }
193
+ },
194
+
195
+ hideWithTransition: function () {
196
+ var that = this
197
+ , timeout = setTimeout(function () {
198
+ that.$element.off($.support.transition.end);
199
+ that.hideModal();
200
+ }, 500);
201
+
202
+ this.$element.one($.support.transition.end, function () {
203
+ clearTimeout(timeout);
204
+ that.hideModal();
205
+ });
206
+ },
207
+
208
+ hideModal: function () {
209
+ var prop = this.options.height ? 'height' : 'max-height';
210
+ var value = this.options.height || this.options.maxHeight;
211
+
212
+ if (value){
213
+ this.$element.find('.modal-body')
214
+ .css('overflow', '')
215
+ .css(prop, '');
216
+ }
217
+
218
+ this.$element
219
+ .hide()
220
+ .trigger('hidden');
221
+ },
222
+
223
+ removeLoading: function () {
224
+ this.$loading.remove();
225
+ this.$loading = null;
226
+ this.isLoading = false;
227
+ },
228
+
229
+ loading: function (callback) {
230
+ callback = callback || function () {};
231
+
232
+ var animate = this.$element.hasClass('fade') ? 'fade' : '';
233
+
234
+ if (!this.isLoading) {
235
+ var doAnimate = $.support.transition && animate;
236
+
237
+ this.$loading = $('<div class="loading-mask ' + animate + '">')
238
+ .append(this.options.spinner)
239
+ .appendTo(this.$element);
240
+
241
+ if (doAnimate) this.$loading[0].offsetWidth; // force reflow
242
+
243
+ this.$loading.addClass('in');
244
+
245
+ this.isLoading = true;
246
+
247
+ doAnimate ?
248
+ this.$loading.one($.support.transition.end, callback) :
249
+ callback();
250
+
251
+ } else if (this.isLoading && this.$loading) {
252
+ this.$loading.removeClass('in');
253
+
254
+ var that = this;
255
+ $.support.transition && this.$element.hasClass('fade')?
256
+ this.$loading.one($.support.transition.end, function () { that.removeLoading() }) :
257
+ that.removeLoading();
258
+
259
+ } else if (callback) {
260
+ callback(this.isLoading);
261
+ }
262
+ },
263
+
264
+ focus: function () {
265
+ var $focusElem = this.$element.find(this.options.focusOn);
266
+
267
+ $focusElem = $focusElem.length ? $focusElem : this.$element;
268
+
269
+ $focusElem.focus();
270
+ },
271
+
272
+ attention: function (){
273
+ // NOTE: transitionEnd with keyframes causes odd behaviour
274
+
275
+ if (this.options.attentionAnimation){
276
+ this.$element
277
+ .removeClass('animated')
278
+ .removeClass(this.options.attentionAnimation);
279
+
280
+ var that = this;
281
+
282
+ setTimeout(function () {
283
+ that.$element
284
+ .addClass('animated')
285
+ .addClass(that.options.attentionAnimation);
286
+ }, 0);
287
+ }
288
+
289
+
290
+ this.focus();
291
+ },
292
+
293
+
294
+ destroy: function () {
295
+ var e = $.Event('destroy');
296
+
297
+ this.$element.trigger(e);
298
+
299
+ if (e.isDefaultPrevented()) return;
300
+
301
+ this.$element
302
+ .off('.modal')
303
+ .removeData('modal')
304
+ .removeClass('in')
305
+ .attr('aria-hidden', true);
306
+
307
+ if (this.$parent !== this.$element.parent()) {
308
+ this.$element.appendTo(this.$parent);
309
+ } else if (!this.$parent.length) {
310
+ // modal is not part of the DOM so remove it.
311
+ this.$element.remove();
312
+ this.$element = null;
313
+ }
314
+
315
+ this.$element.trigger('destroyed');
316
+ }
317
+ };
318
+
319
+
320
+ /* MODAL PLUGIN DEFINITION
321
+ * ======================= */
322
+
323
+ $.fn.modal = function (option, args) {
324
+ return this.each(function () {
325
+ var $this = $(this),
326
+ data = $this.data('modal'),
327
+ options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option);
328
+
329
+ if (!data) $this.data('modal', (data = new Modal(this, options)));
330
+ if (typeof option == 'string') data[option].apply(data, [].concat(args));
331
+ else if (options.show) data.show()
332
+ })
333
+ };
334
+
335
+ $.fn.modal.defaults = {
336
+ keyboard: true,
337
+ backdrop: true,
338
+ loading: false,
339
+ show: true,
340
+ width: null,
341
+ height: null,
342
+ maxHeight: null,
343
+ modalOverflow: false,
344
+ consumeTab: true,
345
+ focusOn: null,
346
+ replace: false,
347
+ resize: false,
348
+ attentionAnimation: 'shake',
349
+ manager: 'body',
350
+ 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>',
351
+ backdropTemplate: '<div class="modal-backdrop" />'
352
+ };
353
+
354
+ $.fn.modal.Constructor = Modal;
355
+
356
+
357
+ /* MODAL DATA-API
358
+ * ============== */
359
+
360
+ $(function () {
361
+ $(document).off('click.modal').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
362
+ var $this = $(this),
363
+ href = $this.attr('href'),
364
+ $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))), //strip for ie7
365
+ option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data());
366
+
367
+ e.preventDefault();
368
+ $target
369
+ .modal(option)
370
+ .one('hide', function () {
371
+ $this.focus();
372
+ })
373
+ });
374
+ });
375
+
376
+ }(window.jQuery);
@@ -0,0 +1,423 @@
1
+ /* ===========================================================
2
+ * bootstrap-modalmanager.js v2.2.4
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 (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);
@@ -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.5;
88
+ filter: alpha(opacity=50);
89
+ background: #000;
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 CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kuhsaft
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Immanuel Häussermann
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-04-01 00:00:00.000000000 Z
15
+ date: 2014-04-02 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rspec
@@ -647,7 +647,10 @@ files:
647
647
  - lib/templates/kuhsaft/assets/customizations.css.sass
648
648
  - lib/templates/kuhsaft/assets/customizations.js.coffee
649
649
  - lib/templates/kuhsaft/translations/add_translation.html.erb
650
+ - vendor/assets/javascripts/bootstrap-modal-v2.js
651
+ - vendor/assets/javascripts/bootstrap-modalmanager.js
650
652
  - vendor/assets/javascripts/jquery.nestable.js
653
+ - vendor/assets/stylesheets/bootstrap_modal.css
651
654
  - vendor/assets/stylesheets/nestable.css
652
655
  - Rakefile
653
656
  - README.md
@@ -750,7 +753,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
750
753
  version: '0'
751
754
  requirements: []
752
755
  rubyforge_project: kuhsaft
753
- rubygems_version: 2.1.10
756
+ rubygems_version: 2.0.5
754
757
  signing_key:
755
758
  specification_version: 4
756
759
  summary: A tool that helps you to manage your content within your app.