-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #584 from Badgerati/update_links
Adds Actions to allow Updating, Enabling, and Disabling Links
- Loading branch information
Showing
17 changed files
with
214 additions
and
40 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
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
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,47 @@ | ||
# Link | ||
|
||
This page details the actions available to Links. | ||
|
||
## Enable | ||
|
||
To enable a disabled link on the page, you can use [`Enable-PodeWebLink`](../../../Functions/Actions/Enable-PodeWebLink): | ||
|
||
```powershell | ||
New-PodeWebCard -Content @( | ||
New-PodeWebLink -Value 'Google' -Url 'https://www.google.com' -Id 'link' -Disabled | ||
New-PodeWebButton -Name 'Example' -ScriptBlock { | ||
Enable-PodeWebLink -Id 'link' | ||
} | ||
) | ||
``` | ||
|
||
## Disable | ||
|
||
To disable an enabled link on the page, you can use [`Disable-PodeWebLink`](../../../Functions/Actions/Disable-PodeWebLink): | ||
|
||
```powershell | ||
New-PodeWebCard -Content @( | ||
New-PodeWebLink -Value 'Google' -Url 'https://www.google.com' -Id 'link' | ||
New-PodeWebButton -Name 'Example' -ScriptBlock { | ||
Disable-PodeWebLink -Id 'link' | ||
} | ||
) | ||
``` | ||
|
||
## Update | ||
|
||
You can update a link's URL, Value, or Tab state using [`Update-PodeWebLink`](../../../Functions/Actions/Update-PodeWebLink). | ||
|
||
For example, to change the URL of a link from Google to DuckDuckGo, including its Value: | ||
|
||
```powershell | ||
New-PodeWebCard -Content @( | ||
New-PodeWebLink -Value 'Google' -Url 'https://www.google.com' -Id 'link' | ||
New-PodeWebButton -Name 'Example' -ScriptBlock { | ||
Update-PodeWebLink -Id 'link' -Url 'https://www.duckduckgo.com' -Value 'DuckDuckGo' | ||
} | ||
) | ||
``` |
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
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
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
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
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
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
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
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
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
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,35 @@ | ||
Import-Module Pode -MaximumVersion 2.99.99 -Force | ||
Import-Module ..\src\Pode.Web.psm1 -Force | ||
|
||
Start-PodeServer -Browse { | ||
# add a simple endpoint | ||
Add-PodeEndpoint -Address localhost -Port 8090 -Protocol Http | ||
New-PodeLoggingMethod -Terminal | Enable-PodeErrorLogging | ||
|
||
# set the use of templates, and set a login page | ||
Use-PodeWebTemplates -Title 'Links Example' -Theme Dark | ||
|
||
# home page with link togglging | ||
Add-PodeWebPage -Name 'Home' -Path '/' -HomePage -Title 'Homepage' -ScriptBlock { | ||
New-PodeWebCard -Name 'Link' -Content @( | ||
New-PodeWebLink -Value 'Google' -Url 'https://www.google.com' -Id 'link' -NewTab | ||
) | ||
|
||
New-PodeWebCard -Name 'Update Link' -Content @( | ||
New-PodeWebButtonGroup -Buttons @( | ||
New-PodeWebButton -Name 'Update to Goole' -ScriptBlock { | ||
Update-PodeWebLink -Id 'link' -Value 'Google' -Url 'https://www.google.com' | ||
} | ||
New-PodeWebButton -Name 'Update to DuckDuckGo' -ScriptBlock { | ||
Update-PodeWebLink -Id 'link' -Value 'DuckDuckGo' -Url 'https://www.duckduckgo.com' | ||
} | ||
New-PodeWebButton -Name 'Disable Link' -ScriptBlock { | ||
Disable-PodeWebLink -Id 'link' | ||
} | ||
New-PodeWebButton -Name 'Enable Link' -ScriptBlock { | ||
Enable-PodeWebLink -Id 'link' | ||
} | ||
) | ||
) | ||
} | ||
} |
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
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
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
Oops, something went wrong.