<commit_before>var _ = require('underscore')
  , moment = require('moment');

module.exports = NewsFeed;

function NewsFeed() {
  var directive = {
    restrict: "A",
    template:  require('./feed.directive.html'),
    scope: {
      event: '=',
      addObservation: '=',
      feedUsersChanged: '=',
      onToggleFeed: '&'
    },
    controller: NewsFeedController
  };

  return directive;
}

NewsFeedController.$inject = ['$scope', '$element', 'MapService', 'EventService', 'ObservationService', 'FilterService', 'UserService', 'Observation', '$uibModal'];

function NewsFeedController($scope, $element, MapService, EventService, ObservationService, FilterService, UserService, Observation, $uibModal) {
  var contentEls = $element.find('.content');

  $scope.tabs = [{
    tabName: 'Observations',
    tabId: 'observations',
    icon: 'place'
  }, {
    tabName: 'People',
    tabId: 'people',
    icon: 'supervisor_account'
  }];

  $scope.onTabSwitched = function(index) {
    $scope.currentFeedPanel = $scope.tabs[index].tabId;
    let active = $element.find('.content--active')[0];
    active.classList.remove('content--active');
    contentEls[index].classList.add('content--active');
  };

  $scope.currentFeedPanel = 'observations';

  var newObservation;

  $scope.createObservation = function(form) {
    delete $scope.newObservationForms;
    $scope.newObservation = newObservation;

    $scope.newObservationForm = {
      geometryField: {
        title: 'Location',
        type: 'geometry',
        name: 'geometry',
        value: newObservation.geometry
      },
      timestampField: {
        title: 'Date',
        type: 'date',
        name:'timestamp',
        value: moment(newObservation.properties.timestamp).toDate()
      },
      forms: []
    };

    if (form) {
      var observationForm = EventService.createForm(newObservation, form);
      observationForm.name = form.name;
      $scope.newObservationForm.forms.push(observationForm);
    }

  };

  $scope.$on('user:view', function(e, user) {<commit_msg>Fix observation form picker close<commit_after>var _ = require('underscore')
  , moment = require('moment');

module.exports = NewsFeed;

function NewsFeed() {
  var directive = {
    restrict: "A",
    template:  require('./feed.directive.html'),
    scope: {
      event: '=',
      addObservation: '=',
      feedUsersChanged: '=',
      onToggleFeed: '&'
    },
    controller: NewsFeedController
  };

  return directive;
}

NewsFeedController.$inject = ['$scope', '$element', 'MapService', 'EventService', 'ObservationService', 'FilterService', 'UserService', 'Observation', '$uibModal'];

function NewsFeedController($scope, $element, MapService, EventService, ObservationService, FilterService, UserService, Observation, $uibModal) {
  var contentEls = $element.find('.content');

  $scope.tabs = [{
    tabName: 'Observations',
    tabId: 'observations',
    icon: 'place'
  }, {
    tabName: 'People',
    tabId: 'people',
    icon: 'supervisor_account'
  }];

  $scope.onTabSwitched = function(index) {
    $scope.currentFeedPanel = $scope.tabs[index].tabId;
    let active = $element.find('.content--active')[0];
    active.classList.remove('content--active');
    contentEls[index].classList.add('content--active');
  };

  $scope.currentFeedPanel = 'observations';

  var newObservation;

  $scope.createObservation = function(form) {
    delete $scope.newObservationForms;
    $scope.newObservation = newObservation;

    $scope.newObservationForm = {
      geometryField: {
        title: 'Location',
        type: 'geometry',
        name: 'geometry',
        value: newObservation.geometry
      },
      timestampField: {
        title: 'Date',
        type: 'date',
        name:'timestamp',
        value: moment(newObservation.properties.timestamp).toDate()
      },
      forms: []
    };

    if (form) {
      var observationForm = EventService.createForm(newObservation, form);
      observationForm.name = form.name;
      $scope.newObservationForm.forms.push(observationForm);
    }

  };

  $scope.cancelNewObservation = function() {
    delete $scope.newObservationForms;
  }

  $scope.$on('user:view', function(e, user) {
{'fraction_non_alphanumeric': 0.15113230035756853, 'fraction_numerical': 0.0004767580452920143, 'mean_word_length': 3.4402116402116403, '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': '6945661', 'n_tokens_mistral': 1284, 'n_tokens_neox': 1264, 'n_words': 226}