Skip to content
Permalink
b3a4236922
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
108 lines (78 sloc) 3.08 KB
(ns ulysses.db
(:require [ulysses.utils :refer [document-size window-size window-scroll-position]]))
(def default-db
{;; -------------------------------------------------------------------------
;; general
;; -------------------------------------------------------------------------
; current active page
:active-page :home
; current route arguments
:route-args {}
; progress trackers
:progress {}
; next progress ids (gets incremented eagerly)
:next-progress-id 1
; current document size
:document-size (document-size)
; current window size
:window-size (window-size)
; current window scroll position
:window-scroll-position (window-scroll-position)
;; -------------------------------------------------------------------------
;; user
;; -------------------------------------------------------------------------
:user nil
;; -------------------------------------------------------------------------
;; data
;; -------------------------------------------------------------------------
;; general ----
; grant ops (bare-bones, for listings)
:grant-ops []
; workspaces (bare-bones)
:workspaces []
; faculties (extended, with keywords) [builder]
:faculties {}
; faculty titles [builder]
:faculty-titles []
;; builder ----
; builder: current grant op (extended)
:builder-grant-op nil
; builder: current faculty pool results given filters (with metrics)
:builder-faculties-pool []
; builder: current workspace, OR nil for default
:builder-workspace nil
;; -------------------------------------------------------------------------
;; user data
;; -------------------------------------------------------------------------
; pagination: generic current page
:page-current 1
; pagination: generic max page
:page-last 1
; home page grant op filters and sort options
:home-filters {:search ""
:mechanisms {:nih true
:nsf true
:ncbi true}
:sort "posted_date"
:sort-direction "desc"}
; builder pool filters
:builder-filters {:faculty-title-set #{"director"}
:faculty-years-uconn 0
:metrics {:publicationCount 0
:grantCount 0
:grantFunds 0
:recentGrantCount 0
:recentGrantFunds 0}}
; user workspace-faculty hover (id)
:builder-workspace-faculty-hover nil
; builder workspaces saved timestamps {workspace-id => timestamp}
:builder-workspaces-saved-timestamps {}
;; -------------------------------------------------------------------------
;; interface
;; -------------------------------------------------------------------------
; modal: {:title Hiccup | String, :action-label String :on-action Function :children Hiccup | String}
:modal nil})
(defn refresh-keys
"given a db, set the given keys to their original state"
[db keys]
(merge db (select-keys default-db keys)))