'use strict';

GLClient.controller('LatenzaCtrl', 
    ['$scope', '$timeout', 
    function($scope, $timeout) {
  $scope.loading = false;
}]);

@@ -71,16 +71,23 @@
 meout', 
+'Node',
 %0A    fun
@@ -112,12 +112,19 @@
 eout
+, Node
 ) %7B%0A
+%0A
   $s
@@ -145,13 +145,1320 @@
  false;%0A
+%0A  // We do this in latenza so that we don't have to do requests multiple%0A  // times.%0A  if (!$scope.node_info) %7B%0A    // We set this to the parent scope that that we don't have to make this%0A    // request again later.%0A    $scope.$parent.node_info = Node.info(function() %7B%0A      console.log($scope.node_info);%0A      // Here are functions that are specific to language localization. They%0A      // are somwhat hackish and I am sure there is a javascript ninja way of%0A      // doing them.%0A      // XXX refactor these into something more 1337%0A      $scope.$parent.selected_language =%0A        $scope.node_info.available_languages%5B0%5D.code;%0A%0A      $scope.$parent.get_node_name = function() %7B%0A        return $scope.$parent.node_info.name%5B$scope.selected_language%5D;%0A      %7D%0A%0A      // Here we add to every context a special function that allows us to%0A      // retrieve the value of the name and description of the context%0A      // geolocalized.%0A      for (var i in $scope.$parent.node_info.contexts) %7B%0A        $scope.$parent.node_info.contexts%5Bi%5D.get_context_name = function() %7B%0A          return this.name%5B$scope.selected_language%5D;%0A        %7D%0A        $scope.$parent.node_info.contexts%5Bi%5D.get_context_description = function() %7B%0A          return this.description%5B$scope.selected_language%5D;%0A        %7D%0A      %7D%0A    %7D);%0A  %7D%0A%0A
 %7D%5D);%0A

Move node information discovery to latenza module and helpers for localization support * This will fetch the node information only the first time it loads to reduce the number of requests that must be done to the backend. * In this module we also have some functions to convert the variables that are sent from the node to the language that is selected by the user. * XXX possibly refactor these functions are they are somewhat hackish