Skip to content

Commit

Permalink
BS5 button classes (#1149)
Browse files Browse the repository at this point in the history
* remove y margin class from button class template tags

* use template tags for primary/secondary button classes

* change btn-success to primary button classes

* use nav_link template tag for exp studies list navigation

* Remove querystring from active and paused

---------

Co-authored-by: CJ Green <[email protected]>
  • Loading branch information
becky-gilbert and okaycj authored Mar 23, 2023
1 parent 44e1506 commit fec9a52
Show file tree
Hide file tree
Showing 28 changed files with 137 additions and 106 deletions.
4 changes: 3 additions & 1 deletion accounts/templates/accounts/2fa-setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
{% load django_bootstrap5 %}
{% load bootstrap_icons %}
{% load static %}
{% load web_extras %}
{% block title %}
Set up Two Factor Authentication
{% endblock title %}
{% block content %}
{% button_primary_classes as btn_primary_classes %}
{% bootstrap_messages %}
<div class="row">
<div class="col">
Expand All @@ -28,7 +30,7 @@ <h3 class="card-title">QR Code</h3>
{% csrf_token %}
{% bootstrap_form_errors form %}
{% bootstrap_form form %}
{% bootstrap_button "Test Code" button_type="submit" button_class="btn-primary" %}
{% bootstrap_button "Test Code" button_type="submit" button_class=btn_primary_classes %}
</form>
</li>
</ol>
Expand Down
4 changes: 3 additions & 1 deletion accounts/templates/accounts/participant_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
{% load django_bootstrap5 %}
{% load bootstrap_icons %}
{% load exp_extras %}
{% load web_extras %}
{% block title %}
Participants
{% endblock title %}
{% block content %}
{% button_primary_classes "btn-sm" as btn_primary_classes %}
<h1>Participants</h1>
<form method="get">
<input id="search-participants"
Expand Down Expand Up @@ -58,7 +60,7 @@ <h1>Participants</h1>
</td>
<td>{{ user.uuid }}</td>
<td>{{ user.last_login|date:"n/d/Y"|default:"N/A" }}</td>
<td>{% bootstrap_button "View Profile" href=url_participant_detail button_class="btn-primary btn-sm" %}</td>
<td>{% bootstrap_button "View Profile" href=url_participant_detail button_class=btn_primary_classes %}</td>
</tr>
{% endfor %}
</tbody>
Expand Down
42 changes: 22 additions & 20 deletions studies/templates/studies/_all_json_and_csv_data.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{% load web_extras %}
{% load static %}
{% load bootstrap_icons %}
{% load web_extras %}
{% block title %}
All Responses | {{ study.name }}
{% endblock title %}
Expand Down Expand Up @@ -34,6 +35,7 @@
{% url 'exp:study-demographics-download-json' pk=study.id as url_demographics_download_json %}
{% url 'exp:study-demographics-download-csv' pk=study.id as url_demographics_download_csv %}
{% url 'exp:study-demographics-download-dict-csv' pk=study.id as url_demographics_download_dict %}
{% button_primary_classes as btn_primary_classes %}
<h1>All Responses</h1>
<div class="row">
<div class="col">{% include "studies/_response_nav_tabs.html" with active=active %}</div>
Expand Down Expand Up @@ -85,9 +87,9 @@ <h1>All Responses</h1>
<div class="text-end my-3 download-button">
Data
{% if n_responses %}
{% bootstrap_button bs_icon_download|add:" JSON" button_type="submit" button_class="btn btn-primary" id="download-all-data-json" formaction=url_download_all_json %}
{% bootstrap_button bs_icon_download|add:" JSON" button_type="submit" button_class=btn_primary_classes id="download-all-data-json" formaction=url_download_all_json %}
{% else %}
{% bootstrap_button bs_icon_download|add:" JSON" button_type="submit" button_class="btn btn-primary" id="download-all-data-json" formaction=url_download_all_json disabled="disabled" %}
{% bootstrap_button bs_icon_download|add:" JSON" button_type="submit" button_class=btn_primary_classes id="download-all-data-json" formaction=url_download_all_json disabled="disabled" %}
{% endif %}
</div>
</div>
Expand All @@ -104,14 +106,14 @@ <h1>All Responses</h1>
<div class="text-end my-3 download-button">
Data
{% if n_responses %}
{% bootstrap_button bs_icon_download|add:" CSV" button_type="submit" button_class="btn btn-primary" id="download-all-data-csv" formaction=url_download_all_csv %}
{% bootstrap_button bs_icon_download|add:" CSV" button_type="submit" button_class=btn_primary_classes id="download-all-data-csv" formaction=url_download_all_csv %}
{% else %}
{% bootstrap_button bs_icon_download|add:" CSV" button_type="submit" button_class="btn btn-primary" id="download-all-data-csv" formaction=url_download_all_csv disabled="disabled" %}
{% bootstrap_button bs_icon_download|add:" CSV" button_type="submit" button_class=btn_primary_classes id="download-all-data-csv" formaction=url_download_all_csv disabled="disabled" %}
{% endif %}
</div>
<div class="text-end my-3 download-button">
Data dictionary
{% bootstrap_button bs_icon_download|add:" CSV" button_type="submit" button_class="btn btn-primary" id="download-data-dict-csv" formaction=url_download_summary_dict %}
{% bootstrap_button bs_icon_download|add:" CSV" button_type="submit" button_class=btn_primary_classes id="download-data-dict-csv" formaction=url_download_summary_dict %}
</div>
</div>
</div>
Expand All @@ -133,17 +135,17 @@ <h1>All Responses</h1>
<div class="text-end my-3 download-button">
Data (one file per response)
{% if n_responses %}
{% bootstrap_button bs_icon_download|add:" ZIP, CSVs" button_class="btn btn-primary" id="download-frame-data-csv" formaction=url_download_frame_data %}
{% bootstrap_button bs_icon_download|add:" ZIP, CSVs" button_class=btn_primary_classes id="download-frame-data-csv" formaction=url_download_frame_data %}
{% else %}
{% bootstrap_button bs_icon_download|add:" ZIP, CSVs" button_class="btn btn-primary" id="download-frame-data-csv" formaction=url_download_frame_data disabled="disabled" %}
{% bootstrap_button bs_icon_download|add:" ZIP, CSVs" button_class=btn_primary_classes id="download-frame-data-csv" formaction=url_download_frame_data disabled="disabled" %}
{% endif %}
</div>
<div class="text-end my-3 download-button">
Data dictionary
{% if n_responses %}
{% bootstrap_button bs_icon_download|add:" CSV" button_class="btn btn-primary" id="download-frame-dict-csv" formaction=url_download_frame_data_dict %}
{% bootstrap_button bs_icon_download|add:" CSV" button_class=btn_primary_classes id="download-frame-dict-csv" formaction=url_download_frame_data_dict %}
{% else %}
{% bootstrap_button bs_icon_download|add:" CSV" button_class="btn btn-primary" id="download-frame-dict-csv" formaction=url_download_frame_data_dict disabled="disabled" %}
{% bootstrap_button bs_icon_download|add:" CSV" button_class=btn_primary_classes id="download-frame-dict-csv" formaction=url_download_frame_data_dict disabled="disabled" %}
{% endif %}
</div>
</div>
Expand All @@ -161,17 +163,17 @@ <h1>All Responses</h1>
<div class="text-end my-3 download-button">
Data
{% if n_responses %}
{% bootstrap_button bs_icon_download|add:" CSV" button_class="btn btn-primary" id="download-child-data-csv" formaction=url_download_children_summary_data %}
{% bootstrap_button bs_icon_download|add:" CSV" button_class=btn_primary_classes id="download-child-data-csv" formaction=url_download_children_summary_data %}
{% else %}
{% bootstrap_button bs_icon_download|add:" CSV" button_class="btn btn-primary" id="download-child-data-csv" formaction=url_download_children_summary_data disabled="disabled" %}
{% bootstrap_button bs_icon_download|add:" CSV" button_class=btn_primary_classes id="download-child-data-csv" formaction=url_download_children_summary_data disabled="disabled" %}
{% endif %}
</div>
<div class="text-end my-3 download-button">
Data dictionary
{% if n_responses %}
{% bootstrap_button bs_icon_download|add:" CSV" button_class="btn btn-primary" id="download-child-data-dict-csv" formaction=url_download_children_summary_data_dict %}
{% bootstrap_button bs_icon_download|add:" CSV" button_class=btn_primary_classes id="download-child-data-dict-csv" formaction=url_download_children_summary_data_dict %}
{% else %}
{% bootstrap_button bs_icon_download|add:" CSV" button_class="btn btn-primary" id="download-child-data-dict-csv" formaction=url_download_children_summary_data_dict disabled="disabled" %}
{% bootstrap_button bs_icon_download|add:" CSV" button_class=btn_primary_classes id="download-child-data-dict-csv" formaction=url_download_children_summary_data_dict disabled="disabled" %}
{% endif %}
</div>
</div>
Expand All @@ -186,7 +188,7 @@ <h1>All Responses</h1>
</div>
<div class="col">
<div class="text-end my-3 download-button">
{% bootstrap_button "Check now" button_class="btn btn-primary" id="check-for-collisions" url=url_hashed_id_collision_check %}
{% bootstrap_button "Check now" button_class=btn_primary_classes id="check-for-collisions" url=url_hashed_id_collision_check %}
</div>
<div class="text-end my-3" style="clear:both;">
<p id="collision-indicator"></p>
Expand All @@ -208,7 +210,7 @@ <h1>All Responses</h1>
</div>
<div class="col">
<div class="text-end my-3 download-button">
{% bootstrap_button "Delete all preview data" button_type="submit" button_class="btn btn-primary" id="delete-preview-data" %}
{% bootstrap_button "Delete all preview data" button_type="submit" button_class=btn_primary_classes id="delete-preview-data" %}
</div>
<div class="text-end my-3" style="clear:both;">
<p id="delete-preview-indicator"></p>
Expand Down Expand Up @@ -255,22 +257,22 @@ <h1>All Responses</h1>
<div class="text-end my-3 download-button">
Data
{% if n_responses %}
{% bootstrap_button bs_icon_download|add:" JSON" button_class="btn btn-primary" button_type="submit" id="download-all-demo-json" formaction=url_demographics_download_json %}
{% bootstrap_button bs_icon_download|add:" JSON" button_class=btn_primary_classes button_type="submit" id="download-all-demo-json" formaction=url_demographics_download_json %}
{% else %}
{% bootstrap_button bs_icon_download|add:" JSON" button_class="btn btn-primary" button_type="submit" id="download-all-demo-json" formaction=url_demographics_download_json disabled="disabled" %}
{% bootstrap_button bs_icon_download|add:" JSON" button_class=btn_primary_classes button_type="submit" id="download-all-demo-json" formaction=url_demographics_download_json disabled="disabled" %}
{% endif %}
</div>
<div class="text-end my-3 download-button">
Data
{% if n_responses %}
{% bootstrap_button bs_icon_download|add:" CSV" button_class="btn btn-primary" button_type="submit" id="download-all-demo-csv" formaction=url_demographics_download_csv %}
{% bootstrap_button bs_icon_download|add:" CSV" button_class=btn_primary_classes button_type="submit" id="download-all-demo-csv" formaction=url_demographics_download_csv %}
{% else %}
{% bootstrap_button bs_icon_download|add:" CSV" button_class="btn btn-primary" button_type="submit" id="download-all-demo-csv" formaction=url_demographics_download_csv disabled="disabled" %}
{% bootstrap_button bs_icon_download|add:" CSV" button_class=btn_primary_classes button_type="submit" id="download-all-demo-csv" formaction=url_demographics_download_csv disabled="disabled" %}
{% endif %}
</div>
<div class="text-end my-3 download-button">
Data dictionary
{% bootstrap_button bs_icon_download|add:" CSV" button_class="btn btn-primary" button_type="submit" id="download-all-demo-dict-csv" formaction=url_demographics_download_dict %}
{% bootstrap_button bs_icon_download|add:" CSV" button_class=btn_primary_classes button_type="submit" id="download-all-demo-dict-csv" formaction=url_demographics_download_dict %}
</div>
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion studies/templates/studies/_study_type.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{% load exp_extras %}
{% load web_extras %}
{% load django_bootstrap5 %}
{% load bootstrap_icons %}
{% load static %}
{% button_secondary_classes as btn_secondary_classes %}
<script src="{% static 'js/study-type.js' %}" defer></script>
<div id="study-type-metadata">
<div class="row">
Expand Down Expand Up @@ -74,7 +76,7 @@
<h3 class="card-subtitle my-1">
About this version
<div class="float-end me-4">
{% bootstrap_button "Check for updates" button_class="btn btn-light link-secondary border-secondary" id="update-button" %}
{% bootstrap_button "Check for updates" button_class=btn_secondary_classes id="update-button" %}
</div>
</h3>
</div>
Expand Down
7 changes: 5 additions & 2 deletions studies/templates/studies/lab_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
{% load django_bootstrap5 %}
{% load bootstrap_icons %}
{% load exp_extras %}
{% load web_extras %}
{% block title %}
Labs
{% endblock title %}
{% block content %}
{% button_primary_classes "btn-sm" as btn_primary_classes %}
<div class="d-flex justify-content-between align-items-center">
<h1>View Labs</h1>
<div>
<a class="btn btn-success" href="{% url 'exp:lab-create' %}">{% bs_icon "plus" %} Create Lab</a>
<a class="{% button_primary_classes %}"
href="{% url 'exp:lab-create' %}">{% bs_icon "plus" %} Create Lab</a>
</div>
</div>
<div class="my-4">
Expand Down Expand Up @@ -72,7 +75,7 @@ <h1>View Labs</h1>
{% else %}
<form action="{% url 'exp:lab-request' pk=lab.id %}" method="post">
{% csrf_token %}
{% bootstrap_button "Request to join" button_class="btn-sm btn-primary" %}
{% bootstrap_button "Request to join" button_class=btn_primary_classes %}
</form>
{% endif %}
</div>
Expand Down
6 changes: 4 additions & 2 deletions studies/templates/studies/lab_update.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
{% endblock breadcrumb %}
{% block content %}
{% url 'exp:lab-edit' pk=lab.id as url_lab_edit %}
{% button_primary_classes as btn_primary_classes %}
{% button_secondary_classes as btn_secondary_classes %}
<h1>Update Lab</h1>
<form action="" enctype="multipart/form-data" method="post">
{% csrf_token %}
{% bootstrap_form_errors form %}
{% bootstrap_form form %}
{% bootstrap_button "Discard Changes" href=url_lab_edit button_class="btn-secondary" %}
{% bootstrap_button "Save" type="submit" %}
{% bootstrap_button "Discard Changes" href=url_lab_edit button_class=btn_secondary_classes %}
{% bootstrap_button "Save" type="submit" button_class=btn_primary_classes %}
</form>
{% endblock content %}
7 changes: 4 additions & 3 deletions studies/templates/studies/study_attachments.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
{% query_transform request sort='-full_name' as sort_name_down %}
{% query_transform request sort='created_at' as sort_date_up %}
{% query_transform request sort='-created_at' as sort_date_down %}
{% button_primary_classes "mt-3" as btn_primary_classes %}
<h1>Videos</h1>
<div class="row">
<div class="col">{% include "studies/_response_nav_tabs.html" with active="attachments" %}</div>
Expand All @@ -33,8 +34,8 @@ <h1>Videos</h1>
<span class="text-end">
<form method="post">
{% csrf_token %}
{% bootstrap_button "Download all videos" button_class="btn btn-primary mt-3" button_type="submit" name="all-attachments" value="all" %}
{% bootstrap_button "Download all consent videos" button_class="btn btn-primary mt-3" button_type="submit" name="all-consent-videos" value="all" %}
{% bootstrap_button "Download all videos" button_class=btn_primary_classes button_type="submit" name="all-attachments" value="all" %}
{% bootstrap_button "Download all consent videos" button_class=btn_primary_classes button_type="submit" name="all-consent-videos" value="all" %}
</form>
</span>
</div>
Expand Down Expand Up @@ -90,7 +91,7 @@ <h1>Videos</h1>
<td>{{ video.created_at|date:"n/j/Y g:i A"|default:"N/A" }}</td>
<td>
<a href="{% url 'exp:study-response-video-download' pk=study.id video=video.pk %}?mode=download"
class="btn btn-primary btn-sm"> Download </a>
class="{% button_primary_classes %} btn-sm"> Download </a>
</td>
</tr>
{% empty %}
Expand Down
Loading

0 comments on commit fec9a52

Please sign in to comment.