refactor ident_for helper

This commit is contained in:
Priit Tark 2015-03-17 11:20:17 +02:00
parent b52ec4e35e
commit 1264cde50d
3 changed files with 6 additions and 6 deletions

View file

@ -9,12 +9,12 @@ module ApplicationHelper
"background-image: url(#{image_path(unstable_env.to_s + '.png')});" "background-image: url(#{image_path(unstable_env.to_s + '.png')});"
end end
def ident_indicator(contact) def ident_for(contact)
case contact.ident_type case contact.ident_type
when 'birthday' when 'birthday'
"[#{contact.ident_type}]" "#{contact.ident} [#{contact.ident_type}]"
else else
"[#{contact.ident_country_code} #{contact.ident_type}]" "#{contact.ident} [#{contact.ident_country_code} #{contact.ident_type}]"
end end
end end
end end

View file

@ -1,6 +1,6 @@
.row .row
.col-sm-12 .col-sm-12
%h2.text-center-xs= t('contacts') %h2.text-center-xs= t(:contacts)
%hr %hr
.row .row
.col-md-12 .col-md-12
@ -35,7 +35,7 @@
- @contacts.each do |contact| - @contacts.each do |contact|
%tr %tr
%td= link_to(contact, admin_contact_path(contact)) %td= link_to(contact, admin_contact_path(contact))
%td= "#{contact.ident} #{ident_indicator(contact)}" %td= ident_for(contact)
%td= contact.email %td= contact.email
%td= contact.code %td= contact.code
%td %td

View file

@ -4,7 +4,7 @@
.panel-body .panel-body
%dl.dl-horizontal %dl.dl-horizontal
%dt= t(:ident) %dt= t(:ident)
%dd= "#{@contact.ident} #{ident_indicator(@contact)}" %dd= ident_for(@contact)
%br %br