Skip to content

Commit 1350c11

Browse files
committed
Add code comments for modal view handling
ref: slackapi/python-slack-sdk#1373 (comment)
1 parent 9814103 commit 1350c11

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

docs/_basic/ja_listening_modals.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ order: 12
2121
# モーダル送信でのビューの更新
2222
@app.view("view_1")
2323
def handle_submission(ack, body):
24+
# build_new_view() method はモーダルビューを返します
25+
# モーダルの構築には Block Kit Builder を試してみてください:
26+
# https://app.slack.com/block-kit-builder/#%7B%22type%22:%22modal%22,%22callback_id%22:%22view_1%22,%22title%22:%7B%22type%22:%22plain_text%22,%22text%22:%22My%20App%22,%22emoji%22:true%7D,%22blocks%22:%5B%5D%7D
2427
ack(response_action="update", view=build_new_view(body))
2528
```
2629
この例と同様に、モーダルでの送信リクエストに対して、<a href="https://api.slack.com/surfaces/modals/using#displaying_errors">エラーを表示する</a>ためのオプションもあります。

docs/_basic/listening_modals.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ To update a view in response to a `view_submission` event, you may pass a `respo
2121
# Update the view on submission
2222
@app.view("view_1")
2323
def handle_submission(ack, body):
24+
# The build_new_view() method returns a modal view
25+
# To build a modal view, we recommend using Block Kit Builder:
26+
# https://app.slack.com/block-kit-builder/#%7B%22type%22:%22modal%22,%22callback_id%22:%22view_1%22,%22title%22:%7B%22type%22:%22plain_text%22,%22text%22:%22My%20App%22,%22emoji%22:true%7D,%22blocks%22:%5B%5D%7D
2427
ack(response_action="update", view=build_new_view(body))
2528
```
2629
Similarly, there are options for [displaying errors](https://api.slack.com/surfaces/modals/using#displaying_errors) in response to view submissions.

0 commit comments

Comments
 (0)