-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(Cookbook): client and server scripts
- Loading branch information
1 parent
412ed7a
commit 3305e81
Showing
4 changed files
with
23 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
title: Adding Web Link in Sidebar | ||
description: Using the `add_web_link` JS API in Client Scripts | ||
--- | ||
|
||
![Screenshot showing web link in form view side bar](../../../../assets/images/view_in_youtube_web_link.png) | ||
|
||
```js | ||
// Assuming there is a "Live Stream" DocType | ||
// with a field `stream_link` that has the link to a YouTube video | ||
frappe.ui.form.on('Live Stream', { | ||
refresh(frm) { | ||
const stream_link = frm.doc.stream_link; | ||
frm.add_web_link(stream_link, "View in YouTube"); | ||
} | ||
}) | ||
``` | ||
|
||
:::note | ||
The link opens in a new browser tab. You can add multiple of these web links. | ||
::: |
6 changes: 2 additions & 4 deletions
6
...ent/docs/cookbook/Server Scripts/index.md → ...docs/cookbook/Server Scripts/recipe-01.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.