Skip to content

Commit

Permalink
CellRanger form completed
Browse files Browse the repository at this point in the history
  • Loading branch information
neoformit committed Aug 21, 2023
1 parent 5efc2d8 commit 0778e5d
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 209 deletions.
64 changes: 1 addition & 63 deletions webapp/home/templates/home/requests/access/alphafold.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,69 +33,7 @@ <h2> Galaxy Australia AlphaFold 2 Access Request </h2>

{{ form.non_field_errors }}

<div class="row mb-10">
<div class="col-sm-12">
<label for="nameInput" class="form-label">Name</label>
{{ form.name.errors }}
<input class="form-control" id="nameInput" type="text" name="name"
value="{{form.name.value|default_if_none:''}}" required
>
</div>

<div class="col-sm-12">
<label for="emailInput" class="form-label">Galaxy account email</label>
{{ form.email.errors }}

<input class="form-control" id="emailInput" type="email" name="email"
value="{{form.email.value|default_if_none:''}}"
aria-describedby="emailHelp"
onclick="$('#emailHelp').show();"
required
autocomplete="off"
>

<div
class="form-text"
id="emailHelp"
style="display: none;"
data-bs-toggle="tooltip"
data-bs-placement="bottom"
data-bs-title='Go to User > Preferences > Manage information to see your registered email address on usegalaxy.org.au'
>
<div class="alert alert-danger">
<ul style="margin: 0;">
<li>
Your Galaxy Australia account must be registered to this email
for us to provide access
</li>
<li>
Access will be provided only to recognised
<a href="/institutions">
Australian institution email addresses
</a>
</li>
<ul>
</div>
</div>
</div>

<div class="col-sm-12">
<label for="institutionInput" class="form-label">Institution</label>
{{ form.institution.errors }}
<input
class="form-control"
id="institutionInput"
name="institution"
type="text"
value="{{form.institution.value|default_if_none:''}}"
aria-describedby="institutionHelp"
required
/>
<div class="form-text" id="institutionHelp">
Your department, organization or research institute
</div>
</div>
</div>
{% include 'home/requests/access/snippets/personal-details-fields.html' %}

<div class="row mb-10">
<p class="lead">
Expand Down
68 changes: 3 additions & 65 deletions webapp/home/templates/home/requests/access/cellranger.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,72 +55,10 @@ <h2> Galaxy Australia CellRanger Access Request </h2>

{{ form.non_field_errors }}

<div class="row mb-10">
<div class="col-sm-12">
<label for="nameInput" class="form-label">Name</label>
{{ form.name.errors }}
<input class="form-control" id="nameInput" type="text" name="name"
value="{{form.name.value|default_if_none:''}}" required
>
</div>

<div class="col-sm-12">
<label for="emailInput" class="form-label">Galaxy account email</label>
{{ form.email.errors }}

<input class="form-control" id="emailInput" type="email" name="email"
value="{{form.email.value|default_if_none:''}}"
aria-describedby="emailHelp"
onclick="$('#emailHelp').show();"
required
autocomplete="off"
>

<div
class="form-text"
id="emailHelp"
style="display: none;"
data-bs-toggle="tooltip"
data-bs-placement="bottom"
data-bs-title='Go to User > Preferences > Manage information to see your registered email address on usegalaxy.org.au'
>
<div class="alert alert-danger">
<ul style="margin: 0;">
<li>
Your Galaxy Australia account must be registered to this email
for us to provide access
</li>
<li>
Access will be provided only to recognised
<a href="/institutions">
Australian institution email addresses
</a>
</li>
<ul>
</div>
</div>
</div>

<div class="col-sm-12">
<label for="institutionInput" class="form-label">Institution</label>
{{ form.institution.errors }}
<input
class="form-control"
id="institutionInput"
name="institution"
type="text"
value="{{form.institution.value|default_if_none:''}}"
aria-describedby="institutionHelp"
required
/>
<div class="form-text" id="institutionHelp">
Your department, organization or research institute
</div>
</div>
</div>
{% include 'home/requests/access/snippets/personal-details-fields.html' %}

<div class="row mb-10">
<div class="col-sm-12">
<div class="col-sm-12 mb-5">
<p>
The
<a
Expand Down Expand Up @@ -155,7 +93,7 @@ <h2> Galaxy Australia CellRanger Access Request </h2>
type="checkbox"
{% if form.agree_usage.value %}checked{% endif %}
/>
<label for="usageInput" class="form-check-label">I accept the terms of the license agreement</label>
<label for="usageInput" class="form-check-label">I agree to only use CellRanger for academic or non-commercial research purposes</label>
</div>
</div>

Expand Down
64 changes: 1 addition & 63 deletions webapp/home/templates/home/requests/access/fgenesh.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,69 +37,7 @@ <h2> Galaxy Australia FGENESH++ Access Request </h2>

{{ form.non_field_errors }}

<div class="row mb-5">
<div class="col-sm-12">
<label for="nameInput" class="form-label">Name</label>
{{ form.name.errors }}
<input class="form-control" id="nameInput" type="text" name="name"
value="{{form.name.value|default_if_none:''}}" required
>
</div>

<div class="col-sm-12">
<label for="emailInput" class="form-label">Galaxy account email</label>
{{ form.email.errors }}

<input class="form-control" id="emailInput" type="email" name="email"
value="{{form.email.value|default_if_none:''}}"
aria-describedby="emailHelp"
onclick="$('#emailHelp').show();"
required
autocomplete="off"
>

<div
class="form-text"
id="emailHelp"
style="display: none;"
data-bs-toggle="tooltip"
data-bs-placement="bottom"
data-bs-title='Go to User > Preferences > Manage information to see your registered email address on usegalaxy.org.au'
>
<div class="alert alert-danger">
<ul style="margin: 0;">
<li>
Your Galaxy Australia account must be registered to this email
for us to provide access
</li>
<li>
Access will be provided only to recognised
<a href="/institutions">
Australian institution email addresses
</a>
</li>
<ul>
</div>
</div>
</div>

<div class="col-sm-12">
<label for="institutionInput" class="form-label">Institution</label>
{{ form.institution.errors }}
<input
class="form-control"
id="institutionInput"
name="institution"
type="text"
value="{{form.institution.value|default_if_none:''}}"
aria-describedby="institutionHelp"
required
/>
<div class="form-text" id="institutionHelp">
Your department, organization or research institute
</div>
</div>
</div>
{% include 'home/requests/access/snippets/personal-details-fields.html' %}

<hr>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<div class="row mb-10">
<div class="col-sm-12">
<label for="nameInput" class="form-label">Name</label>
{{ form.name.errors }}
<input class="form-control" id="nameInput" type="text" name="name"
value="{{form.name.value|default_if_none:''}}" required
>
</div>

<div class="col-sm-12">
<label for="emailInput" class="form-label">Galaxy account email</label>
{{ form.email.errors }}
<input class="form-control" id="emailInput" type="email" name="email"
value="{{form.email.value|default_if_none:''}}"
aria-describedby="emailHelp"
onfocus="$('#emailHelp').show();"
autocomplete="off"
required
>
<div
class="form-text"
id="emailHelp"
style="display: none;"
>
<div class="alert alert-danger">
<ul style="margin: 0;">
<li>
Your Galaxy Australia account must be registered to this email
for us to provide access
</li>
<li>
Go to User > Preferences > Manage information to see your registered
email address on usegalaxy.org.au
</li>
<li>
Access will be provided only to recognised
<a href="/institutions">
Australian institution email addresses
</a>
</li>
<ul>
</div>
</div>
</div>

<div class="col-sm-12">
<label for="institutionInput" class="form-label">Institution</label>
{{ form.institution.errors }}
<input
class="form-control"
id="institutionInput"
name="institution"
type="text"
value="{{form.institution.value|default_if_none:''}}"
aria-describedby="institutionHelp"
required
/>
<div class="form-text" id="institutionHelp">
Your department, organization or research institute
</div>
</div>
</div>
50 changes: 32 additions & 18 deletions webapp/home/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,17 +181,7 @@ def test_it_can_handle_request_for_alphafold_access(self):
'email': '[email protected]',
'institution': 'University of Queensland',
})
self.assertEqual(response.status_code, 200)
self.assertContains(
response,
'Thanks for your submission',
)
self.assertContains(
response,
'please check your spam folder',
)
# Mail sent to admins and user
self.assertEqual(len(mail.outbox), 2)
self.assert_access_form_success(response, auto_action=True)

def test_it_can_handle_request_for_fgenesh_access(self):
response = self.client.post('/request/access/fgenesh', {
Expand All @@ -202,15 +192,39 @@ def test_it_can_handle_request_for_fgenesh_access(self):
'agree_acknowledge': 'on',
'matrices': [genematrix_tree.as_choices()[0][0]],
})
self.assert_access_form_success(response, auto_action=False)

def test_it_can_handle_request_for_cellranger_access(self):
response = self.client.post('/request/access/cellranger', {
'name': 'John Doe',
'email': '[email protected]',
'institution': 'University of Queensland',
'agree_terms': 'on',
'agree_usage': 'on',
})
self.assert_access_form_success(response, auto_action=True)

def assert_access_form_success(self, response, auto_action=True):
"""Assert that an auto-action form has been successfully submitted.
Auto-action forms send an email to user to let them know that access
has been granted. Non-auto-action forms do not send an email because
manual intervention is required.
"""
self.assertEqual(response.status_code, 200)
self.assertContains(
response,
'Thanks for your submission',
)
# FGenesh needs to be actioned by admins, so user mail should not be
# sent
self.assertNotContains(
response,
'please check your spam folder',
)
self.assertEqual(len(mail.outbox), 1)
if auto_action:
self.assertContains(
response,
'please check your spam folder',
)
else:
self.assertNotContains(
response,
'please check your spam folder',
)
expect_len = 2 if auto_action else 1
self.assertEqual(len(mail.outbox), expect_len)

0 comments on commit 0778e5d

Please sign in to comment.