conversation_forms 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/assets/javascripts/conversation_forms.coffee +50 -49
- data/lib/conversation_forms/version.rb +1 -1
- metadata +1 -3
- data/assets/javascripts/index.js +0 -4
- data/assets/stylesheets/application.css +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73a4b62ab78bfaf9f4d28fd29592c47b00bc9656
|
4
|
+
data.tar.gz: 0f619ec9115977f9fdbcbddf28b6cdf465a61f12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 385196147cad12498dbbb4112680dc0c3190950a7af9685f83f1dfa4b342a7cffe50916ac0b30876d4cd387665cd051466667e7c335d3b4c9b29cf2588484afa
|
7
|
+
data.tar.gz: 6a670fe7f67e0cbccd7eec8460d46ac086bc3f23a969764c6dc889eb3cbf9e00cd57c91651f166ff6175377a31be07f1711627b962fb0f6faa580af6594f6a85
|
data/Gemfile.lock
CHANGED
@@ -7,69 +7,70 @@ $ ->
|
|
7
7
|
window.wrapUp = ->
|
8
8
|
console.log('done')
|
9
9
|
convoForm.show()
|
10
|
-
convoForm.submit()
|
11
10
|
$('#convo-form-enter').prop('disabled', true)
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
<
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
12
|
+
converse = ->
|
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
25
|
|
26
|
-
|
26
|
+
inputIds = [];
|
27
27
|
|
28
|
-
|
29
|
-
|
28
|
+
$('#convo-form input[name]').each ->
|
29
|
+
inputIds.push($(this).attr('id'))
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
item = inputIds[sequenceIndex]
|
34
|
-
inputBox = $('#input-box')
|
35
|
-
|
36
|
-
|
37
|
-
openDialog = ->
|
31
|
+
endIndex = inputIds.length - 1
|
32
|
+
sequenceIndex = 0
|
38
33
|
item = inputIds[sequenceIndex]
|
39
|
-
$('
|
40
|
-
|
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);
|
34
|
+
inputBox = $('#input-box')
|
35
|
+
|
47
36
|
|
48
|
-
|
49
|
-
|
50
|
-
submitted = inputBox.val()
|
51
|
-
inputBox.val(null)
|
52
|
-
$('#' + item).val(submitted)
|
37
|
+
openDialog = ->
|
38
|
+
item = inputIds[sequenceIndex]
|
53
39
|
$('.convo-window .convo-chat-history').append('
|
54
|
-
<li class="
|
40
|
+
<li class="other">
|
55
41
|
<div class="msg">
|
56
|
-
<p>' +
|
42
|
+
<p>Please enter your ' + item + '</p>
|
57
43
|
</div>
|
58
44
|
</li>
|
59
45
|
')
|
60
46
|
$('.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
47
|
|
69
|
-
|
70
|
-
|
71
|
-
|
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()
|
72
68
|
|
69
|
+
inputBox.keyup (e) ->
|
70
|
+
if e.which is 13
|
71
|
+
$('#convo-form-enter').click()
|
73
72
|
|
73
|
+
openDialog(inputIds)
|
74
74
|
|
75
|
-
|
75
|
+
if document.getElementById('convo-form') != null ->
|
76
|
+
converse()
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: conversation_forms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sampson Crowley
|
@@ -241,8 +241,6 @@ files:
|
|
241
241
|
- README.md
|
242
242
|
- Rakefile
|
243
243
|
- assets/javascripts/conversation_forms.coffee
|
244
|
-
- assets/javascripts/index.js
|
245
|
-
- assets/stylesheets/application.css
|
246
244
|
- assets/stylesheets/conversation_forms.scss
|
247
245
|
- bin/test
|
248
246
|
- conversation_forms.gemspec
|
data/assets/javascripts/index.js
DELETED
@@ -1,15 +0,0 @@
|
|
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
|
-
*/
|