<commit_before>React = require("react")
App         = require './app'
Router      = require 'react-router'
{Handler, Root, RouteHandler, Route, DefaultRoute, Redirect, Navigation, Link, Transition} = Router

HomePage      = require './yale-home-page'
Mark          = require './mark'
Transcribe    = require './transcribe'
Verify        = require './verify'
GroupPage     = require './group-page'
GroupBrowser  = require './group-browser'
AboxutPage    = require './yale-about-page'
YaleLogin     = require './yale-login'

Project       = require 'models/project.coffee'

class AppRouter
  constructor: ->
    API.type('projects').get().then (result)=>
      window.project = new Project(result[0])
      @runRoutes window.project

  saveRequestedRoute: (requestedRoute) ->
    $.post "/save_requested_route",
      requested_route: "/#" + requestedRoute
      (data) ->
        response = data
        # pass

  # function to check if the current route is restricted, and if so, to redirect
  # users to a login route
  checkForAuthentication: (Handler, state) ->
    self = this
    # check if the requested route is protected
    if state.pathname in ["/mark", "/transcribe"]

      # check if the current user is logged in
      request = $.getJSON "/current_user"

      request.done (result) =>
        if result?.data<commit_msg>mount the about page<commit_after>React = require("react")
App         = require './app'
Router      = require 'react-router'
{Handler, Root, RouteHandler, Route, DefaultRoute, Redirect, Navigation, Link, Transition} = Router

HomePage      = require './yale-home-page'
Mark          = require './mark'
Transcribe    = require './transcribe'
Verify        = require './verify'
GroupPage     = require './group-page'
GroupBrowser  = require './group-browser'
AboutPage    = require './yale-about-page'
YaleLogin     = require './yale-login'

Project       = require 'models/project.coffee'

class AppRouter
  constructor: ->
    API.type('projects').get().then (result)=>
      window.project = new Project(result[0])
      @runRoutes window.project

  saveRequestedRoute: (requestedRoute) ->
    $.post "/save_requested_route",
      requested_route: "/#" + requestedRoute
      (data) ->
        response = data
        # pass

  # function to check if the current route is restricted, and if so, to redirect
  # users to a login route
  checkForAuthentication: (Handler, state) ->
    self = this
    # check if the requested route is protected
    if state.pathname in ["/mark", "/transcribe"]

      # check if the current user is logged in
      request = $.getJSON "/current_user"

      request.done (result) =>
        if result?.data
{'fraction_non_alphanumeric': 0.12173263629574309, 'fraction_numerical': 0.0007468259895444362, 'mean_word_length': 2.8162393162393164, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '6123771', 'n_tokens_mistral': 764, 'n_tokens_neox': 749, 'n_words': 234}