Extends Submit and Reset to use new approach of multiple submit buttons
Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/706b289a Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/706b289a Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/706b289a Branch: refs/heads/feature/use-js-to-support-multiple-buttons Commit: 706b289aaa1a64c8928e848b1b108f52a5981977 Parents: ca91136 Author: Lukasz Lenart <lukaszlen...@apache.org> Authored: Thu Mar 13 09:22:14 2014 +0100 Committer: Lukasz Lenart <lukaszlen...@apache.org> Committed: Thu Mar 13 09:22:14 2014 +0100 ---------------------------------------------------------------------- .../template/simple/action-handler.ftl | 30 ++++++++++++++++++++ .../main/resources/template/simple/reset.ftl | 9 +++++- .../resources/template/simple/submit-close.ftl | 1 + 3 files changed, 39 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts/blob/706b289a/core/src/main/resources/template/simple/action-handler.ftl ---------------------------------------------------------------------- diff --git a/core/src/main/resources/template/simple/action-handler.ftl b/core/src/main/resources/template/simple/action-handler.ftl new file mode 100644 index 0000000..34517f9 --- /dev/null +++ b/core/src/main/resources/template/simple/action-handler.ftl @@ -0,0 +1,30 @@ +<#-- +/* + * $Id$ + * + * 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. + */ +--> +<#if parameters.name?? && parameters.name?contains("action:")> +<script> + function submitAction_${parameters.id?html}(element) { + element.form.action = '${parameters.name?substring("action:"?length)}'; + element.form.submit(); + } +</script> +</#if> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/struts/blob/706b289a/core/src/main/resources/template/simple/reset.ftl ---------------------------------------------------------------------- diff --git a/core/src/main/resources/template/simple/reset.ftl b/core/src/main/resources/template/simple/reset.ftl index 0ddba57..635cee6 100644 --- a/core/src/main/resources/template/simple/reset.ftl +++ b/core/src/main/resources/template/simple/reset.ftl @@ -22,6 +22,9 @@ --> <#if parameters.type?? && parameters.type=="button"> <button type="reset"<#rt/> +<#if parameters.id??> + id="${parameters.id?html}"<#rt/> +</#if> <#if parameters.name??> name="${parameters.name?html}"<#rt/> </#if> @@ -51,6 +54,9 @@ /><#else><#if parameters.label??><@s.property value="parameters.label"/><#rt/></#if></#if></button> <#else> <input type="reset"<#rt/> +<#if parameters.id??> + id="${parameters.id?html}"<#rt/> +</#if> <#if parameters.name??> name="${parameters.name?html}"<#rt/> </#if> @@ -73,4 +79,5 @@ <#include "/${parameters.templateDir}/${parameters.expandTheme}/common-attributes.ftl" /> <#include "/${parameters.templateDir}/${parameters.expandTheme}/dynamic-attributes.ftl" /> /> -</#if> \ No newline at end of file +</#if> +<#include "/${parameters.templateDir}/${parameters.expandTheme}/action-handler.ftl"/> http://git-wip-us.apache.org/repos/asf/struts/blob/706b289a/core/src/main/resources/template/simple/submit-close.ftl ---------------------------------------------------------------------- diff --git a/core/src/main/resources/template/simple/submit-close.ftl b/core/src/main/resources/template/simple/submit-close.ftl index 7f51958..3c4138b 100644 --- a/core/src/main/resources/template/simple/submit-close.ftl +++ b/core/src/main/resources/template/simple/submit-close.ftl @@ -4,3 +4,4 @@ <#else> ${parameters.body}<#rt/> </#if> +<#include "/${parameters.templateDir}/${parameters.expandTheme}/action-handler.ftl"/>