N°2847 - Change calls to methods in TWIG to something more meaningful to avoid consufion between methods, properties and array keys

This commit is contained in:
Molkobain
2020-08-06 17:46:17 +02:00
parent af87a04d13
commit f20310b437
12 changed files with 41 additions and 41 deletions

View File

@@ -1 +1 @@
<div id="{{ oUIBlock.Id }}" class="ibo-breadcrumbs"></div>
<div id="{{ oUIBlock.GetId() }}" class="ibo-breadcrumbs"></div>

View File

@@ -1,6 +1,6 @@
// TODO: We need to find a clean way to launch this script only once the JS scripts are loaded
document.addEventListener("DOMContentLoaded", function(){
setTimeout(function(){
$('#{{ oUIBlock.Id }}').breadcrumbs({{ oUIBlock.JsWidgetOptions|json_encode|raw }});
$('#{{ oUIBlock.GetId() }}').breadcrumbs({{ oUIBlock.GetJsWidgetOptions()|json_encode|raw }});
}, 500);
});

View File

@@ -1,5 +1,5 @@
<div id="{{ oUIBlock.Id }}" class="ibo-global-search" data-role="ibo-global-search">
<form action="{{ oUIBlock.Endpoint }}" method="post" class="ibo-global-search--head" data-role="ibo-global-search--head">
<div id="{{ oUIBlock.GetId() }}" class="ibo-global-search" data-role="ibo-global-search">
<form action="{{ oUIBlock.GetEndpoint() }}" method="post" class="ibo-global-search--head" data-role="ibo-global-search--head">
<a href="#" class="ibo-global-search--icon fas fa-search" data-role="ibo-global-search--icon" data-tooltip-content="{{ 'UI:Component:GlobalSearch:Tooltip'|dict_s }}" data-tooltip-placement="bottom-start" data-tooltip-distance-offset="25"></a>
<input type="text" name="query" class="ibo-global-search--input" data-role="ibo-global-search--input" placeholder="{{ 'UI:Component:GlobalSearch:Input:Placeholder'|dict_s }}" autocomplete="off" />
</form>
@@ -9,8 +9,8 @@
<span>{{ 'UI:Component:GlobalSearch:Recents:Title'|dict_s }}</span>
</div>
<div class="ibo-global-search--compartment-content" data-role="ibo-global-search--compartment-content">
{% if oUIBlock.LastQueries|length > 0 %}
{% for aQuery in oUIBlock.LastQueries %}
{% if oUIBlock.GetLastQueries()|length > 0 %}
{% for aQuery in oUIBlock.GetLastQueries() %}
<a href="#" class="ibo-global-search--compartment-element" data-role="ibo-global-search--compartment-element" data-query-raw="{{ aQuery.query }}" title="{{ aQuery.query }}">
{% if aQuery.icon_url is defined %}
<img src="{{ aQuery.icon_url}}" class="ibo-global-search--compartment-element-image" />

View File

@@ -1,6 +1,6 @@
// TODO: We need to find a clean way to launch this script only once the JS scripts are loaded
document.addEventListener("DOMContentLoaded", function(){
setTimeout(function(){
$('#{{ oUIBlock.Id }}').global_search();
$('#{{ oUIBlock.GetId() }}').global_search();
}, 500);
});

View File

@@ -1,7 +1,7 @@
{% extends 'components/popover-menu/item/layout.html.twig' %}
{% block iboPopoverMenuItem %}
<a class="ibo-popover-menu--item" data-role="ibo-popover-menu--item" href="{{ oUIBlock.Url }}" onclick="{{ oUIBlock.JsCode }}">
{{ oUIBlock.Label }}
<a class="ibo-popover-menu--item" data-role="ibo-popover-menu--item" href="{{ oUIBlock.GetUrl() }}" onclick="{{ oUIBlock.GetJsCode() }}">
{{ oUIBlock.GetLabel() }}
</a>
{% endblock %}

View File

@@ -1,8 +1,8 @@
{% extends 'components/popover-menu/item/layout.html.twig' %}
{% block iboPopoverMenuItem %}
<a class="ibo-popover-menu--item" data-role="ibo-popover-menu--item" href="{{ oUIBlock.Url }}" target="{{ oUIBlock.Target }}">
{{ oUIBlock.Label }}
<a class="ibo-popover-menu--item" data-role="ibo-popover-menu--item" href="{{ oUIBlock.GetUrl() }}" target="{{ oUIBlock.GetTarget() }}">
{{ oUIBlock.GetLabel() }}
</a>
{% endblock %}

View File

@@ -1,5 +1,5 @@
<div {% if oUIBlock.Id is defined %}id="{{ oUIBlock.Id }}"{% endif %} class="ibo-popover-menu" data-role="ibo-popover-menu">
{% for aSection in oUIBlock.Sections %}
<div {% if oUIBlock.GetId() is defined %}id="{{ oUIBlock.GetId() }}"{% endif %} class="ibo-popover-menu" data-role="ibo-popover-menu">
{% for aSection in oUIBlock.GetSections() %}
{% if aSection.aItems|length > 0 %}
<div class="ibo-popover-menu--section" data-role="ibo-popover-menu--section">
{% for oUIBlockItem in aSection.aItems %}

