Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

List Card Support in NodeJs Sample App #61

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

List Card Support in NodeJs Sample App #61

wants to merge 3 commits into from

Conversation

vamagra
Copy link
Contributor

@vamagra vamagra commented Oct 1, 2018

let list = Array<builderteams.ListCardItem>();

// list item1
let item1 = new builderteams.ListCardItem();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use session, and chain the fluent methods.
new builderteams.ListCardItem(session)
.title(Strings.left_card_item1_title)
...


// list item1
let item1 = new builderteams.ListCardItem();
item1.type(builderteams.ListCardItemType.resultItem);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default type is resultItem, so strictly speaking this isn't necessary.

item2.subtitle(session.gettext(Strings.list_card_item1_subtitle));

// we have added only two items for this sample, list card support multiple items as needed
list.push(item1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use addItem() method on ListCard.

list.push(item1);
list.push(item2);

let card = new builderteams.ListCard();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too, use session and chain the fluent methods.
new ListCard(session)
.title(Strings.list_card_title)
.addItem(xxx)
....

card.items(list);

let message = new builder.Message(session);
message.addAttachment(card.toAttachment());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chain this to the new, and there's no need to call toAttachment()
new builder.Message(session)
.addAttachment(card)

import { TriggerActionDialog } from "../../../utils/TriggerActionDialog";
import { DialogIds } from "../../../utils/DialogIds";
import { DialogMatches } from "../../../utils/DialogMatches";
// import { ListCard, ListCardItem, ListCardItemType } from "../basic/ListCard";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants