server-generated-popups 1.1.5 → 1.1.6

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: f44889fade94aaf392127e00315078e2c7cf9475
4
- data.tar.gz: 1a356a0aba7c5995cded8dc644b47b0c5007cbec
3
+ metadata.gz: 7c2036800e7ea8636eb0c470c6ff5920a08488bd
4
+ data.tar.gz: 926185300b09af0d11835029cfe281073cc24b64
5
5
  SHA512:
6
- metadata.gz: cdca7359f6e16bc0be9de36696a77fbe743195d08c5205e19b94eec62ca40988d3c0f4c48028bf47de6e1f26be0eb2fbdbadb32b988e55e537c2474c4f3515a6
7
- data.tar.gz: 8dd1af1f7e0a366dabba8a81a56f27e5ae38a4c0cbd6ad13399f74e2dfdbac292c0d2b96261e2edd1bc3fca2ebd5918c61f1eec009f50d259ad217da961e832a
6
+ metadata.gz: 59d3840643ef016cad8b468eae2d98c6ee5e4441bf55ea0656ddcec9b7ed41fd2783a4121497a6e026f250d9a3f6e38d9d07599b7edf5c4c70ef35e383bb407c
7
+ data.tar.gz: bc19ce0c8419bb67508fddd2457d5cd8b0e3155fe88c12fb09ae8f959af93b409e1610c08c321c21d66e963e65bc06f11d4e40ddc1df88b9417433b1b9133810
data/README.md CHANGED
@@ -61,14 +61,13 @@ Sink the popup down through the bottom of the screen:
61
61
  popup.hide('down')
62
62
  ```
63
63
 
64
- ### Events
65
-
66
- Say, you have buttons in your popup and want to handle clicks on them. Well, my usual advice is to go for `<%= link_to 'Button', remote: true %>` and a [JavaScript response](https://signalvnoise.com/posts/3697-server-generated-javascript-responses), but sometimes you want to do something right there on the front-end. In such case, hook up to `popup:show` event:
64
+ If you need to do something after the popup slides onto the screen — play an animation and attach a handler to the "Close" button — pass a second argument to the `show` method:
67
65
 
68
66
  ```javascript
69
- $(document).on('popup:show', function (popup) {
70
- $('.popup #close.button').on('click', function () {
71
- popup.hide('down')
67
+ editInvoiceDetails = Popup("<%=j render @invoice %>").show('up', function () {
68
+ blink($('.heading'))
69
+ $(this).on('click', '#close.button', function () {
70
+ editInvoiceDetails.hide('down')
72
71
  })
73
72
  })
74
73
  ```
@@ -16,12 +16,10 @@ function Popup(html, options) {
16
16
  this.popupWindow.animate({top: to}, callback)
17
17
  }
18
18
 
19
- this.show = function (direction) {
19
+ this.show = function (direction, callback) {
20
20
  $('body').append(this.popupWindow)
21
- $(document).trigger('popup:show', this)
22
-
23
21
  startFrom = (direction == 'up') ? '150%' : '-50%'
24
- move(startFrom, distanceFromTop)
22
+ move(startFrom, distanceFromTop, callback)
25
23
  return this;
26
24
  }
27
25
  this.hide = function (direction) {
@@ -4,7 +4,7 @@ Gem::Specification.new do |gem|
4
4
  gem.authors = ["Anton Khamets"]
5
5
  gem.email = ["colorfulfool@gmail.com"]
6
6
  gem.summary = %q{Show a popup with one line of code}
7
- gem.summary = %q{Show a popup with one line of code. Perfect for format: :js responses, and just in JS too.}
7
+ gem.summary = %q{Show a popup with one line of code. Perfect for format.js responses, and just in JS too.}
8
8
  gem.homepage = "https://github.com/colorfulfool/rails-popup"
9
9
 
10
10
  gem.files = `git ls-files`.split($\)
@@ -12,5 +12,5 @@ Gem::Specification.new do |gem|
12
12
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
13
13
  gem.name = "server-generated-popups"
14
14
  gem.require_paths = ["lib"]
15
- gem.version = "1.1.5"
15
+ gem.version = "1.1.6"
16
16
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: server-generated-popups
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Khamets
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-22 00:00:00.000000000 Z
11
+ date: 2016-06-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -45,6 +45,6 @@ rubyforge_project:
45
45
  rubygems_version: 2.5.1
46
46
  signing_key:
47
47
  specification_version: 4
48
- summary: 'Show a popup with one line of code. Perfect for format: :js responses, and
49
- just in JS too.'
48
+ summary: Show a popup with one line of code. Perfect for format.js responses, and
49
+ just in JS too.
50
50
  test_files: []