Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delete widget in adf #128

Merged

Conversation

dulcedilip
Copy link

Added new delete widget to adf,which prompts user modal popup before he deletes.

$scope.close = function() {
var deleteScope= $scope.$new();
var adfDeleteTemplatePath = adfTemplatePath + 'widget-delete.html';
if (definition.deleteTemplateUrl) {
adfEditTemplatePath = definition.deleteTemplateUrl;
}
 var opts = {
 scope: deleteScope,
templateUrl: adfDeleteTemplatePath,
backdrop: 'static'
};
var instance = $modal.open(opts);

          deleteScope.closeDialog = function() {
            instance.close();
            deleteScope.$destroy();
          };
          deleteScope.deleteDialog = function() {
            instance.close();
            deleteScope.$destroy();
            var column = $scope.col;
            if (column) {
              var index = column.widgets.indexOf(definition);
              if (index >= 0) {
                column.widgets.splice(index, 1);
              }
            }
            $element.remove();
          };
    }

@sdorra sdorra self-assigned this Jul 30, 2015
@sdorra
Copy link
Member

sdorra commented Jul 30, 2015

I'm not sure if we need this, because we could always revert a deleted widget with the undo button. Could you add an parameter to the options, for enable/disable this feature? The default value should be disabled for now.

@dulcedilip
Copy link
Author

My thought process towards this enhancement is before user delete directly, will have chance to remove or cancel. Instead he need to go , undo the changes as you said, but it increase another click to user. Any way will update the code with above approach.

@dulcedilip
Copy link
Author

Done.

@sdorra sdorra merged commit e738637 into angular-dashboard-framework:master Aug 28, 2015
@sdorra
Copy link
Member

sdorra commented Aug 28, 2015

Thanks

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.

None yet

2 participants