Skip to content

Commit 0879a75

Browse files
authored
IBX-10473: Refactor custom URL form styles and templates to match the design and improve maintainability and consistency. (#1707)
1 parent 121cb69 commit 0879a75

File tree

2 files changed

+29
-15
lines changed

2 files changed

+29
-15
lines changed

src/bundle/Resources/public/scss/_custom-url-form.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
&__info-text {
1818
font-size: $ibexa-text-font-size-small;
1919
color: $ibexa-color-dark-400;
20+
margin-top: calculateRem(6px);
2021

2122
&--checked {
2223
display: none;
@@ -31,6 +32,11 @@
3132
display: none;
3233
}
3334
}
35+
36+
.ibexa-icon {
37+
fill: currentColor;
38+
margin-top: calculateRem(-3px);
39+
}
3440
}
3541

3642
&__helper-text {

src/bundle/Resources/views/themes/admin/content/tab/url/modal_add_custom_url.html.twig

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@
1313
{{ form_start(form, {'action': path('ibexa.custom_url.add')}) }}
1414
{% endblock %}
1515
{% block body_content %}
16+
{% macro info_text(message, modifier = '') %}
17+
<div class="ibexa-custom-url-from__info-text{{ modifier ? ' ibexa-custom-url-from__info-text--' ~ modifier : '' }}">
18+
<svg class="ibexa-icon ibexa-icon--small">
19+
<use xlink:href="{{ ibexa_icon_path('system-information') }}"></use>
20+
</svg>
21+
{{ message }}
22+
</div>
23+
{% endmacro %}
24+
25+
{% import _self as component %}
26+
1627
<div class="ibexa-custom-url-from">
1728
<div class="ibexa-custom-url-from__item">
1829
<label class="ibexa-label required">{{ 'tab.urls.add.path'|trans|desc('URL') }}</label>
@@ -25,29 +36,26 @@
2536
<div class="ibexa-custom-url-from__item">
2637
<label class="ibexa-label">{{ 'tab.urls.add.redirect'|trans|desc('Redirect to alias destination') }}</label>
2738
{{ form_widget(form.redirect) }}
28-
<div class="ibexa-custom-url-from__info-text ibexa-custom-url-from__info-text--checked">{{ 'tab.urls.add.redirect.helper.checked'|trans|desc('The alias will redirect to the destination using an HTTP 301 response.') }}</div>
29-
<div class="ibexa-custom-url-from__info-text ibexa-custom-url-from__info-text--unchecked">{{ 'tab.urls.add.redirect.helper.unchecked'|trans|desc('The alias will not redirect to the destination and the URL will stay the same.') }}</div>
39+
{{ component.info_text('tab.urls.add.redirect.helper.checked'|trans|desc('The alias will redirect to the destination using an HTTP 301 response.'), 'checked') }}
40+
{{ component.info_text('tab.urls.add.redirect.helper.unchecked'|trans|desc('The alias will not redirect to the destination and the URL will stay the same.'), 'unchecked') }}
3041
</div>
3142
<div class="ibexa-custom-url-from__item">
3243
<label class="ibexa-label">{{ 'tab.urls.add.site_root'|trans|desc('Place at the site root') }}</label>
3344
{{ form_widget(form.site_root) }}
34-
<div class="ibexa-custom-url-from__info-text ibexa-custom-url-from__info-text--checked">{{ 'tab.urls.add.site_root.helper.checked'|trans|desc('The alias will be placed at the site root.') }}</div>
35-
<div class="ibexa-custom-url-from__info-text ibexa-custom-url-from__info-text--unchecked">
36-
{% if parent_name is not null %}
37-
{{ 'tab.urls.add.site_root.helper.unchecked'|trans({'%parent_name%': parent_name})|desc('The alias will be placed under %parent_name%') }}
38-
{% else %}
39-
{{ 'tab.urls.add.site_root.helper.no_parent_name'|trans|desc('The alias will be placed under the parent of this Location') }}
40-
{% endif %}
41-
</div>
45+
{{ component.info_text('tab.urls.add.site_root.helper.checked'|trans|desc('The alias will be placed at the site root.'), 'checked') }}
46+
{{ component.info_text(
47+
parent_name is not null
48+
? 'tab.urls.add.site_root.helper.unchecked'|trans({'%parent_name%': parent_name})|desc('The alias will be placed under %parent_name%')
49+
: 'tab.urls.add.site_root.helper.no_parent_name'|trans|desc('The alias will be placed under the parent of this Location'),
50+
'unchecked'
51+
) }}
4252
</div>
4353
<div class="ibexa-custom-url-from__item ibexa-custom-url-from__item--siteacces">
4454
<label class="ibexa-label">{{ 'tab.urls.add.site_access'|trans|desc('SiteAccess') }}</label>
4555
{{ form_widget(form.site_access) }}
46-
<div class="ibexa-custom-url-from__info-text">
47-
{{ 'tab.urls.add.root_location_id.helper_secondary'|trans|desc(
48-
"If no SiteAccess selected, the alias will be placed at main root Location."
49-
) }}
50-
</div>
56+
{{ component.info_text('tab.urls.add.root_location_id.helper_secondary'|trans|desc(
57+
"If no SiteAccess selected, the alias will be placed at main root Location."
58+
)) }}
5159
</div>
5260
</div>
5361
{% endblock %}

0 commit comments

Comments
 (0)