diff --git a/app/models/profile.rb b/app/models/profile.rb index d432d73e7..b0e7cefad 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -23,6 +23,7 @@ class Profile < ActiveRecord::Base xml_attr :birthday xml_attr :gender xml_attr :bio + xml_attr :location xml_attr :searchable xml_attr :tag_string @@ -36,7 +37,7 @@ class Profile < ActiveRecord::Base validate :max_tags attr_accessible :first_name, :last_name, :image_url, :image_url_medium, - :image_url_small, :birthday, :gender, :bio, :searchable, :date, :tag_string + :image_url_small, :birthday, :gender, :bio, :location, :searchable, :date, :tag_string belongs_to :person diff --git a/app/views/people/_profile_sidebar.html.haml b/app/views/people/_profile_sidebar.html.haml index 78ed5c137..af8fc81dc 100644 --- a/app/views/people/_profile_sidebar.html.haml +++ b/app/views/people/_profile_sidebar.html.haml @@ -42,6 +42,11 @@ %h4 =t('.bio') = markdownify(person.profile.bio, :newlines => true) + - unless person.profile.location.blank? + %li + %h4 + =t('.location') + = markdownify(person.profile.location, :newlines => true) %li.span-8.last .span-4 diff --git a/app/views/profiles/_edit.html.haml b/app/views/profiles/_edit.html.haml index ecae3400c..fe0ab2b76 100644 --- a/app/views/profiles/_edit.html.haml +++ b/app/views/profiles/_edit.html.haml @@ -17,6 +17,11 @@ = t('profiles.edit.your_bio') = text_area_tag 'profile[bio]', profile.bio, :rows => 5, :placeholder => t('fill_me_out') + %h4 + = t('profiles.edit.your_location') + %br + = text_field_tag 'profile[location]', profile.location, :placeholder => t('fill_me_out') + %h4 = t('profiles.edit.your_gender') %br diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index e680fdfd4..3ed40e3d8 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -371,6 +371,7 @@ en: remove_contact: "remove contact" edit_my_profile: "Edit my profile" bio: "bio" + location: "location" gender: "gender" born: "birthday" in_aspects: "in aspects" @@ -435,6 +436,7 @@ en: your_tags: "You: in 5 #tags" your_tags_placeholder: "i.e. #diaspora #ironing #kittens #music" your_bio: "Your bio" + your_location: "Your location" your_photo: "Your photo" update_profile: "Update Profile" allow_search: "Allow for people to search for you within Diaspora" diff --git a/db/migrate/20110323213655_add_location_to_profile.rb b/db/migrate/20110323213655_add_location_to_profile.rb new file mode 100644 index 000000000..1c3776212 --- /dev/null +++ b/db/migrate/20110323213655_add_location_to_profile.rb @@ -0,0 +1,9 @@ +class AddLocationToProfile < ActiveRecord::Migration + def self.up + add_column :profiles, :location, :string + end + + def self.down + remove_column :profiles, :location + end +end diff --git a/db/schema.rb b/db/schema.rb index fd5a314f1..015075d02 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20110321205715) do +ActiveRecord::Schema.define(:version => 20110323213655) do create_table "aspect_memberships", :force => true do |t| t.integer "aspect_id", :null => false @@ -251,6 +251,7 @@ ActiveRecord::Schema.define(:version => 20110321205715) do t.datetime "created_at" t.datetime "updated_at" t.string "mongo_id" + t.string "location" end add_index "profiles", ["first_name", "last_name", "searchable"], :name => "index_profiles_on_first_name_and_last_name_and_searchable" diff --git a/spec/models/profile_spec.rb b/spec/models/profile_spec.rb index c050172fa..da464f770 100644 --- a/spec/models/profile_spec.rb +++ b/spec/models/profile_spec.rb @@ -102,6 +102,13 @@ describe Profile do xml = person.profile.to_diaspora_xml xml.should include "#one" end + + it 'includes location' do + person.profile.location = 'Dark Side, Moon' + person.profile.save + xml = person.profile.to_diaspora_xml + xml.should include "Dark Side, Moon" + end end describe '#image_url' do