Announcement

Collapse
No announcement yet.

Overriding templates

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.

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

    Comment


    • #3
      Originally posted by tanya View Post
      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?

      Comment


      • #4

        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


        • #5
          Originally posted by tanya View Post
          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:
          https://pasteboard.co/GZ4Cryp.png

          Inside the file there is this line:

          HTML Code:
            {   "view": "Custom:Fields.AttachmentMultiple" }
          Also I created the override files itself in:
          https://pasteboard.co/GZ4CYxt.png

          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.

          Comment

          Working...
          X