jquery-modal-rails 0.0.3 → 0.0.4

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: 5367c922e6150305c4d9df5e75e76c717127b69b
4
+ data.tar.gz: cf67d604f1c6babef15fde20f4237c69192369d4
5
+ SHA512:
6
+ metadata.gz: 27a775d8d7af23947941fe3c250f9ffedbded66db483f94393008f1d621be73992b03162eafbc607da41a632641dde036226a8056b07ca37f68f289d64227b22
7
+ data.tar.gz: 935746f72076b66ba8cb37301ca8a49345b30a9d5dbb75aaf539a3993c66df4448fd45983c413b5fd213d0fd61e1b9ce59b5f6e64754845ac738947f70c7bcde
data/Gemfile CHANGED
@@ -11,8 +11,8 @@ gem 'sqlite3'
11
11
  # Gems used only for assets and not required
12
12
  # in production environments by default.
13
13
  group :assets do
14
- gem 'sass-rails', '~> 3.2.3'
15
- gem 'coffee-rails', '~> 3.2.1'
14
+ gem 'sass-rails', '~> 4.0.0.rc1'
15
+ gem 'coffee-rails', '~> 4.0.0.rc1'
16
16
 
17
17
  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
18
18
  # gem 'therubyracer', :platforms => :ruby
@@ -21,7 +21,8 @@
21
21
  </table>
22
22
 
23
23
  <br />
24
- <div id="diag" style="display:none;">Hudel Welcom Coll</div>
24
+ <div id="diag" style="display:none;">Hudel Welcom Coll <%= link_to_modal 'Another DIV in the page', "#diag2" %></div>
25
+ <div id="diag2" style="display:none;">Hey you</div>
25
26
 
26
27
  <%= link_to 'New User Normal', new_user_path %><BR/>
27
28
  <%= link_to_modal 'New User Modal', new_user_path %><BR/>
@@ -1,7 +1,7 @@
1
1
  module Jquery
2
2
  module Modal
3
3
  module Rails
4
- VERSION = "0.0.3"
4
+ VERSION = "0.0.4"
5
5
  JQUERY_MODAL_VERSION = "0.5"
6
6
  end
7
7
  end
@@ -1,15 +1,17 @@
1
1
  /*
2
2
  A simple jQuery modal (http://github.com/kylefox/jquery-modal)
3
- Version 0.5
3
+ Version 0.5.4
4
4
  */
