Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DecapodesLeaderBoard

DecapodesLeaderBoard is a site for documenting example physics simulations.

See the Decapodes.jl repo for more on the framework itself.

Architecture Choices

Since this site is designed to be feature-light (basic toggling, storing state in the query string), I decided to set it up as a CGI app. Racket is a good choice due to its scribble/html library, which lets you write html directly in the source in a single-file architecture without sacrificing readability:

;; A form for toggling state of the webpage.
(define view-configuration
  (form action:"./dlb.cgi" method:"GET"
        (hiding-checkbox "leaderboard") (hiding-checkbox "plots") (hiding-checkbox "diagrams")
        (input type:"submit" value:"Show")))

Functions that return HTML programmatically (widgets) are easy to write:

;; A widget for checkboxes that hide elements according to a global variable.
(define (hiding-checkbox to-show)
  (define id (~a "show-" to-show))
  (define label-val (string-titlecase to-show))
  (define checked (checked-attr (eval (string->symbol id) ns)))
  (div class:"hiding-checkbox"
       (label for: id label-val)
       (apply element 'input 'type: "checkbox" 'id: id 'name: id 'value: "T" checked)))

Organizing content can be accomplished without any heavy frameworks:

;; The layout of the webpage.
(define (front-page)
  (body
   floating-header
   (div class:"main-content"
        instructions
        leader-board
        scenario-showcase
        decapodes-overview)
   footer))

About

DecapodesLeaderBoard is a simple CGI site where we can keep track of example Decapodes implementations.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages