devise views improoved

This commit is contained in:
Adrian Hinz 2019-05-09 05:58:00 +02:00
parent 4d13d81967
commit 6bf60cd8cb
8 changed files with 295 additions and 53 deletions

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
class ApplicationController < ActionController::Base
# before_action :authenticate_user!
before_action :authenticate_user!
layout :layout_by_resource

View File

@ -1,25 +1,29 @@
<h2>Change your password</h2>
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
<div class="row">
<div class="col-lg-6 d-none d-lg-block bg-password-image"></div>
<div class="col-lg-6">
<div class="p-5">
<div class="text-center">
<h1 class="h4 text-gray-900 mb-4"><%= t('devise.passwords.edit.change_your_password') %></h1>
</div>
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put, class: 'user' }) do |f| %>
<%= render "devise/shared/error_messages", resource: resource %>
<%= f.hidden_field :reset_password_token %>
<div class="field">
<%= f.label :password, "New password" %><br />
<div class="form-group">
<%= f.password_field :password, autofocus: true, autocomplete: "new-password", placeholder: t('devise.passwords.edit.new_password'), class: 'form-control form-control-user' %>
<% if @minimum_password_length %>
<em>(<%= @minimum_password_length %> characters minimum)</em><br />
<small class="form-text text-muted"><%= t('devise.shared.minimum_password_length', count: @minimum_password_length) %></small><br/>
<% end %>
<%= f.password_field :password, autofocus: true, autocomplete: "new-password" %>
</div>
<div class="field">
<%= f.label :password_confirmation, "Confirm new password" %><br />
<%= f.password_field :password_confirmation, autocomplete: "off" %>
<div class="form-group">
<%= f.password_field :password_confirmation, autocomplete: "off", placeholder: t('devise.passwords.edit.confirm_new_password'), class: 'form-control form-control-user' %>
</div>
<div class="actions">
<%= f.submit "Change my password" %>
<%= f.submit t('devise.passwords.edit.change_my_password'), class: 'btn btn-primary btn-user btn-block' %>
<% end %>
<hr>
<%= render "devise/shared/links" %>
</div>
<% end %>
<%= render "devise/shared/links" %>
</div>
</div>

View File

@ -1,16 +1,21 @@
<h2>Forgot your password?</h2>
<div class="row">
<div class="col-lg-6 d-none d-lg-block bg-password-image"></div>
<div class="col-lg-6">
<div class="p-5">
<div class="text-center">
<h1 class="h4 text-gray-900 mb-4"><%= t('devise.passwords.new.forgot_your_password') %></h1>
</div>
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post, class: 'user' }) do |f| %>
<%= render "devise/shared/error_messages", resource: resource %>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
<div class="form-group">
<%= f.email_field :email, autofocus: true, autocomplete: "email", placeholder: 'Email', class: 'form-control form-control-user' %>
</div>
<div class="actions">
<%= f.submit "Send me reset password instructions" %>
<%= f.submit t('devise.passwords.new.send_me_reset_password_instructions'), class: 'btn btn-primary btn-user btn-block' %>
<% end %>
<hr>
<%= render "devise/shared/links" %>
</div>
<% end %>
<%= render "devise/shared/links" %>
</div>
</div>

View File

@ -1,13 +1,12 @@
<!-- Nested Row within Card Body -->
<div class="row">
<div class="col-lg-6 d-none d-lg-block bg-login-image"></div>
<div class="col-lg-6">
<div class="p-5">
<div class="text-center">
<h1 class="h4 text-gray-900 mb-4">Witaj!</h1>
<h1 class="h4 text-gray-900 mb-4"><%= t('welcome') %></h1>
</div>
<%= form_for(resource, as: resource_name, url: session_path(resource_name), html: {class: 'user'}) do |f| %>
<%= form_for(resource, as: resource_name, url: session_path(resource_name), html: { class: 'user' }) do |f| %>
<div class="form-group">
<%= f.email_field :email, autofocus: true, autocomplete: "email", placeholder: 'Email', class: 'form-control form-control-user' %>
</div>

