From 53c9df5feb8ad4ebef8f40840d29255a81edb6df Mon Sep 17 00:00:00 2001 From: David Gay Date: Tue, 15 Jun 2021 19:13:55 -0400 Subject: Reboot omens and allow infixing items (like omens) into skills --- app/views/characters/items/index.html.erb | 4 ++ app/views/characters/skills/_infix_slot.html.erb | 3 ++ app/views/characters/skills/index.html.erb | 59 ++++++++++++++++++------ 3 files changed, 53 insertions(+), 13 deletions(-) create mode 100644 app/views/characters/skills/_infix_slot.html.erb (limited to 'app/views') diff --git a/app/views/characters/items/index.html.erb b/app/views/characters/items/index.html.erb index 671e68f..57e8531 100644 --- a/app/views/characters/items/index.html.erb +++ b/app/views/characters/items/index.html.erb @@ -35,6 +35,10 @@ character_items: @character.character_items.ordered_by_item_name.select { |ci| ci.item.has_tag?("currency") } %> +<%= render "characters/items/inventory_section", heading: "Omens", + character_items: @character.character_items.ordered_by_item_name.select { |ci| + ci.item.has_tag?("omen") } %> + <%= render "characters/items/inventory_section", heading: "Seeds", character_items: @character.character_items.ordered_by_item_name.select { |ci| ci.item.has_tag?("seed") } %> diff --git a/app/views/characters/skills/_infix_slot.html.erb b/app/views/characters/skills/_infix_slot.html.erb new file mode 100644 index 0000000..0113596 --- /dev/null +++ b/app/views/characters/skills/_infix_slot.html.erb @@ -0,0 +1,3 @@ +
+ <%= yield %> +
diff --git a/app/views/characters/skills/index.html.erb b/app/views/characters/skills/index.html.erb index fd53870..f79b06e 100644 --- a/app/views/characters/skills/index.html.erb +++ b/app/views/characters/skills/index.html.erb @@ -1,23 +1,56 @@

Skills

<% @character.character_skills.ordered_by_skill_name.each do |cs| %> -
-
-
-
- <%= cs.skill.name %> +
+
+
+
+
+ <%= cs.skill.name %> +
+
+ XP<%= cs.xp %> +
-
- XP<%= cs.xp %> +
+ <%= cs.level %>
-
- <%= cs.level %> -
-
-
-
+
+
+
+ <% @character.item_infixes.where(skill: cs.skill).each do |ii| %> + <%= render "characters/skills/infix_slot" do %> +
+ <%= ii.item.name %> +
+
+ <%= button_to "Remove", character_item_infix_path(id: ii.id), method: :delete %> +
+ <% 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| %> +
+
+ <%= f.select :item_id, infixable_items.map { |i| [i.name, i.id]}, {}, class: "w-full" %> + <%= f.hidden_field :skill_id, value: cs.skill.id %> +
+
+ <%= f.submit "Infix" %> +
+
+ <% end %> + <% else %> +
No items to infix.
+ <% end %> + <% end %> + <% end %>
<% end %> -- cgit v1.2.3