Add ModsDecorator#form_title

master
Zequez 2015-08-06 13:46:27 -03:00
parent 648a5438f9
commit 3e9edc1a17
2 changed files with 9 additions and 6 deletions

View File

@ -167,6 +167,14 @@ class ModDecorator < Draper::Decorator
'factoriomods://' + Base64.strict_encode64(json_mod).to_s
end
def form_title
if mod.new_record?
I18n.t('mods.new.new')
else
h.raw(I18n.t('mods.new.edit') + ' ' + h.link_to(mod.name, mod))
end
end
### Download button
###################

View File

@ -1,11 +1,6 @@
- title @mod.new_record? ? t('.title') : t('.title_edit', name: @mod.name)
.mods-edit
- if @mod.new_record?
%h2= t('.new')
- else
%h2
= t('.edit')
= link_to @mod.name, @mod
%h1= @mod.decorate.form_title
= semantic_form_for @mod do |f|
= f.inputs do
= f.input :name