Skip to content

Commit

Permalink
Merge pull request #11 from ThinkR-open/patch-2
Browse files Browse the repository at this point in the history
chore: add info to template
  • Loading branch information
ArthurData authored Aug 9, 2024
2 parents c7386ec + 587e649 commit e2c5379
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/run-pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
run: poetry install --no-interaction

- name: 🕸️ Ensure browsers are installed
run: poetry run playwright install
run: poetry run playwright install --with-deps

- name: 🧪 Run tests
run: poetry run pytest --github-report -vvv
run: poetry run pytest --github-report -vvv --browser webkit --browser chromium --browser firefox
10 changes: 9 additions & 1 deletion signature/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,15 @@

def server(input: Inputs, output: Outputs, session: Session):
reactive_values = reactive.Value(
{"firstname", "lastname", "jobtitle", "email", "phone"}
{
"firstname",
"lastname",
"jobtitle",
"email",
"email_url",
"phone",
"phone_url",
}
)

mod_form.form_server("form_signature", reactive_values=reactive_values)
Expand Down
2 changes: 2 additions & 0 deletions signature/modules/mod_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ def _():
"lastname": input.lastname(),
"job_title": input.job_title(),
"email": input.email(),
"email_url": f"mailto:{input.email()}",
"phone": input.phone(),
"phone_url": f"tel:{input.phone()}",
}
)
4 changes: 4 additions & 0 deletions signature/modules/mod_preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,18 @@ def render_template() -> str:
last_name = reactive_values().get("lastname")
job_title = reactive_values().get("job_title")
email = reactive_values().get("email")
email_url = reactive_values().get("email_url")
phone = reactive_values().get("phone")
phone_url = reactive_values().get("phone_url")

rendered_template = template.render(
firstname="{{firstname}}" if first_name == "" else first_name,
lastname="{{lastname}}" if last_name == "" else last_name,
job_title="{{job_title}}" if job_title == "" else job_title,
email="{{email}}" if email == "" else email,
phone="{{phone}}" if phone == "" else phone,
email_url="{{email_url}}" if email_url == "" else email_url,
phone_url="{{phone_url}}" if phone_url == "" else phone_url,
)
return rendered_template

Expand Down

0 comments on commit e2c5379

Please sign in to comment.