diff --git a/app/views/issues/_form.html.erb b/app/views/issues/_form.html.erb index fdf729140..4fa41625f 100644 --- a/app/views/issues/_form.html.erb +++ b/app/views/issues/_form.html.erb @@ -27,6 +27,12 @@ <% if @issue.safe_attribute? 'subject' %>

<%= f.text_field :subject, :size => 80, :maxlength => 255, :required => true %>

+<% if @issue.new_record? %> +
+
+
+
+<% end %> <% end %> <% if @issue.safe_attribute? 'description' %> @@ -56,9 +62,27 @@ <% heads_for_wiki_formatter %> <%= javascript_tag do %> +<% if @issue.new_record? %> +options = { + response: function(e,ui){ + if(ui.content.length>0){ + $('#similar_issues').html('<%= l(:text_following_issues_might_be_similar) %> <%= link_to_function l(:button_hide), "$('#similar_issues').html('');" %>'); + $.each(ui.content, function(index,elm) { $('#similar_issues ul').append('
  • ' + elm.label + '
  • '); }); + }else{ + $('#similar_issues').html(''); + } + }, + open: function(e,ui){ $(".ui-autocomplete").hide(); } +} +observeAutocompleteField('issue_subject', '<%= "#{escape_javascript auto_complete_issues_path(:project_id => @issue.project, :scope => Setting.cross_project_subtasks, :status => @issue.closed? ? 'c' : 'o', :issue_id => @issue.id)}" %>', options); +<% end %> $(document).ready(function(){ $("#issue_tracker_id, #issue_status_id").each(function(){ $(this).val($(this).find("option[selected=selected]").val()); }); + <% if @issue.new_record? %> + $("#issue_subject").keyup(function(){if($(this).val().length<2){$('#similar_issues').html('');}}); + $("#issue_subject").removeClass("autocomplete"); + <% end %> }); <% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 8fcc2262a..73b063f74 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1231,6 +1231,7 @@ en: text_select_apply_tracker: "Select tracker" text_avatar_server_config_html: The current avatar server is %{url}. You can configure it in config/configuration.yml. text_no_subject: no subject + text_following_issues_might_be_similar: The following issues might be similar. default_role_manager: Manager diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 5f8ade106..4e6427d2c 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -775,6 +775,7 @@ html>body .tabular p {overflow:hidden;} .tabular input, .tabular select {max-width:95%} .tabular textarea {width:95%; resize:vertical;} +.tabular div.notice {padding-left: 180px} .tabular label{ font-weight: bold; diff --git a/public/stylesheets/responsive.css b/public/stylesheets/responsive.css index aa5502ee6..43d9b1a5f 100644 --- a/public/stylesheets/responsive.css +++ b/public/stylesheets/responsive.css @@ -749,6 +749,9 @@ width: auto; max-width: 95%; } + .tabular div.notice { + padding-left: 0 + } /* new issue form */ #all_attributes p:first-child {