Skip to content

Commit

Permalink
feat: Added description attribute (#10)
Browse files Browse the repository at this point in the history
* Added description attribute to options and image elements
  • Loading branch information
Steve Green authored and germanattanasio committed Feb 8, 2019
1 parent 55c0d56 commit 8bdcaa9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions public/js/conversation.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,15 +252,18 @@ var ConversationPanel = (function () {
}

function getResponse(responses, gen) {
var title = '';
var title = '', description = '';
if (gen.hasOwnProperty('title')) {
title = gen.title;
}
if (gen.hasOwnProperty('description')) {
description = '<div>' + gen.description + '</div>';
}
if (gen.response_type === 'image') {
var img = '<div><img src="' + gen.source + '" width="300"></div>';
responses.push({
type: gen.response_type,
innerhtml: title + img
innerhtml: title + description + img
});
} else if (gen.response_type === 'text') {
responses.push({
Expand All @@ -282,7 +285,7 @@ var ConversationPanel = (function () {
var list = getOptions(gen.options, preference);
responses.push({
type: gen.response_type,
innerhtml: title + list
innerhtml: title + description + list
});
} else if (gen.response_type === 'search') {
responses.push({
Expand Down

0 comments on commit 8bdcaa9

Please sign in to comment.