From 33d126071340ce21dbce5e4eb08a4739c20c2566 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sun, 19 Jul 2015 20:50:49 +0300 Subject: [PATCH] OpenFest: Add Devise views from v1 --- .../users/confirmations/new.html.erb | 16 -------- .../open_fest/users/confirmations/new.slim | 15 +++++++ .../mailer/confirmation_instructions.html.erb | 5 --- .../mailer/confirmation_instructions.text.erb | 5 +++ .../reset_password_instructions.html.erb | 8 ---- .../reset_password_instructions.text.erb | 8 ++++ .../users/mailer/unlock_instructions.html.erb | 7 ---- .../users/mailer/unlock_instructions.text.erb | 7 ++++ .../open_fest/users/passwords/edit.html.erb | 25 ------------ .../views/open_fest/users/passwords/edit.slim | 18 +++++++++ .../open_fest/users/passwords/new.html.erb | 16 -------- .../views/open_fest/users/passwords/new.slim | 14 +++++++ .../users/registrations/edit.html.erb | 39 ------------------- .../open_fest/users/registrations/edit.slim | 31 +++++++++++++++ .../users/registrations/new.html.erb | 29 -------------- .../open_fest/users/registrations/new.slim | 16 ++++++++ .../open_fest/users/sessions/new.html.erb | 26 ------------- .../views/open_fest/users/sessions/new.slim | 14 +++++++ .../open_fest/users/shared/_links.html.erb | 25 ------------ .../views/open_fest/users/shared/_links.slim | 23 +++++++++++ .../open_fest/users/unlocks/new.html.erb | 16 -------- .../views/open_fest/users/unlocks/new.slim | 15 +++++++ 22 files changed, 166 insertions(+), 212 deletions(-) delete mode 100644 lib/open_fest/app/views/open_fest/users/confirmations/new.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/confirmations/new.slim delete mode 100644 lib/open_fest/app/views/open_fest/users/mailer/confirmation_instructions.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/mailer/confirmation_instructions.text.erb delete mode 100644 lib/open_fest/app/views/open_fest/users/mailer/reset_password_instructions.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/mailer/reset_password_instructions.text.erb delete mode 100644 lib/open_fest/app/views/open_fest/users/mailer/unlock_instructions.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/mailer/unlock_instructions.text.erb delete mode 100644 lib/open_fest/app/views/open_fest/users/passwords/edit.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/passwords/edit.slim delete mode 100644 lib/open_fest/app/views/open_fest/users/passwords/new.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/passwords/new.slim delete mode 100644 lib/open_fest/app/views/open_fest/users/registrations/edit.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/registrations/edit.slim delete mode 100644 lib/open_fest/app/views/open_fest/users/registrations/new.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/registrations/new.slim delete mode 100644 lib/open_fest/app/views/open_fest/users/sessions/new.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/sessions/new.slim delete mode 100644 lib/open_fest/app/views/open_fest/users/shared/_links.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/shared/_links.slim delete mode 100644 lib/open_fest/app/views/open_fest/users/unlocks/new.html.erb create mode 100644 lib/open_fest/app/views/open_fest/users/unlocks/new.slim diff --git a/lib/open_fest/app/views/open_fest/users/confirmations/new.html.erb b/lib/open_fest/app/views/open_fest/users/confirmations/new.html.erb deleted file mode 100644 index 826672f..0000000 --- a/lib/open_fest/app/views/open_fest/users/confirmations/new.html.erb +++ /dev/null @@ -1,16 +0,0 @@ -

Resend confirmation instructions

- -<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> - <%= devise_error_messages! %> - -
- <%= f.label :email %>
- <%= f.email_field :email, autofocus: true, value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %> -
- -
- <%= f.submit "Resend confirmation instructions" %> -
-<% end %> - -<%= render "devise/shared/links" %> diff --git a/lib/open_fest/app/views/open_fest/users/confirmations/new.slim b/lib/open_fest/app/views/open_fest/users/confirmations/new.slim new file mode 100644 index 0000000..72c8dca --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/confirmations/new.slim @@ -0,0 +1,15 @@ +- content_for(:title) { ":: #{t :resend_instructions_header}" } + +h2.entry-title = t :resend_instructions_header + += simple_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| + = f.error_notification + = f.full_error :confirmation_token + + .form-inputs + = f.input :email, required: true, autofocus: true, hint: false + + .form-actions + = f.button :submit, t(:resend_instructions_btn) + +== render 'devise/shared/links' diff --git a/lib/open_fest/app/views/open_fest/users/mailer/confirmation_instructions.html.erb b/lib/open_fest/app/views/open_fest/users/mailer/confirmation_instructions.html.erb deleted file mode 100644 index dc55f64..0000000 --- a/lib/open_fest/app/views/open_fest/users/mailer/confirmation_instructions.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

Welcome <%= @email %>!

- -

You can confirm your account email through the link below:

- -

<%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %>

diff --git a/lib/open_fest/app/views/open_fest/users/mailer/confirmation_instructions.text.erb b/lib/open_fest/app/views/open_fest/users/mailer/confirmation_instructions.text.erb new file mode 100644 index 0000000..b80b172 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/mailer/confirmation_instructions.text.erb @@ -0,0 +1,5 @@ +<%= t(:welcome, name: @email) %>! + +<%= t(:confirm_by_clicking) %> + +<%= confirmation_url(@resource, confirmation_token: @token) %> diff --git a/lib/open_fest/app/views/open_fest/users/mailer/reset_password_instructions.html.erb b/lib/open_fest/app/views/open_fest/users/mailer/reset_password_instructions.html.erb deleted file mode 100644 index f667dc1..0000000 --- a/lib/open_fest/app/views/open_fest/users/mailer/reset_password_instructions.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -

Hello <%= @resource.email %>!

- -

Someone has requested a link to change your password. You can do this through the link below.

- -

<%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %>

- -

If you didn't request this, please ignore this email.

-

Your password won't change until you access the link above and create a new one.

diff --git a/lib/open_fest/app/views/open_fest/users/mailer/reset_password_instructions.text.erb b/lib/open_fest/app/views/open_fest/users/mailer/reset_password_instructions.text.erb new file mode 100644 index 0000000..f0089f8 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/mailer/reset_password_instructions.text.erb @@ -0,0 +1,8 @@ +<%= t(:hello, name: @resource.email) %>! + +<%= t(:someone_requested_passreset) %> + +<%= edit_password_url(@resource, reset_password_token: @token) %> + +<%= t(:do_not_want_pass_reset1) %> +<%= t(:do_not_want_pass_reset2) %> diff --git a/lib/open_fest/app/views/open_fest/users/mailer/unlock_instructions.html.erb b/lib/open_fest/app/views/open_fest/users/mailer/unlock_instructions.html.erb deleted file mode 100644 index 41e148b..0000000 --- a/lib/open_fest/app/views/open_fest/users/mailer/unlock_instructions.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -

Hello <%= @resource.email %>!

- -

Your account has been locked due to an excessive number of unsuccessful sign in attempts.

- -

Click the link below to unlock your account:

- -

<%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %>

diff --git a/lib/open_fest/app/views/open_fest/users/mailer/unlock_instructions.text.erb b/lib/open_fest/app/views/open_fest/users/mailer/unlock_instructions.text.erb new file mode 100644 index 0000000..4d2a69b --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/mailer/unlock_instructions.text.erb @@ -0,0 +1,7 @@ +<%= t(:hello, name: @resource.email) %>! + +<%= t(:account_locked) %> + +<%= t(:click_to_unlock) %> + +<%= unlock_url(@resource, unlock_token: @token) %> diff --git a/lib/open_fest/app/views/open_fest/users/passwords/edit.html.erb b/lib/open_fest/app/views/open_fest/users/passwords/edit.html.erb deleted file mode 100644 index 0ee12dd..0000000 --- a/lib/open_fest/app/views/open_fest/users/passwords/edit.html.erb +++ /dev/null @@ -1,25 +0,0 @@ -

