jquery-modal-rails-assets 0.5.11 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2a59d48095714fae90339c7bc3e988b89c7f515b
4
- data.tar.gz: 8ff30046b1950fc55045e7c26764eee89843cb26
3
+ metadata.gz: ea9f21c14f8650d2ebbf95a82484b9af37aa78c5
4
+ data.tar.gz: cda39e2d833012ebf12f7bd0950204145e57547d
5
5
  SHA512:
6
- metadata.gz: 8108a60b517f9647397f522f9cbdae1504fbe5eb92e89953fb18ee430e01704ff19a08bc8c464f3017c10c2f6f717dd67a6c687d6943f1bab3f5aa2197e54d76
7
- data.tar.gz: 7a66d1fa5118d7fbb8500ccdd3513fe45814de1808aaab2148ad279a117d6d96589bd20981c16ce8b5f7e0bd460c00b1f30f00a7b2b8f063655d3028f8c5d791
6
+ metadata.gz: 4b6f7d47072369bc6e1da4d6f183b6264ca32688da1c05dfa3db4909001065fa3edc98af640a243d805fbc731508fa73c3aa1695663d94308cf410fc197c11b1
7
+ data.tar.gz: 1b9e1c72645633606f6052eca56746d34eb3d3ba86a5662132ece0e42c82867395fb2a6ba1f8f8853780ffa5cbd418e1ee0a8e2583bccd0798c7f93337a06d7f
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  A simple jQuery modal (http://github.com/kylefox/jquery-modal)
3
- Version 0.5.11
3
+ Version 0.6.0
4
4
  */
5
5
  (function($) {
6
6
 
@@ -18,6 +18,7 @@
18
18
  if (/^#/.test(target)) {
19
19
  this.$elm = $(target);
20
20
  if (this.$elm.length !== 1) return null;
21
+ this.$body.append(this.$elm);
21
22
  this.open();
22
23
  //AJAX
23
24
  } else {
@@ -65,7 +66,10 @@
65
66
  if (event.which == 27) $.modal.close();
66
67
  });
67
68
  }
68
- if (this.options.clickClose) this.blocker.click($.modal.close);
69
+ if (this.options.clickClose) this.blocker.click(function(e){
70
+ if (e.target==this)
71
+ $.modal.close();
72
+ });
69
73
  },
70
74
 
71
75
  close: function() {
@@ -75,30 +79,28 @@
75
79
  },
76
80
 
77
81
  block: function() {
78
- var initialOpacity = this.options.doFade ? 0 : this.options.opacity;
79
82
  this.$elm.trigger($.modal.BEFORE_BLOCK, [this._ctx()]);
80
- this.blocker = $('<div class="jquery-modal blocker"></div>').css({
81
- top: 0, right: 0, bottom: 0, left: 0,
82
- width: "100%", height: "100%",
83
- position: "fixed",
84
- zIndex: this.options.zIndex,
85
- background: this.options.overlay,
86
- opacity: initialOpacity
87
- });
83
+ this.blocker = $('<div class="jquery-modal blocker"></div>');
84
+ this.$body.css('overflow','hidden');
88
85
  this.$body.append(this.blocker);
89
86
  if(this.options.doFade) {
90
- this.blocker.animate({opacity: this.options.opacity}, this.options.fadeDuration);
87
+ this.blocker.css('opacity',0).animate({opacity: 1}, this.options.fadeDuration);
91
88
  }
92
89
  this.$elm.trigger($.modal.BLOCK, [this._ctx()]);
93
90
  },
94
91
 
95
92
  unblock: function() {
96
93
  if(this.options.doFade) {
94
+ var self=this;
97
95
  this.blocker.fadeOut(this.options.fadeDuration, function() {
98
- $(this).remove();
96
+ self.blocker.children().appendTo(self.$body);
97
+ self.blocker.remove();
98
+ self.$body.css('overflow','');
99
99
  });
100
100
  } else {
101
+ this.blocker.children().appendTo(this.$body);
101
102
  this.blocker.remove();
103
+ this.$body.css('overflow','');
102
104
  }
103
105
  },
104
106
 
