Worlds Bets
This commit is contained in:
83
app/views/worlds/about.html.slim
Normal file
83
app/views/worlds/about.html.slim
Normal file
@@ -0,0 +1,83 @@
|
||||
= render "worlds_nav"
|
||||
|
||||
.alert.alert-warning role="alert"
|
||||
= t("worlds.about.one_bet_message")
|
||||
|
||||
.alert.alert-primary role="alert"
|
||||
= t("worlds.about.details_message")
|
||||
.mt-3
|
||||
= t("worlds.about.two_rankings_message")
|
||||
.mt-3
|
||||
= t("worlds.about.collaborative_filling_message")
|
||||
|
||||
.row.mt-4
|
||||
.col
|
||||
table.table.table-striped.table-hover
|
||||
thead
|
||||
tr
|
||||
th = t("worlds.about.ranking")
|
||||
th = t("worlds.about.qualifier_round")
|
||||
th = t("worlds.about.semifinal_round")
|
||||
th = t("worlds.about.finals_round")
|
||||
tbody
|
||||
- (1..10).each do |i|
|
||||
tr
|
||||
td #{i}
|
||||
td #{WorldBet.points(i)}
|
||||
td #{WorldBet.points(i) * 2}
|
||||
td #{WorldBet.points(i) * 4}
|
||||
tr
|
||||
td 11-20
|
||||
td #{WorldBet.points(20)}
|
||||
td #{WorldBet.points(20) * 2}
|
||||
td #{WorldBet.points(20) * 4}
|
||||
tr
|
||||
td 21-30
|
||||
td #{WorldBet.points(30)}
|
||||
td #{WorldBet.points(30) * 2}
|
||||
td #{WorldBet.points(30) * 4}
|
||||
tr
|
||||
td 31-40
|
||||
td #{WorldBet.points(40)}
|
||||
td #{WorldBet.points(40) * 2}
|
||||
td #{WorldBet.points(40) * 4}
|
||||
tr
|
||||
td 41-50
|
||||
td #{WorldBet.points(50)}
|
||||
td #{WorldBet.points(50) * 2}
|
||||
td #{WorldBet.points(50) * 4}
|
||||
tr
|
||||
td 51-60
|
||||
td #{WorldBet.points(60)}
|
||||
td #{WorldBet.points(60) * 2}
|
||||
td #{WorldBet.points(60) * 4}
|
||||
tr
|
||||
td 61-70
|
||||
td #{WorldBet.points(70)}
|
||||
td #{WorldBet.points(70) * 2}
|
||||
td #{WorldBet.points(70) * 4}
|
||||
tr
|
||||
td 71-80
|
||||
td #{WorldBet.points(80)}
|
||||
td #{WorldBet.points(80) * 2}
|
||||
td #{WorldBet.points(80) * 4}
|
||||
tr
|
||||
td 81-90
|
||||
td #{WorldBet.points(90)}
|
||||
td #{WorldBet.points(90) * 2}
|
||||
td #{WorldBet.points(90) * 4}
|
||||
tr
|
||||
td 91-100
|
||||
td #{WorldBet.points(100)}
|
||||
td #{WorldBet.points(100) * 2}
|
||||
td #{WorldBet.points(100) * 4}
|
||||
tr
|
||||
td 101-150
|
||||
td #{WorldBet.points(150)}
|
||||
td #{WorldBet.points(150) * 2}
|
||||
td #{WorldBet.points(150) * 4}
|
||||
tr
|
||||
td 151+
|
||||
td #{WorldBet.points(151)}
|
||||
td #{WorldBet.points(151) * 2}
|
||||
td #{WorldBet.points(151) * 4}
|
||||
131
app/views/worlds/collab.html.slim
Normal file
131
app/views/worlds/collab.html.slim
Normal file
@@ -0,0 +1,131 @@
|
||||
= render "worlds_nav"
|
||||
|
||||
.alert.alert-primary role="alert"
|
||||
= t("worlds.collab.details_message")
|
||||
.mt-3
|
||||
= t("worlds.collab.error_message")
|
||||
|
||||
.alert.alert-warning role="alert"
|
||||
= t("worlds.collab.rank_message")
|
||||
|
||||
h4.mt-4 Round A
|
||||
|
||||
- @participants.each do |p|
|
||||
- if p.round == 'a'
|
||||
.row.mt-3
|
||||
.col
|
||||
= form_with model: WorldParticipant, url: "/wjpc_bets/update/#{p.id}", method: :patch do |form|
|
||||
.input-group
|
||||
.input-group-text style="width: 350px;" #{Flags.get_flag(p.world_country.code) + " " + p.name}
|
||||
.input-group-text = t("worlds.main.rank")
|
||||
= form.text_field :qualifier_result, value: p.qualifier_result, autocomplete: "off", class: "form-control", style: "color: orange; max-width: 60px;"
|
||||
.input-group-text = t("worlds.main.points")
|
||||
.input-group-text style="color: green; width: 60px;" #{WorldBet.points(p.qualifier_result)}
|
||||
= form.submit t("helpers.buttons.validate"), class: "btn btn-primary", onclick: "updateScrollPos()"
|
||||
|
||||
javascript:
|
||||
function updateScrollPos() {
|
||||
wsy = window.scrollY;
|
||||
setTimeout(() => window.scrollTo(0, wsy), 25);
|
||||
setTimeout(() => window.scrollTo(0, wsy), 50);
|
||||
setTimeout(() => window.scrollTo(0, wsy), 75);
|
||||
setTimeout(() => window.scrollTo(0, wsy), 100);
|
||||
setTimeout(() => window.scrollTo(0, wsy), 125);
|
||||
setTimeout(() => window.scrollTo(0, wsy), 150);
|
||||
setTimeout(() => window.scrollTo(0, wsy), 175);
|
||||
setTimeout(() => window.scrollTo(0, wsy), 200);
|
||||
setTimeout(() => window.scrollTo(0, wsy), 225);
|
||||
setTimeout(() => window.scrollTo(0, wsy), 250);
|
||||
}
|
||||
|
||||
|
||||
h4.mt-5 Round B
|
||||
|
||||
- @participants.each do |p|
|
||||
- if p.round == 'b'
|
||||
.row.mt-3
|
||||
.col
|
||||
= form_with model: WorldParticipant, url: "/wjpc_bets/update/#{p.id}", method: :patch do |form|
|
||||
.input-group
|
||||
.input-group-text style="width: 350px;" #{Flags.get_flag(p.world_country.code) + " " + p.name}
|
||||
.input-group-text = t("worlds.main.rank")
|
||||
= form.text_field :qualifier_result, value: p.qualifier_result, autocomplete: "off", class: "form-control", style: "color: orange; max-width: 60px;"
|
||||
.input-group-text = t("worlds.main.points")
|
||||
.input-group-text style="color: green; width: 60px;" #{WorldBet.points(p.qualifier_result)}
|
||||
= form.submit t("helpers.buttons.validate"), class: "btn btn-primary", onclick: "updateScrollPos()"
|
||||
|
||||
h4.mt-5 Round C
|
||||
|
||||
- @participants.each do |p|
|
||||
- if p.round == 'c'
|
||||
.row.mt-3
|
||||
.col
|
||||
= form_with model: WorldParticipant, url: "/wjpc_bets/update/#{p.id}", method: :patch do |form|
|
||||
.input-group
|
||||
.input-group-text style="width: 350px;" #{Flags.get_flag(p.world_country.code) + " " + p.name}
|
||||
.input-group-text = t("worlds.main.rank")
|
||||
= form.text_field :qualifier_result, value: p.qualifier_result, autocomplete: "off", class: "form-control", style: "color: orange; max-width: 60px;"
|
||||
.input-group-text = t("worlds.main.points")
|
||||
.input-group-text style="color: green; width: 60px;" #{WorldBet.points(p.qualifier_result)}
|
||||
= form.submit t("helpers.buttons.validate"), class: "btn btn-primary", onclick: "updateScrollPos()"
|
||||
|
||||
h4.mt-5 Round D
|
||||
|
||||
- @participants.each do |p|
|
||||
- if p.round == 'd'
|
||||
.row.mt-3
|
||||
.col
|
||||
= form_with model: WorldParticipant, url: "/wjpc_bets/update/#{p.id}", method: :patch do |form|
|
||||
.input-group
|
||||
.input-group-text style="width: 350px;" #{Flags.get_flag(p.world_country.code) + " " + p.name}
|
||||
.input-group-text = t("worlds.main.rank")
|
||||
= form.text_field :qualifier_result, value: p.qualifier_result, autocomplete: "off", class: "form-control", style: "color: orange; max-width: 60px;"
|
||||
.input-group-text = t("worlds.main.points")
|
||||
.input-group-text style="color: green; width: 60px;" #{WorldBet.points(p.qualifier_result)}
|
||||
= form.submit t("helpers.buttons.validate"), class: "btn btn-primary", onclick: "updateScrollPos()"
|
||||
|
||||
h4.mt-5 = "#{t("worlds.collab.semifinal")} 1"
|
||||
|
||||
- @participants.each do |p|
|
||||
- if p.round == 'a' || p.round == 'b'
|
||||
.row.mt-3
|
||||
.col
|
||||
= form_with model: WorldParticipant, url: "/wjpc_bets/update/#{p.id}", method: :patch do |form|
|
||||
.input-group
|
||||
.input-group-text style="width: 350px;" #{Flags.get_flag(p.world_country.code) + " " + p.name}
|
||||
.input-group-text = t("worlds.main.rank")
|
||||
= form.text_field :semifinal_result, value: p.semifinal_result, autocomplete: "off", class: "form-control", style: "color: orange; max-width: 60px;"
|
||||
.input-group-text = t("worlds.main.points")
|
||||
.input-group-text style="color: green; width: 60px;" #{WorldBet.points(p.semifinal_result) * 2}
|
||||
= form.submit t("helpers.buttons.validate"), class: "btn btn-primary", onclick: "updateScrollPos()"
|
||||
|
||||
h4.mt-5 = "#{t("worlds.collab.semifinal")} 2"
|
||||
|
||||
- @participants.each do |p|
|
||||
- if p.round == 'c' || p.round == 'd'
|
||||
.row.mt-3
|
||||
.col
|
||||
= form_with model: WorldParticipant, url: "/wjpc_bets/update/#{p.id}", method: :patch do |form|
|
||||
.input-group
|
||||
.input-group-text style="width: 350px;" #{Flags.get_flag(p.world_country.code) + " " + p.name}
|
||||
.input-group-text = t("worlds.main.rank")
|
||||
= form.text_field :semifinal_result, value: p.semifinal_result, autocomplete: "off", class: "form-control", style: "color: orange; max-width: 60px;"
|
||||
.input-group-text = t("worlds.main.points")
|
||||
.input-group-text style="color: green; width: 60px;" #{WorldBet.points(p.semifinal_result) * 2}
|
||||
= form.submit t("helpers.buttons.validate"), class: "btn btn-primary", onclick: "updateScrollPos()"
|
||||
|
||||
h4.mt-5 = "#{t("worlds.collab.final")}"
|
||||
|
||||
- @participants.each do |p|
|
||||
.row.mt-3
|
||||
.col
|
||||
= form_with model: WorldParticipant, url: "/wjpc_bets/update/#{p.id}", method: :patch do |form|
|
||||
.input-group
|
||||
.input-group-text style="width: 350px;" #{Flags.get_flag(p.world_country.code) + " " + p.name}
|
||||
.input-group-text = t("worlds.main.rank")
|
||||
= form.text_field :final_result, value: p.final_result, autocomplete: "off", class: "form-control", style: "color: orange; max-width: 60px;"
|
||||
.input-group-text = t("worlds.main.points")
|
||||
.input-group-text style="color: green; width: 60px;" #{WorldBet.points(p.final_result) * 4}
|
||||
= form.submit t("helpers.buttons.validate"), class: "btn btn-primary", onclick: "updateScrollPos()"
|
||||
|
||||
.mb-5
|
||||
52
app/views/worlds/main.html.slim
Normal file
52
app/views/worlds/main.html.slim
Normal file
@@ -0,0 +1,52 @@
|
||||
= render "worlds_nav"
|
||||
|
||||
.row.mt-3
|
||||
.col-6
|
||||
h4 = t("worlds.main.world_participants")
|
||||
table.table.table-striped.table-hover
|
||||
thead
|
||||
tr
|
||||
th = t("worlds.main.rank")
|
||||
th = t("worlds.main.name")
|
||||
th = t("worlds.main.score")
|
||||
tbody
|
||||
- @world_bets_w.each_with_index do |b, i|
|
||||
tr
|
||||
- if i == 0
|
||||
td 🥇
|
||||
- elsif i == 1
|
||||
td 🥈
|
||||
- elsif i == 2
|
||||
td 🥉
|
||||
- else
|
||||
td #{i + 1}
|
||||
td #{b.name}
|
||||
td #{b.world_score}
|
||||
td
|
||||
a.btn.btn-sm.btn-secondary href="/wjpc_bets/view/#{b.id}"
|
||||
= t("worlds.main.view_bet")
|
||||
|
||||
.col-6
|
||||
h4 = t("worlds.main.french_participants")
|
||||
table.table.table-striped.table-hover
|
||||
thead
|
||||
tr
|
||||
th = t("worlds.main.rank")
|
||||
th = t("worlds.main.name")
|
||||
th = t("worlds.main.score")
|
||||
tbody
|
||||
- @world_bets_f.each_with_index do |b, i|
|
||||
tr
|
||||
- if i == 0
|
||||
td 🥇
|
||||
- elsif i == 1
|
||||
td 🥈
|
||||
- elsif i == 2
|
||||
td 🥉
|
||||
- else
|
||||
td #{i + 1}
|
||||
td #{b.name}
|
||||
td #{b.french_score}
|
||||
td
|
||||
a.btn.btn-sm.btn-secondary href="/wjpc_bets/view/#{b.id}"
|
||||
= t("worlds.main.view_bet")
|
||||
45
app/views/worlds/new.html.slim
Normal file
45
app/views/worlds/new.html.slim
Normal file
@@ -0,0 +1,45 @@
|
||||
= render "worlds_nav"
|
||||
|
||||
= form_with model: @world_bet, url: "/wjpc_bets/new", method: :post do |form|
|
||||
.alert.alert-primary role="alert"
|
||||
= t("worlds.new.message")
|
||||
|
||||
.row.mt-4
|
||||
.col
|
||||
.form-floating
|
||||
= form.text_field :name, autocomplete: "off", class: "form-control"
|
||||
= form.label :name, class: "required"
|
||||
|
||||
.row.mt-4
|
||||
.col
|
||||
h4 = t("worlds.new.world_section")
|
||||
|
||||
- (1..10).each do |i|
|
||||
.row.mt-3
|
||||
.col
|
||||
.input-group
|
||||
.input-group-text ##{i} <i class="ms-2" style="color: cadetblue;">(x#{WorldBet.multiplier(i - 1)})</i>
|
||||
= form.select "w_bet_#{i}", @world_participants.map { |p| [Flags.get_flag(p.world_country.code) + " " + p.name, p.id] }, {}, class: "form-select"
|
||||
|
||||
.row.mt-4
|
||||
.col
|
||||
h4 = t("worlds.new.french_section")
|
||||
|
||||
- (1..10).each do |i|
|
||||
.row.mt-3
|
||||
.col
|
||||
.input-group
|
||||
.input-group-text ##{i} <i class="ms-2" style="color: cadetblue;">(x#{WorldBet.multiplier(i - 1)})</i>
|
||||
= form.select "f_bet_#{i}", @french_participants.map { |p| [Flags.get_flag(p.world_country.code) + " " + p.name, p.id] }, {}, class: "form-select"
|
||||
|
||||
- if @w_array && @f_array
|
||||
- (1..10).each do |i|
|
||||
javascript:
|
||||
el = document.querySelector('select[name="world_bet[w_bet_#{i}]"]');
|
||||
el.value = "#{@w_array[i - 1]}"
|
||||
el = document.querySelector('select[name="world_bet[f_bet_#{i}]"]');
|
||||
el.value = "#{@f_array[i - 1]}"
|
||||
|
||||
.row.mt-4.mb-5
|
||||
.col
|
||||
= form.submit t("helpers.buttons.validate"), class: "btn btn-primary"
|
||||
49
app/views/worlds/view.html.slim
Normal file
49
app/views/worlds/view.html.slim
Normal file
@@ -0,0 +1,49 @@
|
||||
= render "worlds_nav"
|
||||
|
||||
h4.mt-3 = t("worlds.view.subtitle", name: @world_bet.name).html_safe
|
||||
|
||||
.row.mt-3
|
||||
.col
|
||||
h5 = t("worlds.view.world_participants")
|
||||
table.table.table-striped.table-hover
|
||||
thead
|
||||
tr
|
||||
th = t("worlds.view.participant")
|
||||
th = t("worlds.view.multiplier")
|
||||
th Q
|
||||
th S
|
||||
th F
|
||||
th = t("worlds.view.total")
|
||||
tbody
|
||||
- @world_participants.each_with_index do |p, i|
|
||||
tr
|
||||
td = Flags.get_flag(p.world_country.code) + " " + p.name
|
||||
td style="color: cadetblue;"
|
||||
= "x#{WorldBet.multiplier(i)}"
|
||||
td = "<span style='color: orange'>#{p.qualifier_result || "?"}</span> > <span style='color: green'>#{WorldBet.points(p.qualifier_result)}p</span>".html_safe
|
||||
td = "<span style='color: orange'>#{p.semifinal_result || "?"}</span> > <span style='color: green'>#{WorldBet.points(p.semifinal_result) * 2}p</span>".html_safe
|
||||
td = "<span style='color: orange'>#{p.final_result || "?"}</span> > <span style='color: green'>#{WorldBet.points(p.final_result) * 4}p</span>".html_safe
|
||||
td = "<span style='color: green'>#{p.score || 0}</span> x <span style='color: cadetblue'>#{WorldBet.multiplier(i)}</span> = <span style='color: green'>#{(p.score || 0) * WorldBet.multiplier(i)}p</span>".html_safe
|
||||
|
||||
.row.mt-3
|
||||
.col
|
||||
h5 = t("worlds.view.french_participants")
|
||||
table.table.table-striped.table-hover
|
||||
thead
|
||||
tr
|
||||
th = t("worlds.view.participant")
|
||||
th = t("worlds.view.multiplier")
|
||||
th Q
|
||||
th S
|
||||
th F
|
||||
th = t("worlds.view.total")
|
||||
tbody
|
||||
- @french_participants.each_with_index do |p, i|
|
||||
tr
|
||||
td = Flags.get_flag(p.world_country.code) + " " + p.name
|
||||
td style="color: cadetblue;"
|
||||
= "x#{WorldBet.multiplier(i)}"
|
||||
td = "<span style='color: orange'>#{p.qualifier_result || "?"}</span> > <span style='color: green'>#{WorldBet.points(p.qualifier_result)}p</span>".html_safe
|
||||
td = "<span style='color: orange'>#{p.semifinal_result || "?"}</span> > <span style='color: green'>#{WorldBet.points(p.semifinal_result) * 2}p</span>".html_safe
|
||||
td = "<span style='color: orange'>#{p.final_result || "?"}</span> > <span style='color: green'>#{WorldBet.points(p.final_result) * 4}p</span>".html_safe
|
||||
td = "<span style='color: green'>#{p.score || 0}</span> x <span style='color: cadetblue'>#{WorldBet.multiplier(i)}</span> = <span style='color: green'>#{(p.score || 0) * WorldBet.multiplier(i)}p</span>".html_safe
|
||||
Reference in New Issue
Block a user