Skip to content
This repository has been archived by the owner on Dec 8, 2018. It is now read-only.

Commit

Permalink
feat: options as clickable and buttons as buttons (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Green authored and germanattanasio committed Sep 24, 2018
1 parent 53e3e8a commit 33fb887
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
5 changes: 5 additions & 0 deletions ui/css/conversation.css
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,11 @@ input#user-input:-moz-placeholder {
background: #00B4A0;
}

.options-list {
cursor: pointer;
text-decoration: underline;
}

.option-buttons {
background-color: #8d25e8;
border-radius: 6px;
Expand Down
28 changes: 14 additions & 14 deletions ui/js/conversation.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,21 +258,21 @@ var Conversation = (function () {
function getOptions(optionsList, preference) {
var list = '';
var i = 0;
if (optionsList !== null) {
if (preference === 'text') {
list = '<ul>';
for (i = 0; i < optionsList.length; i++) {
if (optionsList[i].value) {
list += '<li>' + optionsList[i].label + '</li>';
}
if (preference === 'text') {
list = '<ul>';
for (i = 0; i < optionsList.length; i++) {
if (optionsList[i].value) {
list += '<li><div class="options-list" onclick="Conversation.sendMessage(\'' +
optionsList[i].value.input.text + '\');" >' + optionsList[i].label + '</div></li>';
}
list += '</ul>';
} else if (preference === 'button') {
for (i = 0; i < optionsList.length; i++) {
if (optionsList[i].value) {
var item = '<p class="option-buttons" onclick="Conversation.sendMessage(\'' + optionsList[i].value.input.text + '\');" >' + optionsList[i].label + '</p>';
list += item;
}
}
list += '</ul>';
} else if (preference === 'button') {
list = '<br>';
for (i = 0; i < optionsList.length; i++) {
if (optionsList[i].value) {
var item = '<p class="option-buttons" onclick="Conversation.sendMessage(\'' + optionsList[i].value.input.text + '\');" >' + optionsList[i].label + '</p>';
list += item;
}
}
}
Expand Down

0 comments on commit 33fb887

Please sign in to comment.