|
|
@ -55,6 +55,18 @@ module RankKing
|
|
|
|
</tr>
|
|
|
|
</tr>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</table>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
|
|
|
|
<% @game.each do |item| %>
|
|
|
|
|
|
|
|
<li><%= item.title %></li>
|
|
|
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<form method="post" action="/pools/<%= @pool.id %>/axes/<%= @axis.id %>/rank">
|
|
|
|
|
|
|
|
<% @game.each.with_index do |item, i| %>
|
|
|
|
|
|
|
|
<label><input type="radio" name="winner" value="<%= item.id %>"><%= item.title %></label>
|
|
|
|
|
|
|
|
<input type="hidden" name="item_<%= i %>" value="<%= item.id %>">
|
|
|
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<input type="submit">
|
|
|
|
|
|
|
|
</form>
|
|
|
|
ERB
|
|
|
|
ERB
|
|
|
|
|
|
|
|
|
|
|
|
route do |r|
|
|
|
|
route do |r|
|
|
|
@ -76,9 +88,20 @@ module RankKing
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
r.on "axes" do
|
|
|
|
r.on "axes" do
|
|
|
|
r.is Integer do |id|
|
|
|
|
r.on Integer do |id|
|
|
|
|
@axis = Axis[id]
|
|
|
|
@axis = Axis[id]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
r.is "rank" do
|
|
|
|
|
|
|
|
items = r.params.values_at("item_0", "item_1").map { Item[_1] }
|
|
|
|
|
|
|
|
winner, loser = items.partition { _1.id == r.params.fetch("winner").to_i }.flatten
|
|
|
|
|
|
|
|
RankKing.rank(@axis, winner:, loser:)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
r.redirect "/pools/#{@pool.id}/axes/#{@axis.id}"
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
r.is do
|
|
|
|
|
|
|
|
@game = RankKing.suggest_game(@axis).shuffle
|
|
|
|
|
|
|
|
|
|
|
|
view :axis
|
|
|
|
view :axis
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -87,3 +110,4 @@ module RankKing
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|