Skip to content

Commit

Permalink
LTD-537: Hide "Give advice" button if no ability to give advice
Browse files Browse the repository at this point in the history
This is a cosmetic change to remove the give advice buttons if the user doesn't
have permissions to give advice on a case.
  • Loading branch information
r4vi committed Feb 15, 2021
1 parent 2c6432a commit 952cf8d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
12 changes: 7 additions & 5 deletions caseworker/templates/case/tabs/final-advice.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
</a>
{% endif %}
<div class="lite-!-display-inline lite-buttons-row {% if current_advice_level != 'final' %}app-advice__disabled-buttons{% endif %}">
<div data-enable-on-checkboxes="#form-final-advice-container" class="lite-buttons-row lite-!-display-inline">
<button id="button-give-final-advice" name="action" value="give-advice" type="submit" class="govuk-button" data-module="govuk-button">
{% lcs 'advice.FinalAdvicePage.GIVE_CHANGE_ADVICE_BUTTON' %}
</button>
</div>
{% if current_advice_level %}
<div data-enable-on-checkboxes="#form-final-advice-container" class="lite-buttons-row lite-!-display-inline">
<button id="button-give-final-advice" name="action" value="give-advice" type="submit" class="govuk-button" data-module="govuk-button">
{% lcs 'advice.FinalAdvicePage.GIVE_CHANGE_ADVICE_BUTTON' %}
</button>
</div>
{% endif %}
<button form="form-final-advice" id="button-clear-final-advice" name="action" value="delete" type="submit" class="govuk-button {% if not case.advice|filter_advice_by_level:'final' %}govuk-button--disabled{% endif %}" data-module="govuk-button">
{% lcs 'advice.FinalAdvicePage.CLEAR_ADVICE_BUTTON' %}
</button>
Expand Down
14 changes: 8 additions & 6 deletions caseworker/templates/case/tabs/team-advice.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
</a>
{% endif %}
<div class="lite-!-display-inline lite-buttons-row {% if current_advice_level != 'team' %}app-advice__disabled-buttons{% endif %}">
<div data-enable-on-checkboxes="#form-team-advice-container" class="lite-buttons-row lite-!-display-inline">
<button id="button-give-team-advice" name="action" value="give-advice" type="submit" class="govuk-button" data-module="govuk-button">
{% lcs 'advice.TeamAdvicePage.GIVE_CHANGE_ADVICE_BUTTON' %}
</button>
</div>
{% if current_advice_level %}
<div data-enable-on-checkboxes="#form-team-advice-container" class="lite-buttons-row lite-!-display-inline">
<button id="button-give-team-advice" name="action" value="give-advice" type="submit" class="govuk-button" data-module="govuk-button">
{% lcs 'advice.TeamAdvicePage.GIVE_CHANGE_ADVICE_BUTTON' %}
</button>
</div>
{% endif %}
<button form="form-team-advice" id="button-clear-team-advice" name="action" value="delete" type="submit" class="govuk-button" data-module="govuk-button">
{% lcs 'advice.TeamAdvicePage.CLEAR_ADVICE_BUTTON' %}
</button>
Expand All @@ -42,4 +44,4 @@
</div>

{% include 'case/includes/advice.html' with level='team' %}
</form>
</form>
12 changes: 7 additions & 5 deletions caseworker/templates/case/tabs/user-advice.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
List view
</a>
{% endif %}
<div data-enable-on-checkboxes="#form-user-advice-container" class="lite-!-display-inline lite-buttons-row {% if current_advice_level != 'user' %}app-advice__disabled-buttons{% endif %}">
<button id="button-give-user-advice" type="submit" class="govuk-button" data-module="govuk-button">
{% lcs 'advice.UserAdvicePage.GIVE_CHANGE_ADVICE_BUTTON' %}
</button>
</div>
{% if current_advice_level %}
<div data-enable-on-checkboxes="#form-user-advice-container" class="lite-!-display-inline lite-buttons-row {% if current_advice_level != 'user' %}app-advice__disabled-buttons{% endif %}">
<button id="button-give-user-advice" type="submit" class="govuk-button" data-module="govuk-button">
{% lcs 'advice.UserAdvicePage.GIVE_CHANGE_ADVICE_BUTTON' %}
</button>
</div>
{% endif %}
</div>
<div class="{% if current_advice_level != 'user' or not case.advice|filter_advice_by_level:'user' %}app-advice__disabled-buttons{% endif %}">
<button form="form-user-advice" id="button-combine-user-advice" type="submit" class="govuk-button" data-module="govuk-button">
Expand Down

0 comments on commit 952cf8d

Please sign in to comment.