Skip to content

Commit

Permalink
refactor(Cookbook): client and server scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
NagariaHussain committed Dec 10, 2023
1 parent 412ed7a commit 3305e81
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 34 deletions.
21 changes: 21 additions & 0 deletions src/content/docs/cookbook/Client Scripts/recipe-01.md
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.
:::
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
---
title: Common Tasks
description: Common examples for Document Event, API, and Scheduled Server Scripts.
title: Making HTTP Requests
description: Examples of making HTTP Requests from your Scripts
---

The below examples work in System Console, Server Scripts and Script Reports.

### 1. Making HTTP Requests / Calling external APIs

```py
Expand Down
30 changes: 0 additions & 30 deletions src/content/docs/cookbook/client_scripts.md

This file was deleted.

0 comments on commit 3305e81

Please sign in to comment.