View File

@@ -1,10 +1,10 @@
<div id="{{ oUIBlock.Id }}" class="ibo-quick-create" data-role="ibo-quick-create">
<form action="{{ oUIBlock.Endpoint }}" method="get" class="ibo-quick-create--head" data-role="ibo-quick-create--head">
<div id="{{ oUIBlock.GetId() }}" class="ibo-quick-create" data-role="ibo-quick-create">
<form action="{{ oUIBlock.GetEndpoint() }}" method="get" class="ibo-quick-create--head" data-role="ibo-quick-create--head">
<input type="hidden" name="operation" value="new" />
<a href="#" class="ibo-quick-create--icon fas fa-plus" data-role="ibo-quick-create--icon" data-tooltip-content="{{ 'UI:Component:QuickCreate:Tooltip'|dict_s }}" data-tooltip-placement="bottom-start" data-tooltip-distance-offset="25"></a>
<select name="class" class="ibo-quick-create--input" data-role="ibo-quick-create--input" placeholder="{{ 'UI:Component:QuickCreate:Input:Placeholder'|dict_s }}">
<option value="">{{ 'UI:Component:QuickCreate:Input:Placeholder'|dict_s }}</option>
{% for sClassCode, sClassLabel in oUIBlock.AvailableClasses %}
{% for sClassCode, sClassLabel in oUIBlock.GetAvailableClasses() %}
<option value="{{ sClassCode }}">{{ sClassLabel }}</option>
{% endfor %}
</select>
@@ -15,8 +15,8 @@
<span>{{ 'UI:Component:QuickCreate:Recents:Title'|dict_s }}</span>
</div>
<div class="ibo-quick-create--compartment-content" data-role="ibo-quick-create--compartment-content">
{% if oUIBlock.LastClasses|length > 0 %}
{% for aClass in oUIBlock.LastClasses %}
{% if oUIBlock.GetLastClasses()|length > 0 %}
{% for aClass in oUIBlock.GetLastClasses() %}
<a href="{{ aClass.target_url }}" class="ibo-quick-create--compartment-element" data-role="ibo-quick-create--compartment-element" data-class-code="{{ aQuery.class }}">
{% if aClass.icon_url is defined %}
<img src="{{ aClass.icon_url}}" class="ibo-quick-create--compartment-element-image" />

View File

@@ -1,6 +1,6 @@
// TODO: We need to find a clean way to launch this script only once the JS scripts are loaded
document.addEventListener("DOMContentLoaded", function(){
setTimeout(function(){
$('#{{ oUIBlock.Id }}').quick_create();
$('#{{ oUIBlock.GetId() }}').quick_create();
}, 500);
});

View File

