summaryrefslogtreecommitdiffstats
path: root/app/views/account
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2022-08-06 05:00:28 +0000
committerGo MAEDA <maeda@farend.jp>2022-08-06 05:00:28 +0000
commit5c5ae4637c903279f6297aa73a7b0035d3bfb59d (patch)
tree30da903385caa6eaf1fde53cb5508d38784d9a32 /app/views/account
parentca89202a2eee523a556b918b83e92bf7a4a113f9 (diff)
downloadredmine-5c5ae4637c903279f6297aa73a7b0035d3bfb59d.tar.gz
redmine-5c5ae4637c903279f6297aa73a7b0035d3bfb59d.zip
Replace JQuery `.focus()` method with HTML `autofocus` attribute (#37482).
Patch by Go MAEDA. git-svn-id: https://svn.redmine.org/redmine/trunk@21762 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views/account')
-rw-r--r--app/views/account/login.html.erb10
1 files changed, 2 insertions, 8 deletions
diff --git a/app/views/account/login.html.erb b/app/views/account/login.html.erb
index 38991ae60..27878bc7e 100644
--- a/app/views/account/login.html.erb
+++ b/app/views/account/login.html.erb
@@ -5,13 +5,13 @@
<%= back_url_hidden_field_tag %>
<label for="username"><%=l(:field_login)%></label>
- <%= text_field_tag 'username', params[:username], :tabindex => '1' %>
+ <%= text_field_tag 'username', params[:username], :tabindex => '1', :autofocus => params[:username].blank? %>
<label for="password">
<%=l(:field_password)%>
<%= link_to l(:label_password_lost), lost_password_path, :class => "lost_password" if Setting.lost_password? %>
</label>
- <%= password_field_tag 'password', nil, :tabindex => '2' %>
+ <%= password_field_tag 'password', nil, :tabindex => '2', :autofocus => params[:username].present? %>
<% if Setting.autologin? %>
<label for="autologin"><%= check_box_tag 'autologin', 1, false, :tabindex => 4 %> <%= l(:label_stay_logged_in) %></label>
@@ -22,9 +22,3 @@
</div>
<%= call_hook :view_account_login_bottom %>
-
-<% if params[:username].present? %>
-<%= javascript_tag "$('#password').focus();" %>
-<% else %>
-<%= javascript_tag "$('#username').focus();" %>
-<% end %>