tabletop-companion/app/views/stats/show.html.erb

39 lines
2.0 KiB
Plaintext
Raw Permalink Normal View History

2024-06-21 08:09:19 +00:00
<%= turbo_frame_tag :modal do %>
<div class="feature-box stat">
2024-06-27 13:03:56 +00:00
<div class="feature-box-icons">
<%= icon_link_to "fa-close", table_character_character_sheet_sections_path(@stat.character.table, @stat.character),
class: "icon-link" %>
<%= icon_link_to "fa-edit", edit_stat_path(@stat), class: "icon-link" %>
</div>
2024-06-21 08:09:19 +00:00
<h2><%= @stat.name %></h2>
<%= form_with model: @stat, class: "stat-form", data: { controller: "auto-update" } do |f| %>
2024-06-21 11:46:12 +00:00
<%= f.number_field :value, min: @stat.min_allowed, max: @stat.max_allowed %>
<div class="inline">
<%= f.label :min_allowed, t(".min_allowed") %>
<%= f.number_field :min_allowed %>
<%= f.label :max_allowed, t(".max_allowed") %>
<%= f.number_field :max_allowed %>
</div>
2024-06-21 08:09:19 +00:00
<% end %>
2024-06-21 11:46:12 +00:00
<% if @stat.rollable? %>
<%= form_with model: DiceRoll.new, url: table_dice_rolls_path(@stat.character.table), class: "stat-form",
data: { controller: "dice-roll modal-closer", action: "modal-closer#closeModal" } do |f| %>
<%= f.hidden_field :rollable_type, value: "Stat" %>
<%= f.hidden_field :rollable_id, value: @stat.id %>
2024-06-27 08:33:46 +00:00
<div class="inline">
2024-06-21 11:46:12 +00:00
<%= f.submit "#{t(".roll")}".html_safe, class: "roll-button" %>
2024-06-27 08:33:46 +00:00
<div class="roll-command-display"><%= @stat.roll_command %></div>
</div>
2024-06-21 11:46:12 +00:00
<% end %>
2024-06-21 14:47:07 +00:00
<% @stat.dice_roll_types.each do |dice_roll_type| %>
<%= form_with model: DiceRoll.new, url: table_dice_rolls_path(@stat.character.table), class: "stat-form",
data: { controller: "dice-roll modal-closer", action: "modal-closer#closeModal" } do |f| %>
<%= f.hidden_field :rollable_type, value: "DiceRollType" %>
<%= f.hidden_field :rollable_id, value: dice_roll_type.id %>
2024-06-27 08:33:46 +00:00
<%= f.submit "#{t(".roll_type_html", name: dice_roll_type.name, command: dice_roll_type.roll_command)}".html_safe, class: "roll-button" %>
2024-06-21 14:47:07 +00:00
<% end %>
<% end %>
2024-06-21 08:09:19 +00:00
<% end %>
</div>
<% end %>