diff options
-rw-r--r-- | wqflask/wqflask/oauth2/resources.py | 4 | ||||
-rw-r--r-- | wqflask/wqflask/templates/oauth2/create-resource.html | 79 |
2 files changed, 50 insertions, 33 deletions
diff --git a/wqflask/wqflask/oauth2/resources.py b/wqflask/wqflask/oauth2/resources.py index ed419076..5f7faff9 100644 --- a/wqflask/wqflask/oauth2/resources.py +++ b/wqflask/wqflask/oauth2/resources.py @@ -1,6 +1,7 @@ import uuid -from flask import flash, request, url_for, redirect, Response, Blueprint +from flask import ( + flash, request, jsonify, url_for, redirect, Response, Blueprint) from .ui import render_ui from .checks import require_oauth2 @@ -38,7 +39,6 @@ def create_resource(): error, "Could not retrieve resource categories")), lambda cats: __render_template__(categories=cats)) - from flask import jsonify def __perr__(error): err = process_error(error) flash(f"{err['error']}: {err['error_description']}", "alert-danger") diff --git a/wqflask/wqflask/templates/oauth2/create-resource.html b/wqflask/wqflask/templates/oauth2/create-resource.html index 4cac7ce2..479f4152 100644 --- a/wqflask/wqflask/templates/oauth2/create-resource.html +++ b/wqflask/wqflask/templates/oauth2/create-resource.html @@ -25,41 +25,58 @@ <form method="POST" action="{{url_for('oauth2.resource.create_resource')}}"> - <div class="form-group mytooltip"> - <label for="resource_name" class="form-label">Name</label> - <input type="text" name="resource_name" class="form-control" - {%if resource_name is defined and resource_name is not none%} - value="{{resource_name}}" - {%endif%} - required="required" /> - <span class="mytooltiptext"> - The resource name, e.g. the experiment name. - </span> - </div> + <fieldset> + <legend>Resource Category</legend> + <div class="form-group"> + {%for category in resource_categories%} + <div class="radio mytooltip"> + <label for="rdo:resource_category:{{category.resource_category_id}}" + class="form-label" + style="text-transform: capitalize;"> + <input type="radio" name="resource_category" required="required" + id="rdo:resource_category:{{category.resource_category_id}}" + value="{{category.resource_category_id}}" + {%if resource_category is defined%} + {%if category.resource_category_id == resource_category%} + checked="checked" + {%endif%} + {%endif%} /> + {{category.resource_category_key}} + </label> + <span class="mytooltiptext"> + {{category.resource_category_description}} + </span> + </div> + {%endfor%} + </div> + </fieldset> + + <fieldset> + <legend>Basic Resource Information</legend> + <div class="form-group mytooltip"> + <label for="resource_name" class="form-label">Name</label> + <input type="text" name="resource_name" class="form-control" + {%if resource_name is defined and resource_name is not none%} + value="{{resource_name}}" + {%endif%} + required="required" /> + <span class="mytooltiptext"> + The resource name, e.g. the experiment name. + </span> + </div> + </fieldset> - - <div class="form-group"> - {%for category in resource_categories%} - <div class="radio mytooltip"> - <label for="rdo:resource_category:{{category.resource_category_id}}" - class="form-label" - style="text-transform: capitalize;"> - <input type="radio" name="resource_category" required="required" - id="rdo:resource_category:{{category.resource_category_id}}" - value="{{category.resource_category_id}}" - {%if resource_category is defined%} - {%if category.resource_category_id == resource_category%} - checked="checked" - {%endif%} - {%endif%} /> - {{category.resource_category_key}} - </label> + <fieldset> + <legend>Access Control</legend> + <div class="form-group mytooltip"> + <label for="chk-public">Publicly Viewable?</label> + <input type="checkbox" name="public" id="chk-public" + checked="checked" /> <span class="mytooltiptext"> - {{category.resource_category_description}} + Select whether data in this resource will be publicly viewable. </span> </div> - {%endfor%} - </div> + </fieldset> <input class="btn btn-primary" type="submit" value="Create" /> |