diff --git a/app/controllers/friends_controller.rb b/app/controllers/friends_controller.rb index c39bd1d27..dbe7bc414 100644 --- a/app/controllers/friends_controller.rb +++ b/app/controllers/friends_controller.rb @@ -20,10 +20,15 @@ class FriendsController < ApplicationController def new @friend = Friend.new + @profile = Profile.new end def create + + puts params.inspect @friend = Friend.new(params[:friend]) + + if @friend.save flash[:notice] = "Successfully created friend." redirect_to @friend diff --git a/app/models/person.rb b/app/models/person.rb index ec3949283..bcdcea5bf 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -26,7 +26,7 @@ class Person before_validation :clean_url def real_name - self.profile.first_name + " " + self.profile.last_name + profile.first_name + " " + profile.last_name end diff --git a/app/views/friends/new.html.haml b/app/views/friends/new.html.haml index d8f89f2f6..f18335484 100644 --- a/app/views/friends/new.html.haml +++ b/app/views/friends/new.html.haml @@ -10,7 +10,17 @@ = f.label :url %br = f.text_field :url - %p + + =f.fields_for :profile do |p| + %p + = p.label :first_name + %br + = p.text_field :first_name + + %p + = p.label :last_name + %br + = p.text_field :last_name = f.submit diff --git a/app/views/friends/show.html.haml b/app/views/friends/show.html.haml index 444788360..6ee4f9540 100644 --- a/app/views/friends/show.html.haml +++ b/app/views/friends/show.html.haml @@ -12,6 +12,10 @@ %b Last Name %p = @friend_profile.last_name + %p + %b url + %p + = @friend.url %br %br diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 1e41860bc..060efdcdc 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -42,7 +42,12 @@ var obj = jQuery.parseJSON(evt.data); debug("got a " + obj['class']); if((location.href.indexOf(obj['class']) != -1 ) || (location.pathname == '/')) { - $("#stream").prepend($(obj['html']).fadeIn("fast")); + $("#stream").prepend( + $(obj['html']).fadeIn("fast", function(){ + $("#stream label:first").inFieldLabels(); + } + ) + ); }; }; ws.onclose = function() { debug("socket closed"); }; @@ -59,7 +64,6 @@ }); // in field label plugin - $("label").inFieldLabels(); $(".show_post_comments").click( function() { $(this).parents("li").children(".comments").fadeIn(100); diff --git a/public/javascripts/view.js b/public/javascripts/view.js index 4d35166cb..4ec1ed95b 100644 --- a/public/javascripts/view.js +++ b/public/javascripts/view.js @@ -46,8 +46,11 @@ $(document).ready(function(){ }); }); + + + $("label").inFieldLabels(); - $('#flash_notice, #flash_error, #flash_alert').delay(1500).slideUp(130); + $('#flash_notice, #flash_error, #flash_alert').delay(1500).slideUp(130); });//end document ready