-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FS-4919 - Restructuring and rerouting template routes for clarity
- Loading branch information
Showing
3 changed files
with
64 additions
and
65 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from flask import url_for | ||
|
||
from app.db.models.application_config import Form | ||
|
||
|
||
def json_import(data, template_name, filename): | ||
from app.import_config.load_form_json import load_json_from_file | ||
|
||
load_json_from_file(data, template_name, filename) | ||
|
||
|
||
def build_rows(forms: list[Form]) -> list[dict]: | ||
rows = [] | ||
for form in forms: | ||
row = [ | ||
{ | ||
"html": "<a class='govuk-link--no-visited-state' " | ||
f"href='{url_for('index_bp.preview_form', form_id=form.form_id)}'>{form.template_name}</a>" | ||
}, | ||
{"text": form.name_in_apply_json["en"]}, | ||
{"text": form.runner_publish_name}, | ||
{ | ||
"html": "<a class='govuk-link--no-visited-state' href='" | ||
f"{url_for('template_bp.edit_template', form_id=form.form_id)}'>Edit</a> " | ||
"<a class='govuk-link--no-visited-state' href='" | ||
f"{url_for('template_bp.delete_template', form_id=form.form_id)}'>Delete</a>" | ||
}, | ||
] | ||
rows.append(row) | ||
return rows |
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