<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>public/javascripts/views/login_view.js</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -67,7 +67,7 @@ module AuthenticatedSystem
           redirect_to new_session_path
         end
         format.json do
-          render :json =&gt; {'type' =&gt; 'Redirect', 'attributes' =&gt; {'href' =&gt; new_session_path}}
+          render :json =&gt; {'type' =&gt; 'Login'}
         end
         format.any do
           request_http_basic_authentication 'Web Password'</diff>
      <filename>lib/authenticated_system.rb</filename>
    </modified>
    <modified>
      <diff>@@ -40,13 +40,11 @@
       contentType: &quot;application/json&quot;,
       dataType: &quot;json&quot;,
       success: function(data) {
-        if(data.type == &quot;Redirect&quot;) {
-          self.location.href = data.attributes.href;
+        if(data.type == &quot;Login&quot;) {
+          if(callback) callback(data);
         } else {
           update_attributes.call(self, data.attributes);
-          if(callback) {
-            callback(self);
-          }
+          if(callback) callback(self);
         }
       }
     });</diff>
      <filename>public/javascripts/models/pain_point.js</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
-(function() {
+(function($) {
   window.PainPointsView = {
     'create': function() {
       var b = new XmlBuilder({binding: this});
@@ -11,4 +11,4 @@
       return content;
     }
   };
-})();
\ No newline at end of file
+})(jQuery);
\ No newline at end of file</diff>
      <filename>public/javascripts/views/pain_points_view.js</filename>
    </modified>
    <modified>
      <diff>@@ -51,6 +51,30 @@ Screw.Unit(function() {
       });
     });
 
+    this[&quot;when the server responds with a Login&quot;] = function(method_name) {
+      describe(&quot;when the server responds with a Login&quot;, function() {
+        describe(&quot;when passing in a callback&quot;, function() {
+          it(&quot;invokes the callback with the Login instance&quot;, function() {
+            var callback_object;
+            var callback = function(object) {
+              callback_object = object;
+            }
+            pain_point[method_name](callback);
+
+            ActiveAjaxRequests[0].success({&quot;type&quot;: &quot;Login&quot;});
+            expect(callback_object).to(equal, {&quot;type&quot;: &quot;Login&quot;})
+          });
+        });
+
+        describe(&quot;when not passing in a callback&quot;, function() {
+          it(&quot;does nothing&quot;, function() {
+            pain_point[method_name]();
+            ActiveAjaxRequests[0].success({&quot;type&quot;: &quot;Login&quot;});
+          });
+        });
+      });
+    }
+
     describe(&quot;#up_vote&quot;, function() {
       before(function() {
         window._token = &quot;foobar&quot;;
@@ -80,18 +104,7 @@ Screw.Unit(function() {
           expect(pain_point.score).to(equal, 5);
         });
 
-        describe(&quot;when the server responds with a Redirect&quot;, function() {
-          it(&quot;sets the window.href to value of the location&quot;, function() {
-            var location = {};
-            pain_point.location = location;
-            pain_point.up_vote();
-
-            ActiveAjaxRequests[0].success(
-              {&quot;type&quot;: &quot;Redirect&quot;, &quot;attributes&quot;: {&quot;href&quot;: &quot;/sessions/new&quot;}}
-            );
-            expect(location.href).to(equal, &quot;/sessions/new&quot;);
-          });
-        });
+        this[&quot;when the server responds with a Login&quot;]('up_vote');
       });
 
     });
@@ -123,18 +136,7 @@ Screw.Unit(function() {
         expect(pain_point.vote_state).to(equal, 'down');
       });
 
-      describe(&quot;when the server responds with a Redirect&quot;, function() {
-        it(&quot;sets the window.href to value of the location&quot;, function() {
-          var location = {};
-          pain_point.location = location;
-          pain_point.down_vote();
-
-          ActiveAjaxRequests[0].success(
-            {&quot;type&quot;: &quot;Redirect&quot;, &quot;attributes&quot;: {&quot;href&quot;: &quot;/sessions/new&quot;}}
-          );
-          expect(location.href).to(equal, &quot;/sessions/new&quot;);
-        });
-      });
+      this[&quot;when the server responds with a Login&quot;]('down_vote');
     });
   });
 });</diff>
      <filename>spec/javascripts/models/pain_point_spec.js</filename>
    </modified>
    <modified>
      <diff>@@ -2,6 +2,7 @@
 require(&quot;/implementations/xmlbuilder&quot;);
 require(&quot;/implementations/json2&quot;);
 require(&quot;/implementations/models/pain_point&quot;);
