<commit_before>var util = require('util');
var Tab = require('../client/tab').Tab;
var rewriter = require('../util/jsonrewriter');

var TxTab = function ()
{
  Tab.call(this);
};

util.inherits(TxTab, Tab);

TxTab.prototype.tabName = 'tx';

TxTab.prototype.generateHtml = function ()
{
  return require('../../jade/tabs/tx.jade')();
};

TxTab.prototype.angular = function (module)
{
  module.controller('TxCtrl', ['$scope', 'rpNetwork', '$routeParams',
                               function ($scope, net, $routeParams)
  {
    $scope.state = 'loading';
    $scope.transaction = {
      hash: $routeParams.id
    };

    function loadTx() {
      // XXX: Dirty, dirty. But it's going to change soon anyway.
      var request = net.remote.request_ledger_hash();
      request.message.command = 'tx';
      request.message.transaction = $routeParams.id;
      request.on('success', function (res) {
        $scope.$apply(function () {
          $scope.state = 'loaded';
          // XXX This is for the upcoming tx RPC call format change.
          var tx = res.tx ? res.tx : res;
          _.extend($scope.transaction, res);

          $scope.amountSent = rewriter.getAmountSent(tx, tx.meta);
        });
      });
      request.on('error', function (res) {
        $scope.$apply(function () {
          $scope.state = 'error';
          console.log(res);<commit_msg>[FIX] Can now logout from transaction details page<commit_after>var util = require('util');
var Tab = require('../client/tab').Tab;
var rewriter = require('../util/jsonrewriter');

var TxTab = function ()
{
  Tab.call(this);
};

util.inherits(TxTab, Tab);

TxTab.prototype.tabName = 'tx';

TxTab.prototype.generateHtml = function ()
{
  return require('../../jade/tabs/tx.jade')();
};

TxTab.prototype.angular = function (module)
{
  module.controller('TxCtrl', ['$scope', 'rpNetwork', '$routeParams', 'rpId',
                               function ($scope, net, $routeParams, $id)
  {
    if (!$id.loginStatus) return $id.goId();

    $scope.state = 'loading';
    $scope.transaction = {
      hash: $routeParams.id
    };

    function loadTx() {
      // XXX: Dirty, dirty. But it's going to change soon anyway.
      var request = net.remote.request_ledger_hash();
      request.message.command = 'tx';
      request.message.transaction = $routeParams.id;
      request.on('success', function (res) {
        $scope.$apply(function () {
          $scope.state = 'loaded';
          // XXX This is for the upcoming tx RPC call format change.
          var tx = res.tx ? res.tx : res;
          _.extend($scope.transaction, res);

          $scope.amountSent = rewriter.getAmountSent(tx, tx.meta);
        });
      });
      request.on('error', function (res) {
        $scope.$apply(function () {
          $scope.state = 'error';
          console.log(res);
{'fraction_non_alphanumeric': 0.16501766784452296, 'fraction_numerical': 0.0, 'mean_word_length': 2.5343320848938826, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3902054', 'n_tokens_mistral': 869, 'n_tokens_neox': 859, 'n_words': 192}