AnsweredAssumed Answered

How can I create a custom template to append to an extended view?

Question asked by Artis Plocins on Mar 15, 2018
Latest reply on Mar 16, 2018 by Prashant Patel

I am trying to extend the Calls create view with a custom template.

 

I've made the following two files and done many experiments to try and find the custom template. I've also tried putting this template in custom/application/clients/base/fields/custom-template/template.hbs to see if that lets me find it in the application.

 

I've tried experimented with the following functions and more in console.log (also tried finding the sugar-cube template, because I know it exists by itself, in hopes of finding some clues):

  • Handlebars.templates
  • Handlebars.template('custom-template')
  • App.template.get('custom-template')

 

These are my Calls create view extension files for the view controller and custom template:

 

custom/modules/Calls/clients/base/views/create/create.php

({
    extendsFrom: 'CallsCreateView',

    initialize: function(options) {
        this._super('initialize', [options]);

        // Get a custom template (ideally located next to this file with a different name.

        // Append the custom template to the current template
        // with this.$el.append(customTemplate).
    }
})

custom/modules/Calls/clients/base/views/create/custom-template.hbs

<button class="btn" name="test-toggle-button" data-toggle="button">
    Test toggle button
</button>

 

I have also tried replacing the Calls create view template by creating custom/modules/Calls/clients/base/views/create/create.hbs, which works, but I cannot get the original components back in it.

Copying the record view template and adding my own bits to it does not work at all.

 

This is what the record view template has:

<div>
    {{#if enableHeaderPane}}
        {{partial 'headerpane' ../this view=../this}}
    {{/if}}
    {{#if meta.useTabsAndPanels}}
        {{partial 'tabspanels' ../this view=../this}}
    {{else}}
        {{partial 'businesscard' ../this view=../this}}
    {{/if}}

    {{!-- I want to put my custom template here, but the components above do not work in create view --}}
</div>

Outcomes