diff --git a/lib/views.rb b/lib/views.rb deleted file mode 100644 index 86a8783..0000000 --- a/lib/views.rb +++ /dev/null @@ -1,50 +0,0 @@ -require "phlex" - -module RankKing - module Views - - class Layout < Phlex::HTML - def initialize(title: nil) - @title = title - end - - def template(&block) - doctype - html(lang: "en") do - head do - meta(charset: "utf-8") - meta(name: "viewport", content: "width=device-width, initial-scale=1") - title { ["Rank King", @title].compact.join(" - ") } - end - - body do - header do - h1 { "Rank King" } - end - - nav - - main(&block) - - footer - end - end - end - end - - class NewPool < Phlex::HTML - def initialize(csrf_token:) - @csrf_token = csrf_token - end - - def template - form do - input(type: "hidden", name: "_csrf", value: @csrf_token) - label(for: "name") - input(type: "text", name: "name", id: "name", required: true) - input(type: "submit", value: "Create") - end - end - end - end -end diff --git a/lib/web.rb b/lib/web.rb index e200823..c4d4855 100644 --- a/lib/web.rb +++ b/lib/web.rb @@ -5,71 +5,133 @@ require_relative "rank_king" module RankKing class Web < Roda plugin :named_templates + plugin :public plugin :render + plugin :symbol_views template(:layout) { <<~ERB } - + + +
+ + + + + + + +<%= i+1 %> | -<%= rating.item.title %> | -<%= rating.ordinal.round(1) %> | -<%= rating.mu.round(1) %> | -<%= rating.sigma.round(1) %> | -