Add sign_in button to profile view
This commit is contained in:
parent
e3fc106db1
commit
8c359b97f9
|
@ -11,7 +11,7 @@ class HydrantsController < ApplicationController
|
|||
if user_signed_in?
|
||||
render("adopt", :layout => "info_window")
|
||||
else
|
||||
render("users/new", :layout => "info_window")
|
||||
render("sessions/new", :layout => "info_window")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
class SessionsController < Devise::SessionsController
|
||||
def new
|
||||
render("new", :layout => "info_window")
|
||||
end
|
||||
|
||||
def create
|
||||
resource = warden.authenticate(:scope => resource_name)
|
||||
if resource
|
||||
|
|
|
@ -8,4 +8,4 @@
|
|||
<p>By adopting this hydrant, you agree to the <%= link_to "Terms of Service", "#", :tabindex => 3 %>.</p>
|
||||
<% end %>
|
||||
<%= render(:partial => 'users/edit_profile') %>
|
||||
<%= render(:partial => 'users/sign_out') %>
|
||||
<%= render(:partial => 'sessions/sign_out') %>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<%= form_for(:sign_in, :html => {:id => "sign_in_form"}) do |f| %>
|
||||
<%= f.submit "Sign in", :id => "sign_in_form_submit" %>
|
||||
<% end %>
|
|
@ -3,5 +3,7 @@
|
|||
<% if user_signed_in? %>
|
||||
<%= render(:partial => 'users/edit_profile') %>
|
||||
<%= render(:partial => 'hydrants/steal') %>
|
||||
<%= render(:partial => 'users/sign_out') %>
|
||||
<%= render(:partial => 'sessions/sign_out') %>
|
||||
<% else %>
|
||||
<%= render(:partial => 'sessions/sign_in') %>
|
||||
<% end %>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<h2>Thank you for adopting this hydrant!</h2>
|
||||
<%= render(:partial => 'users/edit_profile') %>
|
||||
<%= render(:partial => 'hydrants/abandon') %>
|
||||
<%= render(:partial => 'users/sign_out') %>
|
||||
<%= render(:partial => 'sessions/sign_out') %>
|
||||
|
|
|
@ -378,36 +378,6 @@ $(function() {
|
|||
}
|
||||
return false;
|
||||
});
|
||||
$('#sign_out_form').live('submit', function() {
|
||||
var submitButton = $("#sign_out_form input[type='submit']");
|
||||
$(submitButton).attr("disabled", true);
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/users/sign_out.json',
|
||||
data: {
|
||||
'commit': $('#sign_out_form_submit').val(),
|
||||
'utf8': '✓',
|
||||
'authenticity_token': $('#sign_out_form input[name="authenticity_token"]').val()
|
||||
},
|
||||
beforeSend: function() {
|
||||
$('#info_window').hide();
|
||||
$('#loader').show();
|
||||
},
|
||||
success: function(data) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/hydrant',
|
||||
data: {
|
||||
'hydrant_id': activeHydrantId
|
||||
},
|
||||
success: function(data) {
|
||||
activeInfoWindow.setContent(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
$('#adoption_form').live('submit', function() {
|
||||
var submitButton = $("#adoption_form input[type='submit']");
|
||||
$(submitButton).attr("disabled", true);
|
||||
|
@ -677,13 +647,67 @@ $(function() {
|
|||
}
|
||||
return false;
|
||||
});
|
||||
$('#sign_out_form').live('submit', function() {
|
||||
var submitButton = $("#sign_out_form input[type='submit']");
|
||||
$(submitButton).attr("disabled", true);
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/users/sign_out.json',
|
||||
data: {
|
||||
'commit': $('#sign_out_form_submit').val(),
|
||||
'utf8': '✓',
|
||||
'authenticity_token': $('#sign_out_form input[name="authenticity_token"]').val()
|
||||
},
|
||||
beforeSend: function() {
|
||||
$('#info_window').hide();
|
||||
$('#loader').show();
|
||||
},
|
||||
success: function(data) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/hydrant',
|
||||
data: {
|
||||
'hydrant_id': activeHydrantId
|
||||
},
|
||||
success: function(data) {
|
||||
activeInfoWindow.setContent(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
$('#sign_in_form').live('submit', function() {
|
||||
var submitButton = $("#sign_in_form input[type='submit']");
|
||||
$(submitButton).attr("disabled", true);
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/users/sign_in',
|
||||
data: {
|
||||
'commit': $('#sign_in_form_submit').val(),
|
||||
'utf8': '✓',
|
||||
'authenticity_token': $('#sign_in_form input[name="authenticity_token"]').val(),
|
||||
},
|
||||
beforeSend: function() {
|
||||
$('#info_window').hide();
|
||||
$('#loader').show();
|
||||
},
|
||||
success: function(data) {
|
||||
activeInfoWindow.setContent(data);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
$('#back_form').live('submit', function() {
|
||||
var submitButton = $("#edit_form input[type='submit']");
|
||||
var submitButton = $("#back_form input[type='submit']");
|
||||
$(submitButton).attr("disabled", true);
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/hydrant',
|
||||
data: {
|
||||
'commit': $('#back_form_submit').val(),
|
||||
'utf8': '✓',
|
||||
'authenticity_token': $('#back_form input[name="authenticity_token"]').val(),
|
||||
'hydrant_id': activeHydrantId
|
||||
},
|
||||
beforeSend: function() {
|
||||
|
|
Loading…
Reference in New Issue