Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix link icons #1884

Merged
merged 3 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading