Skip to content

Conversation

@dulcedilip
Copy link

The idea behind is to make the header of each widget to be loosely coupled by exposing custom-tempales for dashboard and widget.
usage :

// set our custom widget title template when widgets are added
$scope.$on('adfWidgetAdded',function(event,name,model,widget){
    widget.titleTemplateUrl="partials/custom-widget-title.html";
});

While configuration of widgets new property for dashboard and widget has been added

titleTemplateUrl: 'partials/custom-dashboard-title.html'
titleTemplateUrl: 'partials/custom-widget-title.html'

you can see it in sample-03.

you can see the magic once you start using this .

Note: you can go with sample-03
@sdorra sdorra merged commit c6516c2 into angular-dashboard-framework:master Jul 11, 2015
sdorra added a commit that referenced this pull request Jul 11, 2015
@sdorra sdorra self-assigned this Jul 11, 2015
@sdorra
Copy link
Member

sdorra commented Jul 11, 2015

Very nice enhancement. Thanks.

@random-one
Copy link

Are you sure that specifying the titleTemplateUrl in the config phase with the dashboardProvider.widget(name, widget) function is working properly?

I tried setting it on adfWidgetAdded and it is working but I can't get it working this way:

dashboardProvider
    .widget('sample', {
        title: 'Markdown',
        description: 'Markdown widget',
        controller: 'TestCtrl',
        templateUrl: '{widgetsPath}/widget-template.html',
        titleTemplateUrl: '{widgetsPath}/custom-widget-title.html',
        collapsible: true,
    })
...

Same is for the collapsible feature. Could you please take a look at it?

@dulcedilip
Copy link
Author

It should work with titleTemplateURL can you check the {widgetpath }. May be it is not fetching the path. The example for the above can be seen in sample02 or sample03 tab.
Let me know still if you are not able to figure it out.

@random-one
Copy link

I just saw my issue is solved, but not yet merged: #139
It's not about the widgetsPath, otherwise my widget wouldn't be rendered at all, because it's widgetTemplate is in there too.
The sample is working because it set's the titleTemplateUrl on adfWidgetAdded, but that's too late for me and I also have different titleTemplateUrls depending on the widget type and setting it in adfWidgetAdded is not flexible.

@dulcedilip
Copy link
Author

Hope your issue is solved..but adfWidgetAdded event , when you add new widget this event help you to set titleTemplatURL dynamic.

@random-one
Copy link

Yes, thank you!
I will wait for the new release and using the adfWidgetAdded event is a way to avoid the bug until the new release comes.

@dulcedilip
Copy link
Author

If you still want that release ..you can pull my branch which you are looking for ..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants