Files
ofbiz-framework/themes/common-theme/template/macro/HtmlMenuMacroLibrary.ftl
T
Jacques Le Roux 5ed72f1e95 Improved: Replace Inline js with External js in renderFormClose macro
(OFBIZ-9846)

Replaced inline js from renderFormClose macro to external js in OfbizUtils.js
Done following:
Used custom data attributes: data-focus-field to define focus field for the form.
Used attribute selector to find elements and set focus on the particular field.

Added "requireValidation" class to all the forms with required fields.

Used the class selector to find such forms & attached Validator plugin to it.

Steps to verify:

At add ProdCatalog page: https://localhost:8443/catalog/control/EditProdCatalog

Dialogs:
New Example dialog on Find Example page 
    Go to Find Example page https://localhost:8443/example/control/FindExample
    Click on New Example button
    Validations should work in dialog on form submit.

Additional Changes:

Link for dialog in HtmlMenuMacroLibrary still had the inline code. 
Replaced the code with external js code.

Validations on forms rendered with renderSubmitField macro from 
HtmlFormMacroLibrary.ftl seems not working 
https://demo-trunk.ofbiz.apache.org/partymgr/control/NewEmployee, will create 
a separate ticket for it.

jleroux: 
I agree about NewEmployee issue
As mentionned Aditya themes/rainbowstone/template/HtmlMenuMacroLibrary.ftl was
redundant, removed
I also removed commented out code in rainbowstone HtmlMenuMacroLibrary.ftl 
(left by Aditya while working on the issue I guess)

Thanks: Aditya 


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1832307 13f79535-47bb-0310-9956-ffa450edef68
2018-05-26 12:42:20 +00:00

89 lines
3.8 KiB
Plaintext

<#--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<#macro renderMenuBegin boundaryComment="" id="" style="" title="">
<#if boundaryComment?has_content>
<!-- ${boundaryComment} -->
</#if>
<#-- FIXME: A menu could have an ID and a style, but some visual themes break if both are used. -->
<div<#if id?has_content> id="${id}"<#elseif style?has_content> class="${style}"</#if>>
<#if title?has_content>
<h2>${title}</h2>
</#if>
<ul>
<li>
<ul>
</#macro>
<#macro renderMenuEnd boundaryComment="">
</ul>
</li>
</ul>
<br class="clear"/>
</div>
<#if boundaryComment?has_content>
<!-- ${boundaryComment} -->
</#if>
</#macro>
<#macro renderImage src id style width height border>
<img src="${src}"<#if id?has_content> id="${id}"</#if><#if style?has_content> class="${style}"</#if><#if width?has_content> width="${width}"</#if><#if height?has_content> height="${height}"</#if><#if border?has_content> border="${border}"</#if> />
</#macro>
<#macro renderLink linkUrl parameterList targetWindow uniqueItemName actionUrl linkType="" id="" style="" name="" height="600" width="800" text="" imgStr="">
<#if linkType?has_content && "hidden-form" == linkType>
<form method="post" action="${actionUrl}"<#if targetWindow?has_content> target="${targetWindow}"</#if> onsubmit="javascript:submitFormDisableSubmits(this)" name="${uniqueItemName}"><#rt/>
<#list parameterList as parameter>
<input name="${parameter.name}" value="${parameter.value}" type="hidden"/><#rt/>
</#list>
</form><#rt/>
</#if>
<#if uniqueItemName?has_content && "layered-modal" == linkType>
<#local params = "{ 'presentation': 'layer'">
<#if parameterList?has_content>
<#list parameterList as parameter>
<#local params += ",'${parameter.name}': '${parameter.value}'">
</#list>
</#if>
<#local params += " }">
<a href="javascript:void(0);" id="${uniqueItemName}_link"
data-dialog-params="${params}"
data-dialog-width="${width}"
data-dialog-height="${height}"
data-dialog-url="${linkUrl}"
<#if text?has_content>data-dialog-title="${text}"</#if>
<#if style?has_content>class="${style}"</#if>>
<#if text?has_content>${text}</#if></a>
<#else>
<#if (linkType?has_content && "hidden-form" == linkType) || linkUrl?has_content>
<a<#if id?has_content> id="${id}"</#if><#if style?has_content> class="${style}"</#if><#if name?has_content> name="${name}"</#if><#if targetWindow?has_content> target="${targetWindow}"</#if> href="<#if "hidden-form"==linkType>javascript:document.${uniqueItemName}.submit()<#else>${linkUrl}</#if>"><#rt/>
</#if>
<#if imgStr?has_content>${imgStr}</#if> <#if text?has_content>${text}</#if><#rt/>
<#if (linkType?has_content && "hidden-form" == linkType) || linkUrl?has_content></a><#rt/></#if>
</#if>
</#macro>
<#macro renderMenuItemBegin style toolTip linkStr containsNestedMenus>
<li<#if style?has_content> class="${style}"</#if><#if toolTip?has_content> title="${toolTip}"</#if>><#if linkStr?has_content>${linkStr}</#if><#if containsNestedMenus><ul></#if><#rt/>
</#macro>
<#macro renderMenuItemEnd containsNestedMenus>
<#if containsNestedMenus></ul></#if></li>
</#macro>