[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#753800: marked as done (Ensure all octicons have proper fallback in text browsers)



Your message dated Wed, 10 Feb 2016 12:04:05 +0100
with message-id <20160210110405.GB29200@home.ouaza.com>
and subject line Re: Bug#753800: tracker.debian.org: please give the details link some content
has caused the Debian Bug report #753800,
regarding Ensure all octicons have proper fallback in text browsers
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
753800: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=753800
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: tracker.debian.org
Severity: minor

Please add some content to the "<span title="details">" links.
Currently the whole content of the <a ..> is a <i...> tag without any
content and the image of the question mark in the circle is put there as
background image. This causes some text browsers to not offer anything
to select there, so the link is not shown and cannot be followed.

It would be nicer if there was some <img ..> with a proper alternate
text.

Thanks in advance,
        Bernhard R. Link
-- 
F8AC 04D5 0B9B 064B 3383  C3DA AFFC 96D1 151D FFDC

--- End Message ---
--- Begin Message ---
Hi,

On Sun, 07 Feb 2016, Esa Peuha wrote:
> Here is a patch that hopefully fixes this issue. It adds two new
> template tags, "octicon" which renders any octicon with alternate
> text (which should appear as both mouseover text and text-mode-only
> text), and "toggle_chevron" which gives a downward chevron to toggle
> the display of details (this was so frequent special case that it
> seemed worth its own tag). The only testing I have done is to make
> sure that "manage.py test" didn't break.

Thanks I merged your work but I had to fix it up a little bit. It was
not working entirely as you expected it. You probably should have tried
to run it :)

Instead of the expected octicons in the "versioned links" panel, we had
a dump of the dict returned by the octicon function. Also you used
"toggle-chevron" instead of "toggle_chevron" in two places.

I also made some other changes, cf attached patch.

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Support Debian LTS: http://www.freexian.com/services/debian-lts.html
Learn to master Debian: http://debian-handbook.info/get/
commit a907a76bb3e990158e751ce9fffa4659a7d1aaf9 (HEAD -> master)
Author: Raphaël Hertzog <hertzog@debian.org>
Date:   Wed Feb 10 11:18:13 2016 +0100

    templates: rework slightly the new templatetags
    
    * Do not use an intermediary template file for toggle chevron.
    * Allow use of different texts for tooltip and textual rendering,
      defaulting to [tooltip] for the textual rendering of the icon.
    * Fix octicon function to return the expected string directly so that
      it can be used outside of the templating system too (direct usage
      was returing a dict despite the @register.inclusion_tag decorator).
    * Replace non-existing "toggle-chevron" tags with the correct
      "toggle_chevron".

diff --git a/distro_tracker/core/templates/core/edit-team-membership.html b/distro_tracker/core/templates/core/edit-team-membership.html
index 77c4fe2..06125ed 100644
--- a/distro_tracker/core/templates/core/edit-team-membership.html
+++ b/distro_tracker/core/templates/core/edit-team-membership.html
@@ -22,7 +22,8 @@
         <div class="accordion-heading">
             <div class="row">
             <div class="col-md-10">
-	    <button class="btn btn-sm btn-default" data-toggle="collapse" data-parent="#{{ accordion_id }}" data-target="#{{ accordion_id }}-details-{{ forloop.counter }}">{% toggle-chevron %}</button>
+	    <button class="btn btn-sm btn-default" data-toggle="collapse"
+		data-parent="#{{ accordion_id }}" data-target="#{{ accordion_id }}-details-{{ forloop.counter }}">{% toggle_chevron %}</button>
             {% if pkg.get_absolute_url %}
             <a href="{{ pkg.get_absolute_url }}">{{ pkg }}</a>
             {% else %}
diff --git a/distro_tracker/core/templates/core/octicon.html b/distro_tracker/core/templates/core/octicon.html
index 7af8464..0ae758d 100644
--- a/distro_tracker/core/templates/core/octicon.html
+++ b/distro_tracker/core/templates/core/octicon.html
@@ -1 +1 @@
-<span class="octicon octicon-{{ name }}" title="{{ text }}"><span class="sr-only">{{ text }}</span></span>
+<span class="octicon octicon-{{ name }}" title="{{ title }}"><span class="sr-only">{{ content }}</span></span>
diff --git a/distro_tracker/core/templates/core/panels/action-needed.html b/distro_tracker/core/templates/core/panels/action-needed.html
index 9d4078c..a5bf272 100644
--- a/distro_tracker/core/templates/core/panels/action-needed.html
+++ b/distro_tracker/core/templates/core/panels/action-needed.html
@@ -11,7 +11,7 @@
 		  data-parent="#action-needed-list"
 		  data-target="#action-needed-details-{{ forloop.counter }}"
 		  class="chevron">
-		{% toggle-chevron %}
+		{% toggle_chevron %}
 	    </span>
 	    {# The short description is allowed to contain some HTML markup #}
 	    {{ item.short_description|safe }}
diff --git a/distro_tracker/core/templates/core/toggle-chevron.html b/distro_tracker/core/templates/core/toggle-chevron.html
deleted file mode 100644
index 9ec7def..0000000
--- a/distro_tracker/core/templates/core/toggle-chevron.html
+++ /dev/null
@@ -1,2 +0,0 @@
-{% load distro_tracker_extras %}
-{% octicon 'chevron-down' 'Toggle details' %}
diff --git a/distro_tracker/core/templatetags/distro_tracker_extras.py b/distro_tracker/core/templatetags/distro_tracker_extras.py
index fd81af6..3f33fc7 100644
--- a/distro_tracker/core/templatetags/distro_tracker_extras.py
+++ b/distro_tracker/core/templatetags/distro_tracker_extras.py
@@ -9,7 +9,9 @@
 # except according to the terms contained in the LICENSE file.
 """Additional distro-tracker specific template tags."""
 from __future__ import unicode_literals
+
 from django import template
+from django.template.loader import render_to_string
 
 register = template.Library()
 
@@ -49,20 +51,26 @@ def repeat(parser, token):
     return RepeatNode(nodelist, count)
 
 
-@register.inclusion_tag('core/octicon.html')
-def octicon(name, text):
+@register.simple_tag()
+def octicon(name, title='', content=None):
     """
     Renders an octicon with alternate text.
     """
-    return { 'name':name, 'text':text }
+    if content is None:
+        content = "[{}]".format(title)
+
+    return render_to_string(
+        'core/octicon.html',
+        {'name': name, 'title': title, 'content': content}
+    )
 
 
-@register.inclusion_tag('core/toggle-chevron.html')
-def toggle_chevron():
+@register.simple_tag()
+def toggle_chevron(title='Toggle details', content=None):
     """
     Renders a chevron to toggle details.
     """
-    return {}
+    return octicon('chevron-down', title, content)
 
 
 @register.filter(name='zip')

--- End Message ---

Reply to: