forked from fixin.me/fixin.me
Display Unit name using #to_s
This commit is contained in:
parent
bdc4ec4644
commit
76ce2eeedd
@ -42,7 +42,7 @@ class UnitsController < ApplicationController
|
||||
permitted = params.require(:unit).permit(:base_id)
|
||||
if permitted[:base_id].blank? && @unit.multiplier != 1
|
||||
permitted.merge!(multiplier: 1)
|
||||
flash.now[:notice] = t(".multiplier_reset", symbol: @unit.symbol)
|
||||
flash.now[:notice] = t(".multiplier_reset", unit: @unit)
|
||||
end
|
||||
|
||||
run_and_render :index if @unit.update(permitted)
|
||||
|
@ -78,6 +78,10 @@ class Unit < ApplicationRecord
|
||||
nil
|
||||
end
|
||||
|
||||
def to_s
|
||||
symbol
|
||||
end
|
||||
|
||||
def movable?
|
||||
subunits.empty?
|
||||
end
|
||||
|
@ -1,7 +1,7 @@
|
||||
<%= tag.tr do %>
|
||||
<td class="<%= class_names({subunit: unit.base,
|
||||
grayed: unit.default? && !unit.portable.nil? }) %>">
|
||||
<%= unit.symbol %>
|
||||
<%= unit %>
|
||||
</td>
|
||||
|
||||
<td class="actions">
|
||||
|
@ -5,7 +5,7 @@
|
||||
data: {drag_path: rebase_unit_path(unit), drop_id: dom_id(unit.base || unit)} do %>
|
||||
|
||||
<td class="<%= class_names('link', {subunit: unit.base}) %>">
|
||||
<%= link_to unit.symbol, edit_unit_path(unit), id: dom_id(unit, :edit),
|
||||
<%= link_to unit, edit_unit_path(unit), id: dom_id(unit, :edit),
|
||||
onclick: 'this.blur();', data: {turbo_stream: true} %>
|
||||
</td>
|
||||
<td><%= unit.name %></td>
|
||||
|
@ -64,7 +64,7 @@ en:
|
||||
update:
|
||||
success: Updated unit
|
||||
rebase:
|
||||
multiplier_reset: Multiplier of "%{symbol}" has been reset to 1, due to repositioning
|
||||
multiplier_reset: Multiplier of "%{unit}" has been reset to 1, due to repositioning
|
||||
destroy:
|
||||
success: Deleted unit
|
||||
default:
|
||||
|
Loading…
x
Reference in New Issue
Block a user