Skip to content

Commit

Permalink
added comments that explicitly label the modified section, and detail…
Browse files Browse the repository at this point in the history
… where to find the original code so that we can maintain some parity down the road
  • Loading branch information
Spencer Alger committed Feb 25, 2014
1 parent 6f06dca commit bdc13ef
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/kibana/directives/kbn_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ define(function (require) {

angular
.module('kibana/directives')
/******
****** COPIED directive from angular-router
****** https://github.com/angular/angular.js/blob/6f0503514f/src/ngRoute/directive/ngView.js#L183
******
****** Modification made:
****** - prevent the view from being recreated unnecessarily
******
******/
.directive('kbnView', function modifiedNgViewFactory($route, $anchorScroll, $animate) {
return {
restrict: 'ECA',
Expand Down Expand Up @@ -31,13 +39,15 @@ define(function (require) {
}

function update() {
/****** START modification *******/
if ($route.current) {
if (currentTemplateUrl && $route.current.templateUrl === currentTemplateUrl) {
return;
} else {
currentTemplateUrl = $route.current.templateUrl;
}
}
/****** STOP modification *******/

var locals = $route.current && $route.current.locals;
var template = locals && locals.$template;
Expand Down Expand Up @@ -73,6 +83,14 @@ define(function (require) {
}
};
})

/******
****** COPIED directive from angular-router
****** https://github.com/angular/angular.js/blob/6f0503514f/src/ngRoute/directive/ngView.js#L251
******
****** No Modifications made
******
******/
.directive('kbnView', function modifiedNgViewFillContentFactory($compile, $controller, $route) {
return {
restrict: 'ECA',
Expand Down

0 comments on commit bdc13ef

Please sign in to comment.