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

NGSTACK-452 - unify external link/internal relation into single macro #40

Merged
merged 2 commits into from
Oct 18, 2020

Conversation

Ljudevit
Copy link
Member

In order to generate the URL on the ng_banner content types, the repetitive chunk of code was used which first checked if external URL value is set or either an internal object relation is set in order to set a link value. It was repeated across all macros and was sometimes repeated in other twig templates as well, with no possibility of "unifing" the logic in one separate macro and reusing it when needed.

A link_generator macro was created in order to make this possible. Now, other macros are much more lightweight and link_generator macro can be used in other templates as well, if needed.

This change was tested on four different cases: if banner does not have neither relation or URL, if banner has relation, if banner has URL and if banner has both relation and URL set.

ISSUES: since link_generator macro is used only to set an URL value, it does not have any additional logic like checking if "open_in_new_window" is set, and this logic is left in existing macros. This made a change that interal relation value can also be opened in new tab, which can be considered a feature since this use cases have been required in the past. The only issue that has been identified as an "unwanted" behaviour is the case where neither relation or URL have been set but checkbox "open_in_new_window" is set, which generates an image link to # in new tab, however, this will be resolved in another PR where ng_banner will be modifed that it can work without link markup set (the issue with explicit CSS rules on banner link).

@Ljudevit Ljudevit requested a review from emodric October 18, 2020 09:28
@pspanja pspanja merged commit cdf1aef into 1.9 Oct 18, 2020
@pspanja pspanja deleted the NGSTACK-452 branch October 18, 2020 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants