From de73eac2d0e821158e7954676efdde95a0ecfb37 Mon Sep 17 00:00:00 2001 From: kikito Date: Sun, 16 Aug 2015 23:41:05 +0200 Subject: [PATCH] Moves the registrations controller to users/registrations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is necessary because rails gets confused when it has a a “root” registration_controller and another non-root one. The non-root one uses the views from the root. --- .../{ => users}/registrations_controller.rb | 9 ++-- app/views/devise/registrations/edit.html.erb | 45 ------------------ app/views/users/registrations/edit.html.erb | 45 ++++++++++++++++++ .../registrations/new.html.erb | 32 ++++++------- config/locales/devise_views.en.yml | 47 ++++++++++--------- config/locales/devise_views.es.yml | 47 ++++++++++--------- config/routes.rb | 2 +- 7 files changed, 114 insertions(+), 113 deletions(-) rename app/controllers/{ => users}/registrations_controller.rb (51%) delete mode 100644 app/views/devise/registrations/edit.html.erb create mode 100644 app/views/users/registrations/edit.html.erb rename app/views/{devise => users}/registrations/new.html.erb (68%) diff --git a/app/controllers/registrations_controller.rb b/app/controllers/users/registrations_controller.rb similarity index 51% rename from app/controllers/registrations_controller.rb rename to app/controllers/users/registrations_controller.rb index 4991cdf70..174b12aa2 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -1,4 +1,4 @@ -class RegistrationsController < Devise::RegistrationsController +class Users::RegistrationsController < Devise::RegistrationsController include RecaptchaHelper def create @@ -11,11 +11,10 @@ class RegistrationsController < Devise::RegistrationsController end end - private - def sign_up_params - params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation, :use_nickname, :nickname) - end + def sign_up_params + params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation, :use_nickname, :nickname) + end end diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb deleted file mode 100644 index b670b6776..000000000 --- a/app/views/devise/registrations/edit.html.erb +++ /dev/null @@ -1,45 +0,0 @@ -
- -
\ No newline at end of file diff --git a/app/views/users/registrations/edit.html.erb b/app/views/users/registrations/edit.html.erb new file mode 100644 index 000000000..b17b8f2e1 --- /dev/null +++ b/app/views/users/registrations/edit.html.erb @@ -0,0 +1,45 @@ +
+ +
diff --git a/app/views/devise/registrations/new.html.erb b/app/views/users/registrations/new.html.erb similarity index 68% rename from app/views/devise/registrations/new.html.erb rename to app/views/users/registrations/new.html.erb index c7cd839a2..893054f8e 100644 --- a/app/views/devise/registrations/new.html.erb +++ b/app/views/users/registrations/new.html.erb @@ -2,60 +2,60 @@
-

<%= t("devise_views.registrations.new.title") %>

+

<%= t("devise_views.users.registrations.new.title") %>

<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> <%= devise_error_messages! %>
- <%= f.label :first_name, t("devise_views.registrations.new.first_name_label") %> - <%= f.text_field :first_name, autofocus: true, placeholder: t("devise_views.registrations.new.first_name_label") %> + <%= f.label :first_name, t("devise_views.users.registrations.new.first_name_label") %> + <%= f.text_field :first_name, autofocus: true, placeholder: t("devise_views.users.registrations.new.first_name_label") %>
- <%= f.label :last_name, t("devise_views.registrations.new.last_name_label") %> - <%= f.text_field :last_name, placeholder: t("devise_views.registrations.new.last_name_label") %> + <%= f.label :last_name, t("devise_views.users.registrations.new.last_name_label") %> + <%= f.text_field :last_name, placeholder: t("devise_views.users.registrations.new.last_name_label") %>
<%= f.check_box :use_nickname %> - <%= t("devise_views.registrations.new.use_nickname_label") %> + <%= t("devise_views.users.registrations.new.use_nickname_label") %>
- <%= f.label :nickname, t("devise_views.registrations.new.nickname_label") %> - <%= f.text_field :nickname, placeholder: t("devise_views.registrations.new.nickname_label") %> + <%= f.label :nickname, t("devise_views.users.registrations.new.nickname_label") %> + <%= f.text_field :nickname, placeholder: t("devise_views.users.registrations.new.nickname_label") %>
- <%= f.label :email, t("devise_views.registrations.new.email_label") %> - <%= f.email_field :email, placeholder: t("devise_views.registrations.new.email_label") %> + <%= f.label :email, t("devise_views.users.registrations.new.email_label") %> + <%= f.email_field :email, placeholder: t("devise_views.users.registrations.new.email_label") %>
- <%= f.label :password, t("devise_views.registrations.new.password_label"), class: "inline-block" %> + <%= f.label :password, t("devise_views.users.registrations.new.password_label"), class: "inline-block" %> <% if @minimum_password_length %> - <%= t("devise_views.registrations.new.min_length", min: @minimum_password_length) %> + <%= t("devise_views.users.registrations.new.min_length", min: @minimum_password_length) %> <% end %> - <%= f.password_field :password, autocomplete: "off", placeholder: t("devise_views.registrations.new.password_label") %> + <%= f.password_field :password, autocomplete: "off", placeholder: t("devise_views.users.registrations.new.password_label") %>
- <%= f.label :password_confirmation, t("devise_views.registrations.new.password_confirmation_label") %> - <%= f.password_field :password_confirmation, autocomplete: "off", placeholder: t("devise_views.registrations.new.password_confirmation_label") %> + <%= f.label :password_confirmation, t("devise_views.users.registrations.new.password_confirmation_label") %> + <%= f.password_field :password_confirmation, autocomplete: "off", placeholder: t("devise_views.users.registrations.new.password_confirmation_label") %>
@@ -63,7 +63,7 @@
- <%= f.submit t("devise_views.registrations.new.submit"), class: "button radius expand" %> + <%= f.submit t("devise_views.users.registrations.new.submit"), class: "button radius expand" %>
<% end %> diff --git a/config/locales/devise_views.en.yml b/config/locales/devise_views.en.yml index ae778d00f..3560ecdc5 100644 --- a/config/locales/devise_views.en.yml +++ b/config/locales/devise_views.en.yml @@ -36,29 +36,30 @@ en: title: "Forgot your password?" email_label: "Email" send_submit: "Send me reset password instructions" - registrations: - edit: - edit: "Edit" - email_label: "Email" - waiting_for: "Currently waiting confirmation for:" - leave_blank: "Leave blank if you don't want to change it" - password_label: "New password" - password_confirmation_label: "Confirm new password" - current_password_label: "Current password" - need_current: "We need your current password to confirm your changes" - update_submit: "Update" - back_link: "Back" - new: - title: "Sign up" - first_name_label: "First name" - last_name_label: "Last name" - nickname_label: "Nickname" - use_nickname_label: "Use nickname" - email_label: "Email" - password_label: "Password" - min_length: "(%{min} characters minimum)" - password_confirmation_label: "Confirm password" - submit: "Sign up" + users: + registrations: + edit: + edit: "Edit" + email_label: "Email" + waiting_for: "Currently waiting confirmation for:" + leave_blank: "Leave blank if you don't want to change it" + password_label: "New password" + password_confirmation_label: "Confirm new password" + current_password_label: "Current password" + need_current: "We need your current password to confirm your changes" + update_submit: "Update" + back_link: "Back" + new: + title: "Sign up" + first_name_label: "First name" + last_name_label: "Last name" + nickname_label: "Nickname" + use_nickname_label: "Use nickname" + email_label: "Email" + password_label: "Password" + min_length: "(%{min} characters minimum)" + password_confirmation_label: "Confirm password" + submit: "Sign up" sessions: new: title: "Log in" diff --git a/config/locales/devise_views.es.yml b/config/locales/devise_views.es.yml index 647dd3237..50da3f345 100644 --- a/config/locales/devise_views.es.yml +++ b/config/locales/devise_views.es.yml @@ -36,29 +36,30 @@ es: title: "¿Has olvidado tu contraseña?" email_label: "Email" send_submit: "Recibir instrucciones para recuperar mi contraseña" - registrations: - edit: - edit: "Editar" - email_label: "Email" - waiting_for: "Esperando confirmación de:" - leave_blank: "Dejar en blanco si no deseas cambiarla" - password_label: "Contraseña nueva" - password_confirmation_label: "Confirmar contraseña nueva" - current_password_label: "Contraseña actual" - need_current: "Necesitamos tu contraseña actual para confirmar los cambios" - update_submit: "Actualizar" - back_link: "Atrás" - new: - title: "Registrarse" - first_name_label: "Nombre" - last_name_label: "Apellidos" - nickname_label: "Pseudónimo" - use_nickname_label: "Usar pseudónimo" - email_label: "Email" - password_label: "Contraseña" - min_length: "(mínimo %{min} caracteres)" - password_confirmation_label: "Confirmar contraseña" - submit: "Registrarse" + users: + registrations: + edit: + edit: "Editar" + email_label: "Email" + waiting_for: "Esperando confirmación de:" + leave_blank: "Dejar en blanco si no deseas cambiarla" + password_label: "Contraseña nueva" + password_confirmation_label: "Confirmar contraseña nueva" + current_password_label: "Contraseña actual" + need_current: "Necesitamos tu contraseña actual para confirmar los cambios" + update_submit: "Actualizar" + back_link: "Atrás" + new: + title: "Registrarse" + first_name_label: "Nombre" + last_name_label: "Apellidos" + nickname_label: "Pseudónimo" + use_nickname_label: "Usar pseudónimo" + email_label: "Email" + password_label: "Contraseña" + min_length: "(mínimo %{min} caracteres)" + password_confirmation_label: "Confirmar contraseña" + submit: "Registrarse" sessions: new: title: "Entrar" diff --git a/config/routes.rb b/config/routes.rb index fa1f6624b..286b8237a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,5 @@ Rails.application.routes.draw do - devise_for :users, controllers: { registrations: 'registrations' } + devise_for :users, controllers: { registrations: 'users/registrations' } # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes".