diff --git a/Manifest.toml b/Manifest.toml index b72c87a..7bd8da7 100755 --- a/Manifest.toml +++ b/Manifest.toml @@ -2,7 +2,7 @@ julia_version = "1.8.2" manifest_format = "2.0" -project_hash = "7fa9bc39e3ae741288470877e398ff9f29579821" +project_hash = "c29e8447aeee171858dde0b54605eebd985a214b" [[deps.ArgParse]] deps = ["Logging", "TextWrap"] diff --git a/Project.toml b/Project.toml index f8fc42a..a0aae69 100755 --- a/Project.toml +++ b/Project.toml @@ -12,6 +12,7 @@ HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3" Inflector = "6d011eab-0732-4556-8808-e463c76bf3b6" JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1" Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" +Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SQLite = "0aa819cd-b072-5ff4-a722-6bc24af294d9" SearchLight = "340e8cb6-72eb-11e8-37ce-c97ebeb32050" SearchLightSQLite = "21a827c4-482a-11ea-3a19-4d2243a4a2c5" diff --git a/app/resources/surveys/SurveysController.jl b/app/resources/surveys/SurveysController.jl index df6a10c..332eb5c 100644 --- a/app/resources/surveys/SurveysController.jl +++ b/app/resources/surveys/SurveysController.jl @@ -1,6 +1,7 @@ module SurveysController using Genie.Router, Genie.Requests, Genie.Renderers.Html, HTTP +using Random # For shuffling donation links using ..Main.UserApp.Results, ..Main.UserApp.Surveys, Dates @@ -50,7 +51,8 @@ function completed(uid) preserve_query = false)) end res = html(:surveys, :thanks, layout=:base; - uid=uidstr, survey=SURVEY, resultlinks=links) + uid=uidstr, survey=SURVEY, resultlinks=links, + donateitems=donationlinks()) Genie.Cookies.set!(res, "response-page", 0, Dict{String, Any}("maxage" => -1)) Genie.Cookies.set!(res, "response-id", "", Dict{String, Any}("maxage" => -1)) end @@ -174,4 +176,91 @@ function submit(forminfo::Dict; backpage::Bool=false) end end +const DONATION_INDIVIDUALS = [ + ("https://liberapay.com/hlissner/", + "Henrik Lissner", "hlissner", + ["Doom Emacs" => "doomemacs/doomemacs", "assorted packages"]), + ("https://liberapay.com/magit/", + "Jonas Bernoulli", "tarsius", + ["Magit" => "magit", "Transient" => "transient", "others"]), + ("https://github.com/sponsors/abo-abo", + "Oleh Krehel", "abo-abo", + ["Swiper" => "swiper", "Hydra" => "hydra", + "Avy" => "avy", "Lispy" => "Lispy"]), + ("https://github.com/sponsors/progfolio", + "Nicholas Vollmer", "progfolio", + ["Straight" => "radian-software/straight.el", + "Elpaca" => "elpaca", "Doct" => "doct"]), + ("https://liberapay.com/protesilaos/", + "Protesilaos Stavrou", "protesilaos", + ["Modus themes" => "https://git.sr.ht/~protesilaos/modus-themes", + "Denote" => "https://git.sr.ht/~protesilaos/denote", + "others"]), + ("https://github.com/sponsors/yyoncho", + "Ivan Yonchovski", "yyoncho", + ["lsp-mode" => "emacs-lsp/lsp-mode", "dap-mode" => "emacs-lisp/dap-mode", + "and other LSP things"]), + ("https://liberapay.com/wasamasa/", + "Vasilij Schneidermann", "wasamasa", + ["nov.el" => "https://depp.brause.cc/nov.el/", + "circe" => "https://github.com/emacs-circe/circe", + "eyebrowse" => "https://depp.brause.cc/eyebrowse", + "shackle" => "https://depp.brause.cc/shackle"]), + ("https://liberapay.com/tec", + "me, Timothy", "tecosaur", + ["this survey", "a few other things"]) +] + +function donationlinks() + donate_org = ("https://liberapay.com/org-mode/", + "The Org Project", + "https://orgmode.org", + ["org-mode" => "https://orgmode.org"]) + donate_fsf = ("https://my.fsf.org/donate", + "The Free Software Foundation", + "https://www.fsf.org/", + ["an assortment of projects"]) + donate_specs = vcat(donate_org, + shuffle(DONATION_INDIVIDUALS), + donate_fsf) + donate_spec_to_link.(donate_specs) +end + +function donate_spec_to_link((link, name, site, projects)) + string("
  • Donate to ", + name, ' ', + if isnothing(site) + "" + elseif occursin("http", site) + "" + else # assume GitHub username + "@$site" + end, + " (responsible for ", + join(map(projects) do proj + if proj isa String + proj + elseif proj isa Pair{String,String} + string("", + proj[1], "") + else + "" + end + end, ", ", ", and "), + ")
  • ") +end + end diff --git a/app/resources/surveys/views/thanks.jl.html b/app/resources/surveys/views/thanks.jl.html index 97f2a68..dc2f1e7 100644 --- a/app/resources/surveys/views/thanks.jl.html +++ b/app/resources/surveys/views/thanks.jl.html @@ -24,71 +24,7 @@

    Should this sound like something you would be interested in, here is a small selection of donation links that may be of interest.


    Go Home