diff --git a/app/assets/stylesheets/help.scss b/app/assets/stylesheets/help.scss index c19e09439..3dfc335af 100644 --- a/app/assets/stylesheets/help.scss +++ b/app/assets/stylesheets/help.scss @@ -106,3 +106,26 @@ ul#help_nav { } } } + +.ball{ + background: image-url('branding/ball.png') no-repeat; + background-size: contain; + height: 633px; + max-width: 100%; +} + +.v-center { + display: table; + height: 633px; + } + +.content { + display: table-cell; + vertical-align: middle; + + h2 { + font-size: 35px; + margin: 12px; + text-align: left; + } +} diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 1224160fd..142563314 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -33,8 +33,12 @@ class RegistrationsController < Devise::RegistrationsController def check_registrations_open_or_valid_invite! return true if AppConfig.settings.enable_registrations? || invite.try(:can_be_used?) - flash[:error] = params[:invite] ? t("registrations.invalid_invite") : t("registrations.closed") - redirect_to new_user_session_path + if params[:invite] + flash[:error] = t("registrations.invalid_invite") + redirect_to new_user_session_path + else + redirect_to registration_closed_path + end end def invite diff --git a/app/views/help/registration_closed.html.haml b/app/views/help/registration_closed.html.haml new file mode 100644 index 000000000..ea794a5b2 --- /dev/null +++ b/app/views/help/registration_closed.html.haml @@ -0,0 +1,25 @@ +- content_for :page_title do + = AppConfig.settings.pod_name + " - " + t("devise.shared.links.sign_up_closed") + +.container + .row + .col-md-10.offset1 + .col-md-7.hidden-phone + %h1.ball + .col-md-5.v-center + .content + %h2 + = t("devise.shared.links.sign_up_closed") + + != t("help.closed_pod", + wiki: link_to("another pod", "https://diasporafoundation.org/getting_started/sign_up")) + + != t("help.find_pods", + poduptime: link_to("Poduptime", "https://podupti.me/")) + + != t("help.other_questions", + wiki: link_to("Wiki", "https://wiki.diasporafoundation.org/Choosing_a_pod")) + + + + diff --git a/app/views/help/registration_closed.mobile.haml b/app/views/help/registration_closed.mobile.haml new file mode 100644 index 000000000..f3822cc51 --- /dev/null +++ b/app/views/help/registration_closed.mobile.haml @@ -0,0 +1,11 @@ +%h2 + = t("devise.shared.links.sign_up_closed") + +!= t("help.closed_pod", + wiki: link_to("another pod", "https://diasporafoundation.org/getting_started/sign_up")) + +!= t("help.find_pods", + poduptime: link_to("Poduptime", "https://podupti.me/")) + +!= t("help.other_questions", + wiki: link_to("Wiki", "https://wiki.diasporafoundation.org/Choosing_a_pod")) diff --git a/app/views/layouts/_header_not_connected.haml b/app/views/layouts/_header_not_connected.haml index c8760e3cb..4ed08291c 100644 --- a/app/views/layouts/_header_not_connected.haml +++ b/app/views/layouts/_header_not_connected.haml @@ -1,5 +1,5 @@ %ul.nav.navbar-nav.navbar-right - - if AppConfig.settings.enable_registrations? && !current_page?(controller: "/registrations", action: :new) + - unless current_page?(controller: "/registrations", action: :new) %li= link_to t("devise.shared.links.sign_up"), new_user_registration_path, class: "login" - unless current_page?(controller: "/sessions", action: :new) %li= link_to t("devise.shared.links.sign_in"), new_user_session_path, class: "login" diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index f6434e66e..a3bb4eddf 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -346,6 +346,10 @@ en: tutorials: "tutorials" tutorial: "tutorial" irc: "IRC" + closed_pod: "This pod is currently closed to new registrations. However, you can still join the diaspora* network by registering on %{wiki}. Because all pods are interconnected, you will have access to the same content there." + find_pods: "You can find pods at %{poduptime}." + other_questions: "If you have any other questions regarding choosing a pod, checkout our %{wiki}." + choose_another: "Please, choose another pod" wiki: "wiki" faq: "FAQ" markdown: "Markdown" diff --git a/config/routes.rb b/config/routes.rb index 4115bf5ba..66b3ecf92 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -205,6 +205,7 @@ Rails.application.routes.draw do # Help get 'help' => 'help#faq', :as => 'help' + get "help/registration_closed" => "help#registration_closed", :as => "registration_closed" get 'help/:topic' => 'help#faq' #Protocol Url diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb index c7063e728..c1aa7744c 100644 --- a/spec/controllers/registrations_controller_spec.rb +++ b/spec/controllers/registrations_controller_spec.rb @@ -25,16 +25,14 @@ describe RegistrationsController, type: :controller do AppConfig.settings.enable_registrations = false end - it "redirects #new to the login page" do + it "redirects #new to the registration closed page" do get :new - expect(flash[:error]).to eq(I18n.t("registrations.closed")) - expect(response).to redirect_to new_user_session_path + expect(response).to redirect_to registration_closed_path end - it "redirects #create to the login page" do + it "redirects #create to the registration closed page" do post :create, params: valid_params - expect(flash[:error]).to eq(I18n.t("registrations.closed")) - expect(response).to redirect_to new_user_session_path + expect(response).to redirect_to registration_closed_path end it "does not redirect if there is a valid invite token" do