use-html-autofocus.patch

Go MAEDA, 2022-07-21 16:57

Download (1.52 KB)

View differences:

app/views/account/login.html.erb
5 5
  <%= back_url_hidden_field_tag %>
6 6
  
7 7
  <label for="username"><%=l(:field_login)%></label>
8
  <%= text_field_tag 'username', params[:username], :tabindex => '1' %>
8
  <%= text_field_tag 'username', params[:username], :tabindex => '1', :autofocus => true %>
9 9
  
10 10
  <label for="password">
11 11
    <%=l(:field_password)%>
......
23 23

  
24 24
<%= call_hook :view_account_login_bottom %>
25 25

  
26
<% if params[:username].present? %>
27
<%= javascript_tag "$('#password').focus();" %>
28
<% else %>
29
<%= javascript_tag "$('#username').focus();" %>
30
<% end %>
26
<%= javascript_tag "$('#password').focus();" if params[:username].present? %>
app/views/sudo_mode/new.html.erb
8 8
  <div class="box">
9 9
    <p>
10 10
      <label for="sudo_password"><%= l :field_password %><span class="required">*</span></label>
11
      <%= password_field_tag :sudo_password, nil, size: 25 %>
11
      <%= password_field_tag :sudo_password, nil, size: 25, autofocus: true %>
12 12
      </br><%= link_to l(:label_password_lost), lost_password_path, :class => "lost_password" if Setting.lost_password? %>
13 13
    </p>
14 14
  </div>
15 15
  <%= submit_tag l(:button_submit) %>
16 16
<% end %>
17
<%= javascript_tag "$('#sudo_password').focus();" %>