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

Add shiny create option to choose from online template gallery #1277

Merged
merged 2 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions shiny/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ def try_import_module(module: str) -> Optional[types.ModuleType]:
"Dashboard": "dashboard",
"Multi-page app with modules": "multi-page",
"Custom JavaScript Component": "js-component",
"Choose from the Shiny Templates website": "external-gallery",
}

# These are templates which produce a Python package and have content filled in at
Expand Down
8 changes: 8 additions & 0 deletions shiny/_template_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ def template_query(
# Define the control flow for the top level menu
if template is None or template == "cancel":
sys.exit(1)
elif template == "external-gallery":
url = "https://shiny.posit.co/py/templates"
print(f"Opening <{url}> in your browser.")
print("Choose a template and copy the `shiny create` command to use it.")
import webbrowser

webbrowser.open(url)
sys.exit(0)
elif template == "js-component":
js_component_questions(dest_dir=dest_dir, package_name=package_name)
return
Expand Down
Loading