Skip to content

Commit

Permalink
detailed UI hooks processing can be used in stable targets again now
Browse files Browse the repository at this point in the history
  • Loading branch information
Guite committed Oct 3, 2017
1 parent 7c2ecb8 commit 8e5a96c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -340,16 +340,12 @@ class Forms {
def private displayHooks(Entity it, Application app) '''
{% set hookId = mode != 'create' ? «name.formatForDB».«primaryKey.name.formatForCode» : null %}
«IF application.targets('2.0-dev') || (application.targets('1.5-dev') && !application.targets('2.0'))»
{% set hooks = notifyDisplayHooks(eventName='«app.appName.formatForDB».ui_hooks.«nameMultiple.formatForDB».form_edit', id=hookId, true) %}
{% if hooks is iterable and hooks|length > 0 %}
{% for area, hook in hooks %}
<div class="z-displayhook" data-area="{{ area|e('html_attr') }}">{{ hook }}</div>
{% endfor %}
{% endif %}
«ELSE»
{{ notifyDisplayHooks(eventName='«app.appName.formatForDB».ui_hooks.«nameMultiple.formatForDB».form_edit', id=hookId) }}
«ENDIF»
{% set hooks = notifyDisplayHooks(eventName='«app.appName.formatForDB».ui_hooks.«nameMultiple.formatForDB».form_edit', id=hookId, true) %}
{% if hooks is iterable and hooks|length > 0 %}
{% for area, hook in hooks %}
<div class="z-displayhook" data-area="{{ area|e('html_attr') }}">{{ hook }}</div>
{% endfor %}
{% endif %}
'''
def private additionalInitScript(DerivedField it) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,11 @@ class Delete {
'''
def private callDisplayHooks(Entity it, String appName) '''
«IF application.targets('2.0-dev') || (application.targets('1.5-dev') && !application.targets('2.0'))»
{% set hooks = notifyDisplayHooks(eventName='«appName.formatForDB».ui_hooks.«nameMultiple.formatForDB».form_delete', id=«name.formatForCode».getKey(), true) %}
{% if hooks is iterable and hooks|length > 0 %}
{% for area, hook in hooks %}
<div class="z-displayhook" data-area="{{ area|e('html_attr') }}">{{ hook }}</div>
{% endfor %}
{% endif %}
«ELSE»
{{ notifyDisplayHooks(eventName='«appName.formatForDB».ui_hooks.«nameMultiple.formatForDB».form_delete', id=«name.formatForCode».getKey()) }}
«ENDIF»
{% set hooks = notifyDisplayHooks(eventName='«appName.formatForDB».ui_hooks.«nameMultiple.formatForDB».form_delete', id=«name.formatForCode».getKey(), true) %}
{% if hooks is iterable and hooks|length > 0 %}
{% for area, hook in hooks %}
<div class="z-displayhook" data-area="{{ area|e('html_attr') }}">{{ hook }}</div>
{% endfor %}
{% endif %}
'''
}
Original file line number Diff line number Diff line change
Expand Up @@ -329,16 +329,12 @@ class Display {
<div role="tabpanel" class="tab-pane fade" id="tabHooks" aria-labelledby="hooksTab">
<h3>{{ __('Hooks') }}</h3>
«ENDIF»
«IF application.targets('2.0-dev') || (application.targets('1.5-dev') && !application.targets('2.0'))»
{% set hooks = notifyDisplayHooks(eventName='«appName.formatForDB».ui_hooks.«nameMultiple.formatForDB».display_view', id=«name.formatForCode».getKey(), urlObject=currentUrlObject, true) %}
{% if hooks is iterable and hooks|length > 0 %}
{% for area, hook in hooks %}
<div class="z-displayhook" data-area="{{ area|e('html_attr') }}">{{ hook }}</div>
{% endfor %}
{% endif %}
«ELSE»
{{ notifyDisplayHooks(eventName='«appName.formatForDB».ui_hooks.«nameMultiple.formatForDB».display_view', id=«name.formatForCode».getKey(), urlObject=currentUrlObject) }}
«ENDIF»
{% set hooks = notifyDisplayHooks(eventName='«appName.formatForDB».ui_hooks.«nameMultiple.formatForDB».display_view', id=«name.formatForCode».getKey(), urlObject=currentUrlObject, true) %}
{% if hooks is iterable and hooks|length > 0 %}
{% for area, hook in hooks %}
<div class="z-displayhook" data-area="{{ area|e('html_attr') }}">{{ hook }}</div>
{% endfor %}
{% endif %}
«IF useGroupingTabs('display'
</div>
«ENDIF»
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,16 +338,12 @@ class View {
{# here you can activate calling display hooks for the view page if you need it #}
{# % if routeArea != 'admin' %}
«IF application.targets('2.0-dev') || (application.targets('1.5-dev') && !application.targets('2.0'))»
{% set hooks = notifyDisplayHooks(eventName='«appName.formatForDB».ui_hooks.«nameMultiple.formatForDB».display_view', urlObject=currentUrlObject, true) %}
{% if hooks is iterable and hooks|length > 0 %}
{% for area, hook in hooks %}
<div class="z-displayhook" data-area="{{ area|e('html_attr') }}">{{ hook }}</div>
{% endfor %}
{% endif %}
«ELSE»
{{ notifyDisplayHooks(eventName='«appName.formatForDB».ui_hooks.«nameMultiple.formatForDB».display_view', urlObject=currentUrlObject) }}
«ENDIF»
{% set hooks = notifyDisplayHooks(eventName='«appName.formatForDB».ui_hooks.«nameMultiple.formatForDB».display_view', urlObject=currentUrlObject, true) %}
{% if hooks is iterable and hooks|length > 0 %}
{% for area, hook in hooks %}
<div class="z-displayhook" data-area="{{ area|e('html_attr') }}">{{ hook }}</div>
{% endfor %}
{% endif %}
{% endif % #}
'''

Expand Down

0 comments on commit 8e5a96c

Please sign in to comment.