Overriding templates

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • theBuzzyCoder
    replied
    Thanks tanya ! It worked! You're the best.

    Leave a comment:


  • tanya
    replied
    Hi, did you override Lead clientDefs?
    if you want to use other controller, you need to set it in clientdefs

    Leave a comment:


  • theBuzzyCoder
    replied
    Hi tanya ,

    I am trying to override Covert lead template.

    But this is not working

    espocrm/client/custom/src/views/lead/convert.js

    Code:
    Espo.define('custom:views/lead/convert', 'crm:views/lead/convert', function (Dep) {
    
        return Dep.extend({
    
            template: 'custom:lead/convert'
    
        });
    
    });
    espocrm/client/custom/res/templates/lead/convert.tpl

    HTML Code:
    <div class="page-header">
        <h3><a href='#Lead'>{{translate scope category='scopeNamesPlural'}}</a>
        &raquo
        <a href='#Lead/view/{{this.model.id}}'>{{get this.model 'name'}}</a>
        &raquo
        {{translate 'convert' scope='Lead'}}</h3>
    </div>
    
    {{#each scopeList}}
    <div>
        <label><h4><input type="checkbox" checked class="check-scope" data-scope="{{./this}}"> {{translate this category='scopeNames'}}</h4></label>
        <div class="edit-container-{{toDom this}}">
        {{{var this ../this}}}
        </div>
    </div>
    {{/each}}
    
    <div class="button-container">
        <div class="btn-group">
            <button class="btn btn-primary" data-action="convert">{{translate 'Convert' scope='Lead'}}</button>
            <button class="btn btn-default" data-action="cancel">{{translate 'Cancel'}}</button>
        </div>
    </div>

    espocrm/client/custom/src/controllers/lead.js

    Code:
    Espo.define('custom:controllers/lead', 'crm:controllers/lead', function (Dep) {
    
        return Dep.extend({
    
            convert: function (id) {
                this.main('custom:views/lead/convert', {
                    id: id
                });
            },
    
        });
    });

    Leave a comment:


  • The50
    replied
    Originally posted by tanya
    the template is called from client/src/views/modals/image-preview.js

    this view use only file and attachment-multiple views
    client/src/views/fields/file.js
    client/src/views/fields/attachment-multiple.js

    override these field types http://forum.espocrm.com/forum/gener...d-to-addresses
    and call your image-preview view
    Trying to accomplish this but still I have a problem. I just made these files in metadata:
    Super simple and lightning fast image sharing. Upload clipboard images with Copy & Paste and image files with Drag & Drop.


    Inside the file there is this line:

    HTML Code:
      {   "view": "Custom:Fields.AttachmentMultiple" }
    Also I created the override files itself in:
    Super simple and lightning fast image sharing. Upload clipboard images with Copy & Paste and image files with Drag & Drop.


    attachment-multiple.js is defined like this:

    PHP Code:
      Espo.define('Custom:Views.Fields.AttachmentMultiple', 'views/fields/base', function (Dep) { 
    
    EDIT:

    The problem was in attachmentMultiple.json file, I named it as attachment-multiple.json in the first place. Thanks, it works!
    Last edited by The50; 12-20-2017, 01:07 PM.

    Leave a comment:


  • tanya
    replied

    the template is called from client/src/views/modals/image-preview.js

    this view use only file and attachment-multiple views
    client/src/views/fields/file.js
    client/src/views/fields/attachment-multiple.js

    override these field types http://forum.espocrm.com/forum/gener...d-to-addresses
    and call your image-preview view

    Leave a comment:


  • The50
    replied
    Originally posted by tanya
    Hello
    in custom view you need to define custom template (also starts with custom: )
    Okay, I still have a problem with overriding the modal views. I made an override for entity named "Task" like this:

    client/custom/src/views/task/detail.js

    also I included: "views": {
    "list": "custom:views/task/list",
    "detail": "custom:views/task/detail",
    "edit": "custom:views/task/edit"
    },

    in my Task.json.

    Now, how could I override the client/custom/src/views/modals/image-preview.js file?

    What should I write in my task.json to define this new path for image-preview.js?

    Leave a comment:


  • tanya
    replied
    Hello
    in custom view you need to define custom template (also starts with custom: )

    Leave a comment:


  • The50
    started a topic Overriding templates

    Overriding templates

    How could I override the default template files? As example I want to change the /templates/modals/image-preview.tpl template. I put the res folder with all the templates into the custom folder, but system still loads the default templates from client/res folder.
Working...