-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1884 from alphagov/fix-link-icons
Fix link icons
- Loading branch information
Showing
4 changed files
with
24 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters