- Revision
- 1343
- Author
- mauro
- Date
- 2009-10-15 15:44:42 -0500 (Thu, 15 Oct 2009)
Log Message
JBEHAVE-190: Added file path normalisation in view.
Modified Paths
Added Paths
Diff
Modified: trunk/web/web-runner/src/main/webapp/ftl/data/files.ftl (1342 => 1343)
--- trunk/web/web-runner/src/main/webapp/ftl/data/files.ftl 2009-10-15 20:19:37 UTC (rev 1342) +++ trunk/web/web-runner/src/main/webapp/ftl/data/files.ftl 2009-10-15 20:44:42 UTC (rev 1343) @@ -1,5 +1,6 @@ <#import "/ftl/waffle/i18n.ftl" as i> <#import "/ftl/waffle/form.ftl" as w> +<#import "/ftl/paths.ftl" as p> <html xmlns="http://www.w3.org/1999/xhtml"> <body> <head> @@ -17,7 +18,7 @@ <table> <#list files as file> <tr> - <td>${file.path}</td> + <td><@p.normalise file.path/></td> <td><@w.checkbox "selectedPaths" "${file.path}" /></td> </tr> </#list> @@ -37,11 +38,11 @@ <#list files as file> <tr> <td> - <#if (file.getPath().matches(".*\\.[a-z]+")) > - <a class="buttonView" "viewContent" "View"/></a> + <#if (p.isViewable(file)) > + <a class="buttonView" path/>/<@p.normalise file.path/>')"><@i.messageFor "viewContent" "View"/></a> </#if> </td> - <td class="contentFilePath">${file.path}</td> + <td class="contentFilePath"><@p.normalise file.path/></td> </tr> </#list> </#list>
Added: trunk/web/web-runner/src/main/webapp/ftl/paths.ftl (0 => 1343)
--- trunk/web/web-runner/src/main/webapp/ftl/paths.ftl (rev 0) +++ trunk/web/web-runner/src/main/webapp/ftl/paths.ftl 2009-10-15 20:44:42 UTC (rev 1343) @@ -0,0 +1,19 @@ +<#ftl strip_whitespace=true> +<#-- + * Normalises path by replacing '\' with '/' + * + * @param path the path + --> +<#macro normalise path> + <#if path?exists><#assign path=path.replace("\\","/")></#if>${path} +</#macro> + +<#-- + * Determines if file is viewable by looking for a path name with an extension + * + * @param file the file + --> +<#function isViewable file> + <#if file.path.matches(".*\\.[A-Za-z]+")><#return true></#if> + <#return false> +</#function> \ No newline at end of file
To unsubscribe from this list please visit:
