Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HTML] Fallback and Requires support #2161

Merged
merged 10 commits into from
Dec 11, 2018
Merged

[HTML] Fallback and Requires support #2161

merged 10 commits into from
Dec 11, 2018

Conversation

dclaux
Copy link
Member

@dclaux dclaux commented Nov 9, 2018

Implements #2019

@dclaux dclaux changed the title [HTML] Fallback support Element fallback support Nov 14, 2018
@dclaux dclaux changed the title Element fallback support [HTML] Fallback support Nov 14, 2018
@dclaux dclaux self-assigned this Nov 14, 2018
@dclaux
Copy link
Member Author

dclaux commented Nov 15, 2018

Sample payload to test with:

{
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "type": "AdaptiveCard",
    "version": "1.0",
    "fallbackText": "This is the fallback text",
    "fallback": {
        "type": "TextBlock",
        "text": "This is the fallback element"
    },
    "body": [
        {
            "type": "Container",
            "fallback": {
                "type": "TextBlock",
                "text": "The container is falling back."
            },
            "selectAction": {
                "type": "Action.OpenUrl",
                "title": "Hello world",
                "url": "http://www.microsoft.com"
            },
            "items": [
                {
                    "type": "TextBlock",
                    "text": "Publish Adaptive Card schema",
                    "weight": "bolder",
                    "size": "medium"
                },
                {
                    "type": "ActionSet",
                    "actions": [
                        {
                            "type": "Action.OpenfUrl",
                            "title": "Hello world",
                            "url": "http://www.microsoft.com"
                        }
                    ]
                },
                {
                    "type": "Image",
                    "size": "large",
                    "url": "http://cdn.nirmaltv.com/images/Powerpoint-2013.png",
                    "fallback": "drop",
                    "selectAction": {
                        "type": "Action.OpenUrl",
                        "title": "Hello world",
                        "url": "http://www.microsoft.com"
                    }
                }
            ]
        },
        {
            "type": "ColumnSet",
            "selectAction": {
                "type": "Action.OpenUrl",
                "title": "Hello world",
                "url": "http://www.microsoft.com"
            },
            "columns": [
                {
                    "width": 1,
                    "style": "emphasis",
                    "items": [
                        {
                            "type": "TextBlock",
                            "text": "Column 1",
                            "horizontalAlignment": "center"
                        }
                    ]
                },
                {
                    "width": 1,
                    "style": "emphasis",
                    "items": [
                        {
                            "type": "TextBlock",
                            "text": "Column 2",
                            "horizontalAlignment": "center"
                        }
                    ]
                },
                {
                    "width": 1,
                    "style": "emphasis",
                    "fallback": "drop",
                    "items": [
                        {
                            "type": "TextBlock",
                            "text": "Column 3",
                            "horizontalAlignment": "center"
                        }
                    ]
                }
            ]
        }
    ],
    "actions": [
        {
            "type": "Action.OpefnUrl",
            "title": "Hello world",
            "url": "http://www.microsoft.com",
            "fallback": {
                "type": "Action.OpenUrl",
                "title": "Fallback action",
                "url": "http://www.microsoft.com"
            }
        }
    ]
}

@paulcam206
Copy link
Member

paulcam206 commented Nov 27, 2018

        throw new Error("The action already belongs to another element.")

or is null? also, ; #Closed


Refers to: source/nodejs/adaptivecards/src/card-elements.ts:3666 in 077c274. [](commit_id = 077c274, deletion_comment = False)

Copy link
Member

@paulcam206 paulcam206 left a comment

Choose a reason for hiding this comment

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

:shipit:

@dclaux
Copy link
Member Author

dclaux commented Nov 30, 2018

Now supports "requires" clause. Can be tested via the Outlook host in the visualizer, which defines two "capabilities":

  • helloWorld, any version
  • whatNot, version 2.12

To test, select the Outloook Actionable Messages host container, and add a "requires" property to any element, action or the card itself. For instance:

"requires": {
  "whatNow": "3.0"
}

The above will cause the element/action/card to fall back.

Copy link
Member

@paulcam206 paulcam206 left a comment

Choose a reason for hiding this comment

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

🕐

@dclaux dclaux merged commit b1db666 into master Dec 11, 2018
@dclaux dclaux changed the title [HTML] Fallback support [HTML] Fallback and Requires support Dec 11, 2018
@paulcam206 paulcam206 deleted the html-fallback-support branch August 31, 2019 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants