<commit_before>require('lib/setup')
Spine = require('spine')

# Helpers
Keys = require("utils/keys")

# Models
Task  = require('models/task')
List  = require('models/list')
Setting = require('models/setting')

# Controllers
Tasks = require('controllers/tasks')
Lists = require('controllers/lists')
ListTitle = require('controllers/lists.title')
Panel = require('controllers/panel')
Settings = require("controllers/settings")

class App extends Spine.Controller

  elements:
    '.tasks': 'tasksContainer'
    '.sidebar': 'listsContainer'
    '.tasks .title': 'listTitle'
    'header': 'panel'
    '.settings': 'settings'

  events:
    "keydown": "collapseAllOnEsc"

  constructor: ->
    super

    # Load settings
    Setting.fetch()
    if Setting.count() is 0
      Setting.create()

    # Init panel
    new Panel
      el: @panel

    # Init settings
    window.settings = new Settings
      el: @settings

    # Init tasks
    @tasks = new Tasks( el: @tasksContainer )

    # Init lists
    @lists = new Lists( el: @listsContainer )
    new ListTitle
      el: @listTitle

    # Load data for localStorage
    List.fetch()
    Task.fetch()

    # Create inbox list
    if not !!List.exists("inbox")
      List.create
        id: "inbox"
        name: "Inbox"
        permanent: yes

    # Select the first list on load
    @lists.showInbox()

    # Login to sync
    Spine.Sync.login(Setting.first().username)

  collapseAllOnEsc: (e) =>
    if e.which is Keys.ESCAPE
      focusedInputs = $ "div:focus"
      if focusedInputs.length is 0
        @tasks.collapseAll()

module.exports = App<commit_msg>This fixes list counts. Somehow. George, your code is magical.<commit_after>require('lib/setup')
Spine = require('spine')

# Helpers
Keys = require("utils/keys")

# Models
Task  = require('models/task')
List  = require('models/list')
Setting = require('models/setting')

# Controllers
Tasks = require('controllers/tasks')
Lists = require('controllers/lists')
ListTitle = require('controllers/lists.title')
Panel = require('controllers/panel')
Settings = require("controllers/settings")

class App extends Spine.Controller

  elements:
    '.tasks': 'tasksContainer'
    '.sidebar': 'listsContainer'
    '.tasks .title': 'listTitle'
    'header': 'panel'
    '.settings': 'settings'

  events:
    "keydown": "collapseAllOnEsc"

  constructor: ->
    super

    # Load settings
    Setting.fetch()
    if Setting.count() is 0
      Setting.create()

    # Init panel
    new Panel
      el: @panel

    # Init settings
    window.settings = new Settings
      el: @settings

    # Init tasks
    @tasks = new Tasks( el: @tasksContainer )

    # Init lists
    @lists = new Lists( el: @listsContainer )
    new ListTitle
      el: @listTitle

    # Load data for localStorage
    Task.fetch()
    List.fetch()

    # Create inbox list
    if not !!List.exists("inbox")
      List.create
        id: "inbox"
        name: "Inbox"
        permanent: yes

    # Select the first list on load
    @lists.showInbox()

    # Login to sync
    Spine.Sync.login(Setting.first().username)

  collapseAllOnEsc: (e) =>
    if e.which is Keys.ESCAPE
      focusedInputs = $ "div:focus"
      if focusedInputs.length is 0
        @tasks.collapseAll()

module.exports = App
{'fraction_non_alphanumeric': 0.12496171516079632, 'fraction_numerical': 0.001225114854517611, 'mean_word_length': 2.883472057074911, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 7, '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': '1406322', 'n_tokens_mistral': 1023, 'n_tokens_neox': 988, 'n_words': 266}