<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -153,4 +153,5 @@ class ApplicationController &lt; ActionController::Base
       redirect_to url
     end
   end
+  
 end</diff>
      <filename>app/controllers/application_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -15,6 +15,9 @@ class SessionsController &lt; ApplicationController
 
   def create
     self.current_user = User.authenticate(params[:email], Base64.decode64(params[:encoded_password]))
+    if params[:link_facebook] == &quot;true&quot;
+      self.current_user.link_fb_connect(facebook_session.user.id) unless self.current_user.fb_user_id == facebook_session.user.id
+    end
     if logged_in?
        
       handle_remember_me</diff>
      <filename>app/controllers/sessions_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -67,6 +67,10 @@ class Story &lt; NewsItem
   end
 
   belongs_to :pitch, :foreign_key =&gt; 'news_item_id'
+  
+  has_many :organizational_donors, :through =&gt; :donations, :source =&gt; :user, :order =&gt; &quot;donations.created_at&quot;, 
+            :conditions =&gt; &quot;users.type = 'organization'&quot;,
+            :uniq =&gt; true
   validate_on_update :extended_description
 
   named_scope :published, :conditions =&gt; {:status =&gt; 'published'}</diff>
      <filename>app/models/story.rb</filename>
    </modified>
    <modified>
      <diff>@@ -10,33 +10,13 @@
   /[if IE 6]
     = stylesheet_link_tag 'ie_spotus.css'
   = stylesheet_link_tag 'screen','screen_spotus','ie.css','facebox', :media =&gt; &quot;screen&quot;, :cache =&gt; &quot;styles_all&quot;
-  =# stylesheet_link_tag 'screen_spotus', :media =&gt; &quot;screen&quot;
   = stylesheet_link_tag 'print', :media =&gt; &quot;print&quot;
-  =# stylesheet_link_tag 'ie.css'
   
   
   = javascript_include_tag 'jquery-1.3.1.min'
   %script{:type =&gt; 'text/javascript'}
     jQuery.noConflict();
   = javascript_include_tag 'fckeditor/fckeditor','jquery-ui','jrails','jquery.pngFix','jquery.equalHeights','prototype','effects','jsProgressBarHandler','jquery.livequery','jquery.cookie','jcarousellite_1.0.1','jquery.form','application','auth','facebox', :cache =&gt; &quot;js_all&quot;
-  =# javascript_include_tag 'jquery-ui'
-  =# javascript_include_tag 'jrails'
-  =# javascript_include_tag 'jquery.pngFix'
-  =# javascript_include_tag 'jquery.equalHeights'
-  =# javascript_include_tag 'prototype'
-  =# javascript_include_tag 'scriptaculous'
-  =# javascript_include_tag 'effects'
-  =# javascript_include_tag 'jsProgressBarHandler'
-  =# javascript_include_tag 'jquery.livequery'
-  =# javascript_include_tag 'jquery.cookie'
-  =# javascript_include_tag 'jcarousellite_1.0.1'
-  =# javascript_include_tag 'jquery.form'
-  =# javascript_include_tag 'application'
-  =# javascript_include_tag 'auth'
-
-  =# stylesheet_link_tag 'facebox'
-  =# javascript_include_tag 'facebox'
-
   = iboxify_page
   = yield :head
   </diff>
      <filename>app/views/layouts/_head.html.haml</filename>
    </modified>
    <modified>
      <diff>@@ -1,35 +1,74 @@
