conversation_forms 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +34 -0
- data/lib/app/assets/javascripts/app.coffee +75 -0
- data/lib/app/assets/javascripts/index.js +4 -0
- data/lib/app/assets/stylesheets/application.scss +180 -0
- data/lib/conversation_forms/version.rb +3 -0
- data/lib/conversation_forms.rb +5 -0
- data/lib/tasks/conversation_forms_tasks.rake +4 -0
- metadata +88 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: de58c09642eb92d3382163d7f81edb3cc590eb8e
|
4
|
+
data.tar.gz: d5528e837d32068aba3deb2f9bd43d64c02c5f38
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1c8f24beaa579136c717bfdfac723e6bbfb09bcabc8c9a766758ac55f97e77418daa752ed14d069c697fb40801f2e4d8bc1570eb7f0385f728d35cd55e7d553f
|
7
|
+
data.tar.gz: 7e0cb16bc1a2e28582850d13acdf4529f65a00810916d660a7dbdc8b8c10b63321a84c1a64cc1f42387c626f0345d1c309e35f93daf552d6c4e8644f5e4bea27
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2016 Sampson Crowley
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# ConversationForms
|
2
|
+
Short description and motivation.
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
How to use my plugin.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'conversation_forms'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
```bash
|
16
|
+
$ bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
```bash
|
21
|
+
$ gem install conversation_forms
|
22
|
+
```
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
Contribution directions go here.
|
26
|
+
|
27
|
+
## License
|
28
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'ConversationForms'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
require 'bundler/gem_tasks'
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'lib'
|
28
|
+
t.libs << 'test'
|
29
|
+
t.pattern = 'test/**/*_test.rb'
|
30
|
+
t.verbose = false
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
task default: :test
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# Place all the behaviors and hooks related to the matching controller here.
|
2
|
+
# All this logic will automatically be available in application.js.
|
3
|
+
# You can use CoffeeScript in this file: http://coffeescript.org/
|
4
|
+
|
5
|
+
|
6
|
+
$ ->
|
7
|
+
window.wrapUp = ->
|
8
|
+
console.log('done')
|
9
|
+
convoForm.show()
|
10
|
+
convoForm.submit()
|
11
|
+
$('#convo-form-enter').prop('disabled', true)
|
12
|
+
|
13
|
+
doc = $('body')
|
14
|
+
convoForm = $('#convo-form')
|
15
|
+
convoForm.hide()
|
16
|
+
doc.append("""
|
17
|
+
<div class="convo-window">
|
18
|
+
<ol class="convo-chat-history">
|
19
|
+
</ol>
|
20
|
+
<input id="input-box" class="input-box" placeholder="Type your answer here ...">
|
21
|
+
<button id="convo-form-enter">Next</button>
|
22
|
+
</div>
|
23
|
+
"""
|
24
|
+
)
|
25
|
+
|
26
|
+
inputIds = [];
|
27
|
+
|
28
|
+
$('.convo input[name]').each ->
|
29
|
+
inputIds.push($(this).attr('id'))
|
30
|
+
|
31
|
+
endIndex = inputIds.length - 1
|
32
|
+
sequenceIndex = 0
|
33
|
+
item = inputIds[sequenceIndex]
|
34
|
+
inputBox = $('#input-box')
|
35
|
+
|
36
|
+
|
37
|
+
openDialog = ->
|
38
|
+
item = inputIds[sequenceIndex]
|
39
|
+
$('.convo-window .convo-chat-history').append('
|
40
|
+
<li class="other">
|
41
|
+
<div class="msg">
|
42
|
+
<p>Please enter your ' + item + '</p>
|
43
|
+
</div>
|
44
|
+
</li>
|
45
|
+
')
|
46
|
+
$('.convo-window .convo-chat-history').scrollTop($('.convo-window .convo-chat-history')[0].scrollHeight);
|
47
|
+
|
48
|
+
$('#convo-form-enter').click ->
|
49
|
+
if sequenceIndex <= endIndex
|
50
|
+
submitted = inputBox.val()
|
51
|
+
inputBox.val(null)
|
52
|
+
$('#' + item).val(submitted)
|
53
|
+
$('.convo-window .convo-chat-history').append('
|
54
|
+
<li class="self">
|
55
|
+
<div class="msg">
|
56
|
+
<p>' + submitted + '</p>
|
57
|
+
</div>
|
58
|
+
</li>
|
59
|
+
')
|
60
|
+
$('.convo-window .convo-chat-history').scrollTop($('.convo-window .convo-chat-history')[0].scrollHeight);
|
61
|
+
sequenceIndex++
|
62
|
+
if sequenceIndex == endIndex
|
63
|
+
$('#convo-form-enter').html 'submit'
|
64
|
+
if sequenceIndex > endIndex
|
65
|
+
wrapUp()
|
66
|
+
else
|
67
|
+
openDialog()
|
68
|
+
|
69
|
+
inputBox.keyup (e) ->
|
70
|
+
if e.which is 13
|
71
|
+
$('#convo-form-enter').click()
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
openDialog(inputIds)
|
@@ -0,0 +1,180 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
16
|
+
|
17
|
+
*{
|
18
|
+
box-sizing: border-box;
|
19
|
+
}
|
20
|
+
|
21
|
+
.convo-window{
|
22
|
+
display: flex;
|
23
|
+
width: 100%;
|
24
|
+
max-width: 500px;
|
25
|
+
height: 500px;
|
26
|
+
border-radius: 4px;
|
27
|
+
border: 1px solid #ccc;
|
28
|
+
box-shadow: -1px 2px 10px #999;
|
29
|
+
background: #c4d4e9;
|
30
|
+
padding: 20px;
|
31
|
+
flex-flow: column nowrap;
|
32
|
+
|
33
|
+
.convo-chat-history {
|
34
|
+
flex: 1;
|
35
|
+
padding: 10px 0;
|
36
|
+
overflow-y: scroll;
|
37
|
+
overflow-x: hidden;
|
38
|
+
list-style: none;
|
39
|
+
background: none;
|
40
|
+
margin: 0;
|
41
|
+
margin-bottom: 15px;
|
42
|
+
flex-flow: column nowrap;
|
43
|
+
justify-content: flex-end;
|
44
|
+
}
|
45
|
+
|
46
|
+
.input-box {
|
47
|
+
height: 30px;
|
48
|
+
width: 100%;
|
49
|
+
color: #666;
|
50
|
+
font-size: 16px;
|
51
|
+
padding: 4px 15px 4px 30px;
|
52
|
+
border: 1px solid #C0C0BA;
|
53
|
+
font-weight: 400;
|
54
|
+
border-top-right-radius: 10px;
|
55
|
+
border-top-left-radius: 10px;
|
56
|
+
overflow: hidden;
|
57
|
+
resize: none;
|
58
|
+
box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.3);
|
59
|
+
transition: all 0.4s cubic-bezier(0.565, -0.26, 0.255, 1.41);
|
60
|
+
outline: none;
|
61
|
+
}
|
62
|
+
|
63
|
+
.other .msg {
|
64
|
+
border-top-left-radius: 0px;
|
65
|
+
box-shadow: -1px 2px 0px #c1cbcd;
|
66
|
+
}
|
67
|
+
.other:before {
|
68
|
+
content: "";
|
69
|
+
position: relative;
|
70
|
+
top: 0px;
|
71
|
+
right: 0px;
|
72
|
+
left: 0px;
|
73
|
+
width: 0px;
|
74
|
+
height: 0px;
|
75
|
+
border: 5px solid #efefef;
|
76
|
+
border-left-color: transparent;
|
77
|
+
border-bottom-color: transparent;
|
78
|
+
|
79
|
+
}
|
80
|
+
|
81
|
+
.self {
|
82
|
+
justify-content: flex-end;
|
83
|
+
align-items: flex-end;
|
84
|
+
}
|
85
|
+
.self .msg {
|
86
|
+
border-bottom-right-radius: 0px;
|
87
|
+
box-shadow: 1px 2px 0px #c1cbcd;
|
88
|
+
}
|
89
|
+
.self:after {
|
90
|
+
content: "";
|
91
|
+
position: relative;
|
92
|
+
display: inline-block;
|
93
|
+
float: right;
|
94
|
+
bottom: 0px;
|
95
|
+
right: 0px;
|
96
|
+
width: 0px;
|
97
|
+
height: 0px;
|
98
|
+
border: 5px solid #eef8ff;
|
99
|
+
border-right-color: transparent;
|
100
|
+
border-top-color: transparent;
|
101
|
+
box-shadow: 0px 2px 0px #c1cbcd;
|
102
|
+
}
|
103
|
+
|
104
|
+
.msg {
|
105
|
+
background: #efefef;
|
106
|
+
min-width: 50px;
|
107
|
+
padding: 10px;
|
108
|
+
border-radius: 2px;
|
109
|
+
word-break: break-all;
|
110
|
+
}
|
111
|
+
.msg p {
|
112
|
+
font-size: 16px;
|
113
|
+
margin: 0 0 2px 0;
|
114
|
+
color: #777;
|
115
|
+
transition: all .2s ease;
|
116
|
+
}
|
117
|
+
.convo-chat-history li {
|
118
|
+
padding: 0.5rem;
|
119
|
+
overflow: hidden;
|
120
|
+
display: flex;
|
121
|
+
}
|
122
|
+
|
123
|
+
/* R E S P O N S I V E C O N F I G U R A T I O N */
|
124
|
+
|
125
|
+
@media screen and (max-width: 750px) {
|
126
|
+
::-webkit-scrollbar {
|
127
|
+
display: none;
|
128
|
+
}
|
129
|
+
.msg p {
|
130
|
+
font-size: 14px;
|
131
|
+
}
|
132
|
+
}
|
133
|
+
@media screen and (max-width: 550px) {
|
134
|
+
.msg p {
|
135
|
+
max-width: 250px;
|
136
|
+
}
|
137
|
+
.msg img {
|
138
|
+
width: 200px;
|
139
|
+
}
|
140
|
+
}
|
141
|
+
}
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
@-webkit-keyframes pulse {
|
149
|
+
from { opacity: 0; }
|
150
|
+
to { opacity: 0.5; }
|
151
|
+
}
|
152
|
+
|
153
|
+
::-webkit-scrollbar {
|
154
|
+
min-width: 12px;
|
155
|
+
width: 12px;
|
156
|
+
max-width: 12px;
|
157
|
+
min-height: 12px;
|
158
|
+
height: 12px;
|
159
|
+
max-height: 12px;
|
160
|
+
}
|
161
|
+
|
162
|
+
::-webkit-scrollbar-thumb {
|
163
|
+
background: rgba(255,255,255,0.2);
|
164
|
+
border: none;
|
165
|
+
border-radius: 100px;
|
166
|
+
border: solid 3px #252C33;
|
167
|
+
}
|
168
|
+
|
169
|
+
::-webkit-scrollbar-thumb:hover {
|
170
|
+
background: rgba(255,255,255,0.1);
|
171
|
+
}
|
172
|
+
|
173
|
+
::-webkit-scrollbar-thumb:active {
|
174
|
+
background: rgba(255,255,255,0.1);
|
175
|
+
}
|
176
|
+
|
177
|
+
::-webkit-scrollbar-button {
|
178
|
+
display: block;
|
179
|
+
height: 26px;
|
180
|
+
}
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: conversation_forms
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sampson Crowley
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-12-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 5.0.0
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 5.0.0.1
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 5.0.0
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 5.0.0.1
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: sqlite3
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
description: conversation_forms allows you to create a form that runs as a chat conversation
|
48
|
+
for the ultimate user experience
|
49
|
+
email:
|
50
|
+
- sampsonsprojects@gmail.com
|
51
|
+
executables: []
|
52
|
+
extensions: []
|
53
|
+
extra_rdoc_files: []
|
54
|
+
files:
|
55
|
+
- MIT-LICENSE
|
56
|
+
- README.md
|
57
|
+
- Rakefile
|
58
|
+
- lib/app/assets/javascripts/app.coffee
|
59
|
+
- lib/app/assets/javascripts/index.js
|
60
|
+
- lib/app/assets/stylesheets/application.scss
|
61
|
+
- lib/conversation_forms.rb
|
62
|
+
- lib/conversation_forms/version.rb
|
63
|
+
- lib/tasks/conversation_forms_tasks.rake
|
64
|
+
homepage: https://github.com/SampsonCrowley/conversation_forms
|
65
|
+
licenses:
|
66
|
+
- MIT
|
67
|
+
metadata: {}
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options: []
|
70
|
+
require_paths:
|
71
|
+
- lib
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
requirements: []
|
83
|
+
rubyforge_project:
|
84
|
+
rubygems_version: 2.6.8
|
85
|
+
signing_key:
|
86
|
+
specification_version: 4
|
87
|
+
summary: Create the ultimate form.
|
88
|
+
test_files: []
|