Skip to content

Commit

Permalink
Add log in & sign up pages and its logic (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
canan8 authored May 25, 2020
1 parent 44f58f0 commit 8e4e861
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 107 deletions.
66 changes: 40 additions & 26 deletions app/views/devise/registrations/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,29 +1,43 @@
<h2>Sign up</h2>

<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
<div class="ui container">
<%= render "devise/shared/error_messages", resource: resource %>

<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
</div>

<div class="field">
<%= f.label :password %>
<% if @minimum_password_length %>
<em>(<%= @minimum_password_length %> characters minimum)</em>
<% end %><br />
<%= f.password_field :password, autocomplete: "new-password" %>
</div>

<div class="field">
<%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
</div>

<div class="actions">
<%= f.submit "Sign up" %>
<div class="ui placeholder segment">
<div class="ui two column very relaxed stackable grid">
<div class="column">
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: {class: "ui form"}) do |f| %>
<div class="field">
<%= f.label :email %>
<div class="ui left icon input">
<%= f.email_field :email, placeholder: "Email", autofocus: true, autocomplete: "email" %>
<i class="user icon"></i>
</div>
</div>
<div class="field">
<%= f.label :password %>
<div class="ui left icon input">
<%= f.password_field :password, autocomplete: "new-password", placeholder: "Password" %>
<i class="lock icon"></i>
</div>
</div>
<div class="field">
<%= f.label :password_confirmation %>
<div class="ui left icon input">
<%= f.password_field :password_confirmation, autocomplete: "new-password", placeholder: "Password" %>
<i class="lock icon"></i>
</div>
</div>
<%= f.button "Sign up", class: "ui blue submit button" %>
<% end %>
</div>
<div class="middle aligned column">
<div class="field">
<%= link_to "Log in", session_path(resource_name), class: "ui big button" %>
</div>
</div>
</div>
<div class="ui vertical divider">
Or
</div>
</div>
<% end %>
</div>

<%= render "devise/shared/links" %>
<!-- <%= render "devise/shared/links" %> -->
61 changes: 38 additions & 23 deletions app/views/devise/sessions/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
<h2>Log in</h2>

<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
</div>

<div class="field">
<%= f.label :password %><br />
<%= f.password_field :password, autocomplete: "current-password" %>
</div>

<% if devise_mapping.rememberable? %>
<div class="field">
<%= f.check_box :remember_me %>
<%= f.label :remember_me %>
<div class="ui container">
<div class="ui placeholder segment">
<div class="ui two column very relaxed stackable grid">
<div class="column">
<%= form_for(resource, as: resource_name, url: session_path(resource_name), html: { class: "ui form" }) do |f| %>
<div class="field">
<%= f.label :email %>
<div class="ui left icon input">
<%= f.email_field :email, autofocus: true, autocomplete: "email", placeholder: "Email" %>
<i class="user icon"></i>
</div>
</div>
<div class="field">
<%= f.label :password %>
<div class="ui left icon input">
<%= f.password_field :password, autocomplete: "current-password", placeholder: "Password" %>
<i class="lock icon"></i>
</div>
</div>
<% if devise_mapping.rememberable? %>
<div class="field">
<%= f.check_box :remember_me %>
<%= f.label :remember_me %>
</div>
<% end %>
<%= f.button "Log in", class: "ui blue submit button" %>
<% end %>
</div>
<div class="middle aligned column">
<div class="field">
<%= link_to "Sign up", new_user_registration_path, class: "ui big button" %>
</div>
</div>
</div>
<div class="ui vertical divider">
Or
</div>
<% end %>

<div class="actions">
<%= f.submit "Log in" %>
</div>
<% end %>
</div>

<%= render "devise/shared/links" %>
<!-- <%= render "devise/shared/links" %> -->
58 changes: 0 additions & 58 deletions app/views/welcome/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,59 +1 @@
<!-- %h2.ui.centered.header Welcome to Pretro!
.ui.container
.ui.placeholder.segment
.ui.two.column.very.relaxed.stackable.grid
.column
= form_with scope: :session, class: "ui form", url: login_path do |f|
.field
=f.label :username
.ui.left.icon.input
=f.text_field :username, placeholder: "Username"
%i.user.icon
.field
=f.label :password
.ui.left.icon.input
=f.text_field :password, placeholder: "Password"
%i.lock.icon
= f.button "Log in", class: "ui blue submit button"
.middle.aligned.column
.ui.big.button
%i.signup.icon
Sign Up
.ui.vertical.divider
Or -->
<h2 class="ui centered header">Welcome to Pretro!</h2>
<div class="ui container">
<div class="ui placeholder segment">
<div class="ui two column very relaxed stackable grid">
<div class="column">
<%= form_with scope: :session, class: "ui form", url: user_session_path, html: { method: :post } do |f| %>
<div class="field">
<%= f.label :email %>
<div class="ui left icon input">
<%= f.text_field :email, placeholder: "Email" %>
<i class="user icon"></i>
</div>
</div>
<div class="field">
<%= f.label :password %>
<div class="ui left icon input">
<%= f.text_field :password, placeholder: "Password" %>
<i class="lock icon"></i>
</div>
</div>
<%= f.button "Log in", class: "ui blue submit button" %>
<% end %>
</div>
<div class="middle aligned column">
<div class="ui big button">
<i class="signup icon"></i>
Sign Up
</div>
</div>
</div>
<div class="ui vertical divider">
Or
</div>
</div>
</div>

0 comments on commit 8e4e861

Please sign in to comment.