View File

@ -1,11 +1,11 @@
<% if resource.errors.any? %>
<div id="error_explanation">
<h2>
<div id="error_explanation" class="alert alert-danger" role="alert">
<h5>
<%= I18n.t("errors.messages.not_saved",
count: resource.errors.count,
resource: resource.class.model_name.human.downcase)
%>
</h2>
</h5>
<ul>
<% resource.errors.full_messages.each do |message| %>
<li><%= message %></li>

View File

@ -123,10 +123,8 @@
Activity Log
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#logoutModal">
<i class="fas fa-sign-out-alt fa-sm fa-fw mr-2 text-gray-400"></i>
Logout
</a>
<%= link_to(raw("<i class=\"fas fa-sign-out-alt fa-sm fa-fw mr-2 text-gray-400\"></i> #{t('logout')}"), destroy_user_session_path, method: :delete, class: "dropdown-item") %>
</div>
</li>

View File

@ -126,11 +126,7 @@ pl:
sign_in: Zaloguj się
sign_in_with_provider: Zaloguj się przez %{provider}
sign_up: Zarejestruj się
minimum_password_length:
few: "(minimum %{count} znaki)"
many: "(minimum %{count} znaków)"
one: "(minimum %{count} znak)"
other: "(minimum %{count} znaku)"
minimum_password_length: "minimalna ilość znaków: %{count}"
unlocks:
new:
resend_unlock_instructions: Wyślij instrukcje odblokowania konta

View File

@ -1,4 +1,5 @@
pl:
welcome: 'Witaj!'
logout: 'Wyloguj'
login: 'Zaloguj'
add: 'Dodaj'
@ -31,3 +32,242 @@ pl:
forgot_password: 'Zapomniane hasło?'
no_account: 'Nie masz konta?'
spikon_inv: 'Zapraszamy do Spikon!'
activerecord:
errors:
messages:
record_invalid: 'Negatywne sprawdzenie poprawności: %{errors}'
restrict_dependent_destroy:
has_one: Nie może zostać usunięte, gdyż istnieje zależny od niego %{record}
has_many: Nie może zostać usunięte, gdyż istnieją zależne od niego %{record}
date:
abbr_day_names:
- nie
- pon
- wto
- śro
- czw
- pią
- sob
abbr_month_names:
-
- sty
- lut
- mar
- kwi
- maj
- cze
- lip
- sie
- wrz
- paź
- lis
- gru
day_names:
- niedziela
- poniedziałek
- wtorek
- środa
- czwartek
- piątek
- sobota
formats:
default: "%d-%m-%Y"
long: "%B %d, %Y"
short: "%d %b"
month_names:
-
- styczeń
- luty
- marzec
- kwiecień
- maj
- czerwiec
- lipiec
- sierpień
- wrzesień
- październik
- listopad
- grudzień
order:
- :day
- :month
- :year
datetime:
distance_in_words:
about_x_hours:
one: około godziny
few: około %{count} godziny
many: około %{count} godzin
other: około %{count} godzin
about_x_months:
one: około miesiąca
few: około %{count} miesiące
many: około %{count} miesięcy
other: około %{count} miesięcy
about_x_years:
one: około rok
few: około %{count} lata
many: około %{count} lat
other: około %{count} lat
almost_x_years:
one: prawie rok
few: prawie %{count} lata
many: prawie %{count} lat
other: prawie %{count} lat
half_a_minute: pół minuty
less_than_x_seconds:
one: mniej niż sekundę
few: mniej niż %{count} sekundy
many: mniej niż %{count} sekund
other: mniej niż %{count} sekund
less_than_x_minutes:
one: mniej niż minutę
few: mniej niż %{count} minuty
many: mniej niż %{count} minut
other: mniej niż %{count} minut
over_x_years:
one: ponad rok
few: ponad %{count} lata
many: ponad %{count} lat
other: ponad %{count} lat
x_seconds:
one: 1 sekunda
few: "%{count} sekundy"
many: "%{count} sekund"
other: "%{count} sekund"
x_minutes:
one: 1 minuta
few: "%{count} minuty"
many: "%{count} minut"
other: "%{count} minut"
x_days:
one: 1 dzień
few: "%{count} dni"
many: "%{count} dni"
other: "%{count} dni"
x_months:
one: 1 miesiąc
few: "%{count} miesiące"
many: "%{count} miesięcy"
other: "%{count} miesięcy"
prompts:
second: Sekundy
minute: Minuta
hour: Godzina
day: Dzień
month: Miesiąc
year: Rok
errors:
format: "%{attribute} %{message}"
messages:
accepted: musi zostać zaakceptowane
blank: nie może być puste
confirmation: nie zgadza się z polem %{attribute}
empty: nie może być puste
equal_to: musi być równe %{count}
even: musi być parzyste
exclusion: jest zarezerwowane
greater_than: musi być większe od %{count}
greater_than_or_equal_to: musi być większe lub równe %{count}
inclusion: nie znajduje się na liście dopuszczalnych wartości
invalid: jest nieprawidłowe
less_than: musi być mniejsze od %{count}
less_than_or_equal_to: musi być mniejsze lub równe %{count}
not_a_number: nie jest liczbą
not_an_integer: musi być liczbą całkowitą
odd: musi być nieparzyste
other_than: musi być inna niż %{count}
present: musi być puste
required: musi istnieć
taken: zostało już zajęte
too_long:
one: jest za długie (maksymalnie jeden znak)
few: jest za długie (maksymalnie %{count} znaki)
many: jest za długie (maksymalnie %{count} znaków)
other: jest za długie (maksymalnie %{count} znaków)
too_short:
one: jest za krótkie (przynajmniej jeden znak)
few: jest za krótkie (przynajmniej %{count} znaki)
many: jest za krótkie (przynajmniej %{count} znaków)
other: jest za krótkie (przynajmniej %{count} znaków)
wrong_length:
one: ma nieprawidłową długość (powinna wynosić jeden znak)
few: ma nieprawidłową długość (powinna wynosić %{count} znaki)
many: ma nieprawidłową długość (powinna wynosić %{count} znaków)
other: ma nieprawidłową długość (powinna wynosić %{count} znaków)
template:
body: 'Błędy dotyczą następujących pól:'
header:
one: "%{model} nie został zachowany z powodu jednego błędu"
few: "%{model} nie został zachowany z powodu %{count} błędów"
many: "%{model} nie został zachowany z powodu %{count} błędów"
other: "%{model} nie został zachowany z powodu %{count} błędów"
helpers:
select:
prompt: Proszę wybrać
submit:
create: Utwórz %{model}
submit: Zapisz %{model}
update: Aktualizuj %{model}
number:
currency:
format:
delimiter: " "
format: "%n %u"
precision: 2
separator: ","
significant: false
strip_insignificant_zeros: true
unit:
format:
delimiter: " "
precision: 3
separator: ","
significant: false
strip_insignificant_zeros: false
human:
decimal_units:
format: "%n %u"
units:
billion: Miliard
million: Milion
quadrillion: Biliard
thousand: Tysiąc
trillion: Bilion
unit: ''
format:
delimiter: ''
precision: 3
significant: true
strip_insignificant_zeros: true
storage_units:
format: "%n %u"
units:
byte:
one: bajt
few: bajty
many: bajtów
other: bajty
gb: GB
kb: KB
mb: MB
tb: TB
percentage:
format:
delimiter: ''
format: "%n%"
precision:
format:
delimiter: ''
support:
array:
last_word_connector: " oraz "
two_words_connector: " i "
words_connector: ", "
time:
am: przed południem
formats:
default: "%a, %d %b %Y %H:%M:%S %z"
long: "%B %d, %Y %H:%M"
short: "%d %b %H:%M"
pm: po południu