From c055c88efcb033a787f5c1bcf531ba4b03484699 Mon Sep 17 00:00:00 2001 From: Dan Croak Date: Wed, 18 Dec 2019 12:55:14 -0800 Subject: [PATCH] Double-click to select attribute text (#1484) * Be able to double-click to select attribute text Each show page displays a description list of the fields. When the field is text, it is rendered inside an inline ``. I've found it common to want to double-click this text to copy-paste an identifier from our admin app into other systems. Previously, double-clicking would not select the field's value. The bug can be seen on the show page in the demo app. For example, try selecting the city or zip code values from: https://administrate-prototype.herokuapp.com/admin/orders/198962 Changing the markup to be a block `
` fixes the bug. Alternatively, we could change the `preserve-whitespace` CSS rule to be `display: block;`. * Make text field behave the same way as string fields --- app/views/fields/string/_show.html.erb | 4 ++-- app/views/fields/text/_show.html.erb | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/views/fields/string/_show.html.erb b/app/views/fields/string/_show.html.erb index 2607473404..d427e53314 100644 --- a/app/views/fields/string/_show.html.erb +++ b/app/views/fields/string/_show.html.erb @@ -4,7 +4,7 @@ This partial renders a string attribute, to be displayed on a resource's show page. -By default, the attribute is rendered as an unformatted string. +By default, the attribute is rendered as text with whitespace preserved. ## Local variables: @@ -15,4 +15,4 @@ By default, the attribute is rendered as an unformatted string. [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/String %> -<%= field.data %> +
<%= field.data %>
diff --git a/app/views/fields/text/_show.html.erb b/app/views/fields/text/_show.html.erb index ad9e6e77a7..25c569bf80 100644 --- a/app/views/fields/text/_show.html.erb +++ b/app/views/fields/text/_show.html.erb @@ -4,8 +4,7 @@ This partial renders a text attribute, to be displayed on a resource's show page. -By default, the attribute is rendered as text with -whitespace preserved. +By default, the attribute is rendered as text with whitespace preserved. ## Local variables: @@ -16,4 +15,4 @@ whitespace preserved. [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Text %> -<%= field.data %> +
<%= field.data %>