+require(&quot;/implementations/views/login_view&quot;);
 require(&quot;/implementations/views/pain_point_view&quot;);
 require(&quot;/implementations/views/pain_points_view&quot;);
 require(&quot;/specs/fake_jQuery_ajax&quot;);
@@ -9,6 +10,7 @@ require(&quot;/specs/fake_jQuery_ajax&quot;);
 
 Screw.Unit(function() {
   before(function() {
+    $(&quot;body &gt; .overlay&quot;).remove();
     $(&quot;#screw_unit_content&quot;).html(&quot;&quot;);
     ActiveAjaxRequests.length = 0;
     PainPoint.instances = [];</diff>
      <filename>spec/javascripts/spec_helper.js</filename>
    </modified>
    <modified>
      <diff>@@ -9,16 +9,16 @@ Screw.Unit(function() {
       })
 
       it(&quot;renders a li element with an up vote, down vote, and an edit link&quot;, function() {
-        var output = PainPointView.create(pain_point);
-        expect(output.find(&quot;a.up&quot;)).to_not(be_empty);
-        expect(output.find(&quot;a.down&quot;)).to_not(be_empty);
-        expect(output.find(&quot;a[@href='/pain_points/1/edit']&quot;)).to_not(be_empty);
+        var view = PainPointView.create(pain_point);
+        expect(view.find(&quot;a.up&quot;)).to_not(be_empty);
+        expect(view.find(&quot;a.down&quot;)).to_not(be_empty);
+        expect(view.find(&quot;a[@href='/pain_points/1/edit']&quot;)).to_not(be_empty);
       });
 
       describe(&quot;PainPoint#score&quot;, function() {
         it(&quot;renders the score&quot;, function() {
-          var output = PainPointView.create(pain_point);
-          expect(output.html()).to(match, pain_point.score.toString());
+          var view = PainPointView.create(pain_point);
+          expect(view.html()).to(match, pain_point.score.toString());
         });
       });
 
@@ -29,9 +29,9 @@ Screw.Unit(function() {
           });
 
           it(&quot;renders neither the up vote or down vote link as selected&quot;, function() {
-            var output = PainPointView.create(pain_point);
-            expect(output.find(&quot;a.up.selected&quot;)).to(be_empty);
-            expect(output.find(&quot;a.down.selected&quot;)).to(be_empty);
+            var view = PainPointView.create(pain_point);
+            expect(view.find(&quot;a.up.selected&quot;)).to(be_empty);
+            expect(view.find(&quot;a.down.selected&quot;)).to(be_empty);
           });
         });
 
@@ -41,9 +41,9 @@ Screw.Unit(function() {
           });
 
           it(&quot;renders the up vote link as selected&quot;, function() {
-            var output = PainPointView.create(pain_point);
-            expect(output.find(&quot;a.up.selected&quot;)).to_not(be_empty);
-            expect(output.find(&quot;a.down.selected&quot;)).to(be_empty);
+            var view = PainPointView.create(pain_point);
+            expect(view.find(&quot;a.up.selected&quot;)).to_not(be_empty);
+            expect(view.find(&quot;a.down.selected&quot;)).to(be_empty);
           });
         });
 
@@ -53,9 +53,9 @@ Screw.Unit(function() {
           });
 
           it(&quot;renders the down vote link as selected&quot;, function() {
-            var output = PainPointView.create(pain_point);
-            expect(output.find(&quot;a.up.selected&quot;)).to(be_empty);
-            expect(output.find(&quot;a.down.selected&quot;)).to_not(be_empty);
+            var view = PainPointView.create(pain_point);
+            expect(view.find(&quot;a.up.selected&quot;)).to(be_empty);
+            expect(view.find(&quot;a.down.selected&quot;)).to_not(be_empty);
           });
         });
       });
@@ -65,57 +65,64 @@ Screw.Unit(function() {
     describe(&quot;#refresh&quot;, function() {
       before(function() {
         pain_point = new PainPoint({id: 1, name: &quot;Pain Point 1&quot;, vote_state: &quot;neutral&quot;, score: 0});
-        output = PainPointView.create(pain_point);
+        view = PainPointView.create(pain_point);
       });
       
       describe(&quot;PainPoint#score &gt; 0&quot;, function() {
         it(&quot;renders the score&quot;, function() {
           pain_point.score = 1;
-          output.refresh(pain_point);
-          expect(output.find(&quot;.score&quot;).html()).to(equal, &quot;1&quot;);
+          view.refresh(pain_point);
+          expect(view.find(&quot;.score&quot;).html()).to(equal, &quot;1&quot;);
         })
       });
 
       describe(&quot;PainPoint#score == 0&quot;, function() {
         it(&quot;renders the score&quot;, function() {
           pain_point.score = 0;
-          output.refresh(pain_point);
-          expect(output.find(&quot;.score&quot;).html()).to(equal, &quot;0&quot;);
+          view.refresh(pain_point);
+          expect(view.find(&quot;.score&quot;).html()).to(equal, &quot;0&quot;);
         })
       });
 
       describe(&quot;PainPoint#score &lt; 0&quot;, function() {
         it(&quot;renders the score&quot;, function() {
           pain_point.score = -1;
-          output.refresh(pain_point);
-          expect(output.find(&quot;.score&quot;).html()).to(equal, &quot;-1&quot;);
+          view.refresh(pain_point);
+          expect(view.find(&quot;.score&quot;).html()).to(equal, &quot;-1&quot;);
         })
       });
     });
 
     describe(&quot;#up_vote.click&quot;, function() {
-      var output;
+      var view, link;
       before(function() {
         pain_point = new PainPoint({id: 1, name: &quot;Pain Point 1&quot;, vote_state: &quot;neutral&quot;, score: 0});
-        output = PainPointView.create(pain_point);
+        view = PainPointView.create(pain_point);
+        link = view.find(&quot;a.up&quot;);
       });
 
       it(&quot;sends a POST to /pain_points/:pain_point_id/up_vote&quot;, function() {
-        output.find(&quot;a.up&quot;).click();
+        view.find(&quot;a.up&quot;).click();
         expect(ActiveAjaxRequests.length).to(equal, 1);
         var request = ActiveAjaxRequests[0];
         expect(request.type).to(equal, 'POST');
         expect(request.url).to(equal, '/pain_points/1/up_vote');
       });
 
-      describe(&quot;processing the server response&quot;, function() {
+      describe(&quot;when the server responds with a Login&quot;, function() {
+        it(&quot;causes login form to show itself&quot;, function() {
+          
+        });
+      });
+
+      describe(&quot;when the server responds with a PainPoint&quot;, function() {
         describe(&quot;PainPoint#vote_state&quot;, function() {
           describe(&quot;up&quot;, function() {
             it(&quot;adds the 'selected' up vote link css class and removes 'selected' from the down vote link css class&quot;, function() {
-              output.find(&quot;a.down&quot;).addClass(&quot;selected&quot;);
-              expect(output.find(&quot;a.up.selected&quot;)).to(be_empty);
-              expect(output.find(&quot;a.down.selected&quot;)).to_not(be_empty);
-              output.find(&quot;a.up&quot;).click();
+              view.find(&quot;a.down&quot;).addClass(&quot;selected&quot;);
+              expect(view.find(&quot;a.up.selected&quot;)).to(be_empty);
+              expect(view.find(&quot;a.down.selected&quot;)).to_not(be_empty);
+              link.click();
               ActiveAjaxRequests[0].success(
                 {
                   'type': &quot;PainPoint&quot;,
@@ -123,19 +130,19 @@ Screw.Unit(function() {
                 }
               );
 
-              expect(output.find(&quot;a.up.selected&quot;)).to_not(be_empty);
-              expect(output.find(&quot;a.down.selected&quot;)).to(be_empty);
+              expect(view.find(&quot;a.up.selected&quot;)).to_not(be_empty);
+              expect(view.find(&quot;a.down.selected&quot;)).to(be_empty);
             });
           });
 
           describe(&quot;neutral&quot;, function() {
             it(&quot;removes the 'selected' up vote link and down vote link css classes&quot;, function() {
-              output.find(&quot;a.up&quot;).addClass(&quot;selected&quot;);
-              expect(output.find(&quot;a.up.selected&quot;)).to_not(be_empty);
-              output.find(&quot;a.down&quot;).addClass(&quot;selected&quot;);
-              expect(output.find(&quot;a.down.selected&quot;)).to_not(be_empty);
+              view.find(&quot;a.up&quot;).addClass(&quot;selected&quot;);
+              expect(view.find(&quot;a.up.selected&quot;)).to_not(be_empty);
+              view.find(&quot;a.down&quot;).addClass(&quot;selected&quot;);
+              expect(view.find(&quot;a.down.selected&quot;)).to_not(be_empty);
 
-              output.find(&quot;a.up&quot;).click();
+              link.click();
               ActiveAjaxRequests[0].success(
                 {
                   'type': &quot;PainPoint&quot;,
@@ -143,17 +150,17 @@ Screw.Unit(function() {
                 }
               );
 
-              expect(output.find(&quot;a.up.selected&quot;)).to(be_empty);
-              expect(output.find(&quot;a.down.selected&quot;)).to(be_empty);
+              expect(view.find(&quot;a.up.selected&quot;)).to(be_empty);
+              expect(view.find(&quot;a.down.selected&quot;)).to(be_empty);
             });
           });
         });
 
         describe(&quot;PainPoint#score&quot;, function() {
           it(&quot;renders the updated score&quot;, function() {
-            expect(output.find(&quot;.score&quot;).html()).to_not(equal, &quot;5&quot;);
+            expect(view.find(&quot;.score&quot;).html()).to_not(equal, &quot;5&quot;);
 
-            output.find(&quot;a.up&quot;).click();
+            link.click();
             ActiveAjaxRequests[0].success(
               {
                 'type': &quot;PainPoint&quot;,
@@ -161,7 +168,7 @@ Screw.Unit(function() {
               }
             );
 
-            expect(output.find(&quot;.score&quot;).html()).to(equal, &quot;5&quot;);
+            expect(view.find(&quot;.score&quot;).html()).to(equal, &quot;5&quot;);
           })
         });
       });
@@ -169,14 +176,14 @@ Screw.Unit(function() {
     })
 
     describe(&quot;#down_vote.click&quot;, function() {
-      var output;
+      var view;
       before(function() {
         pain_point = new PainPoint({id: 1, name: &quot;Pain Point 1&quot;, vote_state: &quot;neutral&quot;, score: 0});
-        output = PainPointView.create(pain_point);
+        view = PainPointView.create(pain_point);
       });
 
       it(&quot;sends a POST to /pain_points/:pain_point_id/down_vote&quot;, function() {
-        output.find(&quot;a.down&quot;).click();
+        view.find(&quot;a.down&quot;).click();
         expect(ActiveAjaxRequests.length).to(equal, 1);
         var request = ActiveAjaxRequests[0];
         expect(request.type).to(equal, 'POST');
@@ -187,41 +194,41 @@ Screw.Unit(function() {
         describe(&quot;PainPoint#vote_state&quot;, function() {
           describe(&quot;down&quot;, function() {
             it(&quot;adds the 'selected' down vote link css class and removes the 'selected' up vote link css class&quot;, function() {
-              output.find(&quot;a.up&quot;).addClass('selected');
-              expect(output.find(&quot;a.up.selected&quot;)).to_not(be_empty);
-              expect(output.find(&quot;a.down.selected&quot;)).to(be_empty);
-              output.find(&quot;a.down&quot;).click();
+              view.find(&quot;a.up&quot;).addClass('selected');
+              expect(view.find(&quot;a.up.selected&quot;)).to_not(be_empty);
+              expect(view.find(&quot;a.down.selected&quot;)).to(be_empty);
+              view.find(&quot;a.down&quot;).click();
               ActiveAjaxRequests[0].success(
                 {'type': &quot;PainPoint&quot;, 'attributes': {id: 1, name: &quot;Pain Point 1&quot;, vote_state: &quot;down&quot;, score: 1}}
               );
 
-              expect(output.find(&quot;a.up.selected&quot;)).to(be_empty);
-              expect(output.find(&quot;a.down.selected&quot;)).to_not(be_empty);
+              expect(view.find(&quot;a.up.selected&quot;)).to(be_empty);
+              expect(view.find(&quot;a.down.selected&quot;)).to_not(be_empty);
             });
           });
 
           describe(&quot;neutral&quot;, function() {
             it(&quot;removes the 'selected' down vote and up vote link css class&quot;, function() {
-              output.find(&quot;a.up&quot;).addClass(&quot;selected&quot;);
-              output.find(&quot;a.down&quot;).addClass(&quot;selected&quot;);
-              expect(output.find(&quot;a.up.selected&quot;)).to_not(be_empty);
-              expect(output.find(&quot;a.down.selected&quot;)).to_not(be_empty);
-              output.find(&quot;a.down&quot;).click();
+              view.find(&quot;a.up&quot;).addClass(&quot;selected&quot;);
+              view.find(&quot;a.down&quot;).addClass(&quot;selected&quot;);
+              expect(view.find(&quot;a.up.selected&quot;)).to_not(be_empty);
+              expect(view.find(&quot;a.down.selected&quot;)).to_not(be_empty);
+              view.find(&quot;a.down&quot;).click();
               ActiveAjaxRequests[0].success(
                 {'type': &quot;PainPoint&quot;, 'attributes': {id: 1, name: &quot;Pain Point 1&quot;, vote_state: &quot;neutral&quot;, score: 3}}
               );
 
-              expect(output.find(&quot;a.up.selected&quot;)).to(be_empty);
-              expect(output.find(&quot;a.down.selected&quot;)).to(be_empty);
+              expect(view.find(&quot;a.up.selected&quot;)).to(be_empty);
+              expect(view.find(&quot;a.down.selected&quot;)).to(be_empty);
             });
           });
         });
 
         describe(&quot;PainPoint#score&quot;, function() {
           it(&quot;renders the updated score&quot;, function() {
-            expect(output.find(&quot;.score&quot;).html()).to_not(equal, &quot;-5&quot;);
+            expect(view.find(&quot;.score&quot;).html()).to_not(equal, &quot;-5&quot;);
 
-            output.find(&quot;a.down&quot;).click();
+            view.find(&quot;a.down&quot;).click();
             ActiveAjaxRequests[0].success(
               {
                 'type': &quot;PainPoint&quot;,
@@ -229,7 +236,7 @@ Screw.Unit(function() {
               }
             );
 
-            expect(output.find(&quot;.score&quot;).html()).to(equal, &quot;-5&quot;);
+            expect(view.find(&quot;.score&quot;).html()).to(equal, &quot;-5&quot;);
           })
         });
       });</diff>
      <filename>spec/javascripts/views/pain_point_view_spec.js</filename>
    </modified>
    <modified>
      <diff>@@ -9,7 +9,7 @@ describe &quot;A User on the home page&quot; do
 
   describe &quot;when not logged in&quot; do
     describe &quot;clicking the up vote&quot; do
-      it &quot;sends a message to redirect to /login&quot; do
+      it &quot;sends a Login&quot; do
         pain_point = pain_points(:slow_tests)
         post(
           pain_point_up_vote_index_path(:pain_point_id =&gt; pain_point.to_param),
@@ -20,7 +20,7 @@ describe &quot;A User on the home page&quot; do
           &quot;Cookie&quot; =&gt; &quot;bc_test=true; _pain-point_session=#{session_id}&quot;
         )
         status.should == 200
-        JSON.parse(@response.body).should == {'type' =&gt; 'Redirect', 'attributes' =&gt; {'href' =&gt; new_session_path}}
+        JSON.parse(@response.body).should == {'type' =&gt; 'Login'}
       end
     end
   end</diff>
      <filename>spec/rails_integration/vote_submissions_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -37,7 +37,9 @@ describe &quot;A User on the home page&quot; do
         before do
           element(&quot;css=.score&quot;).assert_contains('0')
           click &quot;css=.up&quot;
-          assert_location_ends_with new_session_path
+          pending &quot;Client side will handle login&quot; do
+            assert_location_ends_with new_session_path
+          end
           @user = users(:quentin)
           element(&quot;link=Login&quot;).click
           element(&quot;name=login&quot;).type(user.login)</diff>
      <filename>spec/selenium/vote_submissions_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7fad954a16dc46226900fb1a99e2a1f8b64cf211</id>
    </parent>
  </parents>
  <author>
    <name>Brian Takita</name>
    <email>brian.takita@gmail.com</email>
  </author>
  <url>http://github.com/btakita/pain-point/commit/1730d32c19b1f45e2d3675910e515cc979e6e691</url>
  <id>1730d32c19b1f45e2d3675910e515cc979e6e691</id>
  <committed-date>2008-05-28T11:58:49-07:00</committed-date>
  <authored-date>2008-05-28T11:58:49-07:00</authored-date>
  <message>Moving toward having the client side handle the login.</message>
  <tree>f6dbada8aad048db97eb0f98e681fd1dc21c828b</tree>
  <committer>
    <name>Brian Takita</name>
    <email>brian.takita@gmail.com</email>
  </committer>
</commit>
