mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-24 08:52:14 -04:00
HAML-ify new session
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
<h2>Sign in</h2>
|
||||
|
||||
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
|
||||
<div><%= f.label :login %><br />
|
||||
<%= f.text_field :login %></div>
|
||||
|
||||
<div><%= f.label :password %><br />
|
||||
<%= f.password_field :password %></div>
|
||||
|
||||
<% if devise_mapping.rememberable? -%>
|
||||
<div><%= f.check_box :remember_me %> <%= f.label :remember_me %></div>
|
||||
<% end -%>
|
||||
|
||||
<div><%= f.submit "Sign in" %></div>
|
||||
<% end %>
|
||||
|
||||
<%= render "devise/shared/links" %>
|
||||
23
app/views/devise/sessions/new.html.haml
Normal file
23
app/views/devise/sessions/new.html.haml
Normal file
@@ -0,0 +1,23 @@
|
||||
%h2 Sign in
|
||||
|
||||
= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f|
|
||||
%div
|
||||
= f.label :login
|
||||
%br
|
||||
= f.text_field :login
|
||||
|
||||
%div
|
||||
= f.label :password
|
||||
%br
|
||||
= f.password_field :password
|
||||
|
||||
- if devise_mapping.rememberable?
|
||||
%div
|
||||
= f.check_box :remember_me
|
||||
= f.label :remember_me
|
||||
|
||||
%div
|
||||
= f.submit "Sign in"
|
||||
|
||||
|
||||
= render "devise/shared/links"
|
||||
25
app/views/devise/shared/_links.haml
Normal file
25
app/views/devise/shared/_links.haml
Normal file
@@ -0,0 +1,25 @@
|
||||
- if controller_name != 'sessions'
|
||||
= link_to "Sign in", new_session_path(resource_name)
|
||||
%br
|
||||
|
||||
- if devise_mapping.registerable? && controller_name != 'registrations'
|
||||
= link_to "Sign up", new_registration_path(resource_name)
|
||||
%br
|
||||
|
||||
- if devise_mapping.recoverable? && controller_name != 'passwords'
|
||||
= link_to "Forgot your password?", new_password_path(resource_name)
|
||||
%br
|
||||
|
||||
- if devise_mapping.confirmable? && controller_name != 'confirmations'
|
||||
= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name)
|
||||
%br
|
||||
|
||||
- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks'
|
||||
= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name)
|
||||
%br
|
||||
|
||||
- if devise_mapping.omniauthable?
|
||||
- resource_class.omniauth_providers.each do |provider|
|
||||
= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider)
|
||||
%br
|
||||
|
||||
20
spec/views/devise/sessions/new_spec.rb
Normal file
20
spec/views/devise/sessions/new_spec.rb
Normal file
@@ -0,0 +1,20 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'devise/sessions/new.html.haml', :type => "view" do
|
||||
|
||||
context "logged in" do
|
||||
before(:each) do
|
||||
@view.stub(:resource).and_return(User.new)
|
||||
@view.stub(:resource_name).and_return("user")
|
||||
@view.stub(:resource_class).and_return(User)
|
||||
@view.stub(:devise_mapping).and_return(Devise.mappings[:user])
|
||||
render
|
||||
end
|
||||
|
||||
it 'should have some fields' do
|
||||
rendered.should contain 'Remember me'
|
||||
rendered.should contain 'Password'
|
||||
rendered.should contain 'Sign in'
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user