fdbq-rails 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/fdbq/feedback_controller.rb +7 -2
- data/app/models/fdbq/feedback.rb +2 -0
- data/lib/fdbq/plugin.rb +2 -0
- data/lib/fdbq/rails/engine.rb +3 -1
- data/lib/fdbq/rails/version.rb +1 -1
- data/lib/generators/fdbq/rails/install_generator.rb +4 -0
- data/lib/generators/templates/fdbq.en.yml +4 -0
- data/lib/generators/templates/fdbq.rb +8 -0
- data/lib/generators/templates/fdbq.yml +1 -0
- data/vendor/{assets/javascripts → node_modules}/@softserveopensource/fdbq/README.md +1 -0
- data/vendor/{assets/javascripts → node_modules}/@softserveopensource/fdbq/index.js +20 -4
- data/vendor/node_modules/@softserveopensource/fdbq/package.json +62 -0
- data/vendor/{assets/javascripts → node_modules}/@softserveopensource/fdbq/theme.css +51 -0
- metadata +7 -7
- data/app/views/fdbq/feedback/create.json.jbuilder +0 -7
- data/vendor/assets/javascripts/@softserveopensource/fdbq/package.json +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df314fdffb6053f9ca40c0dcac86002851f1f4fe8ab88991902b6a950f247df1
|
4
|
+
data.tar.gz: 5762c0e77c2d988c6e5b48952238c6850955b1a740246f20dfb744f95cc96e78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cda69e3b03688976fa0a82acbbf0af8af3541cf9206778fffcc7ef4b06ea26d45278e645bf6548522d2c97bb910bc2f68eb6f9bde53edbdc331395e10016940c
|
7
|
+
data.tar.gz: bf1e5394c62c63ba91c3a7dcd798519d6158083fa862ddea1d2c82b2865f10e9cf70d89c613d28182b8a1b74ccd097f2c71cd81d57dfc81a46e714b9796207d7
|
@@ -2,12 +2,17 @@ module Fdbq
|
|
2
2
|
class FeedbackController < Fdbq::Rails.controller_parent.constantize
|
3
3
|
skip_before_action :verify_authenticity_token, only: :create
|
4
4
|
|
5
|
+
self.instance_eval(&Fdbq::Plugin.instance.controller_extensions) if Fdbq::Plugin.instance.controller_extensions
|
6
|
+
|
5
7
|
def create
|
6
8
|
@feedback = Fdbq::Feedback.new(fields: permitted_params.to_h)
|
7
|
-
|
9
|
+
|
10
|
+
if @feedback.save
|
11
|
+
flash.now[:notice] = I18n.t('fdbq.events.created')
|
12
|
+
end
|
8
13
|
|
9
14
|
respond_to do |format|
|
10
|
-
format.json {
|
15
|
+
format.json { head(@feedback.persisted? ? 201 : 422) }
|
11
16
|
end
|
12
17
|
end
|
13
18
|
|
data/app/models/fdbq/feedback.rb
CHANGED
data/lib/fdbq/plugin.rb
CHANGED
data/lib/fdbq/rails/engine.rb
CHANGED
@@ -5,13 +5,15 @@ module Fdbq
|
|
5
5
|
engine_name 'fdbq'
|
6
6
|
|
7
7
|
initializer "fdbq.assets.precompile" do |app|
|
8
|
-
app.config.assets.precompile += %w( fdbq.* )
|
8
|
+
app.config.assets.precompile += %w( *fdbq.* )
|
9
9
|
end
|
10
10
|
|
11
11
|
initializer "fdbq.engine" do |app|
|
12
12
|
ActionController::Base.send :include, Fdbq::Rails::Helpers
|
13
13
|
ActionView::Base.send :include, Fdbq::Rails::Helpers
|
14
14
|
end
|
15
|
+
|
16
|
+
config.assets.paths << File.expand_path("../../../../vendor/node_modules", __FILE__)
|
15
17
|
end
|
16
18
|
end
|
17
19
|
end
|
data/lib/fdbq/rails/version.rb
CHANGED
@@ -2,4 +2,12 @@ Fdbq.configure do |config|
|
|
2
2
|
config.config_file_path = Rails.root.join('config', 'fdbq.yml').to_s
|
3
3
|
|
4
4
|
config.param_key = :feedback
|
5
|
+
|
6
|
+
# config.controller_extensions do
|
7
|
+
# # extend controller
|
8
|
+
# end
|
9
|
+
|
10
|
+
# config.model_extensions do
|
11
|
+
# # extend model
|
12
|
+
# end
|
5
13
|
end
|
@@ -66,6 +66,7 @@
|
|
66
66
|
| ------------------------ | -------- | ------------------- | -------------------------------- | --------- | ----------------------------- |
|
67
67
|
| `mountNode` | No | String | |`"body" ` | Root node to mount lugin into |
|
68
68
|
| `placement` | Yes | String | `bottom`, `top`, `left`, `right` | | Button placement on a screen |
|
69
|
+
| `appearance` | No | String | `fade`, `slide-up`, `slide-down` | `fade` | Modal appearance animation |
|
69
70
|
| `modal` | No | Object | | | Modal settings |
|
70
71
|
| `submit` | Yes | Object | | `func` | Modal submit handler. Default handler submit on `url` |
|
71
72
|
| `subHeader` | No | String | | | Modal body sub-header |
|
@@ -292,7 +292,7 @@
|
|
292
292
|
function FdbqModal(instance) {
|
293
293
|
var overlay = document.createElement("div");
|
294
294
|
var node = document.createElement("div");
|
295
|
-
node.className = "fdbq-modal";
|
295
|
+
node.className = "fdbq-modal fdbq-"+(instance.config.appearance || "fade");
|
296
296
|
node.id = instance.modalContainerSelector;
|
297
297
|
|
298
298
|
renderModalBody(node, instance);
|
@@ -325,10 +325,21 @@
|
|
325
325
|
var closeButton = document.getElementById(this.modalCloseSelector);
|
326
326
|
var submitButton = document.getElementById(this.modalSubmitSelector);
|
327
327
|
|
328
|
-
if(button)
|
329
|
-
|
330
|
-
|
328
|
+
if(button) {
|
329
|
+
button.removeEventListener("click", this.onActionClick);
|
330
|
+
button.addEventListener("click", this.onActionClick.bind(this));
|
331
|
+
}
|
332
|
+
if(closeButton) {
|
333
|
+
closeButton.removeEventListener("click", this.onCloseClick);
|
334
|
+
closeButton.addEventListener("click", this.onCloseClick.bind(this));
|
335
|
+
}
|
336
|
+
if(submitButton) {
|
337
|
+
submitButton.removeEventListener("click", this.onSubmitClick);
|
338
|
+
submitButton.addEventListener("click", this.onSubmitClick.bind(this));
|
339
|
+
}
|
331
340
|
|
341
|
+
document.removeEventListener("keydown", this.handleModalKeyboardNavigation);
|
342
|
+
document.addEventListener("keydown", this.handleModalKeyboardNavigation.bind(this));
|
332
343
|
};
|
333
344
|
|
334
345
|
this.mountNode = function() { return document.querySelector(this.config.mountNode) || document.body; };
|
@@ -378,6 +389,11 @@
|
|
378
389
|
|
379
390
|
return true;
|
380
391
|
};
|
392
|
+
this.handleModalKeyboardNavigation = function(event) {
|
393
|
+
if(event.keyCode === 27 || event.key === "Escape") {
|
394
|
+
this.onCloseClick();
|
395
|
+
}
|
396
|
+
};
|
381
397
|
|
382
398
|
// props;
|
383
399
|
this.config = config || {};
|
@@ -0,0 +1,62 @@
|
|
1
|
+
{
|
2
|
+
"_from": "@softserveopensource/fdbq@0.1.1",
|
3
|
+
"_id": "@softserveopensource/fdbq@0.1.1",
|
4
|
+
"_inBundle": false,
|
5
|
+
"_integrity": "sha512-LkSCEEVJVL9J7bKy/8yxe4b093qvLi6US+/koferhO/HHcOxpcortbtxyRIr5BPybOQvaPdpCBD1CZVNla0O+g==",
|
6
|
+
"_location": "/@softserveopensource/fdbq",
|
7
|
+
"_phantomChildren": {},
|
8
|
+
"_requested": {
|
9
|
+
"type": "version",
|
10
|
+
"registry": true,
|
11
|
+
"raw": "@softserveopensource/fdbq@0.1.1",
|
12
|
+
"name": "@softserveopensource/fdbq",
|
13
|
+
"escapedName": "@softserveopensource%2ffdbq",
|
14
|
+
"scope": "@softserveopensource",
|
15
|
+
"rawSpec": "0.1.1",
|
16
|
+
"saveSpec": null,
|
17
|
+
"fetchSpec": "0.1.1"
|
18
|
+
},
|
19
|
+
"_requiredBy": [
|
20
|
+
"#USER",
|
21
|
+
"/"
|
22
|
+
],
|
23
|
+
"_resolved": "https://registry.npmjs.org/@softserveopensource/fdbq/-/fdbq-0.1.1.tgz",
|
24
|
+
"_shasum": "4a50eb16c812055ed2eeb3fc6f588189dd44e026",
|
25
|
+
"_spec": "@softserveopensource/fdbq@0.1.1",
|
26
|
+
"_where": "/Users/rsolomud/dev/rails/fdbq-rails/vendor",
|
27
|
+
"author": {
|
28
|
+
"name": "SoftServe OpenSource"
|
29
|
+
},
|
30
|
+
"bugs": {
|
31
|
+
"url": "https://github.com/SoftServeInc/fdbq/issues"
|
32
|
+
},
|
33
|
+
"bundleDependencies": false,
|
34
|
+
"deprecated": false,
|
35
|
+
"description": "A simple lightweight survey for your website",
|
36
|
+
"devDependencies": {
|
37
|
+
"jest": "^24.9.0",
|
38
|
+
"serve": "^11.3.0"
|
39
|
+
},
|
40
|
+
"directories": {
|
41
|
+
"example": "examples"
|
42
|
+
},
|
43
|
+
"files": [
|
44
|
+
"index.js",
|
45
|
+
"theme.css"
|
46
|
+
],
|
47
|
+
"homepage": "https://github.com/SoftServeInc/fdbq#readme",
|
48
|
+
"keywords": [
|
49
|
+
"Feedback"
|
50
|
+
],
|
51
|
+
"license": "MIT",
|
52
|
+
"main": "index.js",
|
53
|
+
"name": "@softserveopensource/fdbq",
|
54
|
+
"repository": {
|
55
|
+
"url": "git+https://github.com/SoftServeInc/fdbq.git",
|
56
|
+
"type": "git"
|
57
|
+
},
|
58
|
+
"scripts": {
|
59
|
+
"test": "jest"
|
60
|
+
},
|
61
|
+
"version": "0.1.1"
|
62
|
+
}
|
@@ -1,3 +1,38 @@
|
|
1
|
+
@keyframes fdbq-fadeIn {
|
2
|
+
from {
|
3
|
+
opacity: 0;
|
4
|
+
}
|
5
|
+
|
6
|
+
to {
|
7
|
+
opacity: 1;
|
8
|
+
}
|
9
|
+
}
|
10
|
+
|
11
|
+
@keyframes fdbq-slide-up {
|
12
|
+
from {
|
13
|
+
margin-top: 100%;
|
14
|
+
}
|
15
|
+
|
16
|
+
to {
|
17
|
+
margin-top: 40px;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
@keyframes fdbq-slide-down {
|
22
|
+
from {
|
23
|
+
margin-top: -100%;
|
24
|
+
}
|
25
|
+
|
26
|
+
to {
|
27
|
+
margin-top: 40px;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
@keyframes fdbq-action-hover {
|
32
|
+
0% { transform: scale(1); }
|
33
|
+
50% { transform: scale(.7); }
|
34
|
+
100% { transform: scale(1); }
|
35
|
+
}
|
1
36
|
|
2
37
|
.fdbq-modal-overlay {
|
3
38
|
position: fixed;
|
@@ -21,6 +56,18 @@
|
|
21
56
|
background-color: #ffffff;
|
22
57
|
}
|
23
58
|
|
59
|
+
.fdbq-modal.fdbq-fade {
|
60
|
+
animation: fdbq-fadeIn .4s;
|
61
|
+
}
|
62
|
+
|
63
|
+
.fdbq-modal.fdbq-slide-up {
|
64
|
+
animation: fdbq-slide-up .4s;
|
65
|
+
}
|
66
|
+
|
67
|
+
.fdbq-modal.fdbq-slide-down {
|
68
|
+
animation: fdbq-slide-down .4s;
|
69
|
+
}
|
70
|
+
|
24
71
|
.fdbq-modal .fdbq-modal-head {
|
25
72
|
display: flex;
|
26
73
|
margin: 0;
|
@@ -173,6 +220,10 @@
|
|
173
220
|
transition: background-color .5s;
|
174
221
|
}
|
175
222
|
|
223
|
+
.fdbq-toggle:hover .fdbq-icon-action, .fdbq-toggle:focus .fdbq-icon-action {
|
224
|
+
animation: fdbq-action-hover 2s infinite;
|
225
|
+
}
|
226
|
+
|
176
227
|
.fdbq-toggle .fdbq-icon-action {
|
177
228
|
display: inline-block;
|
178
229
|
width: 45px;
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fdbq-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SoftServe OpenSource
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -73,7 +73,6 @@ files:
|
|
73
73
|
- app/assets/stylesheets/fdbq.css
|
74
74
|
- app/controllers/fdbq/feedback_controller.rb
|
75
75
|
- app/models/fdbq/feedback.rb
|
76
|
-
- app/views/fdbq/feedback/create.json.jbuilder
|
77
76
|
- config/routes.rb
|
78
77
|
- lib/fdbq-rails.rb
|
79
78
|
- lib/fdbq/fdbq.rb
|
@@ -87,12 +86,13 @@ files:
|
|
87
86
|
- lib/fdbq/version.rb
|
88
87
|
- lib/generators/fdbq/rails/install_generator.rb
|
89
88
|
- lib/generators/templates/create_fdbq_feedback.rb
|
89
|
+
- lib/generators/templates/fdbq.en.yml
|
90
90
|
- lib/generators/templates/fdbq.rb
|
91
91
|
- lib/generators/templates/fdbq.yml
|
92
|
-
- vendor/
|
93
|
-
- vendor/
|
94
|
-
- vendor/
|
95
|
-
- vendor/
|
92
|
+
- vendor/node_modules/@softserveopensource/fdbq/README.md
|
93
|
+
- vendor/node_modules/@softserveopensource/fdbq/index.js
|
94
|
+
- vendor/node_modules/@softserveopensource/fdbq/package.json
|
95
|
+
- vendor/node_modules/@softserveopensource/fdbq/theme.css
|
96
96
|
homepage: https://github.com/SoftServeInc/fdbq-rails
|
97
97
|
licenses:
|
98
98
|
- MIT
|
@@ -1,33 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "@softserveopensource/fdbq",
|
3
|
-
"version": "0.1.0",
|
4
|
-
"description": "A simple lightweight survey for your website",
|
5
|
-
"main": "index.js",
|
6
|
-
"author": "SoftServe OpenSource",
|
7
|
-
"license": "MIT",
|
8
|
-
"homepage": "https://github.com/SoftServeInc/fdbq#readme",
|
9
|
-
"scripts": {
|
10
|
-
"test": "jest"
|
11
|
-
},
|
12
|
-
"devDependencies": {
|
13
|
-
"jest": "^24.9.0",
|
14
|
-
"serve": "^11.3.0"
|
15
|
-
},
|
16
|
-
"files": [
|
17
|
-
"index.js",
|
18
|
-
"theme.css"
|
19
|
-
],
|
20
|
-
"repository": {
|
21
|
-
"url": "git+https://github.com/SoftServeInc/fdbq.git",
|
22
|
-
"type": "git"
|
23
|
-
},
|
24
|
-
"bugs": {
|
25
|
-
"url": "https://github.com/SoftServeInc/fdbq/issues"
|
26
|
-
},
|
27
|
-
"directories": {
|
28
|
-
"example": "examples"
|
29
|
-
},
|
30
|
-
"keywords": [
|
31
|
-
"Feedback"
|
32
|
-
]
|
33
|
-
}
|