volt-bootbox 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +103 -12
- data/lib/volt/bootbox/version.rb +1 -1
- data/lib/volt/bootbox.rb +2 -13
- data/make/build +1 -1
- data/make/push +1 -1
- data/volt-bootbox.gemspec +1 -1
- 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: cc34a2a396a45dafa609c3619df44e71aad864a0
|
4
|
+
data.tar.gz: 7ecec7893adffeff764fbe8463f223065bb530a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7167d69336c9319c2d6890f32bfc5e72421d8d701144d204e18bfed3c5cd3d482ed79381145c1b202ad44e4c1fae1fb53e7a01a041dd9b829b99df323f9988e6
|
7
|
+
data.tar.gz: 20c0271ec1f4abcbcc83cfbfdc37b070016a2b291d63b870d6027ed4fc0b53152efc63104bcfccd097c899a2a2fec6a44f2dd2687915f7eb2fb1c31b7bf1b9e0
|
data/README.md
CHANGED
@@ -34,25 +34,51 @@ Next add volt-bootbox to the dependencies.rb file:
|
|
34
34
|
|
35
35
|
```component 'bootbox'```
|
36
36
|
|
37
|
+
The Opal/Ruby interface is largely consistent with the Javascript interface.
|
38
|
+
|
39
|
+
See http://bootboxjs.com/documentation.html for Javascript library documentation.
|
40
|
+
|
41
|
+
Where a method expects a single callback substitute a block for the JS function.
|
42
|
+
|
43
|
+
The value for a `callback:` keyword argument should be a Ruby proc.
|
44
|
+
|
45
|
+
Keyword arguments should preserve the JS camelcase (e.g. className:).
|
46
|
+
|
37
47
|
### Examples
|
38
48
|
|
39
49
|
```
|
40
50
|
$bootbox.alert('Hello world!') do
|
41
51
|
puts 'hello world acknowledged'
|
42
52
|
end
|
53
|
+
```
|
43
54
|
|
44
|
-
|
45
|
-
|
46
|
-
|
55
|
+
```
|
56
|
+
$bootbox.alert(
|
57
|
+
size: 'small',
|
58
|
+
title: 'Alert',
|
59
|
+
message: 'Hello world!',
|
60
|
+
callback: -> {puts 'hello world acknowledged'}
|
61
|
+
)
|
62
|
+
```
|
47
63
|
|
64
|
+
```
|
48
65
|
$bootbox.confirm('Are you sure?') do |result|
|
49
66
|
puts "user is #{result ? 'sure' : 'unsure'}"
|
50
67
|
end
|
68
|
+
```
|
51
69
|
|
52
|
-
|
53
|
-
|
70
|
+
```
|
71
|
+
$bootbox.confirm(
|
72
|
+
size: 'small',
|
73
|
+
title: 'Confirmation',
|
74
|
+
message: 'Are you sure?'
|
75
|
+
callback: ->(result) {
|
76
|
+
puts "user is #{result ? 'sure' : 'unsure'}"
|
77
|
+
}
|
54
78
|
end
|
79
|
+
```
|
55
80
|
|
81
|
+
```
|
56
82
|
$bootbox.prompt('What is your name?') do |result|
|
57
83
|
if result
|
58
84
|
puts "user's name is '#{result}'"
|
@@ -60,15 +86,80 @@ $bootbox.prompt('What is your name?') do |result|
|
|
60
86
|
puts "prompt dismissed"
|
61
87
|
end
|
62
88
|
end
|
89
|
+
```
|
63
90
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
91
|
+
```
|
92
|
+
$bootbox.prompt(
|
93
|
+
size: 'small',
|
94
|
+
title: 'Prompt',
|
95
|
+
message: 'What is your name?',
|
96
|
+
value: 'default name'),
|
97
|
+
callback: ->(result) {
|
98
|
+
if result
|
99
|
+
puts "user's name is '#{result}'"
|
100
|
+
else
|
101
|
+
puts "prompt dismissed"
|
102
|
+
}
|
103
|
+
)
|
104
|
+
```
|
71
105
|
|
106
|
+
```
|
107
|
+
$bootbox.dialog(
|
108
|
+
# required
|
109
|
+
message: "I am a custom dialog",
|
110
|
+
|
111
|
+
# optional - adds a header to the dialog and places this text in an h4
|
112
|
+
title: "Custom title",
|
113
|
+
|
114
|
+
# optional - allows the user to dismiss the dialog by hitting ESC
|
115
|
+
# which will call this proc
|
116
|
+
onEscape: -> { puts 'user press escape' },
|
117
|
+
|
118
|
+
# optional - whether the dialog should be shown immediately
|
119
|
+
show: true,
|
120
|
+
|
121
|
+
# optional - whether the dialog should be have a backdrop or not
|
122
|
+
backdrop: true,
|
123
|
+
|
124
|
+
# optional - whether to show a close button (default true)
|
125
|
+
closeButton: true,
|
126
|
+
|
127
|
+
# optional - whether to animate (default true)
|
128
|
+
animate: true,
|
129
|
+
|
130
|
+
# optional - an additional CSS class to apply to the Bootstrap dialog wrapper
|
131
|
+
className: "my-modal",
|
132
|
+
|
133
|
+
# optional - a hash of buttons to be shown in the dialog's footer
|
134
|
+
buttons: {
|
135
|
+
|
136
|
+
success: {
|
137
|
+
# optional - the button label
|
138
|
+
label: "Success!",
|
139
|
+
|
140
|
+
# optional - an additional CSS class to apply to the button
|
141
|
+
className: "btn-success",
|
142
|
+
|
143
|
+
# optional - call proc when button is clicked
|
144
|
+
callback: -> { puts 'success!' }
|
145
|
+
},
|
146
|
+
|
147
|
+
"Danger!": {
|
148
|
+
# no label is provided so the key is used as the button label
|
149
|
+
|
150
|
+
# optional - an additional CSS class to apply to the button
|
151
|
+
className: "btn-danger",
|
152
|
+
|
153
|
+
callback: -> { puts 'danger!' }
|
154
|
+
},
|
155
|
+
|
156
|
+
# if the only value supplied is a callback proc,
|
157
|
+
# the key is used as the button label and all
|
158
|
+
# other options are defaulted
|
159
|
+
|
160
|
+
"Warning!": -> { puts 'warning!}
|
161
|
+
}
|
162
|
+
)
|
72
163
|
```
|
73
164
|
|
74
165
|
`$bootbox` is a global variable. `Volt::Bootbox` may be substituted.
|
data/lib/volt/bootbox/version.rb
CHANGED
data/lib/volt/bootbox.rb
CHANGED
@@ -1,18 +1,7 @@
|
|
1
|
-
# If you need to require in code in the gem's app folder, keep in mind that
|
2
|
-
# the app is not on the load path when the gem is required. Use
|
3
|
-
# app/{gemname}/config/initializers/boot.rb to require in client or server
|
4
|
-
# code.
|
5
|
-
#
|
6
|
-
# Also, in volt apps, you typically use the lib folder in the
|
7
|
-
# app/{componentname} folder instead of this lib folder. This lib folder is
|
8
|
-
# for setting up gem code when Bundler.require is called. (or the gem is
|
9
|
-
# required.)
|
10
|
-
#
|
11
|
-
# If you need to configure volt in some way, you can add a Volt.configure block
|
12
|
-
# in this file.
|
13
|
-
|
14
1
|
require 'opal/bootbox'
|
15
2
|
|
3
|
+
# see http://bootboxjs.com/documentation.html
|
4
|
+
|
16
5
|
module Volt
|
17
6
|
module Bootbox
|
18
7
|
module_function
|
data/make/build
CHANGED
data/make/push
CHANGED
data/volt-bootbox.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
22
|
spec.required_ruby_version = '>= 2.1'
|
23
|
-
spec.add_dependency 'opal-bootbox', '~> 0.1.
|
23
|
+
spec.add_dependency 'opal-bootbox', '~> 0.1.2'
|
24
24
|
|
25
25
|
# spec.add_runtime_dependency "volt", "~> 0.9.5.pre3"
|
26
26
|
# spec.add_development_dependency 'rspec', '~> 3.2.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: volt-bootbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Colin Gunn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal-bootbox
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.1.
|
19
|
+
version: 0.1.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.1.
|
26
|
+
version: 0.1.2
|
27
27
|
description: Volt wrapper for Opal-Bootbox which in turn wraps Bootbox Javascript
|
28
28
|
library.
|
29
29
|
email:
|