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.
Announcement
Collapse
No announcement yet.
Overriding templates
Collapse
X
-
Originally posted by tanya View PostHello
in custom view you need to define custom template (also starts with custom: )
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?
Comment
-
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
Comment
-
Originally posted by tanya View Postthe 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
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" }
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) {
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.
Comment
-
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' }); });
HTML Code:<div class="page-header"> <h3><a href='#Lead'>{{translate scope category='scopeNamesPlural'}}</a> » <a href='#Lead/view/{{this.model.id}}'>{{get this.model 'name'}}</a> » {{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 }); }, }); });
Comment
Comment