24 lines
1.1 KiB
Plaintext
24 lines
1.1 KiB
Plaintext
<div class="stat" id="<%= dom_id(stat) %>">
|
|
<% if @editable %>
|
|
<%= link_to t(".down"), reorder_down_character_sheet_feature_path(stat), data: { turbo_method: :patch } %>
|
|
<%= link_to t(".up"), reorder_up_character_sheet_feature_path(stat), data: { turbo_method: :patch } %>
|
|
<%= link_to(t(".delete"), stat,
|
|
data: { turbo_method: :delete, turbo_confirm: t(".confirm_delete", name: stat.name) }) %>
|
|
<% end %>
|
|
<h6><%= stat.name %></h6>
|
|
<% if @editable %>
|
|
<%= form_with model: stat, class: "stat-form", data: { controller: "auto-update" } do |f| %>
|
|
<%= f.number_field :value %>
|
|
<% end %>
|
|
<% elsif stat.roll_command.present? %>
|
|
<%= 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 %>
|
|
<% else %>
|
|
<div class="stat-value"><%= stat.value %></div>
|
|
<% end %>
|
|
</div>
|