Fogbugz #66: Detail view.

This commit is contained in:
Roland 2011-06-25 21:42:45 +02:00
parent 64fa26c9b7
commit c046a91e24
4 changed files with 50 additions and 3 deletions

View file

@ -75,6 +75,7 @@ class ContactsController < ApplicationController
end
def show
@contact = Contact.find(params[:id])
end
def edit

View file

@ -12,4 +12,23 @@ class Contact < ActiveRecord::Base
s += "." unless birth_month.nil?
s += birth_year.to_s || ""
end
def address_string
s = street || ""
s += " "
s += housenr || ""
s += "&middot;" unless (plz.nil? and place.nil?)
s += plz
s += " "
s += place
end
# very temporary
def twitter_username
"dummy"
end
def twitter_username_link
'<a href="http://twitter.com/' + twitter_username + '">@' + twitter_username + "</a>"
end
end

View file

@ -41,7 +41,7 @@
<%= c.birth_date_string.blank? ? "&nbsp;".html_safe : c.birth_date_string %>
</div>
<div class="onecol">
_
(<%= link_to "&gt;".html_safe, c %>)
</div>
</div>
<% end %>

View file

@ -1,2 +1,29 @@
<h1>Contacts#show</h1>
<p>Find me in app/views/contacts/show.html.erb</p>
<div class="row">
<div class="threecol">
[bild]
</div>
<div class="sixcol">
<span id="show_name"><%= @contact.firstname %> <%= @contact.lastname %></span>
<br />
<span id="show_birthdate"><%= @contact.birth_date_string %></span>
<br />
<span id="show_address"><%= @contact.address_string.html_safe %></span>
<br />
<% @contact.phones.each do |phone| %>
<em><%= phone.desc %></em> <%= phone.nr %>
<br />
<% end %>
<% @contact.emails.each do |email| %>
<em><%= email.desc %></em> <%= email.address %>
<br />
<% end %>
Twitter:
<%= @contact.twitter_username_link.html_safe %>
<br />
<em>shared friends</em>
<br />
<em>follow the same</em>
<br />
</div>
<div class="threecol">&nbsp;</div>
</div>