HH/STANDARDS_APP_ICON_FIX_SUMMARY.md
2026-01-15 15:02:42 +03:00

6.2 KiB

Standards App Icon Fix Summary

Overview

Updated all standards app templates to use SVG icons from the action_icons template tag instead of FontAwesome icons. This makes the standards app consistent with other apps in the project and removes the dependency on FontAwesome.

Changes Made

Templates Updated

  1. source_list.html

    • Added {% load action_icons %} tag
    • Replaced <i class="fas fa-plus"> with {% action_icon "create" %}
    • Replaced <i class="fas fa-edit"> with {% action_icon "edit" %}
    • Replaced <i class="fas fa-trash"> with {% action_icon "delete" %}
    • Replaced <i class="fas fa-building"> with {% action_icon "folder" %}
  2. category_list.html

    • Added {% load action_icons %} tag
    • Replaced all FontAwesome icons with SVG action icons
    • Used {% action_icon "create" %} for Add Category button
    • Used {% action_icon "edit" %} and {% action_icon "delete" %} for action buttons
    • Used {% action_icon "folder" %} for empty state icon
  3. standard_form.html

    • Added {% load action_icons %} tag
    • Replaced <i class="fas fa-arrow-left"> with {% action_icon "back" %}
    • Replaced <i class="fas fa-save"> with {% action_icon "save" %}
  4. source_form.html

    • Added {% load action_icons %} tag
    • Replaced back button icon with {% action_icon "back" %}
    • Replaced save button icon with {% action_icon "save" %}
  5. category_form.html

    • Added {% load action_icons %} tag
    • Replaced all FontAwesome icons with SVG action icons
  6. source_confirm_delete.html

    • Added {% load action_icons %} tag
    • Replaced <i class="fas fa-arrow-left"> with {% action_icon "back" %}
    • Replaced <i class="fas fa-exclamation-triangle"> with {% action_icon "warning" %}
    • Replaced <i class="fas fa-trash"> with {% action_icon "delete" %}
  7. category_confirm_delete.html

    • Added {% load action_icons %} tag
    • Replaced all FontAwesome icons with SVG action icons
  8. standard_detail.html

    • Added {% load action_icons %} tag
    • Replaced back button icon with {% action_icon "back" %}
    • Replaced <i class="fas fa-paperclip"> with {% action_icon "attachment" %}
  9. department_standards.html

    • Added {% load action_icons %} tag
    • Replaced all FontAwesome icons with SVG action icons
    • Used {% action_icon "create" %} for Add Standard button
    • Used {% action_icon "back" %} for back button
    • Used {% action_icon "attachment" %} for evidence count
    • Used {% action_icon "edit" %} for existing assessments
    • Used {% action_icon "save" %} for save assessment button

Benefits

  1. Consistency: All apps now use the same SVG icon system
  2. Performance: SVG icons are lightweight and don't require external CSS/JS libraries
  3. Customization: Icons can be easily customized through the action_icons.py file
  4. Maintainability: Single source of truth for all action icons
  5. Accessibility: SVG icons can be made more accessible than FontAwesome

Icon Mapping

FontAwesome Action Icon Usage
fa-plus create Add/Create actions
fa-edit edit Edit/Update actions
fa-trash delete Delete actions
fa-arrow-left back Back navigation
fa-save save Save actions
fa-exclamation-triangle warning Warning messages
fa-paperclip attachment Attachments
fa-building folder Folders/containers

Technical Details

  • The action_icons template tag is located at: apps/social/templatetags/action_icons.py
  • Icons are rendered as inline SVG elements
  • Icons support size parameter (default: 16px)
  • All SVGs include proper accessibility attributes (aria-hidden, role)

Size Control

The action_icon template tag accepts an optional size parameter to control icon dimensions:

{% action_icon "edit" size=20 %}    <!-- 20x20 pixels -->
{% action_icon "delete" size=24 %}   <!-- 24x24 pixels -->
{% action_icon "create" size=32 %}    <!-- 32x32 pixels -->
{% action_icon "folder" size=64 %}    <!-- 64x64 pixels -->
Use Case Size Example
Inline buttons (btn-sm) 14-16 {% action_icon "edit" %}
Standard buttons 16-20 {% action_icon "save" size=20 %}
Large buttons (btn-lg) 20-24 {% action_icon "create" size=24 %}
Empty state icons 48-64 {% action_icon "folder" size=64 %}
Hero/feature icons 64-96 {% action_icon "star" size=96 %}

Size Examples in Templates

{# Small icon for inline badges #}
<span class="badge bg-info">
    {% action_icon "attachment" size=12 %}
    3 files
</span>

{# Default size for action buttons #}
<button class="btn btn-primary">
    {% action_icon "create" %}
    Add Item
</button>

{# Larger icon for primary actions #}
<button class="btn btn-lg btn-success">
    {% action_icon "save" size=24 %}
    Save Changes
</button>

{# Extra large icon for empty states #}
<div class="text-center py-5">
    <span class="text-muted mb-3 d-block">
        {% action_icon "folder" size=64 %}
    </span>
    <h5>No items found</h5>
</div>

Testing Recommendations

  1. Navigate to all standards app pages
  2. Verify all buttons display icons correctly
  3. Check icon alignment with text
  4. Verify icons work on different screen sizes
  5. Test with different browser rendering engines
  • apps/social/templatetags/action_icons.py - Icon definitions
  • templates/standards/source_list.html - Updated
  • templates/standards/category_list.html - Updated
  • templates/standards/standard_form.html - Updated
  • templates/standards/source_form.html - Updated
  • templates/standards/category_form.html - Updated
  • templates/standards/source_confirm_delete.html - Updated
  • templates/standards/category_confirm_delete.html - Updated
  • templates/standards/standard_detail.html - Updated
  • templates/standards/department_standards.html - Updated

Completion Status

All standards app templates updated with SVG icons FontAwesome dependency removed from standards app Consistent with other apps in the project No breaking changes to functionality