Focus first text field automatically (#13134).

git-svn-id: http://svn.redmine.org/redmine/trunk@12670 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2014-01-19 08:57:47 +00:00
parent 6f1cda4852
commit bacc250816
5 changed files with 7 additions and 6 deletions

View File

@ -44,8 +44,6 @@
<%= submit_tag l(:button_create) %> <%= submit_tag l(:button_create) %>
<%= submit_tag l(:button_create_and_continue), :name => 'continue' %> <%= submit_tag l(:button_create_and_continue), :name => 'continue' %>
<%= preview_link preview_new_issue_path(:project_id => @project), 'issue-form' %> <%= preview_link preview_new_issue_path(:project_id => @project), 'issue-form' %>
<%= javascript_tag "$('#issue_subject').focus();" %>
<% end %> <% end %>
<div id="preview" class="wiki"></div> <div id="preview" class="wiki"></div>

View File

@ -22,5 +22,3 @@
<%= render :partial => 'sidebar' %> <%= render :partial => 'sidebar' %>
<% end %> <% end %>
<% end %> <% end %>
<%= javascript_tag "$('#password').focus();" %>

View File

@ -4,5 +4,4 @@
<%= render :partial => 'form', :locals => { :f => f } %> <%= render :partial => 'form', :locals => { :f => f } %>
<%= submit_tag l(:button_create) %> <%= submit_tag l(:button_create) %>
<%= submit_tag l(:button_create_and_continue), :name => 'continue' %> <%= submit_tag l(:button_create_and_continue), :name => 'continue' %>
<%= javascript_tag "$('#project_name').focus();" %>
<% end %> <% end %>

View File

@ -4,7 +4,6 @@
<%= form_tag({}, :method => :get, :id => 'search-form') do %> <%= form_tag({}, :method => :get, :id => 'search-form') do %>
<%= label_tag "search-input", l(:description_search), :class => "hidden-for-sighted" %> <%= label_tag "search-input", l(:description_search), :class => "hidden-for-sighted" %>
<p><%= text_field_tag 'q', @question, :size => 60, :id => 'search-input' %> <p><%= text_field_tag 'q', @question, :size => 60, :id => 'search-input' %>
<%= javascript_tag "$('#search-input').focus()" %>
<%= project_select_tag %> <%= project_select_tag %>
<%= hidden_field_tag 'all_words', '', :id => nil %> <%= hidden_field_tag 'all_words', '', :id => nil %>
<label><%= check_box_tag 'all_words', 1, @all_words %> <%= l(:label_all_words) %></label> <label><%= check_box_tag 'all_words', 1, @all_words %> <%= l(:label_all_words) %></label>

View File

@ -583,6 +583,12 @@ function addFormObserversForDoubleSubmit() {
}); });
} }
function defaultFocus(){
if ($('#content :focus').length == 0) {
$('#content input[type=text], #content textarea').first().focus();
}
}
function blockEventPropagation(event) { function blockEventPropagation(event) {
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();
@ -604,4 +610,5 @@ $(document).ready(function(){
$(document).ready(setupAjaxIndicator); $(document).ready(setupAjaxIndicator);
$(document).ready(hideOnLoad); $(document).ready(hideOnLoad);
$(document).ready(addFormObserversForDoubleSubmit); $(document).ready(addFormObserversForDoubleSubmit);
$(document).ready(defaultFocus);