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)
|
permitted = params.require(:unit).permit(:base_id)
|
||||||
if permitted[:base_id].blank? && @unit.multiplier != 1
|
if permitted[:base_id].blank? && @unit.multiplier != 1
|
||||||
permitted.merge!(multiplier: 1)
|
permitted.merge!(multiplier: 1)
|
||||||
flash.now[:notice] = t(".multiplier_reset", symbol: @unit.symbol)
|
flash.now[:notice] = t(".multiplier_reset", unit: @unit)
|
||||||
end
|
end
|
||||||
|
|
||||||
run_and_render :index if @unit.update(permitted)
|
run_and_render :index if @unit.update(permitted)
|
||||||
|
@ -78,6 +78,10 @@ class Unit < ApplicationRecord
|
|||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s
|
||||||
|
symbol
|
||||||
|
end
|
||||||
|
|
||||||
def movable?
|
def movable?
|
||||||
subunits.empty?
|
subunits.empty?
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<%= tag.tr do %>
|
<%= tag.tr do %>
|
||||||
<td class="<%= class_names({subunit: unit.base,
|
<td class="<%= class_names({subunit: unit.base,
|
||||||
grayed: unit.default? && !unit.portable.nil? }) %>">
|
grayed: unit.default? && !unit.portable.nil? }) %>">
|
||||||
<%= unit.symbol %>
|
<%= unit %>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
data: {drag_path: rebase_unit_path(unit), drop_id: dom_id(unit.base || unit)} do %>
|
data: {drag_path: rebase_unit_path(unit), drop_id: dom_id(unit.base || unit)} do %>
|
||||||
|
|
||||||
<td class="<%= class_names('link', {subunit: unit.base}) %>">
|
<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} %>
|
onclick: 'this.blur();', data: {turbo_stream: true} %>
|
||||||
</td>
|
</td>
|
||||||
<td><%= unit.name %></td>
|
<td><%= unit.name %></td>
|
||||||
|
@ -64,7 +64,7 @@ en:
|
|||||||
update:
|
update:
|
||||||
success: Updated unit
|
success: Updated unit
|
||||||
rebase:
|
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:
|
destroy:
|
||||||
success: Deleted unit
|
success: Deleted unit
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user