diff --git a/atst/forms/workspace.py b/atst/forms/workspace.py index bab487d6..a1248075 100644 --- a/atst/forms/workspace.py +++ b/atst/forms/workspace.py @@ -5,4 +5,4 @@ from .forms import ValidatedForm class WorkspaceForm(ValidatedForm): - name = StringField("Workspace Name", validators=[Length(min=4, max=50)]) + name = StringField("Workspace Name", validators=[Length(min=4, max=50, message="Workspace names must be at least 4 and not more than 50 characters")]) diff --git a/atst/routes/workspaces.py b/atst/routes/workspaces.py index 6dd93085..673719a5 100644 --- a/atst/routes/workspaces.py +++ b/atst/routes/workspaces.py @@ -51,6 +51,19 @@ def workspaces(): return render_template("workspaces/index.html", page=5, workspaces=workspaces) +@bp.route("/workspaces//edit") +def workspace(workspace_id): + workspace = Workspaces.get_for_update_information(g.current_user, workspace_id) + form = WorkspaceForm(data={"name": workspace.name}) + return render_template("workspaces/edit.html", form=form, workspace=workspace) + + +@bp.route("/workspaces//projects") +def workspace_projects(workspace_id): + workspace = Workspaces.get(g.current_user, workspace_id) + return render_template("workspaces/projects/index.html", workspace=workspace) + + @bp.route("/workspaces//edit", methods=["POST"]) def edit_workspace(workspace_id): workspace = Workspaces.get_for_update_information(g.current_user, workspace_id) @@ -61,14 +74,7 @@ def edit_workspace(workspace_id): url_for("workspaces.workspace_projects", workspace_id=workspace.id) ) else: - # return render_template("workspaces/edit.html", form=form, workspace=workspace) - pass - - -@bp.route("/workspaces//projects") -def workspace_projects(workspace_id): - workspace = Workspaces.get(g.current_user, workspace_id) - return render_template("workspaces/projects/index.html", workspace=workspace) + return render_template("workspaces/edit.html", form=form, workspace=workspace) @bp.route("/workspaces/") diff --git a/js/lib/input_validations.js b/js/lib/input_validations.js index d326d0b8..1696facc 100644 --- a/js/lib/input_validations.js +++ b/js/lib/input_validations.js @@ -78,5 +78,11 @@ export default { match: /[0-9]{2}\w?$/, unmask: [], validationError: 'Please enter a valid BA Code. Note that it should be two digits, followed by a letter.' - } + }, + workspaceName: { + mask: false, + match: /^.{4,50}$/, + unmask: [], + validationError: 'Workspace names must be at least 4 and not more than 50 characters' + }, } diff --git a/styles/elements/_inputs.scss b/styles/elements/_inputs.scss index babd6ce5..6cd22272 100644 --- a/styles/elements/_inputs.scss +++ b/styles/elements/_inputs.scss @@ -194,6 +194,7 @@ &--validation { &--anything, + &--workspaceName, &--email { input { max-width: 30em; diff --git a/templates/navigation/workspace_navigation.html b/templates/navigation/workspace_navigation.html index 5ef3ec8c..2b8a18f8 100644 --- a/templates/navigation/workspace_navigation.html +++ b/templates/navigation/workspace_navigation.html @@ -2,6 +2,13 @@