From 61fa60dc8df42f6a3aae4a91bc46c8bbf38fba4a Mon Sep 17 00:00:00 2001 From: Dan Croak Date: Mon, 9 Dec 2019 13:29:59 -0800 Subject: [PATCH 1/2] 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;`. --- app/views/fields/text/_show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/fields/text/_show.html.erb b/app/views/fields/text/_show.html.erb index ad9e6e77a7..ab0a755bbe 100644 --- a/app/views/fields/text/_show.html.erb +++ b/app/views/fields/text/_show.html.erb @@ -16,4 +16,4 @@ whitespace preserved. [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Text %> -<%= field.data %> +
<%= field.data %>
From 937762325c7f352825c033bdef4b5421de5e559f Mon Sep 17 00:00:00 2001 From: Dan Croak Date: Mon, 16 Dec 2019 09:06:47 -0800 Subject: [PATCH 2/2] 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 | 3 +-- 2 files changed, 3 insertions(+), 4 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 ab0a755bbe..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: