E
E
eovechkin20172021-07-22 22:39:08
Ruby on Rails
eovechkin2017, 2021-07-22 22:39:08

How to change the registration/authorization template?

Hello. I am learning Ruby On Rails and writing a web application on it. I did registration/authorization using the Clearance plugin. Everything works, but I can't change the registration/authorization page in any way, i.e. neither change the content nor apply the styles. There is no html file. I was only able to decorate the top.

60f9c5c69f545257186695.png

What you see at the very top (text on a blue background) is the same thing displayed on all pages (i.e. a layer on top of the page).

Here is the layer code, which is located on top of all pages, it redirects to the page with authorization / registration, which I can’t just change:

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" href="styles/auth.css">
    <%= csrf_meta_tags %>
    <%= csp_meta_tag %>

  </head>

  <body>
    <% if signed_in? %>
      <div class="account-preview">
        Ваш аккаунт: <%= current_user.email %>
      </div>
      <div class="leave-button">
        <%= button_to 'Выйти', sign_out_path, method: :delete %>
      </div>
    <% else %>
    <div class="auth">
      <%= link_to 'Авторизоваться', sign_in_path %>
    </div>
    <% end %>



    <section>
      <div id="flash">
        <% flash.each do |key, value| %>
          <div class="flash <%= key %>"><%= value %></div>
        <% end %>
      </div>
      <%= yield %>
    </section>
  </body>
</html>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GeneAYak, 2021-07-22
@eovechkin2017

So it seems right on the main page https://github.com/thoughtbot/clearance#views
To override a view, create your own copy of it:
app/views/clearance_mailer/change_password.html.erb
app/views/passwords/create. html.erb
app/views/passwords/edit.html.erb
app/views/passwords/new.html.erb
app/views/sessions/_form.html.erb
app/views/sessions/new.html.erb
app/views /users/_form.html.erb
app/views/users/new.html.erb
You can use the Clearance views generator to copy the default views to your application for modification.
rails generate clearance:views

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question