Add devise defaults
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
#= require jquery
|
||||
#= require jquery_ujs
|
||||
#= require vendor/modernizr
|
||||
#= require foundation
|
||||
#= require_directory .
|
||||
#= require_self
|
||||
$(document).on 'click', '.flash-box', -> $(@).slideUp()
|
||||
$ ->
|
||||
$('.menu-secondary-toggle').click -> $('.nav.secondary').toggleClass('active')
|
||||
$(document).foundation()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Taken from the bootstrap and overrides source, application not
|
||||
// verified
|
||||
body
|
||||
.nav
|
||||
.nav
|
||||
> li
|
||||
> a
|
||||
&:hover
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
padding-left: 8px
|
||||
padding-right: 8px
|
||||
line-height: 30px
|
||||
box-shadow: 2px 6px 10px #333
|
||||
&:hover
|
||||
color: white
|
||||
text-decoration: underline
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
ul.devise-nav
|
||||
+inline-list
|
||||
|
||||
.devise-links
|
||||
+sub-nav
|
||||
margin-top: 22px
|
||||
background-color: #f2f2f2
|
||||
padding: 10px 10px 10px 0
|
||||
|
||||
@@ -2,7 +2,7 @@ module DeviseHelper
|
||||
def devise_error_messages!
|
||||
if resource.errors.present?
|
||||
content_tag(:div,
|
||||
content_tag(:h3, t("errors.messages.not_saved.#{resource.errors.size == 1 ? 'one' : 'other'}", count: resource.errors.size)) +
|
||||
content_tag(:h3, t("errors.messages.not_saved.#{resource.errors.size == 1 ? 'one' : 'other'}", resource: resource.class.model_name.human, count: resource.errors.size)) +
|
||||
content_tag(:ul, resource.errors.full_messages.map{|m| content_tag(:li, m)}.join.html_safe),
|
||||
class: 'form-errors'
|
||||
)
|
||||
|
||||
@@ -16,7 +16,7 @@ class Employee
|
||||
end
|
||||
|
||||
#view :by_confirmation_token, key: :confirmation_token # devise confirmable
|
||||
devise :database_authenticatable, :recoverable, :rememberable, :trackable #, :registerable #, :confirmable
|
||||
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable #, :registerable #, :confirmable
|
||||
property :unconfirmed_email
|
||||
|
||||
property :name
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
ul.nav.nav-pills.devise-nav
|
||||
dl.devise-links
|
||||
- devise_mapping = Devise.mappings[resource_name]
|
||||
dt= t 'devise.links.prefix'
|
||||
- if controller_name != 'sessions'
|
||||
li= link_to t('devise.sessions.button'), new_session_path(resource_name), class: [:devise, :btn]
|
||||
dd= link_to t('devise.sign_in.link'), new_session_path(resource_name), class: ['devise-link', 'new-session']
|
||||
|
||||
- if devise_mapping.registerable? && controller_name != 'registrations'
|
||||
li= link_to t('devise.registrations.button'), new_registration_path(resource_name), class: [:devise, :btn]
|
||||
dd= link_to t('devise.registrations.link'), new_registration_path(resource_name), class: ['devise-link', 'new-registration']
|
||||
- if resource_name == :employee and controller_name != 'new_suppliers'
|
||||
dd= link_to t('devise.registrations.link'), new_suppliers_path, class: ['devise-link', 'new-registration']
|
||||
|
||||
- if devise_mapping.recoverable? && controller_name != 'passwords'
|
||||
li= link_to t('devise.sessions.forgot_your_password'), new_password_path(resource_name), class: [:devise, :btn]
|
||||
dd= link_to t('devise.passwords.link'), new_password_path(resource_name), class: ['devise-link', 'forgot-password']
|
||||
|
||||
- if devise_mapping.confirmable? && controller_name != 'confirmations'
|
||||
li= link_to t('devise.confirmations.did_not_receive_instructions_link'), new_confirmation_path(resource_name), class: [:devise, :btn]
|
||||
dd= link_to t('devise.confirmations.did_not_receive_instructions_link'), new_confirmation_path(resource_name), class: ['devise-link', 'did-not-receive-instructions']
|
||||
|
||||
- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks'
|
||||
li= link_to t('devise.unlocks.did_not_receive_instructions_link'), new_unlock_path(resource_name), class: [:devise, :btn]
|
||||
dd= link_to t('devise.unlocks.did_not_receive_instructions_link'), new_unlock_path(resource_name), class: ['devise-link', 'did-not-receive-instructions']
|
||||
|
||||
- if devise_mapping.omniauthable?
|
||||
- resource_class.omniauth_providers.each do |provider|
|
||||
li= link_to t('devise.omniauth_callbacks.sign_in_with', provider: provider.to_s.titleize), omniauth_authorize_path(resource_name, provider), class: [:devise, :btn]
|
||||
dd= link_to t('devise.omniauth_callbacks.sign_in_with', provider: provider.to_s.titleize), omniauth_authorize_path(resource_name, provider), class: ['devise-link', 'omniauth', provider]
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<h2>Resend confirmation instructions</h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Resend confirmation instructions" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "devise/shared/links" %>
|
||||
@@ -0,0 +1,5 @@
|
||||
<p>Welcome <%= @email %>!</p>
|
||||
|
||||
<p>You can confirm your account email through the link below:</p>
|
||||
|
||||
<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>
|
||||
@@ -0,0 +1,8 @@
|
||||
<p>Hello <%= @resource.email %>!</p>
|
||||
|
||||
<p>Someone has requested a link to change your password. You can do this through the link below.</p>
|
||||
|
||||
<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>
|
||||
|
||||
<p>If you didn't request this, please ignore this email.</p>
|
||||
<p>Your password won't change until you access the link above and create a new one.</p>
|
||||
@@ -0,0 +1,7 @@
|
||||
<p>Hello <%= @resource.email %>!</p>
|
||||
|
||||
<p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
|
||||
|
||||
<p>Click the link below to unlock your account:</p>
|
||||
|
||||
<p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p>
|
||||
@@ -0,0 +1,39 @@
|
||||
<h2>Edit <%= resource_name.to_s.humanize %></h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true %>
|
||||
</div>
|
||||
|
||||
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
|
||||
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
|
||||
<% end %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
|
||||
<%= f.password_field :password, autocomplete: "off" %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password_confirmation %><br />
|
||||
<%= f.password_field :password_confirmation, autocomplete: "off" %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
|
||||
<%= f.password_field :current_password, autocomplete: "off" %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Update" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<h3>Cancel my account</h3>
|
||||
|
||||
<p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p>
|
||||
|
||||
<%= link_to "Back", :back %>
|
||||
@@ -0,0 +1,29 @@
|
||||
<h2>Sign up</h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password %>
|
||||
<% if @validatable %>
|
||||
<em>(<%= @minimum_password_length %> characters minimum)</em>
|
||||
<% end %><br />
|
||||
<%= f.password_field :password, autocomplete: "off" %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password_confirmation %><br />
|
||||
<%= f.password_field :password_confirmation, autocomplete: "off" %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Sign up" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "devise/shared/links" %>
|
||||
@@ -0,0 +1,26 @@
|
||||
<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 %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password %><br />
|
||||
<%= f.password_field :password, autocomplete: "off" %>
|
||||
</div>
|
||||
|
||||
<% if devise_mapping.rememberable? -%>
|
||||
<div class="field">
|
||||
<%= f.check_box :remember_me %>
|
||||
<%= f.label :remember_me %>
|
||||
</div>
|
||||
<% end -%>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Log in" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "devise/shared/links" %>
|
||||
@@ -0,0 +1,25 @@
|
||||
<%- if controller_name != 'sessions' %>
|
||||
<%= link_to "Log in", new_session_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
|
||||
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
|
||||
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
||||
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- 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 />
|
||||
<% end -%>
|
||||
|
||||
<%- 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 />
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
@@ -0,0 +1,16 @@
|
||||
<h2>Resend unlock instructions</h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Resend unlock instructions" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "devise/shared/links" %>
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<p>Someone has requested a link to change your password, and you can do this through the link below.</p>
|
||||
|
||||
<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p>
|
||||
<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>
|
||||
|
||||
<p>If you didn't request this, please ignore this email.</p>
|
||||
<p>Your password won't change until you access the link above and create a new one.</p>
|
||||
|
||||
+4
-4
@@ -1,12 +1,12 @@
|
||||
h2= t('devise.passwords.edit.title')
|
||||
= form_for(resource, :as => resource_name, :url => password_path(resource_name), html: {class: 'form-horizontal', method: :put}) do |f|
|
||||
= form_for(resource, :as => resource_name, :url => password_path(resource_name), html: {method: :put}) do |f|
|
||||
= devise_error_messages!
|
||||
= f.hidden_field :reset_password_token
|
||||
.form-row
|
||||
= f.row :password
|
||||
.form-label= f.label :password
|
||||
.form-field= f.password_field :password
|
||||
= f.row :password_confirmation do
|
||||
= f.row :password_confirmation
|
||||
.form-label= f.label :password_confirmation
|
||||
.form-field= f.password_field :password_confirmation
|
||||
.form-row= f.submit t('devise.passwords.edit.button'), class: 'button'
|
||||
= render "links"
|
||||
= render "devise/links"
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
h2= t('devise.passwords.title')
|
||||
= form_for(resource, :as => resource_name, :url => password_path(resource_name), html: {class: 'form-horizontal'}) do |f|
|
||||
= form_for(resource, :as => resource_name, :url => password_path(resource_name)) do |f|
|
||||
= devise_error_messages!
|
||||
= f.row :email do
|
||||
.form-label= f.label :email, class: 'control-label'
|
||||
.form-field= f.email_field :email
|
||||
.form-row.form-actions= f.submit t('devise.passwords.button'), class: 'button'
|
||||
= render "links"
|
||||
= render "devise/links"
|
||||
@@ -37,3 +37,4 @@
|
||||
.form-actions
|
||||
= f.submit class: 'button'
|
||||
|
||||
= render "devise/links", resource_name: :employee
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
h2= t('devise.sessions.title')
|
||||
= form_for(resource, :as => resource_name, :url => session_path(resource_name), html: {class: 'form-horizontal'}) do |f|
|
||||
h2= t('devise.sign_in.title')
|
||||
= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f|
|
||||
= devise_error_messages!
|
||||
= f.row :email do
|
||||
.form-label= f.label :email
|
||||
.form-field= f.email_field :email
|
||||
= f.row :email do
|
||||
.form-label= f.label :password, class: 'control-label'
|
||||
.form-label= f.label :password
|
||||
.form-field= f.password_field :password
|
||||
.form-row
|
||||
= f.label :remember_me do
|
||||
= f.check_box :remember_me
|
||||
|
|
||||
= t('devise.sessions.remember_me')
|
||||
= t('devise.sign_in.remember_me')
|
||||
.form-row
|
||||
= f.submit t('devise.sessions.button'), class: 'new-session-button'
|
||||
= render "links"
|
||||
= f.submit t('devise.sign_in.button'), class: 'devise-button new-session-button'
|
||||
= render "devise/links"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
- if flash[:alert].present?
|
||||
.alert-box.warning
|
||||
.alert-box.warning data-alert=true
|
||||
= flash[:alert]
|
||||
a.close data-dismiss="alert" ×
|
||||
- if flash[:notice].present?
|
||||
.alert-box.info
|
||||
.alert-box.info data-alert=true
|
||||
= flash[:notice]
|
||||
a.close data-dismiss="alert" ×
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
a.theme-button Test
|
||||
.social
|
||||
a.wsite-social-facebook href="https://www.facebook.com/mozo.bar" target=:_blank
|
||||
span.wsite-social-inner
|
||||
@@ -8,3 +7,5 @@ a.theme-button Test
|
||||
span.wsite-social-inner
|
||||
/a.wsite-social-rss
|
||||
span.wsite-social-inner
|
||||
.pull-right
|
||||
= link_to t('devise.registrations.link'), new_suppliers_path, class: 'theme-button'
|
||||
|
||||
Reference in New Issue
Block a user