Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Max 80 posts 437 karma points
    Jun 25, 2018 @ 13:29
    Max
    0

    I have figured out how to add tabs to my custom section template using a umb-tabs directive and a tabs object in my model... with a properties array:

     return [
                        {
                            active: true,
                            alias: "Feature Detail",
                            label: "Details",
                            id: 1,
                            properties: [
                                {
                                    //id: 1,
                                    alias: "title",
                                    label: "Title",
                                    description: "Short title/name to describe the ad/campaign.",
                                    editor: null,
                                    hideLabel: false,
                                    validation: { mandatory: true },
                                    value: model.title.value,
                                    view: "textbox"
                                }, // title,
    

    ....

    But can I add a tab via my own directive? as well as the tabs array?

    something like:

     return [
                        {
                            active: true,
                            alias: "Tab1",
                            label: "Tab 1",
                            id: 1,
                            properties: [
                                {
                                    //id: 1,
                                    alias: "title",
                                    label: "Title",
                                    description: "Short title/name to describe the ad/campaign.",
                                    editor: null,
                                    hideLabel: false,
                                    validation: { mandatory: true },
                                    value: model.title.value,
                                    view: "textbox"
                                }, // title,
                         ]},
                   {
     active: true,
                                alias: "Tab2FromTemplate",
                                label: "Tab From Template",
                                id: 2,
                                template: "/path/to/view/file/or/template",
                                data: _myDataToPassToDirective
    }]
    

    EDIT: I figured out that in my view where I added the directive, I wasn't passing in "node", my call to the directive looks like this:

    <umb-content-node-info ng-if="tab.view == '_umbInfoTab' && node.id" node="node"></umb-content-node-info>
    

    In my controller I define "node" on the scope:

     $scope.node = {
                id: null,
                owner: owner,
                allowedTemplates: [],
                documentType: { id: null },
                template: null, // templateAlias
                releaseDate: serverTime, //
                createDate: null,
                removeDate: null,
                published: true,
                urls: [],
                createDateFormatted:'LLL', // dateHelper.getLocalDate($scope.node.createDate, obj.currentUser.locale, 'LLL'),
                releaseDateYear: null, // $scope.node.releaseDate ? ucfirst(dateHelper.getLocalDate($scope.node.releaseDate, obj.currentUser.locale, 'YYYY')) : null,
                releaseDateMonth: null, // $scope.node.releaseDate ? ucfirst(dateHelper.getLocalDate($scope.node.releaseDate, obj.currentUser.locale, 'MMMM')) : null,
                releaseDateDayNumber: null, //$scope.node.releaseDate ? ucfirst(dateHelper.getLocalDate($scope.node.releaseDate, obj.currentUser.locale, 'DD')) : null,
                releaseDateDay: null, // $scope.node.releaseDate ? ucfirst(dateHelper.getLocalDate($scope.node.releaseDate, obj.currentUser.locale, 'dddd')) : null,
                releaseDateTime: null, // $scope.node.releaseDate ? ucfirst(dateHelper.getLocalDate($scope.node.releaseDate, obj.currentUser.locale, 'HH:mm')) : null,
                removeDateYear: null, // $scope.node.removeDate ? ucfirst(dateHelper.getLocalDate($scope.node.removeDate, obj.currentUser.locale, 'YYYY')) : null,
                removeDateMonth: null, // $scope.node.removeDate ? ucfirst(dateHelper.getLocalDate($scope.node.removeDate, obj.currentUser.locale, 'MMMM')) : null,
                removeDateDayNumber: null, // $scope.node.removeDate ? ucfirst(dateHelper.getLocalDate($scope.node.removeDate, obj.currentUser.locale, 'DD')) : null,
                removeDateDay: null, // $scope.node.removeDate ? ucfirst(dateHelper.getLocalDate($scope.node.removeDate, obj.currentUser.locale, 'dddd')) : null,
                removeDateTime: null, // $scope.node.removeDate ? ucfirst(dateHelper.getLocalDate($scope.node.removeDate, obj.currentUser.locale, 'HH:mm')) : null,
            };
    
  • Max 80 posts 437 karma points
    Jun 26, 2018 @ 14:41
    Max
    0

    My next issue is that the directives scope is out of scope...for my controller... there are various properties that need to be set to gain full control of the directive; such as:

    $scope.loadingAuditTrail = false;

    I'm missing how to pass these items from my $scope into the directive. I've tried adding ng-scope and ng-model but I'm still doing something wrong.

    <umb-content-node-info ng-if="(tab.view == '_umbInfoTab' && node.id)" node="node" class="ng-scope"></umb-content-node-info>
    
Please Sign in or register to post replies

Write your reply to:

Draft