Announcement

Collapse
No announcement yet.

Help with getting started adding custom view?

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

  • Help with getting started adding custom view?

    Hi,

    I'm starting to take a look how I can get a custom view on my entity detail template.

    I'm referring to the docs but not sure where I may be going wrong?

    I have the following inside my clientDef:

    HTML Code:
    {
    "controller": "controllers/record",
    "boolFilterList": [
    "onlyMy"
    ],
    "color": "#ffffff",
    "iconClass": "far fa-money-bill-alt",
    "sidePanels": {
    "detail": [
    {
    "name": "testPanel",
    "label": "TestPanel",
    "view": "custom:views/test/test-panel",
    "aclScope": "TestPanel"
    }
    ]
    }
    }​
    I have created client/src/views/test/test-panel.js which includes:

    HTML Code:
    define('custom:views/test/test-panel', ['view'], function (View) {
    return View.extend({
    name: 'test-panel',
    template: 'test/test-panel',
    });
    });
    And I have my tpl file located at client/res/templates/test/test-panel.tpl - which currently only has text inside a div.

    I have cleared cache and rebuilt but I get the following error when viewing my detail template:

    Content-Security-Policy: The page's settings blocked the loading of a resource at inline ("script-src").​
    Uncaught (in promise) Error: Could not fetch asset 'client/custom/src/views/test/test-panel.js?r=1707169764'.​
    Last edited by l4k3y; 02-08-2024, 07:38 PM.

  • #2
    client/src/views/test/test-panel.js => client/custom/src/views/test/test-panel.js

    The same for template.

    The error message tells by what's wrong.

    Comment


    • #3
      Thanks Yuri, can't believe I over looked that. Thanks for help.

      I noticed the docs say to have the view as:

      HTML Code:
      define('custom:views/test/test-panel', ['view'], function (View) {
      return View.extend({
      name: 'test-panel',
      template: 'test/test-panel',
      });
      });
      But returned a error saying Dep not defined. I updated to the following:

      HTML Code:
      define('custom:views/test/test-panel', ['view'], function (Dep) {
      return Dep.extend({
      name: 'test-panel',
      template: 'test/test-panel',
      });
      });
      ​
      Is it worth updating the docs here?

      Comment


      • #4
        I updated. It was Dep.protype.setup call. Should be View instead.

        Comment

        Working...
        X