@@ -691,7 +691,7 @@ angular.module('adf')
691691 $scope . createCategories = createCategories ;
692692 }
693693
694- var adfAddTemplatePath = adfTemplatePath + 'widget-add.html' ;
694+ var adfAddTemplatePath = dashboard . customWidgetAddTemplatePath ? dashboard . customWidgetAddTemplatePath : adfTemplatePath + 'widget-add.html' ;
695695 if ( model . addTemplateUrl ) {
696696 adfAddTemplatePath = model . addTemplateUrl ;
697697 }
@@ -919,6 +919,7 @@ angular.module('adf.provider', ['adf.locale'])
919919 </div>\n\
920920 </div>' ;
921921 var customWidgetTemplatePath = null ;
922+ var customWidgetAddTemplatePath = null ;
922923
923924 // default apply function of widget.edit.apply
924925 var defaultApplyFunction = function ( ) {
@@ -1117,6 +1118,23 @@ angular.module('adf.provider', ['adf.locale'])
11171118 return this ;
11181119 } ;
11191120
1121+ /**
1122+ * @ngdoc method
1123+ * @name adf.dashboardProvider#customWidgetAddTemplatePath
1124+ * @propertyOf adf.dashboardProvider
1125+ * @description
1126+ *
1127+ * Changes the container template for the widgets
1128+ *
1129+ * @param {string } path to the custom widget template
1130+ *
1131+ * @returns {Object } self
1132+ */
1133+ this . customWidgetAddTemplatePath = function ( templatePath ) {
1134+ customWidgetAddTemplatePath = templatePath ;
1135+ return this ;
1136+ } ;
1137+
11201138 /**
11211139 * @ngdoc method
11221140 * @name adf.dashboardProvider#setLocale
@@ -1193,6 +1211,7 @@ angular.module('adf.provider', ['adf.locale'])
11931211 messageTemplate : messageTemplate ,
11941212 loadingTemplate : loadingTemplate ,
11951213 customWidgetTemplatePath : customWidgetTemplatePath ,
1214+ customWidgetAddTemplatePath : customWidgetAddTemplatePath ,
11961215 setLocale : this . setLocale ,
11971216 locales : getLocales ,
11981217 activeLocale : getActiveLocale ,
@@ -1806,8 +1825,8 @@ angular.module('adf')
18061825 options : '=' ,
18071826 widgetState : '='
18081827 } ,
1809- controller : [ "$scope" , function ( $scope ) {
1810-
1828+ controller : [ "$scope" , "$element" , function ( $scope , $element ) {
1829+ var widgetEm = $element . find ( '.widget' ) ;
18111830 $scope . $on ( 'adfDashboardCollapseExpand' , function ( event , args ) {
18121831 $scope . widgetState . isCollapsed = args . collapseExpandStatus ;
18131832 } ) ;
@@ -1867,7 +1886,7 @@ $templateCache.put("../src/templates/dashboard.html","<div class=dashboard-conta
18671886$templateCache . put ( "../src/templates/structure-preview.html" , "<div class=structure-preview ng-class=\"{selected: selected}\"> <h4>{{name}}</h4> <adf-dashboard-row ng-repeat=\"row in preview.rows\" row=row> </adf-dashboard-row></div> " ) ;
18681887$templateCache . put ( "../src/templates/widget-add.html" , "<div class=modal-header> <button type=button class=close ng-click=closeDialog() aria-hidden=true>×</button> <h4 class=modal-title ng-bind=\"translate(\'ADF_WIDGET_ADD_HEADER\')\">Add new widget</h4> </div> <div class=modal-body> <div ng-if=createCategories> <uib-accordion ng-init=\"categorized = createCategories(widgets)\"> <uib-accordion-group heading={{category.name}} ng-repeat=\"category in categorized | adfOrderByObjectKey: \'name\'\"> <dl class=dl-horizontal> <dt ng-repeat-start=\"widget in category | adfOrderByObjectKey: \'key\'\"> <a href ng-click=addWidget(key) ng-bind-html=widget.title> </a> </dt> <dd ng-repeat-end ng-if=widget.description> {{widget.description}} </dd> </dl> </uib-accordion-group> </uib-accordion> </div> <div style=\"display: inline-block;\" ng-if=!createCategories> <dl class=dl-horizontal> <dt ng-repeat-start=\"widget in widgets | adfOrderByObjectKey: \'key\'\"> <a href ng-click=addWidget(widget.key) ng-bind-html=widget.title> </a> </dt> <dd ng-repeat-end ng-if=widget.description> {{widget.description}} </dd> </dl> </div> </div> <div class=modal-footer> <button type=button class=\"btn btn-primary\" ng-click=closeDialog() ng-bind=\"translate(\'ADF_COMMON_CLOSE\')\">Close</button> </div> " ) ;
18691888$templateCache . put ( "../src/templates/widget-delete.html" , "<div class=modal-header> <h4 class=modal-title><span ng-bind=\"translate(\'ADF_COMMON_DELETE\')\">Delete</span> <span ng-bind-html=widget.title></span></h4> </div> <div class=modal-body> <form role=form> <div class=form-group> <label for=widgetTitle ng-bind=\"translate(\'ADF_WIDGET_DELETE_CONFIRM_MESSAGE\')\">Are you sure you want to delete this widget ?</label> </div> </form> </div> <div class=modal-footer> <button type=button class=\"btn btn-default\" ng-click=closeDialog() ng-bind=\"translate(\'ADF_COMMON_CLOSE\')\">Close</button> <button type=button class=\"btn btn-primary\" ng-click=deleteDialog() ng-bind=\"translate(\'ADF_COMMON_DELETE\')\">Delete</button> </div> " ) ;
1870- $templateCache . put ( "../src/templates/widget-edit.html" , "<form name=widgetEditForm novalidate role=form ng-submit=saveDialog()> <div class=modal-header> <button type=button class=close ng-click=closeDialog() aria-hidden=true>×</button> <h4 class=modal-title>{{widget.title}}</h4> </div> <div class=modal-body> <div class=\"alert alert-danger\" role=alert ng-show=validationError> <strong>Apply error:</strong> {{validationError}} </div> <div class=form-group> <label for=widgetTitle ng-bind=\"translate(\'ADF_COMMON_TITLE\')\">Title</label> <input type=text class=form-control id=widgetTitle ng-model=definition.title placeholder=\"Enter title\" required> </div> <div ng-if=widget.edit> <adf-widget-content model=definition content=widget.edit> </adf-widget-content></div> </div> <div class=modal-footer> <button type=button class=\"btn btn-default\" ng-click=closeDialog() ng-bind=\"translate(\'ADF_COMMON_CANCEL\')\">Cancel</button> <input type=submit class=\"btn btn-primary\" ng-disabled=widgetEditForm.$invalid ng-value=\"translate(\'ADF_COMMON_APPLY\')\"> </div> </form> " ) ;
1889+ $templateCache . put ( "../src/templates/widget-edit.html" , "<form name=widgetEditForm novalidate role=form ng-submit=saveDialog()> <div class=modal-header> <button type=button class=close ng-click=closeDialog() aria-hidden=true>×</button> <h4 class=modal-title>{{widget.title}}</h4> </div> <div class=modal-body> <div class=\"alert alert-danger\" role=alert ng-show=validationError> <strong>Apply error:</strong> {{validationError}} </div> <div class=form-group> <label for=widgetTitle ng-bind=\"translate(\'ADF_COMMON_TITLE\')\">Title</label> <input type=text class=form-control id=widgetTitle ng-model=definition.title placeholder=\"Enter title\"> </div> <div ng-if=widget.edit> <adf-widget-content model=definition content=widget.edit> </adf-widget-content></div> </div> <div class=modal-footer> <button type=button class=\"btn btn-default\" ng-click=closeDialog() ng-bind=\"translate(\'ADF_COMMON_CANCEL\')\">Cancel</button> <input type=submit class=\"btn btn-primary\" ng-disabled=widgetEditForm.$invalid ng-value=\"translate(\'ADF_COMMON_APPLY\')\"> </div> </form> " ) ;
18711890$templateCache . put ( "../src/templates/widget-fullscreen.html" , "<div class=modal-header> <div class=\"pull-right widget-icons\"> <a href title=\"{{ translate(\'ADF_WIDGET_TOOLTIP_REFRESH\') }}\" ng-if=widget.reload ng-click=reload()> <i class=\"glyphicon glyphicon-refresh\"></i> </a> <a href title=close ng-click=closeDialog()> <i class=\"glyphicon glyphicon-remove\"></i> </a> </div> <h4 class=modal-title>{{definition.title}}</h4> </div> <div class=modal-body> <adf-widget-content model=definition content=widget> </adf-widget-content></div> <div class=modal-footer> <button type=button class=\"btn btn-primary\" ng-click=closeDialog() ng-bind=\"translate(\'ADF_COMMON_CLOSE\')\">Close</button> </div> " ) ;
18721891$templateCache . put ( "../src/templates/widget-title.html" , "<h3 class=panel-title> {{definition.title}} <span class=pull-right> <a href title=\"{{ translate(\'ADF_WIDGET_TOOLTIP_REFRESH\') }}\" ng-if=widget.reload ng-click=reload()> <i class=\"glyphicon glyphicon-refresh\"></i> </a> <a href title=flytta class=adf-move ng-if=editMode> <i class=\"glyphicon glyphicon-move\"></i> </a> <a href title=\"{{ translate(\'ADF_WIDGET_TOOLTIP_COLLAPSE\') }}\" ng-show=\"options.collapsible && !widgetState.isCollapsed\" ng-click=\"widgetState.isCollapsed = !widgetState.isCollapsed\"> <i class=\"glyphicon glyphicon-minus\"></i> </a> <a href title=\"{{ translate(\'ADF_WIDGET_TOOLTIP_EXPAND\') }}\" ng-show=\"options.collapsible && widgetState.isCollapsed\" ng-click=\"widgetState.isCollapsed = !widgetState.isCollapsed\"> <i class=\"glyphicon glyphicon-plus\"></i> </a> <a href title=\"{{ translate(\'ADF_WIDGET_TOOLTIP_EDIT\') }}\" ng-click=edit() ng-if=editMode> <i class=\"glyphicon glyphicon-cog\"></i> </a> <a href title=\"{{ translate(\'ADF_WIDGET_TOOLTIP_FULLSCREEN\') }}\" ng-click=openFullScreen() ng-show=options.maximizable> <i class=\"glyphicon glyphicon-fullscreen\"></i> </a> <a href title=\"{{ translate(\'ADF_WIDGET_TOOLTIP_REMOVE\') }}\" ng-click=remove() ng-if=editMode> <i class=\"glyphicon glyphicon-remove\"></i> </a> </span> </h3> " ) ;
18731892$templateCache . put ( "../src/templates/widget.html" , "<div adf-id={{definition.wid}} adf-widget-type={{definition.type}} ng-class=\"widgetClasses(widget, definition)\" class=widget> <div class=\"panel-heading clearfix\" ng-if=\"!widget.frameless || editMode\"> <div ng-include src=definition.titleTemplateUrl></div> </div> <div ng-class=\"{\'panel-body\':!widget.frameless || editMode}\" uib-collapse=widgetState.isCollapsed> <adf-widget-content model=definition content=widget> </adf-widget-content></div> </div> " ) ; } ] ) ;
0 commit comments