Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

merge account settings

  • Loading branch information...
commit 3b1a040faead8bc68bea83376534f68034cc177e 1 parent 1f84123
Jon Rose ghostandthemachine authored
2  lib/model/user.rb
@@ -21,6 +21,8 @@ class Link #from http://datamapper.org/docs/associations.html
21 21 property :img_url, String
22 22 property :email, String
23 23 property :password, String
  24 + property :display_name, String
  25 + property :location, String
24 26 property :salt, String
25 27 property :session_id, String
26 28 property :hashed_password, String
8 lib/routes/user/user.rb
@@ -262,5 +262,11 @@ def categories
262 262 end
263 263 ##############################################################
264 264
265   -
  265 +post '/user/:username/account' do
  266 + @user = current_user
  267 + @user.display_name = params[:display_name]
  268 + @user.location = params[:location]
  269 + @user.save!
  270 + redirect '/'
  271 +end
266 272
4 lib/views/event/event.haml
@@ -57,9 +57,9 @@
57 57 #event_map{:style => "width:400px;height:300px;"}
58 58 .row#follow-tray
59 59 -if current_user.following?(event.user) || current_user == event.user
60   - %p.btn.btn-primary.following-btn= "Following #{event.user.user_name}"
  60 + %p.btn.btn-primary.following-btn= "Following #{event.user.display_name ? event.user.display_name : event.user.user_name}"
61 61 -else
62   - %a.btn.btn-warning.follow-btn{id: "followed-user-#{event.user.user_name}-#{event.user.id}"}= "Follow #{event.user.user_name}"
  62 + %a.btn.btn-warning.follow-btn{id: "followed-user-#{event.user.user_name}-#{event.user.id}"}= "Follow #{event.user.display_name ? event.user.display_name : event.user.user_name}"
63 63 .row
64 64 %h4= "comments"
65 65 %hr
16 lib/views/user/account.haml
@@ -8,20 +8,20 @@
8 8 .content.span9
9 9 -#%h2.center= user.user_name.to_s
10 10 %img.center_block.mid_mb{:src => gravatar_for(user,200)}
11   - %form.form-horizontal
  11 + %form.form-horizontal{:action => "", :method => "post"}
12 12 .control-group
13   - %label.control-label{:for => "inputEmail"}
  13 + %label.control-label{:for => "inputEmail"}
14 14 Email:
15 15 .controls
16   - %input#inputEmail{:value => "#{user.email.to_s}", :placeholder => "Email", :type => "email"}
  16 + %input#inputEmail{:name => "email", :value => "#{user.email}", :type => "text"}
17 17 .control-group
18   - %label.control-label{:for => "inputUrl"}
  18 + %label.control-label{:for => "inputDisplayName"}
19 19 Display Name
20 20 .controls
21   - %input#inputDisplayName{:value => "#{user.img_url.to_s}", :placeholder => "Display Name", :type => "url"}
  21 + %input#inputDisplayName{:name => "display_name", :placeholder => "#{user.display_name ? user.display_name : 'Display Name'}", :type => "text"}
22 22 .control-group
23   - %label.control-label{:for => "inputUrl"}
  23 + %label.control-label{:for => "location"}
24 24 Location
25 25 .controls
26   - %input#inputUrl{:value => "#{user.img_url.to_s}", :placeholder => "Location", :type => "url"}
27   - %input.center_block{:type => "submit", :class => "btn", :value => "Update"}/
  26 + %input#location{:name => "location", :placeholder => "Location", :type => "text"}
  27 + %input.center_block{:type => "submit", :class => "btn", :name => "Update"}/

0 comments on commit 3b1a040

Please sign in to comment.
Something went wrong with that request. Please try again.