2024-06-07 15:53:32 +00:00
|
|
|
<div class="stat" id="<%= dom_id(stat) %>">
|
2024-06-10 19:39:46 +00:00
|
|
|
<% if @editable %>
|
2024-06-18 07:43:39 +00:00
|
|
|
<div class="feature-edit-buttons">
|
|
|
|
<%= icon_link_to("cod-triangle_left", reorder_down_character_sheet_feature_path(stat),
|
|
|
|
data: { turbo_method: :patch }) %>
|
|
|
|
<%= icon_link_to("md-delete", stat,
|
|
|
|
data: { turbo_method: :delete, turbo_confirm: t(".confirm_delete", name: stat.name) }) %>
|
|
|
|
<%= icon_link_to("cod-triangle_right", reorder_up_character_sheet_feature_path(stat),
|
|
|
|
data: { turbo_method: :patch }) %>
|
|
|
|
</div>
|
2024-06-10 19:39:46 +00:00
|
|
|
<% end %>
|
2024-06-07 15:53:32 +00:00
|
|
|
<h6><%= stat.name %></h6>
|
2024-06-13 16:04:25 +00:00
|
|
|
<% if @editable %>
|
|
|
|
<%= form_with model: stat, class: "stat-form", data: { controller: "auto-update" } do |f| %>
|
|
|
|
<%= f.number_field :value %>
|
|
|
|
<% end %>
|
2024-06-14 12:22:24 +00:00
|
|
|
<% elsif stat.roll_command.present? %>
|
2024-06-13 16:04:25 +00:00
|
|
|
<%= form_with model: DiceRoll.new, url: table_dice_rolls_path(stat.character.table), class: "stat-form",
|
|
|
|
data: { controller: "dice-roll" } do |f| %>
|
|
|
|
<%= f.hidden_field :rollable_type, value: "Stat" %>
|
|
|
|
<%= f.hidden_field :rollable_id, value: stat.id %>
|
|
|
|
<div class="stat-value" data-action="click->dice-roll#rollDice"><%= stat.value %></div>
|
|
|
|
<% end %>
|
2024-06-14 12:22:24 +00:00
|
|
|
<% else %>
|
|
|
|
<div class="stat-value"><%= stat.value %></div>
|
2024-06-11 10:37:58 +00:00
|
|
|
<% end %>
|
2024-06-07 15:53:32 +00:00
|
|
|
</div>
|