You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_form.html.erb 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <%= labelled_fields_for :issue, @issue do |f| %>
  2. <%= call_hook(:view_issues_form_details_top, { :issue => @issue, :form => f }) %>
  3. <%= hidden_field_tag 'form_update_triggered_by', '' %>
  4. <%= hidden_field_tag 'back_url', params[:back_url], :id => nil if params[:back_url].present? %>
  5. <% if @issue.safe_attribute? 'is_private' %>
  6. <p id="issue_is_private_wrap">
  7. <%= f.check_box :is_private, :no_label => true %><label class="inline" for="issue_is_private" id="issue_is_private_label"><%= l(:field_is_private) %></label>
  8. </p>
  9. <% end %>
  10. <% projects = @issue.allowed_target_projects(User.current, @project) %>
  11. <% if (@issue.safe_attribute?('project_id') || @issue.project_id_changed?) && (@project.nil? || projects.length > 1 || @issue.copy?) %>
  12. <p><%= f.select :project_id, project_tree_options_for_select(projects, :selected => @issue.project), {:required => true},
  13. :onchange => "updateIssueFrom('#{escape_javascript update_issue_form_path(@project, @issue)}', this)" %></p>
  14. <% end %>
  15. <% if @issue.safe_attribute?('tracker_id') || (@issue.persisted? && @issue.tracker_id_changed?) %>
  16. <p>
  17. <%= f.select :tracker_id, trackers_options_for_select(@issue), {:required => true},
  18. :onchange => "updateIssueFrom('#{escape_javascript update_issue_form_path(@project, @issue)}', this)",
  19. :title => @issue.tracker.description %>
  20. <%= content_tag 'a', l(:label_open_trackers_description), :class => 'icon-only icon-help', :title => l(:label_open_trackers_description), :onclick => "showModal('trackers_description', '500px'); return false;", :href => '#' if trackers_for_select(@issue).any? {|t| t.description.present? } %>
  21. </p>
  22. <%= render partial: 'issues/trackers_description', locals: {trackers: trackers_for_select(@issue)} %>
  23. <% end %>
  24. <% if @issue.safe_attribute? 'subject' %>
  25. <p><%= f.text_field :subject, :size => 80, :maxlength => 255, :required => true %></p>
  26. <% end %>
  27. <% if @issue.safe_attribute? 'description' %>
  28. <p>
  29. <%= f.label_for_field :description, :required => @issue.required_attribute?('description') %>
  30. <%= link_to_function content_tag(:span, l(:button_edit), :class => 'icon icon-edit'), '$(this).hide(); $("#issue_description_and_toolbar").show()' unless @issue.new_record? %>
  31. <%= content_tag 'span', :id => "issue_description_and_toolbar", :style => (@issue.new_record? ? nil : 'display:none') do %>
  32. <%= f.text_area :description, :cols => 60, :accesskey => accesskey(:edit), :class => 'wiki-edit',
  33. :rows => [[10, @issue.description.to_s.length / 50].max, 20].min,
  34. :data => {
  35. :auto_complete => true,
  36. },
  37. :no_label => true %>
  38. <% end %>
  39. </p>
  40. <%= wikitoolbar_for 'issue_description', preview_issue_path(:project_id => @issue.project, :issue_id => @issue.id) %>
  41. <% end %>
  42. <div id="attributes" class="attributes">
  43. <%= render :partial => 'issues/attributes' %>
  44. </div>
  45. <%= call_hook(:view_issues_form_details_bottom, { :issue => @issue, :form => f }) %>
  46. <% end %>
  47. <% heads_for_wiki_formatter %>
  48. <%= heads_for_auto_complete(@issue.project) %>
  49. <%= javascript_tag do %>
  50. $(document).ready(function(){
  51. $("#issue_tracker_id, #issue_status_id").each(function(){
  52. $(this).val($(this).find("option[selected=selected]").val());
  53. });
  54. $(".assign-to-me-link").click(function(event){
  55. event.preventDefault();
  56. var element = $(event.target);
  57. $('#issue_assigned_to_id').val(element.data('id'));
  58. element.hide();
  59. });
  60. $('#issue_assigned_to_id').change(function(event){
  61. var assign_to_me_link = $(".assign-to-me-link");
  62. if (assign_to_me_link.length > 0) {
  63. var user_id = $(event.target).val();
  64. var current_user_id = assign_to_me_link.data('id');
  65. if (user_id == current_user_id) {
  66. assign_to_me_link.hide();
  67. } else {
  68. assign_to_me_link.show();
  69. }
  70. }
  71. });
  72. });
  73. <% end %>