blob: af40e38fc7b38a06a1bcf0d718c2184286c75ead (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
<h2 class="text-3xl mb-2">Skills</h2>
<div class="grid gap-4 grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4">
<% @character.character_skills.ordered_by_skill_name.each do |cs| %>
<div>
<div class="rounded border border-gray-700">
<div class="flex p-1">
<div class="flex-grow">
<div class="text-xl text-display mb-1">
<%= cs.skill.name %>
</div>
<div class="flex items-center text-xs space-x-4">
<div><span class="bg-gray-700 px-1 py-0.5 rounded mr-1">XP</span><%= cs.xp %></div>
<div><span class="bg-gray-700 px-1 py-0.5 rounded mr-1">TNL</span><%= cs.xp_to_next_level %></div>
</div>
</div>
<div class="text-xl m-2 text-display">
<%= cs.level %>
</div>
</div>
<div class="border border-gray-700 h-2 mt-1 -mb-px -mx-px">
<div class="bg-gray-600 h-full" style="width: <%= cs.percentage_of_skill_level_completed %>%">
</div>
</div>
<% @character.item_infixes.where(skill: cs.skill).each do |ii| %>
<%= render "characters/skills/infix_slot" do %>
<div>
<%= ii.item.name %>
</div>
<div>
<%= button_to "Remove", character_item_infix_path(id: ii.id), method: :delete %>
</div>
<% end %>
<% end %>
<% @character.available_infixes(cs.skill).times do %>
<%= render "characters/skills/infix_slot" do %>
<%# TODO: Don't load all into memory %>
<% infixable_items = @character.items.select {|i| i.infixable?(cs.skill)} %>
<% if infixable_items.any? %>
<%= form_with url: character_item_infixes_path, class: "w-full" do |f| %>
<div class="flex space-x-1">
<div class="flex-grow">
<%= f.select :item_id, infixable_items.map { |i| [i.name, i.id]}, {}, class: "w-full" %>
<%= f.hidden_field :skill_id, value: cs.skill.id %>
</div>
<div>
<%= f.submit "Infix" %>
</div>
</div>
<% end %>
<% else %>
<div class="text-gray-500">No omens to infix.</div>
<% end %>
<% end %>
<% end %>
</div>
</div>
<% end %>
</div>
|