Skip to content

Commit

Permalink
Merge pull request #1884 from alphagov/fix-link-icons
Browse files Browse the repository at this point in the history
Fix link icons
  • Loading branch information
kentsanggds authored Nov 25, 2024
2 parents 65ad16f + 9f8da68 commit 1e4eb42
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jobs:
;;
"build_push_test_ckan")
echo "BUILD_TAGS=${{ matrix.app.version }}-test-d" >> $GITHUB_ENV
echo "BUILD_TAGS=${{ matrix.app.version }}-test" >> $GITHUB_ENV
echo "DOCKERFILE=${{ matrix.app.version }}" >> $GITHUB_ENV
echo "BUILD_CKAN_BASE=true" >> $GITHUB_ENV
echo "ADD_PATCH_TAG=true" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion build-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apps:
ckan: &app_ckan
name: ckan
version: "2.10.4"
patch: g
patch: h
pycsw: &app_pycsw
name: pycsw
version: "2.6.1"
Expand Down
21 changes: 21 additions & 0 deletions ckanext/datagovuk/ckan_patches/helpers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import dominate
import dominate.tags as dom_tags
from markupsafe import Markup, escape
from typing import Any

from ckan.lib.helpers import _preprocess_dom_attrs, literal, core_helper


@core_helper
def link_to(label: str, url: str, **attrs: Any) -> Markup:
attrs = _preprocess_dom_attrs(attrs)
attrs['href'] = url
if label == '' or label is None:
label = url

# without dominate.util.raw the returned literal has encoding within it
return literal(dom_tags.a(dominate.util.raw(label), **attrs))


import ckan.lib.helpers
ckan.lib.helpers.link_to = link_to
2 changes: 1 addition & 1 deletion ckanext/datagovuk/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def dgu_home():
return bp

# import these for monkey patching
from ckanext.datagovuk.ckan_patches import cli, logic, query
from ckanext.datagovuk.ckan_patches import cli, logic, query, helpers

# ITemplateHelpers

Expand Down

0 comments on commit 1e4eb42

Please sign in to comment.