<commit_before>import Backbone from 'backbone';
import Marionette from 'backbone.marionette';

import {UserModel} from './base/models/auth';


const Nav = Marionette.View.extend({
  className: 'container-fluid',
  template: require('./templates/nav.html'),

  ui: {
    root: '.root',
    exercise: '.exercise',
    workout: '.workout'
  },

  events: {
    'click @ui.root': 'showRoot',
    'click @ui.exercise': 'showExercise',
    'click @ui.workout': 'showWorkout'
  },

  modelEvents: {
    sync: 'render',
    'change:token': 'render'
  },

  initialize: function() {
    this.model.fetch();
  },

  onRender: function() {
    if (this.model.isLoggedIn()) {
      this.ui.exercise.removeClass('hidden');
      this.ui.workout.removeClass('hidden');
    }
    else {
      this.ui.exercise.addClass('hidden');
      this.ui.workout.addClass('hidden');
    }
  },

  showRoot: function() {
    this._navigate('');
  },

  showExercise: function(e) {
    e.preventDefault();
    this._navigate('exercise/');
  },

  showWorkout: function(e) {
    e.preventDefault();
    this._navigate('workout/');
  },

  _navigate: function(url) {
    Backbone.history.navigate(url, {trigger: true});
  }
});

const Layout = Marionette.View.extend({
  template: require('./templates/base.html'),

  regions: {
    main: '#main',
    nav: '#nav'
  },

  onRender: function() {
    this.showChildView('nav', new Nav({
      model: new UserModel()
    }));
  }
});

export default new Layout();<commit_msg>Made the setup a bit better 46<commit_after>import Backbone from 'backbone';
import Marionette from 'backbone.marionette';

import {UserModel} from './base/models/auth';


const Nav = Marionette.View.extend({
  className: 'container-fluid',
  template: require('./templates/nav.html'),

  ui: {
    root: '.root',
    exercise: '.exercise',
    workout: '.workout'
  },

  events: {
    'click @ui.root': 'showRoot',
    'click @ui.exercise': 'showExercise',
    'click @ui.workout': 'showWorkout'
  },

  modelEvents: {
    sync: 'render',
    'change:token': 'render'
  },

  onRender: function() {
    if (this.model.isLoggedIn()) {
      this.ui.exercise.removeClass('hidden');
      this.ui.workout.removeClass('hidden');
    }
    else {
      this.ui.exercise.addClass('hidden');
      this.ui.workout.addClass('hidden');
    }
  },

  showRoot: function() {
    this._navigate('');
  },

  showExercise: function(e) {
    e.preventDefault();
    this._navigate('exercise/');
  },

  showWorkout: function(e) {
    e.preventDefault();
    this._navigate('workout/');
  },

  _navigate: function(url) {
    Backbone.history.navigate(url, {trigger: true});
  }
});

const Layout = Marionette.View.extend({
  template: require('./templates/base.html'),

  regions: {
    main: '#main',
    nav: '#nav'
  },

  initialize: function() {
    this.model = new UserModel();
    this.model.fetch();
  },

  onRender: function() {
    this.showChildView('nav', new Nav({
      model: this.model
    }));
  }
});

export default new Layout();
{'fraction_non_alphanumeric': 0.18151815181518152, 'fraction_numerical': 0.0006600660066006601, 'mean_word_length': 3.129427792915531, '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': '2163658', 'n_tokens_mistral': 1039, 'n_tokens_neox': 1005, 'n_words': 189}