-%div#fb_profile
-  %h4 
-    Welcome from facebook. To finish registraton:
-  - if @profile &amp;&amp; @profile.errors.any?
-    .error
-      = error_messages_for :profile
-  %h3
-    Fill out your name and email.
-  - form_for :profile, :url =&gt; myspot_profile_path, :html =&gt; { :method =&gt; :put } do |f|
-    .register
-      %div
-        = f.label :first_name, &quot;Your First Name&quot;
-        = f.text_field :first_name, :class =&gt; &quot;text&quot;, :tabindex =&gt; 1
-      %div
-        = f.label :last_name, &quot;Your Last Name&quot;
-        = f.text_field :last_name, :class =&gt; &quot;text&quot;, :tabindex =&gt; 2
-      %div
-        = f.label :email, &quot;Your E-mail Address&quot;
-        = f.text_field :email, :class =&gt; &quot;text&quot;, :tabindex =&gt; 5
-      %div
-        = f.label :type, &quot;I am a&quot;
-        = f.select :type, [[&quot;Community Member&quot;, &quot;Citizen&quot;], [&quot;Reporter&quot;, &quot;Reporter&quot;], [&quot;News Publisher&quot;, &quot;Organization&quot;]]
-      .block-padding.clear
-      .row
-        .float_left= f.check_box :terms_of_service, {}, '1', '0'
-        %label{:for =&gt; 'user_terms_of_service', :class =&gt; &quot;unpadded&quot;, :style =&gt; &quot;width: auto;&quot;}
-          Accept the
-          = link_to 'Terms of Service', page_path('terms')
+%div#fb_updater
+  %div#fb_profile
+    %h4 
+      Welcome from facebook. To finish registraton:
+    - if @profile &amp;&amp; @profile.errors.any?
+      .error
+        = error_messages_for :profile
+    %h3
+      Fill out your name and email. Or &lt;a href=&quot;&quot; class=&quot;login_link&quot;&gt;Login&lt;/a&gt; with existing Spot.Us Account.
+    - form_for :profile, :url =&gt; myspot_profile_path, :html =&gt; { :method =&gt; :put } do |f|
+      .register
+        %div
+          = f.label :first_name, &quot;Your First Name&quot;
+          = f.text_field :first_name, :class =&gt; &quot;text&quot;, :tabindex =&gt; 1
+        %div
+          = f.label :last_name, &quot;Your Last Name&quot;
+          = f.text_field :last_name, :class =&gt; &quot;text&quot;, :tabindex =&gt; 2
+        %div
+          = f.label :email, &quot;Your E-mail Address&quot;
+          = f.text_field :email, :class =&gt; &quot;text&quot;, :tabindex =&gt; 5
+        %div
+          = f.label :type, &quot;I am a&quot;
+          = f.select :type, [[&quot;Community Member&quot;, &quot;Citizen&quot;], [&quot;Reporter&quot;, &quot;Reporter&quot;], [&quot;News Publisher&quot;, &quot;Organization&quot;]]
+        .block-padding.clear
+        .row
+          .float_left= f.check_box :terms_of_service, {}, '1', '0'
+          %label{:for =&gt; 'user_terms_of_service', :class =&gt; &quot;unpadded&quot;, :style =&gt; &quot;width: auto;&quot;}
+            Accept the
+            = link_to 'Terms of Service', page_path('terms')
+          .block-padding.clear
+          %div{:style =&gt; &quot;padding: 0pt 0pt 8px 5px;&quot;}
+            %input{:type =&gt; &quot;image&quot;, :src =&gt; &quot;/images/save.png&quot;, :value =&gt; &quot;Update&quot;, :class =&gt; &quot;float-right&quot;}
+          .block-padding.clear
+          %a{:href=&gt;&quot;#&quot;, :onclick=&gt;'FB.Connect.logoutAndRedirect(&quot;' + destroy_session_path + '&quot;)'}
+            No Thanks
+  %div#spotus_login.hide
+    %h4 
+      Connect your facebook login to an existing Spot.Us Account:
+    - if @profile &amp;&amp; @profile.errors.any?
+      .error
+        = error_messages_for :profile
+    %h3
+      Login or  &lt;a href=&quot;&quot; class=&quot;profile_link&quot;&gt;&amp;laquo; go back&lt;/a&gt;
+    - form_tag session_url(:protocol =&gt; 'http') do
+      .register
+        %div
+          %label Your E-mail Address
+          = text_field_tag &quot;email&quot;, nil, :class=&gt;&quot;text&quot;
+        %div
+          %label Your Password
+          = password_field_tag &quot;password&quot;, nil, :class=&gt;&quot;text&quot;, :id=&gt;&quot;passwordField&quot;
+          = hidden_field_tag &quot;encoded_password&quot;, nil, :class=&gt;&quot;text&quot;, :id=&gt;&quot;passwordHiddenField&quot;
+          = hidden_field_tag &quot;link_facebook&quot;, &quot;true&quot;
         .block-padding.clear
         %div{:style =&gt; &quot;padding: 0pt 0pt 8px 5px;&quot;}
-          %input{:type =&gt; &quot;image&quot;, :src =&gt; &quot;/images/save.png&quot;, :value =&gt; &quot;Update&quot;, :class =&gt; &quot;float-right&quot;}
+          %input{:type =&gt; &quot;image&quot;, :src =&gt; &quot;/images/login.png&quot;, :value =&gt; &quot;Login&quot;, :class =&gt; &quot;float-right&quot;, :onclick=&gt;&quot;processLoginForm();&quot;}
         .block-padding.clear
         %a{:href=&gt;&quot;#&quot;, :onclick=&gt;'FB.Connect.logoutAndRedirect(&quot;' + destroy_session_path + '&quot;)'}
           No Thanks
+          
+:javascript
+  jQuery(document).ready(function(){
+    jQuery('.login_link').click(function(){
+      jQuery('#fb_profile').hide();
+      jQuery('#spotus_login').show();
+      return false;
+    });
+    jQuery('.profile_link').click(function(){
+      jQuery('#fb_profile').show();
+      jQuery('#spotus_login').hide();
+      return false;
+    });
+  });
 </diff>
      <filename>app/views/users/_popup_form.html.haml</filename>
    </modified>
    <modified>
      <diff>@@ -62,7 +62,7 @@ jQuery(document).ready(function($){
     }); // end ajax form
   }); // end livequery
 
