<commit_before>
#################################################################
#       Router Global
#################################################################
Router.configure
  layoutTemplate: "layout"
  notFoundTemplate: "not_found"
  loadingTemplate : "loading"


#################################################################
#       Filters
#################################################################
filters =
  resetScroll: ->
    scrollTo = window.currentScroll or 0
    if not Session.get('dontResetScroll')
      $("body").scrollTop scrollTo
    $("body").css "min-height", 0
    Session.set('dontResetScroll', false)
    this.next()

Router.onBeforeAction ->
  # check for ie8 or less (don't support document.addEventListener)
  if not document.addEventListener and not Session.get('oldBrowserProceed')
    console.log('ie8!')
    @render('upgrade_browser')
    @stop()
  if @url is '/'
    Session.set('currentPage', 'home')
  else
    Session.set('currentPage', @url.split("/")[1])
  this.next()

Router.onBeforeAction(filters.resetScroll)

# Router.onBeforeAction () ->
#   unless @ready()
#     @render "loading"
#     this.next()
#   return

# Router.onAfterAction ->
#   analyticsRequest() # log this request with mixpanel, etc

#################################################################
#       Routes
#################################################################
Router.map ->

  # Home
  @route 'home',
    path: '/'
    yieldTemplates:
      'subnav_announcement': to: 'subnav'
      'banner_carousel':     to: 'banner'
    onBeforeAction: ->
      Session.set('title', 'home')
      GAnalytics.pageview("/")
      this.next()

  # Admin
  @route "admin",
    path: "/admin"
    template: "accountsAdmin"
    onBeforeAction: ->
      AccountsEntry.signInRequired(this)
      this.next()

  # Beers
  @route 'beers',
    path: '/beers/:beer?'
    layoutTemplate: <commit_msg>routing for beers<commit_after>
#################################################################
#       Router Global
#################################################################
Router.configure
  layoutTemplate: "layout"
  notFoundTemplate: "not_found"
  loadingTemplate : "loading"


#################################################################
#       Filters
#################################################################
filters =
  resetScroll: ->
    scrollTo = window.currentScroll or 0
    if not Session.get('dontResetScroll')
      $("body").scrollTop scrollTo
    $("body").css "min-height", 0
    Session.set('dontResetScroll', false)
    this.next()

Router.onBeforeAction ->
  # check for ie8 or less (don't support document.addEventListener)
  if not document.addEventListener and not Session.get('oldBrowserProceed')
    console.log('ie8!')
    @render('upgrade_browser')
    @stop()
  if @url is '/'
    Session.set('currentPage', 'home')
  else
    Session.set('currentPage', @url.split("/")[1])
  this.next()

Router.onBeforeAction(filters.resetScroll)

# Router.onBeforeAction () ->
#   unless @ready()
#     @render "loading"
#     this.next()
#   return

# Router.onAfterAction ->
#   analyticsRequest() # log this request with mixpanel, etc

#################################################################
#       Routes
#################################################################
Router.map ->

  # Home
  @route 'home',
    path: '/'
    yieldTemplates:
      'subnav_announcement': to: 'subnav'
      'banner_carousel':     to: 'banner'
    onBeforeAction: ->
      Session.set('title', 'home')
      GAnalytics.pageview("/")
      this.next()

  # Admin
  @route "admin",
    path: "/admin"
    template: "accountsAdmin"
    onBeforeAction: ->
      AccountsEntry.signInRequired(this)
      this.next()

  @route "ampere",
    path: "/ampere"
    onBeforeAction: ->
      @redirect("/beers/ampere")
      this.next()

  @route "short-circuit",
    path: "/short-circuit"
    onBeforeAction: ->
      @redirect("/beers/short-circuit")
      this.next()

  @route "flipswitch",
    path: "/flipswitch"
    onBeforeAction: ->
      @redirect("/beers/flip-switch")
      this.next()

  @route "wheatstone",
    path: "/wheatstone"
    onBeforeAction: ->
      @redirect("/beers/wheatstone")
      this.next()

  @route "schottky",
    path: "/schottky"
    onBeforeAction: ->
      @redirect("/beers/schottky")
      this.next()

  # Beers
  @route 'beers',
    path: '/beers/:beer?'
    layoutTemplate: 
{'fraction_non_alphanumeric': 0.2972309066547566, 'fraction_numerical': 0.0022331397945511387, 'mean_word_length': 3.759829968119022, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 22, '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': '3996107', 'n_tokens_mistral': 1306, 'n_tokens_neox': 1256, 'n_words': 247}