Fogbugz #61: Erfassen von einem Geburtstag je Contact.

This commit is contained in:
gchq 2011-05-31 21:11:03 +02:00
parent 55ed695513
commit fc03826cc5
5 changed files with 23 additions and 2 deletions

View file

@ -22,6 +22,7 @@ class ContactsController < ApplicationController
c.plz = params[:contact][:plz]
c.place = params[:contact][:place]
c.country = params[:contact][:country]
c.birth_date = Date.civil(params[:birth_date][:year].to_i, params[:birth_date][:month].to_i, params[:birth_date][:day].to_i)
# emails come as: ["0", {"address"=>"a@b.c"}]
params[:contact][:emails_attributes].map {|k,vs| vs}.each { |val|

View file

@ -47,6 +47,12 @@
<%= link_to 'Add a phone', '#phones', :class => "add_nested_item", :rel => "phones" %>
</td>
</tr>
<tr>
<td align="right"><%= label_tag(:birth_date, "Birthday") %></td>
<td>
<%= select_date Date.today, :prefix => :birth_date, :start_year => 1900, :end_year => Date.today.year %>
</td>
</tr>
<tr>
<td align="right"><td><%= f.submit("Save contact") %></td>
</tr>

View file

@ -19,11 +19,15 @@
<%= c.plz + " " + c.place %><%= ", " unless c.country.blank? %>
<%= c.country %>
</div>
<div class="threecol">
<div class="twocol">
<%= "&nbsp;".html_safe unless c.phones.count > 0 %>
<% c.phones.first(2).each do |p| %>
<strong><%= p.desc unless p.desc.blank? %></strong>
<%= p.nr %><br />
<% end %>
</div>
<div class="onecol">
<%= c.birth_date %>
</div>
</div>
<% end %>

View file

@ -0,0 +1,9 @@
class AddBirthdayToContact < ActiveRecord::Migration
def self.up
add_column :contacts, :birth_date, :date
end
def self.down
remove_column :contacts, :birth_date
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20110517221027) do
ActiveRecord::Schema.define(:version => 20110531183659) do
create_table "contacts", :force => true do |t|
t.string "firstname"
@ -22,6 +22,7 @@ ActiveRecord::Schema.define(:version => 20110517221027) do
t.string "country"
t.datetime "created_at"
t.datetime "updated_at"
t.date "birth_date"
end
create_table "emails", :force => true do |t|