-  $(&quot;#facebox .content #fb_profile form&quot;).livequery(function() {
+  $(&quot;#facebox .content #fb_updater #fb_profile form&quot;).livequery(function() {
 		var form = $(this);
     $(this).ajaxForm({
 			complete: function(request,message) {
@@ -76,6 +76,21 @@ jQuery(document).ready(function($){
 			}
 		});
 	});
+	
+	$(&quot;#facebox .content #fb_updater #spotus_login form&quot;).livequery(function() {
+		var form = $(this);
+    $(this).ajaxForm({
+			complete: function(request,message) {
+				 if(message == &quot;error&quot;) {
+						$(&quot;#facebox .content #spotus_login&quot;).replaceWith(request.responseText);
+					} else {
+						$(document).trigger('close.facebox');
+	          renderUserHeader();
+						$(&quot;li.start_story a.authbox&quot;).removeClass(&quot;authbox&quot;).removeAttr(&quot;return_to&quot;).attr(&quot;href&quot;,&quot;/start_story&quot;);
+					}
+			}
+		});
+	});
 					
 });
 function showProfileForm(){</diff>
      <filename>public/javascripts/auth.js</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>016fe7f5b06bb77e9b699d405d339b4d3b3502fd</id>
    </parent>
  </parents>
  <author>
    <name>Dan Newman</name>
    <email>dpnewman@gmail.com</email>
  </author>
  <url>http://github.com/spot-us/spot-us/commit/594ab4b8e7d24dead7aeb7fb4a49e1aceb2d2fa9</url>
  <id>594ab4b8e7d24dead7aeb7fb4a49e1aceb2d2fa9</id>
  <committed-date>2009-11-05T17:26:58-08:00</committed-date>
  <authored-date>2009-11-05T17:26:58-08:00</authored-date>
  <message>Link facebook connect to existing login</message>
  <tree>21453946ed3bf507d2efd71dc46bdd391476c538</tree>
  <committer>
    <name>Dan Newman</name>
    <email>dpnewman@gmail.com</email>
  </committer>
</commit>
