'use strict';
define(function() {
  var templatebasewidget = function(ngDialog) {
    return {
      //            template:
      //                '<button title="Publication" ng-click="openPublishInfos()"><span class="glyphicon glyphicon-globe" ></span> </button>',
      templateUrl:
        'js/XG/modules/dbparameters/views/publishParamComponent.html',
      restrict: 'A',
      scope: {
        param: '=',
      },
      link: function(scope, element, attrs, ctrl) {
        if (attrs.gcclass != undefined) scope.gcclass = attrs.gcclass;
        scope.openPublishInfos = function() {
          console.log(scope.param);
          ngDialog.open({
            template: 'js/XG/modules/dbparameters/views/publishInfosPopup.html',
            scope: scope,
            controller: 'publishController',
            closeByDocument: false,
            data: scope.param,
          });
        };

        scope.isSetId = function() {
          //console.log(scope.param.id);
          return angular.isDefined(scope.param.id);
        };
      },
    };
  };

  templatebasewidget.$inject = ['ngDialog'];
  return templatebasewidget;
});
