Browse Source

ostruct

main
pvincent 6 months ago
parent
commit
92f4979a1c
  1. 212
      Gemfile.lock
  2. 28
      app/views/scores/_score.html.erb
  3. 11
      app/views/scores/index.html.erb
  4. 2
      lib/formatters/ansi_dimensions.rb

212
Gemfile.lock

@ -1,35 +1,35 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (7.1.3.2)
actionpack (= 7.1.3.2)
activesupport (= 7.1.3.2)
actioncable (7.1.3.4)
actionpack (= 7.1.3.4)
activesupport (= 7.1.3.4)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (7.1.3.2)
actionpack (= 7.1.3.2)
activejob (= 7.1.3.2)
activerecord (= 7.1.3.2)
activestorage (= 7.1.3.2)
activesupport (= 7.1.3.2)
actionmailbox (7.1.3.4)
actionpack (= 7.1.3.4)
activejob (= 7.1.3.4)
activerecord (= 7.1.3.4)
activestorage (= 7.1.3.4)
activesupport (= 7.1.3.4)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.1.3.2)
actionpack (= 7.1.3.2)
actionview (= 7.1.3.2)
activejob (= 7.1.3.2)
activesupport (= 7.1.3.2)
actionmailer (7.1.3.4)
actionpack (= 7.1.3.4)
actionview (= 7.1.3.4)
activejob (= 7.1.3.4)
activesupport (= 7.1.3.4)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.2)
actionpack (7.1.3.2)
actionview (= 7.1.3.2)
activesupport (= 7.1.3.2)
actionpack (7.1.3.4)
actionview (= 7.1.3.4)
activesupport (= 7.1.3.4)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
@ -37,35 +37,35 @@ GEM
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
actiontext (7.1.3.2)
actionpack (= 7.1.3.2)
activerecord (= 7.1.3.2)
activestorage (= 7.1.3.2)
activesupport (= 7.1.3.2)
actiontext (7.1.3.4)
actionpack (= 7.1.3.4)
activerecord (= 7.1.3.4)
activestorage (= 7.1.3.4)
activesupport (= 7.1.3.4)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.1.3.2)
activesupport (= 7.1.3.2)
actionview (7.1.3.4)
activesupport (= 7.1.3.4)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activejob (7.1.3.2)
activesupport (= 7.1.3.2)
activejob (7.1.3.4)
activesupport (= 7.1.3.4)
globalid (>= 0.3.6)
activemodel (7.1.3.2)
activesupport (= 7.1.3.2)
activerecord (7.1.3.2)
activemodel (= 7.1.3.2)
activesupport (= 7.1.3.2)
activemodel (7.1.3.4)
activesupport (= 7.1.3.4)
activerecord (7.1.3.4)
activemodel (= 7.1.3.4)
activesupport (= 7.1.3.4)
timeout (>= 0.4.0)
activestorage (7.1.3.2)
actionpack (= 7.1.3.2)
activejob (= 7.1.3.2)
activerecord (= 7.1.3.2)
activesupport (= 7.1.3.2)
activestorage (7.1.3.4)
actionpack (= 7.1.3.4)
activejob (= 7.1.3.4)
activerecord (= 7.1.3.4)
activesupport (= 7.1.3.4)
marcel (~> 1.0)
activesupport (7.1.3.2)
activesupport (7.1.3.4)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
@ -81,8 +81,8 @@ GEM
bigdecimal (3.1.8)
bootsnap (1.18.3)
msgpack (~> 1.2)
builder (3.2.4)
concurrent-ruby (1.2.3)
builder (3.3.0)
concurrent-ruby (1.3.3)
connection_pool (2.4.1)
crass (1.0.6)
date (3.3.4)
@ -95,8 +95,8 @@ GEM
railties (>= 6.1)
drb (2.2.1)
error_highlight (0.6.0)
erubi (1.12.0)
ffi (1.16.3)
erubi (1.13.0)
ffi (1.17.0)
globalid (1.2.1)
activesupport (>= 6.1)
htmlbeautifier (1.4.3)
@ -107,7 +107,7 @@ GEM
activesupport (>= 6.0.0)
railties (>= 6.0.0)
io-console (0.7.2)
irb (1.13.1)
irb (1.13.2)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.7.2)
@ -115,6 +115,7 @@ GEM
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.6.0)
loofah (2.22.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
@ -125,10 +126,10 @@ GEM
net-smtp
marcel (1.0.4)
mini_mime (1.1.5)
minitest (5.22.3)
minitest (5.23.1)
msgpack (1.7.2)
mutex_m (0.2.0)
net-imap (0.4.10)
net-imap (0.4.13)
date
net-protocol
net-pop (0.1.2)
@ -137,32 +138,32 @@ GEM
timeout
net-smtp (0.5.0)
net-protocol
nio4r (2.7.1)
nokogiri (1.16.4-aarch64-linux)
nio4r (2.7.3)
nokogiri (1.16.6-aarch64-linux)
racc (~> 1.4)
nokogiri (1.16.4-arm-linux)
nokogiri (1.16.6-arm-linux)
racc (~> 1.4)
nokogiri (1.16.4-arm64-darwin)
nokogiri (1.16.6-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.4-x86-linux)
nokogiri (1.16.6-x86-linux)
racc (~> 1.4)
nokogiri (1.16.4-x86_64-darwin)
nokogiri (1.16.6-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.4-x86_64-linux)
nokogiri (1.16.6-x86_64-linux)
racc (~> 1.4)
pagy (8.4.0)
parallel (1.24.0)
parser (3.3.1.0)
pagy (8.4.4)
parallel (1.25.1)
parser (3.3.3.0)
ast (~> 2.4.1)
racc
pg (1.5.6)
prism (0.27.0)
prism (0.30.0)
psych (5.1.2)
stringio
puma (6.4.2)
nio4r (~> 2.0)
racc (1.7.3)
rack (3.0.10)
racc (1.8.0)
rack (3.1.3)
rack-session (2.0.0)
rack (>= 3.0.0)
rack-test (2.1.0)
@ -170,20 +171,20 @@ GEM
rackup (2.1.0)
rack (>= 3)
webrick (~> 1.8)
rails (7.1.3.2)
actioncable (= 7.1.3.2)
actionmailbox (= 7.1.3.2)
actionmailer (= 7.1.3.2)
actionpack (= 7.1.3.2)
actiontext (= 7.1.3.2)
actionview (= 7.1.3.2)
activejob (= 7.1.3.2)
activemodel (= 7.1.3.2)
activerecord (= 7.1.3.2)
activestorage (= 7.1.3.2)
activesupport (= 7.1.3.2)
rails (7.1.3.4)
actioncable (= 7.1.3.4)
actionmailbox (= 7.1.3.4)
actionmailer (= 7.1.3.4)
actionpack (= 7.1.3.4)
actiontext (= 7.1.3.4)
actionview (= 7.1.3.4)
activejob (= 7.1.3.4)
activemodel (= 7.1.3.4)
activerecord (= 7.1.3.4)
activestorage (= 7.1.3.4)
activesupport (= 7.1.3.4)
bundler (>= 1.15.0)
railties (= 7.1.3.2)
railties (= 7.1.3.4)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
@ -200,9 +201,9 @@ GEM
rack
railties (>= 5.1)
semantic_logger (~> 4.13)
railties (7.1.3.2)
actionpack (= 7.1.3.2)
activesupport (= 7.1.3.2)
railties (7.1.3.4)
actionpack (= 7.1.3.4)
activesupport (= 7.1.3.4)
irb
rackup (>= 1.0.0)
rake (>= 12.2)
@ -211,15 +212,18 @@ GEM
rainbow (3.1.1)
rake (13.2.1)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
rb-inotify (0.11.1)
ffi (~> 1.0)
rdoc (6.6.3.1)
rbs (3.5.1)
logger
rdoc (6.7.0)
psych (>= 4.0.0)
regexp_parser (2.9.0)
reline (0.5.5)
regexp_parser (2.9.2)
reline (0.5.9)
io-console (~> 0.5)
rexml (3.2.6)
rubocop (1.63.4)
rexml (3.3.0)
strscan
rubocop (1.64.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
@ -232,58 +236,50 @@ GEM
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.3)
parser (>= 3.3.1.0)
rubocop-capybara (2.20.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.25.1)
rubocop (~> 1.41)
rubocop-packaging (0.5.2)
rubocop (>= 1.33, < 2.0)
rubocop-performance (1.21.0)
rubocop-performance (1.21.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (2.29.2)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
rubocop-rspec_rails (~> 2.28)
rubocop-rspec_rails (2.28.3)
rubocop (~> 1.40)
rubocop-rspec (3.0.1)
rubocop (~> 1.61)
rubocop-shopify (2.15.1)
rubocop (~> 1.51)
rubocop-thread_safety (0.5.1)
rubocop (>= 0.90.0)
ruby-lsp (0.16.6)
ruby-lsp (0.17.3)
language_server-protocol (~> 3.17.0)
prism (>= 0.23.0, < 0.28)
prism (>= 0.29.0, < 0.31)
rbs (>= 3, < 4)
sorbet-runtime (>= 0.5.10782)
ruby-lsp-rails (0.3.6)
ruby-lsp (>= 0.16.5, < 0.17.0)
sorbet-runtime (>= 0.5.9897)
ruby-lsp-rails (0.3.7)
ruby-lsp (>= 0.17.0, < 0.18.0)
ruby-progressbar (1.13.0)
semantic_logger (4.15.0)
concurrent-ruby (~> 1.0)
sorbet-runtime (0.5.11369)
sorbet-runtime (0.5.11435)
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
sprockets-rails (3.4.2)
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets-rails (3.5.1)
actionpack (>= 6.1)
activesupport (>= 6.1)
sprockets (>= 3.0.0)
stimulus-rails (1.3.3)
railties (>= 6.0.0)
stringio (3.1.0)
tailwindcss-rails (2.6.0)
stringio (3.1.1)
strscan (3.1.0)
tailwindcss-rails (2.6.1)
railties (>= 7.0.0)
tailwindcss-rails (2.6.0-aarch64-linux)
tailwindcss-rails (2.6.1-aarch64-linux)
railties (>= 7.0.0)
tailwindcss-rails (2.6.0-arm-linux)
tailwindcss-rails (2.6.1-arm-linux)
railties (>= 7.0.0)
tailwindcss-rails (2.6.0-arm64-darwin)
tailwindcss-rails (2.6.1-arm64-darwin)
railties (>= 7.0.0)
tailwindcss-rails (2.6.0-x86_64-darwin)
tailwindcss-rails (2.6.1-x86_64-darwin)
railties (>= 7.0.0)
tailwindcss-rails (2.6.0-x86_64-linux)
tailwindcss-rails (2.6.1-x86_64-linux)
railties (>= 7.0.0)
thor (1.3.1)
timeout (0.4.1)
@ -298,7 +294,7 @@ GEM
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
zeitwerk (2.6.13)
zeitwerk (2.6.16)
PLATFORMS
aarch64-linux

28
app/views/scores/_score.html.erb

@ -1,17 +1,19 @@
<div id="<%= dom_id score %>">
<p class="my-5">
<strong class="block font-medium mb-1">Name:</strong>
<tr id="<%= dom_id score %>">
<td class="my-5">
<%= score.name %>
</p>
</td>
<p class="my-5">
<strong class="block font-medium mb-1">Grade:</strong>
<td class="my-5">
<%= score.grade %>
</p>
</td>
<% if action_name != "show" %>
<%= link_to "Show this score", score, class: "rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
<%= link_to "Edit this score", edit_score_path(score), class: "rounded-lg py-3 ml-2 px-5 bg-gray-100 inline-block font-medium" %>
<hr class="mt-6">
<% end %>
</div>
<td>
<% if action_name != "show" %>
<%= link_to "Show this score", score, class: "rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
<%= link_to "Edit this score", edit_score_path(score), class: "rounded-lg py-3 ml-2 px-5 bg-gray-100 inline-block font-medium" %>
<%= link_to "Edit this score", edit_score_path(score), class: "rounded-lg py-3 ml-2 px-5 bg-gray-100 inline-block font-medium" %>
<%= button_to "Destroy this score", score_path(score), method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium" %>
<hr class="mt-6">
<% end %>
</td>
</tr>

11
app/views/scores/index.html.erb

@ -5,9 +5,16 @@
<%= link_to "New score", new_score_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %>
</div>
<div id="scores" class="min-w-full ">
<table class="min-w-full divide-y divide-gray-300">
<thead>
<tr>
<th>Name</th>
<th>Grade</th>
<th>Actions</th>
</tr>
</thead>
<%= render @scores %>
</div>
</table>
<%== pagy_nav(@pagy) %>
</div>

2
lib/formatters/ansi_dimensions.rb

@ -1,3 +1,5 @@
require 'ostruct'
# extra dimensions to customize ansi_loggingg
module AnsiDimensions
def self.new(rails: '╣x╠', before: 0, after: 0, terminus: false)

Loading…
Cancel
Save