Conversation
…ularjs-portal into addFromFeatureButton
|
|
||
| $rootScope.addPortletToHome = function (fname) { | ||
| layoutService.addToLayoutByFname(fname).success(function() { | ||
| layoutService.getUncachedLayout().then(function(data) { |
There was a problem hiding this comment.
🎨 line 81 to show it is a sub-scope of line 81.
|
|
||
| var addToLayoutByFname = function addToLayoutByFname(fname){ | ||
| var tabName = SERVICE_LOC.layoutTab; | ||
| return $.ajax({ |
| // $sessionStorage.layout = null; | ||
| // getLayout().then(function(result){ | ||
| // $sessionStorage.layout = result; | ||
| // }); |
There was a problem hiding this comment.
🎨 removing commented out code helps to focus on the remaining active code.
| // $sessionStorage.layout = result; | ||
| // }); | ||
| }, | ||
| error: function(request, text, error) { |
| data: null, | ||
| dataType: 'json', | ||
| async: true, | ||
| success: function(request, text) { |
| */ | ||
| vm.addPortlet = function addPortletFunction(fname) { | ||
| $rootScope.addToLayoutByFname(fname).success(function(){ | ||
| $scope.$apply(function(request, text) { |
| }; | ||
|
|
||
|
|
||
| $rootScope.addPortletToHome = function (fname) { |
There was a problem hiding this comment.
❓ could this be factored into a shared service rather than being applied directly to the $rootScope?
There was a problem hiding this comment.
We've got a through rewrite of the layout service coming down the pike. Factoring a new service just for this case would be throwaway work.
There was a problem hiding this comment.
I was not aware of the rewrite, thanks for the info @Doug-Reed!
There was a problem hiding this comment.
It's a long story, but we need this in rootScope in order to grab it from within uw-frame. If we put this in a service (like we already have in layoutService), we'd have to inject it where we need to call it in frame, which would put a hard dependency on angularjs-portal from frame. This way, we can grab it from scope if it's there, and if it's not, no harm.
Adds functionality to support adding a widget to the homepage from a mascot announcement
Contributor License Agreement adherence: