server-generated-popups 1.1.3 → 1.1.5
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 +4 -4
- data/README.md +13 -0
- data/app/assets/javascripts/popup.js +2 -0
- data/server-generated-popups.gemspec +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f44889fade94aaf392127e00315078e2c7cf9475
|
4
|
+
data.tar.gz: 1a356a0aba7c5995cded8dc644b47b0c5007cbec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdca7359f6e16bc0be9de36696a77fbe743195d08c5205e19b94eec62ca40988d3c0f4c48028bf47de6e1f26be0eb2fbdbadb32b988e55e537c2474c4f3515a6
|
7
|
+
data.tar.gz: 8dd1af1f7e0a366dabba8a81a56f27e5ae38a4c0cbd6ad13399f74e2dfdbac292c0d2b96261e2edd1bc3fca2ebd5918c61f1eec009f50d259ad217da961e832a
|
data/README.md
CHANGED
@@ -36,6 +36,7 @@ Override the size of a popup by passing these options (values in %):
|
|
36
36
|
Popup("<div>Hello</div>", {width: 60, fromTop: 20})
|
37
37
|
```
|
38
38
|
|
39
|
+
<br />
|
39
40
|
Raise a popup from the bottom of the screen:
|
40
41
|
|
41
42
|
```javascript
|
@@ -60,6 +61,18 @@ Sink the popup down through the bottom of the screen:
|
|
60
61
|
popup.hide('down')
|
61
62
|
```
|
62
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:
|
67
|
+
|
68
|
+
```javascript
|
69
|
+
$(document).on('popup:show', function (popup) {
|
70
|
+
$('.popup #close.button').on('click', function () {
|
71
|
+
popup.hide('down')
|
72
|
+
})
|
73
|
+
})
|
74
|
+
```
|
75
|
+
|
63
76
|
That's all I ever need from it. Do you need something else? Feel free to contribute.
|
64
77
|
|
65
78
|
## Credits
|
@@ -18,6 +18,8 @@ function Popup(html, options) {
|
|
18
18
|
|
19
19
|
this.show = function (direction) {
|
20
20
|
$('body').append(this.popupWindow)
|
21
|
+
$(document).trigger('popup:show', this)
|
22
|
+
|
21
23
|
startFrom = (direction == 'up') ? '150%' : '-50%'
|
22
24
|
move(startFrom, distanceFromTop)
|
23
25
|
return this;
|
@@ -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
|
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.
|
15
|
+
gem.version = "1.1.5"
|
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.
|
4
|
+
version: 1.1.5
|
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-
|
11
|
+
date: 2016-06-22 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
|
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: []
|