Client Side Customization
Base Workflow
The advanced search page uses the standard template customization framework, as follows:
1. Determine which template to customize, such as codebase.war/delivery/templates/search/advancedSearch.tmpl.html.
2. Create a folder to contain the custom template, or use codebase.war/delivery/custom.
3. Create the same folder hierarchy in the new folder as the folders containing the template, so codebase.war/delivery/custom/templates/search/.
4. Copy the template file to the new location.
5. Modify the copy as desired.
6. Either modify codebase.war/delivery/templateMap.js to return a mapping for the new file, such as { “templates/search/advancedSearch.tmpl.html”: “custom” }, or run ‘java com.ptc.sc.util.TemplateMapGenerator <WT_HOME>/codebase/delivery/templateMap.js <WT_HOME>/codebase/delivery/custom’ to programmatically update templateMap.js.
7. Run minimize.xml to update main-min.js.
A few notes: templateMap.js is used to add redirect mappings for the for files that have been customized. For example, ‘return { “templates/search/advancedSearch.tmpl.html”: “custom/” };’ tells the client to look for codebase.war/delivery/custom/templates/search/advancedSearch.tmpl.html instead of codebase.war/delivery/templates/search/advancedSearch.tmpl.html. This means that “custom/” in this example is simply a prefix, used to indicate the base folder containing the custom files and folders. There is no fallback mechanism, so all mappings must have a corresponding customized template file.
Since the template files are html files, any html or angularjs syntax can be used, and is rendered by the client.
advancedSearch.tmpl.html contains the layout for all the out of the box controls on the advanced search page, as well as a reference to advancedSearchCustomControls.tmpl.html. advancedSearchCustomControls.tmpl.html is empty by default. This means that advancedSearchCustomControls.tmpl.html can be customized without needing to worry about the out of box version of the file changing in a later version of the client, while advancedSearch.tmpl.html could change in later versions of the client, at which point the custom version of the file would potentially have to be manually updated to reflect those changes.
Was this helpful?