Skip to content

Commit 9e4558b

Browse files
committed
Add tooltips for 'Add an expression' and 'Remove' buttons when disabled
1 parent 4f542bb commit 9e4558b

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

examples/ui/basic.ru

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ Flipper::UI.configure do |config|
4848
end
4949

5050
config.application_href = "https://example.com"
51+
52+
config.expression_properties = {
53+
client_version: { type: :number },
54+
client_type: { type: :string },
55+
product: { type: :string },
56+
identified: { type: :boolean }
57+
}
5158
end
5259

5360
# You can uncomment these to get some default data:

lib/flipper/ui/views/feature.erb

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,12 @@
293293
</div>
294294
</div>
295295
<div class="col-auto ms-auto">
296-
<button type="button" class="btn btn-outline-secondary" id="add-expression-btn">
297-
Add an expression
298-
</button>
296+
<%# Disabled buttons don't respond to hover events: https://getbootstrap.com/docs/4.0/components/tooltips/#disabled-elements %>
297+
<span class="d-inline-block" tabindex="0" data-toggle="tooltip" data-placement="top" title="Add an expression is only available for 'Any' and 'All' expression types">
298+
<button type="button" class="btn btn-outline-secondary" id="add-expression-btn">
299+
Add an expression
300+
</button>
301+
</span>
299302
</div>
300303
<% if @feature.has_expression? %>
301304
<div class="col-auto">
@@ -343,7 +346,9 @@
343346
<input type="text" name="expression_value" placeholder="value" class="form-control" value="<%= @feature.expression_form_data[:value] %>">
344347
</div>
345348
<div class="col-auto ms-auto mb-3">
349+
<span class="d-inline-block" tabindex="0" data-toggle="tooltip" data-placement="top" title="'Remove' is only available for 'Any' or 'All' expression types">
346350
<button type="button" class="btn btn-outline-danger remove-expression-btn" disabled>Remove</button>
351+
</span>
347352
</div>
348353
</div>
349354
</div>
@@ -397,7 +402,9 @@
397402
<input type="text" name="complex_expressions[COUNTER][value]" placeholder="value" class="form-control" required>
398403
</div>
399404
<div class="col-auto ms-auto mb-3">
400-
<button type="button" class="btn btn-outline-danger remove-expression-btn">Remove</button>
405+
<span class="d-inline-block" tabindex="0" data-toggle="tooltip" data-placement="top" title="N > 1 expressions required to remove one.">
406+
<button type="button" class="btn btn-outline-danger remove-expression-btn">Remove</button>
407+
</span>
401408
</div>
402409
</div>
403410
</template>

0 commit comments

Comments
 (0)