@@ -109,9 +111,9 @@
109
111
  this.$elm.append(this.closeButton);
110
112
  }
111
113
  this.$elm.addClass(this.options.modalClass + ' current');
112
- this.center();
114
+ this.$elm.appendTo(this.blocker);
113
115
  if(this.options.doFade) {
114
- this.$elm.fadeIn(this.options.fadeDuration);
116
+ this.$elm.css('opacity',0).animate({opacity: 1}, this.options.fadeDuration);
115
117
  } else {
116
118
  this.$elm.show();
117
119
  }
@@ -148,26 +150,12 @@
148
150
  if (this.spinner) this.spinner.remove();
149
151
  },
150
152
 
151
- center: function() {
152
- this.$elm.css({
153
- position: 'fixed',
154
- top: "50%",
155
- left: "50%",
156
- marginTop: - (this.$elm.outerHeight() / 2),
157
- marginLeft: - (this.$elm.outerWidth() / 2),
158
- zIndex: this.options.zIndex + 1
159
- });
160
- },
161
-
162
153
  //Return context for custom events
163
154
  _ctx: function() {
164
155
  return { elm: this.$elm, blocker: this.blocker, options: this.options };
165
156
  }
166
157
  };
167
158
 
168
- //resize is alias for center for now
169
- $.modal.prototype.resize = $.modal.prototype.center;
170
-
171
159
  $.modal.close = function(event) {
172
160
  if (!current) return;
173
161
  if (event) event.preventDefault();
@@ -177,20 +165,12 @@
177
165
  return that;
178
166
  };
179
167
 
180
- $.modal.resize = function() {
181
- if (!current) return;
182
- current.resize();
183
- };
184
-
185
168
  // Returns if there currently is an active modal
186
169
  $.modal.isActive = function () {
187
170
  return current ? true : false;
188
171
  }
189
172
 
190
173
  $.modal.defaults = {
191
- overlay: "#000",
192
- opacity: 0.75,
193
- zIndex: 1,
194
174
  escapeClose: true,
195
175
  clickClose: true,
196
176
  closeText: 'Close',
@@ -1,5 +1,27 @@
1
+ .blocker {
2
+ position: fixed;
3
+ top: 0; right: 0; bottom: 0; left: 0;
4
+ width: 100%; height: 100%;
5
+ overflow: auto;
6
+ z-index: 1;
7
+ padding: 20px;
8
+ box-sizing: border-box;
9
+ background-color: rgb(0,0,0);
10
+ background-color: rgba(0,0,0,0.75);
11
+ text-align: center;
12
+ }
13
+ .blocker:before{
14
+ content: "";
15
+ display: inline-block;
16
+ height: 100%;
17
+ vertical-align: middle;
18
+ margin-right: -0.05em;
19
+ }
1
20
  .modal {
2
- display: none;
21
+ display: inline-block;
22
+ vertical-align: middle;
23
+ position: relative;
24
+ z-index: 2;
3
25
  width: 400px;
4
26
  background: #fff;
5
27
  padding: 15px 30px;
@@ -13,6 +35,7 @@
13
35
  -o-box-shadow: 0 0 10px #000;
14
36
  -ms-box-shadow: 0 0 10px #000;
15
37
  box-shadow: 0 0 10px #000;
38
+ text-align: left;
16
39
  }
17
40
 
18
41
  .modal a.close-modal {
@@ -41,4 +64,4 @@
41
64
  -o-border-radius: 8px;
42
65
  -ms-border-radius: 8px;
43
66
  border-radius: 8px;
44
- }
67
+ }
@@ -1,3 +1,3 @@
1
1
  module JqueryModalRailsAssets
2
- VERSION = "0.5.11"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery-modal-rails-assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.11
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - RogerE
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-05 00:00:00.000000000 Z
11
+ date: 2016-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  version: '0'
76
76
  requirements: []
77
77
  rubyforge_project:
78
- rubygems_version: 2.5.0
78
+ rubygems_version: 2.5.1
79
79
  signing_key:
80
80
  specification_version: 4
81
81
  summary: Use jQuery Modal with Rails Asset Pipeline