@@ -1,8 +1,8 @@
<nav id="{{ oUIBlock.Id }}" class="ibo-navigation-menu {% if NavigationMenu.IsExpanded == true %}ibo-is-expanded{% endif %}">
<nav id="{{ oUIBlock.GetId() }}" class="ibo-navigation-menu {% if oUIBlock.IsExpanded() == true %}ibo-is-expanded{% endif %}">
<div class="ibo-navigation-menu--body">
<div class="ibo-navigation-menu--top-part">
<a class="ibo-navigation-menu--square-company-logo" title="{{ oUIBlock.AppRevisionNumber }}" href="{{ oUIBlock.AppIconLink }}">
<img src="{{ oUIBlock.AppSquareIconUrl }}" alt="{{ 'UI:Layout:NavigationMenu:CompanyLogo:AltText'|dict_s }}" />
<a class="ibo-navigation-menu--square-company-logo" title="{{ oUIBlock.GetAppRevisionNumber() }}" href="{{ oUIBlock.GetAppIconLink() }}">
<img src="{{ oUIBlock.GetAppSquareIconUrl() }}" alt="{{ 'UI:Layout:NavigationMenu:CompanyLogo:AltText'|dict_s }}" />
</a>
<a class="ibo-navigation-menu--toggler" data-role="ibo-navigation-menu--toggler" data-tooltip-content="{{ 'UI:Layout:NavigationMenu:Toggler:Tooltip'|dict_s }}" data-tooltip-placement="right" data-tooltip-distance-offset="20" href="#">
<span class="ibo-navigation-menu--toggler-icon">
@@ -13,18 +13,18 @@
</a>
</div>
<div class="ibo-navigation-menu--middle-part">
{% for aMenuGroup in oUIBlock.MenuGroups %}
{% for aMenuGroup in oUIBlock.GetMenuGroups() %}
{{ include('layouts/navigation-menu/menu-group.html.twig', { aMenuGroup: aMenuGroup }) }}
{% endfor %}
</div>
<div class="ibo-navigation-menu--bottom-part">
{% if oUIBlock.IsNewsroomEnabled == true %}
{% if oUIBlock.IsNewsroomEnabled() == true %}
<div class="ibo-navigation-menu--notifications">
<a class="ibo-navigation-menu--notifications-toggler" data-role="ibo-navigation-menu--notifications-toggler">
<i class="fas fa-bell"></i>
</a>
<div class="ibo-navigation-menu--notifications-menu">
{{ render_block(oNavigationMenu.NewsroomMenu) }}
{{ render_block(oUIBlock.GetNewsroomMenu(), {aPage: aPage}) }}
</div>
</div>
{% endif %}
@@ -32,10 +32,10 @@
<div class="ibo-navigation-menu--user-picture">
<a data-role="ibo-navigation-menu--user-menu--toggler" href="#">
<img class="ibo-navigation-menu--user-picture--image"
src="{{ oUIBlock.UserData.sPictureUrl }}"
alt="{{ 'UI:Layout:NavigationMenu:UserInfo:Picture:AltText'|dict_format(oUIBlock.UserData.sFirstname) }}"
src="{{ oUIBlock.GetUserData().sPictureUrl }}"
alt="{{ 'UI:Layout:NavigationMenu:UserInfo:Picture:AltText'|dict_format(oUIBlock.GetUserData().sFirstname) }}"
data-tooltip-content="{{ oUIBlock.UserData.sLogonMessage }}"
data-tooltip-content="{{ oUIBlock.GetUserData().sLogonMessage }}"
data-tooltip-placement="right"
data-tooltip-distance-offset="20"
/>
@@ -45,7 +45,7 @@
<a data-role="ibo-navigation-menu--user-menu--toggler" href="#">
<div class="ibo-navigation-menu--user-welcome-message--text">
<a class="ibo-navigation-menu--user-welcome-message--toggler" data-role="ibo-navigation-menu--user-menu--toggler" href="#">
{{ oUIBlock.UserData.sWelcomeMessage }}
{{ oUIBlock.GetUserData().sWelcomeMessage }}
<span class="ibo-navigation-menu--user-welcome-message--toggler" data-role="ibo-navigation-menu--user-menu--toggler">
<i class="fas fa-caret-down"></i>
</span>
@@ -53,7 +53,7 @@
</div>
</a>
</div>
{% if oUIBlock.IsNewsroomEnabled == true %}
{% if oUIBlock.IsNewsroomEnabled() == true %}
<div class="ibo-navigation-menu--user-notifications">
<a class="ibo-navigation-menu--user-notifications--text" data-role="ibo-navigation-menu--notifications-toggler" href="#">
{{ '0 notification'|dict_s }}
@@ -66,11 +66,11 @@
{% endif %}
<div class="ibo-navigation-menu--user-organization">
<div class="ibo-navigation-menu--user-organization--text">
{{ oUIBlock.UserData.sOrganization }}
{{ oUIBlock.GetUserData().sOrganization }}
</div>
</div>
<div class="ibo-navigation-menu--user-menu-container" data-role="ibo-navigation-menu--user-menu-container">
{{ render_block(oUIBlock.UserMenu, {aPage: aPage}) }}
{{ render_block(oUIBlock.GetUserMenu(), {aPage: aPage}) }}
</div>
</div>
</div>
@@ -83,7 +83,7 @@
<span class="ibo-navigation-menu--menu-filter-hotkey">{{ 'UI:Layout:NavigationMenu:MenuFilter:Input:Hotkey'|dict_s }}</span>
</div>
<div class="ibo-navigation-menu--menu-groups">
{% for aMenuGroup in oUIBlock.MenuGroups %}
{% for aMenuGroup in oUIBlock.GetMenuGroups() %}
{{ include('layouts/navigation-menu/menu-nodes.html.twig', { aMenuGroup: aMenuGroup }) }}
{% endfor %}
</div>

View File

@@ -1,6 +1,6 @@
// TODO: We need to find a clean way to launch this script only once the JS scripts are loaded
document.addEventListener("DOMContentLoaded", function(){
setTimeout(function(){
$('#{{ oUIBlock.Id }}').navigation_menu();
$('#{{ oUIBlock.GetId() }}').navigation_menu();
}, 500);
});

View File

@@ -1,13 +1,13 @@
<nav id="{{ oUIBlock.Id }}" class="ibo-top-bar">
<nav id="{{ oUIBlock.GetId() }}" class="ibo-top-bar">
<div class="ibo-top-bar--quick-actions">
{% if oUIBlock.HasQuickCreate %}
{{ render_block(oUIBlock.QuickCreate, {aPage: aPage}) }}
{% if oUIBlock.HasQuickCreate() %}
{{ render_block(oUIBlock.GetQuickCreate(), {aPage: aPage}) }}
{% endif %}
{% if oUIBlock.HasGlobalSearch %}
{{ render_block(oUIBlock.GlobalSearch, {aPage: aPage}) }}
{% if oUIBlock.HasGlobalSearch() %}
{{ render_block(oUIBlock.GetGlobalSearch(), {aPage: aPage}) }}
{% endif %}
</div>
{% if oUIBlock.HasBreadcrumbs %}
{{ render_block(oUIBlock.Breadcrumbs, {aPage: aPage}) }}
{% if oUIBlock.HasBreadcrumbs() %}
{{ render_block(oUIBlock.GetBreadcrumbs(), {aPage: aPage}) }}
{% endif %}
</nav>