Change your password

- -<%= 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 %> - -
- <%= f.label :password, "New password" %>
- <% if @minimum_password_length %> - (<%= @minimum_password_length %> characters minimum) - <% end %>
- <%= f.password_field :password, autofocus: true, autocomplete: "off" %> -
- -
- <%= f.label :password_confirmation, "Confirm new password" %>
- <%= f.password_field :password_confirmation, autocomplete: "off" %> -
- -
- <%= f.submit "Change my password" %> -
-<% end %> - -<%= render "devise/shared/links" %> diff --git a/lib/open_fest/app/views/open_fest/users/passwords/edit.slim b/lib/open_fest/app/views/open_fest/users/passwords/edit.slim new file mode 100644 index 0000000..f39bcb7 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/passwords/edit.slim @@ -0,0 +1,18 @@ +- content_for(:title) { ":: #{t :change_pass}" } + +h2.entry-title = t :change_pass + += simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| + = f.error_notification + + = f.input :reset_password_token, as: :hidden + = f.full_error :reset_password_token + + .form-inputs + = f.input :password, required: true, autofocus: true + = f.input :password_confirmation, required: true + + .form-actions + = f.button :submit, t(:change_pass) + += render 'devise/shared/links' diff --git a/lib/open_fest/app/views/open_fest/users/passwords/new.html.erb b/lib/open_fest/app/views/open_fest/users/passwords/new.html.erb deleted file mode 100644 index 3d6d11a..0000000 --- a/lib/open_fest/app/views/open_fest/users/passwords/new.html.erb +++ /dev/null @@ -1,16 +0,0 @@ -

Forgot your password?

- -<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> - <%= devise_error_messages! %> - -
- <%= f.label :email %>
- <%= f.email_field :email, autofocus: true %> -
- -
- <%= f.submit "Send me reset password instructions" %> -
-<% end %> - -<%= render "devise/shared/links" %> diff --git a/lib/open_fest/app/views/open_fest/users/passwords/new.slim b/lib/open_fest/app/views/open_fest/users/passwords/new.slim new file mode 100644 index 0000000..7e1f90c --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/passwords/new.slim @@ -0,0 +1,14 @@ +- content_for(:title) { ":: #{t :lostpass}" } + +h2.entry-title = t :lostpass + += simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| + = f.error_notification + + .form-inputs + = f.input :email, required: true, autofocus: true, hint: false + + .form-actions + = f.button :submit, t(:send_lostpass_instructions) + +== render 'devise/shared/links' diff --git a/lib/open_fest/app/views/open_fest/users/registrations/edit.html.erb b/lib/open_fest/app/views/open_fest/users/registrations/edit.html.erb deleted file mode 100644 index 3ea40f0..0000000 --- a/lib/open_fest/app/views/open_fest/users/registrations/edit.html.erb +++ /dev/null @@ -1,39 +0,0 @@ -

Edit <%= resource_name.to_s.humanize %>

- -<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> - <%= devise_error_messages! %> - -
- <%= f.label :email %>
- <%= f.email_field :email, autofocus: true %> -
- - <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> -
Currently waiting confirmation for: <%= resource.unconfirmed_email %>
- <% end %> - -
- <%= f.label :password %> (leave blank if you don't want to change it)
- <%= f.password_field :password, autocomplete: "off" %> -
- -
- <%= f.label :password_confirmation %>
- <%= f.password_field :password_confirmation, autocomplete: "off" %> -
- -
- <%= f.label :current_password %> (we need your current password to confirm your changes)
- <%= f.password_field :current_password, autocomplete: "off" %> -
- -
- <%= f.submit "Update" %> -
-<% end %> - -

Cancel my account

- -

Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %>

- -<%= link_to "Back", :back %> diff --git a/lib/open_fest/app/views/open_fest/users/registrations/edit.slim b/lib/open_fest/app/views/open_fest/users/registrations/edit.slim new file mode 100644 index 0000000..7158882 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/registrations/edit.slim @@ -0,0 +1,31 @@ +- content_for(:title) { ":: #{t :edit_speaker_profile}" } + += simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put, multipart: true }) do |f| + .form_inputs + h2.entry-title = t :speaker_profile + = f.error_notification + = f.simple_fields_for :speaker_profile do |ff| + = ff.input :picture, as: :image_preview, input_html: {preview_version: :thumb}, required: true + = ff.input :first_name, autofocus: true + = ff.input :last_name + = ff.input :public_email + = ff.input :organisation + = ff.input :github + = ff.input :twitter + = ff.input :mobile_phone, input_html: {value: resource.speaker_profile.mobile_phone.try(:phony_formatted, format: :international)} + = ff.input :biography + + .form-inputs + h3.entry-title = t :login_data + = f.input :email, required: true + + - if devise_mapping.confirmable? && resource.pending_reconfirmation? + p + = t :expected_validation, email: resource.unconfirmed_email + + = f.input :password, autocomplete: "off", hint: t(:pass_update_hint1), required: false + = f.input :password_confirmation, required: false + = f.input :current_password, hint: t(:pass_update_hint2), required: true + + .form-actions + = f.button :submit, t(:update) diff --git a/lib/open_fest/app/views/open_fest/users/registrations/new.html.erb b/lib/open_fest/app/views/open_fest/users/registrations/new.html.erb deleted file mode 100644 index 5a238ce..0000000 --- a/lib/open_fest/app/views/open_fest/users/registrations/new.html.erb +++ /dev/null @@ -1,29 +0,0 @@ -

Sign up

- -<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> - <%= devise_error_messages! %> - -
- <%= f.label :email %>
- <%= f.email_field :email, autofocus: true %> -
- -
- <%= f.label :password %> - <% if @minimum_password_length %> - (<%= @minimum_password_length %> characters minimum) - <% end %>
- <%= f.password_field :password, autocomplete: "off" %> -
- -
- <%= f.label :password_confirmation %>
- <%= f.password_field :password_confirmation, autocomplete: "off" %> -
- -
- <%= f.submit "Sign up" %> -
-<% end %> - -<%= render "devise/shared/links" %> diff --git a/lib/open_fest/app/views/open_fest/users/registrations/new.slim b/lib/open_fest/app/views/open_fest/users/registrations/new.slim new file mode 100644 index 0000000..2fe8223 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/registrations/new.slim @@ -0,0 +1,16 @@ +- content_for(:title) { ":: #{t :registration}" } + +h2.entry-title = t :registration + += simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| + = f.error_notification + + .form-inputs + = f.input :email, required: true, autofocus: true + = f.input :password, required: true + = f.input :password_confirmation, required: true + + .form-actions + = f.button :submit + +== render 'devise/shared/links' diff --git a/lib/open_fest/app/views/open_fest/users/sessions/new.html.erb b/lib/open_fest/app/views/open_fest/users/sessions/new.html.erb deleted file mode 100644 index b261cfd..0000000 --- a/lib/open_fest/app/views/open_fest/users/sessions/new.html.erb +++ /dev/null @@ -1,26 +0,0 @@ -

Log in

- -<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> -
- <%= f.label :email %>
- <%= f.email_field :email, autofocus: true %> -
- -
- <%= f.label :password %>
- <%= f.password_field :password, autocomplete: "off" %> -
- - <% if devise_mapping.rememberable? -%> -
- <%= f.check_box :remember_me %> - <%= f.label :remember_me %> -
- <% end -%> - -
- <%= f.submit "Log in" %> -
-<% end %> - -<%= render "devise/shared/links" %> diff --git a/lib/open_fest/app/views/open_fest/users/sessions/new.slim b/lib/open_fest/app/views/open_fest/users/sessions/new.slim new file mode 100644 index 0000000..b53c4ae --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/sessions/new.slim @@ -0,0 +1,14 @@ +- content_for(:title) { "#{t :login}" } + +h2.entry-title = t :login + += simple_form_for(resource, wrapper: :default, as: resource_name, url: session_path(resource_name), ) do |f| + .form-inputs + = f.input :email, required: false, autofocus: true, hint: false + = f.input :password, required: false, hint: false + = f.input :remember_me, as: :boolean, wrapper: :default if devise_mapping.rememberable? + + .form-actions + = f.button :submit, t(:login) + +== render 'open_fest/users/shared/links' diff --git a/lib/open_fest/app/views/open_fest/users/shared/_links.html.erb b/lib/open_fest/app/views/open_fest/users/shared/_links.html.erb deleted file mode 100644 index cd795ad..0000000 --- a/lib/open_fest/app/views/open_fest/users/shared/_links.html.erb +++ /dev/null @@ -1,25 +0,0 @@ -<%- if controller_name != 'sessions' %> - <%= link_to "Log in", new_session_path(resource_name) %>
-<% end -%> - -<%- if devise_mapping.registerable? && controller_name != 'registrations' %> - <%= link_to "Sign up", new_registration_path(resource_name) %>
-<% end -%> - -<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> - <%= link_to "Forgot your password?", new_password_path(resource_name) %>
-<% end -%> - -<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> - <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
-<% 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) %>
-<% 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) %>
- <% end -%> -<% end -%> diff --git a/lib/open_fest/app/views/open_fest/users/shared/_links.slim b/lib/open_fest/app/views/open_fest/users/shared/_links.slim new file mode 100644 index 0000000..6f66289 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/shared/_links.slim @@ -0,0 +1,23 @@ +- if controller_name != 'sessions' + = link_to t(:enter), new_session_path(resource_name) + br + +- if devise_mapping.registerable? && controller_name != 'registrations' + = link_to t(:registration), new_registration_path(resource_name) + br + +- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' + = link_to t(:lostpass), new_password_path(resource_name) + br + +- if devise_mapping.confirmable? && controller_name != 'confirmations' + = link_to t(:did_not_get_confirmation), new_confirmation_path(resource_name) + br + +- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' + = link_to t(:did_not_get_unlock), new_unlock_path(resource_name) + br + +- if devise_mapping.omniauthable? + - resource_class.omniauth_providers.each do |provider| + = link_to t(:login_with, with: @provider.to_s.titleize), omniauth_authorize_path(resource_name, provider) diff --git a/lib/open_fest/app/views/open_fest/users/unlocks/new.html.erb b/lib/open_fest/app/views/open_fest/users/unlocks/new.html.erb deleted file mode 100644 index 16586bc..0000000 --- a/lib/open_fest/app/views/open_fest/users/unlocks/new.html.erb +++ /dev/null @@ -1,16 +0,0 @@ -

Resend unlock instructions

- -<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> - <%= devise_error_messages! %> - -
- <%= f.label :email %>
- <%= f.email_field :email, autofocus: true %> -
- -
- <%= f.submit "Resend unlock instructions" %> -
-<% end %> - -<%= render "devise/shared/links" %> diff --git a/lib/open_fest/app/views/open_fest/users/unlocks/new.slim b/lib/open_fest/app/views/open_fest/users/unlocks/new.slim new file mode 100644 index 0000000..0f91453 --- /dev/null +++ b/lib/open_fest/app/views/open_fest/users/unlocks/new.slim @@ -0,0 +1,15 @@ +- content_for(:title) { ":: #{t :resend_unlock_instructions_title}" } + +h2 =t :resend_unlock_instructions_title + += simple_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| + = f.error_notification + = f.full_error :unlock_token + + .form-inputs + = f.input :email, required: true, autofocus: true, hint: false + + .form-actions + = f.button :submit, t(:resend_instructions_btn) + +== render 'devise/shared/links'