<commit_before>'use strict';

var _      = require('lodash');
var React  = require('react');
var Reflux = require('reflux');

var NavMenu         = require('component/NavMenu.jsx');
var NavMenuItem     = require('component/NavMenuItem.jsx');
var NavigationStore = require('stores/NavigationStore');

var Navigation = React.createClass({

  mixins : [
    Reflux.connect(NavigationStore)
  ],

  render : function () {

    var dashboards = NavMenuItem.fromArray(_(this.state.dashboards)
      .filter(d => d.builtin || d.owned_by_current_user)
      .map(function (d) {
        return _.assign({ key : 'dashboard-nav-' + d.id }, d);
      })
      .value()
    );

    var enterData = '';
    if (NavigationStore.userHasPermission('upload_csv') || NavigationStore.userHasPermission('data_entry_form')) {

      var formLink = NavigationStore.userHasPermission('data_entry_form') ? (<NavMenuItem href='/datapoints/entry'>Enter Data via Form</NavMenuItem>) : '';
      var uploadLink = NavigationStore.userHasPermission('upload_csv') ? (<NavMenuItem href='/upload/file_upload'>Upload Data via CSV File</NavMenuItem>) : '';

      var enterData = (
          <li className='data'>
            <NavMenu text={'Enter Data'} icon={'fa-table'}>
              {formLink}
              {uploadLink}
            </NavMenu>
          </li>
        );

    }

    var manage = '';
    if (NavigationStore.userHasPermission('manage_system')) {
      manage = (
        <li>
          <a href='/ufadmin/users'>
            <i className='fa fa-cogs'></i>&ensp;Manage System
          </a>
        </li>
      );
    }

    return (
      <nav>
        <ul>
          <li className='home'><a href='/'>
            Rhizome DB
          </a></li>

          <li className='dashboard'>
            <NavMenu text={'Explore Data'} icon={'fa-bar-chart'}>
              {dashboards}
              <li className='separator'><hr /></li>
              <NavMenuItem href='/datapoints/table'>Data Browser</NavMenuItem>
              <li className='separator'><hr /></li>
              <NavMenuItem href='/datapoints/dashboards/'>
                See all custom dashboards
              </NavMenuItem>
              <NavMenuItem href='/datapoints/dashboards/edit'>
                Create New dashboard
              </NavMenuItem>
            </NavMenu>
          </li>

          {enterData}

          {manage}

        </ul>

        <ul className='right'>
          <li>
            <a href='/accounts/logout?next=/' title='logout'>
              log out&ensp;<i className='fa fa-lg fa-sign-out'></i>
            </a>
          </li>
        </ul>
      </nav>
    );
  }
});

module.exports = Navigation;
<commit_msg>fix csv uploader link in top nav menu<commit_after>'use strict';

var _      = require('lodash');
var React  = require('react');
var Reflux = require('reflux');

var NavMenu         = require('component/NavMenu.jsx');
var NavMenuItem     = require('component/NavMenuItem.jsx');
var NavigationStore = require('stores/NavigationStore');

var Navigation = React.createClass({

  mixins : [
    Reflux.connect(NavigationStore)
  ],

  render : function () {

    var dashboards = NavMenuItem.fromArray(_(this.state.dashboards)
      .filter(d => d.builtin || d.owned_by_current_user)
      .map(function (d) {
        return _.assign({ key : 'dashboard-nav-' + d.id }, d);
      })
      .value()
    );

    var enterData = '';
    if (NavigationStore.userHasPermission('upload_csv') || NavigationStore.userHasPermission('data_entry_form')) {

      var formLink = NavigationStore.userHasPermission('data_entry_form') ? (<NavMenuItem href='/datapoints/entry'>Enter Data via Form</NavMenuItem>) : '';
      var uploadLink = NavigationStore.userHasPermission('upload_csv') ? (<NavMenuItem href='/datapoints/source-data/'>Upload Data via CSV File</NavMenuItem>) : '';

      var enterData = (
          <li className='data'>
            <NavMenu text={'Enter Data'} icon={'fa-table'}>
              {formLink}
              {uploadLink}
            </NavMenu>
          </li>
        );

    }

    var manage = '';
    if (NavigationStore.userHasPermission('manage_system')) {
      manage = (
        <li>
          <a href='/ufadmin/users'>
            <i className='fa fa-cogs'></i>&ensp;Manage System
          </a>
        </li>
      );
    }

    return (
      <nav>
        <ul>
          <li className='home'><a href='/'>
            Rhizome DB
          </a></li>

          <li className='dashboard'>
            <NavMenu text={'Explore Data'} icon={'fa-bar-chart'}>
              {dashboards}
              <li className='separator'><hr /></li>
              <NavMenuItem href='/datapoints/table'>Data Browser</NavMenuItem>
              <li className='separator'><hr /></li>
              <NavMenuItem href='/datapoints/dashboards/'>
                See all custom dashboards
              </NavMenuItem>
              <NavMenuItem href='/datapoints/dashboards/edit'>
                Create New dashboard
              </NavMenuItem>
            </NavMenu>
          </li>

          {enterData}

          {manage}

        </ul>

        <ul className='right'>
          <li>
            <a href='/accounts/logout?next=/' title='logout'>
              log out&ensp;<i className='fa fa-lg fa-sign-out'></i>
            </a>
          </li>
        </ul>
      </nav>
    );
  }
});

module.exports = Navigation;

{'fraction_non_alphanumeric': 0.15143120960295475, 'fraction_numerical': 0.0, 'mean_word_length': 2.0122358175750836, 'pattern_counts': {'":': 0, '<': 95, '<?xml version=': 0, '>': 97, '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': '2253355', 'n_tokens_mistral': 1636, 'n_tokens_neox': 1568, 'n_words': 305}