]> source.dussan.org Git - redmine.git/commitdiff
Focus first text field automatically (#13134).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 19 Jan 2014 08:57:47 +0000 (08:57 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 19 Jan 2014 08:57:47 +0000 (08:57 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@12670 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/views/issues/new.html.erb
app/views/my/password.html.erb
app/views/projects/new.html.erb
app/views/search/index.html.erb
public/javascripts/application.js

index feb9e792f7a368c51d5ff8949f6a63394e037ac9..40dae18b21844b000cbca4056e6b170165830a01 100644 (file)
@@ -44,8 +44,6 @@
   <%= submit_tag l(:button_create) %>
   <%= submit_tag l(:button_create_and_continue), :name => 'continue' %>
   <%= preview_link preview_new_issue_path(:project_id => @project), 'issue-form' %>
-
-  <%= javascript_tag "$('#issue_subject').focus();" %>
 <% end %>
 
 <div id="preview" class="wiki"></div>
index 5dbf24cb0c0e6156518cc1007392e165bf19442b..c3f86b99f9c1a688a66444ce7898782624e2ef2b 100644 (file)
@@ -22,5 +22,3 @@
 <%= render :partial => 'sidebar' %>
 <% end %>
 <% end %>
-
-<%= javascript_tag "$('#password').focus();" %>
index a14a9cf3e9f9326708cd9a40cef6f8a60c6a09ab..bd474bb79a4ee62ff15cc1c46c71f67801ec1fda 100644 (file)
@@ -4,5 +4,4 @@
 <%= render :partial => 'form', :locals => { :f => f } %>
 <%= submit_tag l(:button_create) %>
 <%= submit_tag l(:button_create_and_continue), :name => 'continue' %>
-<%= javascript_tag "$('#project_name').focus();" %>
 <% end %>
index 32e067e6fd7b41ec7d39de99930d46ebd371b73f..ffa0b483f733a65cfb05804c5baaac6c8578c7f1 100644 (file)
@@ -4,7 +4,6 @@
 <%= form_tag({}, :method => :get, :id => 'search-form') do %>
 <%= label_tag "search-input", l(:description_search), :class => "hidden-for-sighted" %>
 <p><%= text_field_tag 'q', @question, :size => 60, :id => 'search-input' %>
-<%= javascript_tag "$('#search-input').focus()" %>
 <%= project_select_tag %>
 <%= hidden_field_tag 'all_words', '', :id => nil %>
 <label><%= check_box_tag 'all_words', 1, @all_words %> <%= l(:label_all_words) %></label>
index a6d15f2f016f5d46177a4fd47c4964584a206790..f31cb353a6d7aade6531ffbaaa636400eeb5e656 100644 (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) {
   event.stopPropagation();
   event.preventDefault();
@@ -604,4 +610,5 @@ $(document).ready(function(){
 $(document).ready(setupAjaxIndicator);
 $(document).ready(hideOnLoad);
 $(document).ready(addFormObserversForDoubleSubmit);
+$(document).ready(defaultFocus);