5
5
  (function($) {
6
6
 
7
7
  var current = null;
8
8
 
9
9
  $.modal = function(el, options) {
10
+ $.modal.close(); // Close any open modals.
10
11
  var remove, target;
11
12
  this.$body = $('body');
12
13
  this.options = $.extend({}, $.modal.defaults, options);
14
+ this.options.doFade = !isNaN(parseInt(this.options.fadeDuration, 10));
13
15
  if (el.is('a')) {
14
16
  target = el.attr('href');
15
17
  //Select element by id from href
@@ -47,8 +49,16 @@
47
49
  constructor: $.modal,
48
50
 
49
51
  open: function() {
50
- this.block();
51
- this.show();
52
+ var m = this;
53
+ if(this.options.doFade) {
54
+ this.block();
55
+ setTimeout(function() {
56
+ m.show();
57
+ }, this.options.fadeDuration * this.options.fadeDelay);
58
+ } else {
59
+ this.block();
60
+ this.show();
61
+ }
52
62
  if (this.options.escapeClose) {
53
63
  $(document).on('keydown.modal', function(event) {
54
64
  if (event.which == 27) $.modal.close();
@@ -64,6 +74,7 @@
64
74
  },
65
75
 
66
76
  block: function() {
77
+ var initialOpacity = this.options.doFade ? 0 : this.options.opacity;
67
78
  this.$elm.trigger($.modal.BEFORE_BLOCK, [this._ctx()]);
68
79
  this.blocker = $('<div class="jquery-modal blocker"></div>').css({
69
80
  top: 0, right: 0, bottom: 0, left: 0,
@@ -71,14 +82,23 @@
71
82
  position: "fixed",
72
83
  zIndex: this.options.zIndex,
73
84
  background: this.options.overlay,
74
- opacity: this.options.opacity
85
+ opacity: initialOpacity
75
86
  });
76
87
  this.$body.append(this.blocker);
88
+ if(this.options.doFade) {
89
+ this.blocker.animate({opacity: this.options.opacity}, this.options.fadeDuration);
90
+ }
77
91
  this.$elm.trigger($.modal.BLOCK, [this._ctx()]);
78
92
  },
79
93
 
80
94
  unblock: function() {
81
- this.blocker.remove();
95
+ if(this.options.doFade) {
96
+ this.blocker.fadeOut(this.options.fadeDuration, function() {
97
+ this.remove();
98
+ });
99
+ } else {
100
+ this.blocker.remove();
101
+ }
82
102
  },
83
103
 
84
104
  show: function() {
@@ -89,13 +109,24 @@
89
109
  }
90
110
  this.$elm.addClass(this.options.modalClass + ' current');
91
111
  this.center();
92
- this.$elm.show().trigger($.modal.OPEN, [this._ctx()]);
112
+ if(this.options.doFade) {
113
+ this.$elm.fadeIn(this.options.fadeDuration);
114
+ } else {
115
+ this.$elm.show();
116
+ }
117
+ this.$elm.trigger($.modal.OPEN, [this._ctx()]);
93
118
  },
94
119
 
95
120
  hide: function() {
96
121
  this.$elm.trigger($.modal.BEFORE_CLOSE, [this._ctx()]);
97
122
  if (this.closeButton) this.closeButton.remove();
98
- this.$elm.removeClass('current').hide();
123
+ this.$elm.removeClass('current');
124
+
125
+ if(this.options.doFade) {
126
+ this.$elm.fadeOut(this.options.fadeDuration);
127
+ } else {
128
+ this.$elm.hide();
129
+ }
99
130
  this.$elm.trigger($.modal.CLOSE, [this._ctx()]);
100
131
  },
101
132
 
@@ -135,28 +166,11 @@
135
166
  if (!current) return;
136
167
  if (event) event.preventDefault();
137
168
  current.close();
169
+ var that = current.$elm;
138
170
  current = null;
171
+ return that;
139
172
  };
140
173
 
141
- $.modal.showSpinner = function(event) {
142
- if (!current) return;
143
- if (event) event.preventDefault();
144
- current.showSpinner();
145
- }
146
-
147
- $.modal.hideSpinner = function(event) {
148
- if (!current) return;
149
- if (event) event.preventDefault();
150
- current.hideSpinner();
151
- }
152
-
153
- $.modal.getWidget = function() {
154
- if (!current)
155
- return null;
156
- else
157
- return current.$elm;
158
- }
159
-
160
174
  $.modal.resize = function() {
161
175
  if (!current) return;
162
176
  current.resize();
@@ -172,7 +186,9 @@
172
186
  modalClass: "modal",
173
187
  spinnerHtml: null,
174
188
  showSpinner: true,
175
- showClose: true
189
+ showClose: true,
190
+ fadeDuration: null, // Number of milliseconds the fade animation takes.
191
+ fadeDelay: 1.0 // Point during the overlay's fade-in that the modal begins to fade in (.5 = 50%, 1.5 = 150%, etc.)
176
192
  };
177
193
 
178
194
  // Event constants
@@ -194,72 +210,10 @@
194
210
  return this;
195
211
  };
196
212
 
197
- // Automatically bind links with rel="modal:close" to, well, close the modal.
198
- $(document).on('click', 'a[rel="modal:close"]', $.modal.close);
199
- $(document).on('click', 'a[rel="modal:open"]', function(event) {
200
- event.preventDefault();
201
- $(this).modal();
202
- });
203
-
204
- // Automatically bind links with rel="modal:open:ajaxpost" to
205
- $(document).on('click', 'a[rel="modal:open:ajaxpost"]', function(event)
206
- {
207
- //ensure that our custom events will be received
208
- event.preventDefault();
209
-
210
- // show the dialog
211
- $(this).modal();
212
-
213
- // bind the event when the ajax call is completed
214
- $(this).bind($.modal.AJAX_COMPLETE, function() {
215
- // configure the submit handler
216
- $('form').submit(function(){
217
-
218
- // save the current form
219
- current_form = $(this);
220
-
221
- // show the spinner again
222
- $.modal.showSpinner();
223
-
224
- // send the ajax call
225
- $.ajax({
226
- type: this.method,
227
- url: this.action + '.json',
228
- data: $(this).serialize(),
229
- dataType: 'html',
230
- success: function(data)
231
- {
232
- // hide the sinner
233
- $.modal.hideSpinner();
234
-
235
- // close the dialog
236
- $.modal.close();
237
- },
238
- error: function(data)
239
- {
240
- // hide the sinner
241
- $.modal.hideSpinner();
242
-
243
- // remove the older error message
244
- current_form.find(".error").remove()
245
-
246
- // parse the result
247
- var obj = jQuery.parseJSON(data.responseText);
248
-
249
- $.each(obj.errors, function(key, value)
250
- {
251
-
252
- current_form.find("#"+ current_form.attr("id").split('_').pop()+ "_" + key).after('<span class="error">'+ value[0] + '</span>');
253
- });
254
- }
255
- });
256
- return false;
257
- });
258
- });
259
-
260
-
261
- // return false to prevent normal anchor action
262
- return false;
263
- });
264
-
213
+ // Automatically bind links with rel="modal:close" to, well, close the modal.
214
+ $(document).on('click.modal', 'a[rel="modal:close"]', $.modal.close);
215
+ $(document).on('click.modal', 'a[rel="modal:open"]', function(event) {
216
+ event.preventDefault();
217
+ $(this).modal();
218
+ });
265
219
  })(jQuery);
@@ -13,17 +13,17 @@
13
13
  -o-box-shadow: 0 0 10px #000;
14
14
  -ms-box-shadow: 0 0 10px #000;
15
15
  box-shadow: 0 0 10px #000;
16
- }
17
16
 
18
- .modal a.close-modal {
19
- position: absolute;
20
- top: -12.5px;
21
- right: -12.5px;
22
- display: block;
23
- width: 30px;
24
- height: 30px;
25
- text-indent: -9999px;
26
- background: url(close.png) no-repeat 0 0;
17
+ a.close-modal {
18
+ position: absolute;
19
+ top: -12.5px;
20
+ right: -12.5px;
21
+ display: block;
22
+ width: 30px;
23
+ height: 30px;
24
+ text-indent: -9999px;
25
+ background: image-url('close') no-repeat 0 0;
26
+ }
27
27
  }
28
28
 
29
29
  .modal-spinner {
@@ -35,7 +35,7 @@
35
35
  left: 50%;
36
36
  margin-right: -32px;
37
37
  margin-top: -32px;
38
- background: url(spinner.gif) #111 no-repeat center center;
38
+ background: image-url('spinner') #111 no-repeat center center;
39
39
  -webkit-border-radius: 8px;
40
40
  -moz-border-radius: 8px;
41
41
  -o-border-radius: 8px;
metadata CHANGED
@@ -1,22 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery-modal-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
5
- prerelease:
4
+ version: 0.0.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Dirk Eisenberg
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-11-15 00:00:00.000000000 Z
11
+ date: 2013-12-25 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: railties
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 3.2.0
22
20
  - - <
@@ -25,9 +23,8 @@ dependencies:
25
23
  type: :runtime
26
24
  prerelease: false
27
25
  version_requirements: !ruby/object:Gem::Requirement
28
- none: false
29
26
  requirements:
30
- - - ! '>='
27
+ - - '>='
31
28
  - !ruby/object:Gem::Version
32
29
  version: 3.2.0
33
30
  - - <
@@ -36,7 +33,6 @@ dependencies:
36
33
  - !ruby/object:Gem::Dependency
37
34
  name: thor
38
35
  requirement: !ruby/object:Gem::Requirement
39
- none: false
40
36
  requirements:
41
37
  - - ~>
42
38
  - !ruby/object:Gem::Version
@@ -44,7 +40,6 @@ dependencies:
44
40
  type: :runtime
45
41
  prerelease: false
46
42
  version_requirements: !ruby/object:Gem::Requirement
47
- none: false
48
43
  requirements:
49
44
  - - ~>
50
45
  - !ruby/object:Gem::Version
@@ -52,33 +47,29 @@ dependencies:
52
47
  - !ruby/object:Gem::Dependency
53
48
  name: jquery-ui-rails
54
49
  requirement: !ruby/object:Gem::Requirement
55
- none: false
56
50
  requirements:
57
- - - ! '>='
51
+ - - '>='
58
52
  - !ruby/object:Gem::Version
59
53
  version: '0'
60
54
  type: :runtime
61
55
  prerelease: false
62
56
  version_requirements: !ruby/object:Gem::Requirement
63
- none: false
64
57
  requirements:
65
- - - ! '>='
58
+ - - '>='
66
59
  - !ruby/object:Gem::Version
67
60
  version: '0'
68
61
  - !ruby/object:Gem::Dependency
69
62
  name: uuidtools
70
63
  requirement: !ruby/object:Gem::Requirement
71
- none: false
72
64
  requirements:
73
- - - ! '>='
65
+ - - '>='
74
66
  - !ruby/object:Gem::Version
75
67
  version: '0'
76
68
  type: :runtime
77
69
  prerelease: false
78
70
  version_requirements: !ruby/object:Gem::Requirement
79
- none: false
80
71
  requirements:
81
- - - ! '>='
72
+ - - '>='
82
73
  - !ruby/object:Gem::Version
83
74
  version: '0'
84
75
  description: The simplest possible modal for jQuery for the Rails 3.1+ asset pipeline
@@ -164,29 +155,29 @@ files:
164
155
  - vendor/assets/images/close.png
165
156
  - vendor/assets/images/spinner.gif
166
157
  - vendor/assets/javascripts/jquery.modal.js
167
- - vendor/assets/stylesheets/jquery.modal.css
158
+ - vendor/assets/stylesheets/jquery.modal.css.scss
168
159
  homepage: https://github.com/dei79/jquery-modal-rails
169
160
  licenses: []
161
+ metadata: {}
170
162
  post_install_message:
171
163
  rdoc_options: []
172
164
  require_paths:
173
165
  - lib
174
166
  required_ruby_version: !ruby/object:Gem::Requirement
175
- none: false
176
167
  requirements:
177
- - - ! '>='
168
+ - - '>='
178
169
  - !ruby/object:Gem::Version
179
170
  version: '0'
180
171
  required_rubygems_version: !ruby/object:Gem::Requirement
181
- none: false
182
172
  requirements:
183
- - - ! '>='
173
+ - - '>='
184
174
  - !ruby/object:Gem::Version
185
175
  version: 1.3.6
186
176
  requirements: []
187
177
  rubyforge_project:
188
- rubygems_version: 1.8.23
178
+ rubygems_version: 2.1.11
189
179
  signing_key:
190
- specification_version: 3
180
+ specification_version: 4
191
181
  summary: The simplest possible modal for jQuery for the Rails 3.1+ asset pipeline
192
182
  test_files: []
183
+ has_rdoc: