Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

[WIP] refactor: Separate remove button into own controller #699

Closed
wants to merge 2 commits into from
Closed

[WIP] refactor: Separate remove button into own controller #699

wants to merge 2 commits into from

Conversation

thevoiceofzeke
Copy link
Contributor

@thevoiceofzeke thevoiceofzeke commented Sep 22, 2017

In this PR:

  • Broke functionality for widget remove button into its own controller

Why?

The functionality used to live in LayoutController, and every instance of a <remove-button> in a user's layout was causing LayoutController to initialize (including the getLayout() service call. It's probably better if each instance of the remove button only initializes what it needs to function.

Proof that it still works

remove-button


Contributor License Agreement adherence:

*/
vm.removePortlet = function removePortletFunction(fname) {
layoutService.removeFromHome(fname).success(function() {
$scope.$apply(function(request, text) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure $scope.$apply is needed here.
AFAICT All the operations all the operations are synchronous, and exception handling could be managed by the wrapping promise.
it appears be used to indirectly trigger $scope.$digest, which can be called directly.

});
}).error(
function(request, text, error) {
alert('Issue deleting ' + fname +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably outside of the scope of this PR, but a toast would look a lot nicer than an alert.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChristianMurphy
Copy link
Contributor

Hey @thevoiceofzeke, it looks like a merge conflict has cropped up. Would you be able to resolve the conflict?

@thevoiceofzeke thevoiceofzeke changed the title refactor: Separate remove button into own controller [WIP] refactor: Separate remove button into own controller Oct 2, 2017
@thevoiceofzeke
Copy link
Contributor Author

Closing this PR because I FUBAR'd it by deleting my fork that included the HEAD branch and it's easier to just redo the work in my new fork than figure out how to git my way around it. :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants