Skip to content

Commit

Permalink
Merge pull request #34902 from dimagi/dmr/improve-explicit-disable-fl…
Browse files Browse the repository at this point in the history
…ag-UI

Improve explicit disable flag UI (and additional fix)
  • Loading branch information
dannyroberts authored Jul 29, 2024
2 parents ca29de5 + 512b9f7 commit ef90f4a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions corehq/apps/toggle_ui/static/toggle_ui/js/edit-flag.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ hqDefine('toggle_ui/js/edit-flag', [
self.saveButtonBottom = self.createSaveButton();

self.getNamespaceHtml = function (namespace, value) {
if (value && value[0] === '!') {
value = value.replace(/^!/, '');
}
if (namespace === 'domain') {
return '<a href="' + initialPageData.reverse('domain_internal_settings', value) + '">domain <i class="fa fa-external-link"></i></a>';
} else {
Expand Down
10 changes: 8 additions & 2 deletions corehq/apps/toggle_ui/templates/toggle/edit_flag.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

{% block page_content %}
{% registerurl 'edit_toggle' toggle.slug %}
{% registerurl 'domain_internal_settings' '___' %}
{% registerurl 'domain_internal_settings' '---' %}
{% initial_page_data 'items' toggle.enabled_users %}
{% initial_page_data 'namespaces' namespaces %}
{% initial_page_data 'last_used' last_used %}
Expand Down Expand Up @@ -155,7 +155,7 @@ <h4>
{% trans "Enabled toggle items" %}
{% if is_random %}
<span data-bind="makeHqHelp: {
description: '{% trans "Items added here will be enabled regardless of the randomness" %}'}"></span>
description: '{% trans "Items added here will be enabled regardless of the randomness (or disabled if preceded by `!`)" %}'}"></span>
{% endif %}
</h4>
<table class="table table-condensed"><!-- B5: add table-borderless and remove `border: none` inline styles on table cells -->
Expand All @@ -169,6 +169,12 @@ <h4>
</button>
</span>
<input class="form-control" type="text" data-bind="value: value">
<!-- ko if: value() && value()[0] == '!' -->
<span class="input-group-addon"><i class="fa fa-circle-xmark"></i></span>
<!-- /ko -->
<!-- ko ifnot: value() && value()[0] == '!' -->
<span class="input-group-addon"><i class="fa fa-check"></i></span>
<!-- /ko -->
</div>
</td>
<!-- B5: replace inline styles with vertical alignment class: https://getbootstrap.com/docs/5.3/utilities/vertical-align/#css -->
Expand Down

0 comments on commit ef90f4a

Please sign in to comment.