Opened 7 years ago

Closed 4 years ago

Last modified 4 years ago

#8190 closed New feature (fixed)

Utilise help_text for TabularInline in Admin

Reported by: glenjamin Owned by: dArignac
Component: contrib.admin Version: master
Severity: Normal Keywords:
Cc: rlaager@…, net147@…, glicerinu@…, django@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: yes

Description

When using TabularInline in the automatic admin interface the help_text for fields is not displayed anywhere.

I suggest that the information could be displayed as a tooltip on the column heading, like so:

<th {% if forloop.first %}colspan="2"{% endif %}>{{ field.label|capfirst|escape }}</th>

becomes

<th {% if forloop.first %}colspan="2"{% endif %}>
  {{ field.label|capfirst|escape }}
  {% if field.help_text %}<abbr class="help-text-tooltip" title="{{ field.help_text|striptags }}">?</abbr>{% endif %}
</th>

and then in the CSS:

.help-text-tooltip { cursor: help; }

Attachments (2)

8190-r16351.diff (1.4 KB) - added by dArignac 4 years ago.
8190.tabular-inline-help-text.diff (5.4 KB) - added by julien 4 years ago.

Download all attachments as: .zip

Change History (22)

comment:1 Changed 7 years ago by jacob

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 6 years ago by anonymous

I would prefer this:

         <th {% if forloop.first %}colspan="2"{% endif %}>
           <span class="inline-field-label">{{ field.label|capfirst }}</span>
           {% if field.help_text %}<abbr class="help" title="{{ field.help_text|striptags }}">?</abbr>{% endif %}
         </th>

and

.inline-group .tabular .inline-field-label {
    float: left;
}

.inline-group .tabular abbr.help {
    cursor: help;
    float: right;
}

comment:3 Changed 6 years ago by anonymous

  • Cc rlaager@… added

comment:4 Changed 4 years ago by net147

  • Cc net147@… added

comment:5 Changed 4 years ago by ramiro

#6077 proposed the same with a slightly different UI.

comment:6 Changed 4 years ago by glic3rinu

  • Cc glicerinu@… added

comment:7 Changed 4 years ago by julien

  • milestone set to 1.4

I'd like to see this in 1.4.

comment:8 Changed 4 years ago by lukeplant

  • Severity set to Normal
  • Type set to New feature

comment:9 Changed 4 years ago by julien

  • UI/UX set

comment:10 Changed 4 years ago by dArignac

  • Easy pickings unset
  • Owner changed from nobody to dArignac
  • Status changed from new to assigned

Changed 4 years ago by dArignac

comment:11 Changed 4 years ago by dArignac

  • Has patch set

comment:12 Changed 4 years ago by julien

  • Needs tests set

comment:13 Changed 4 years ago by jedie

  • Cc django@… added

Whats about simply add the help_text to td title ?

e.g:

django/contrib/admin/templates/admin/edit_inline/tabular.html
@@ -42,7 +42,7 @@
{% for fieldset in inline_admin_form %}
{% for line in fieldset %}
{% for field in line %}
- <td class="{{ field.field.name }}">
+ <td class="{{ field.field.name }}" title="{{ field.field.help_text }}">
{% if field.is_readonly %}
<p>{{ field.contents }}</p>
{% else %}

Changed 4 years ago by julien

comment:14 Changed 4 years ago by julien

  • Needs tests unset

The attached patch contains a binary image I've created to symbolise the help text (instead of using a '?' character). I've also added some tests.

comment:15 Changed 4 years ago by julien

By the way, you will need to use 'git apply' to create the binary image from the patch.

comment:16 Changed 4 years ago by jezdez

  • Patch needs improvement set

I don't know the small icon looks a little odd (too dark), maybe we could ask our Design BDFL to create a better one.

Last edited 4 years ago by jezdez (previous) (diff)

comment:18 Changed 4 years ago by idangazit

Small icon is indeed too dark. icon-unknown.gif would be a fine solution here, even if it is used for other purposes elsewhere.

comment:19 Changed 4 years ago by jezdez

  • Resolution set to fixed
  • Status changed from assigned to closed

In [16622]:

Fixed #8190 -- Added support for a field's help text to the tabular admin inline. Thanks, Julien Phalip and Idan Gazit.

comment:20 Changed 4 years ago by jacob

  • milestone 1.4 deleted

Milestone 1.4 deleted

Note: See TracTickets for help on using tickets.
Back to Top