issue 引用模式修改

issue相关代码优化
This commit is contained in:
huang 2015-09-23 14:27:47 +08:00
parent 8d64114c58
commit 5b671c5109
8 changed files with 123 additions and 132 deletions

View File

@ -6,8 +6,7 @@
<li> <li>
<label class="label"><span class="c_red f12">*</span><%= l(:field_status) %></label> <label class="label"><span class="c_red f12">*</span><%= l(:field_status) %></label>
<% if @issue.safe_attribute?('status_id') && @allowed_statuses.present? %> <% if @issue.safe_attribute?('status_id') && @allowed_statuses.present? %>
<%= f.select :status_id, <%= f.select :status_id, (@allowed_statuses.collect { |p| [p.name, p.id] }),
(@allowed_statuses.collect { |p| [p.name, p.id] }),
{:no_label => true}, {:no_label => true},
# ajax 刷新 # ajax 刷新
#:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')", #:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')",
@ -20,8 +19,7 @@
<li> <li>
<label class="label"><span class="c_red f12">*</span><%= l(:field_priority) %></label> <label class="label"><span class="c_red f12">*</span><%= l(:field_priority) %></label>
<% if @issue.safe_attribute? 'priority_id' %> <% if @issue.safe_attribute? 'priority_id' %>
<%= f.select :priority_id, <%= f.select :priority_id, (@priorities.collect { |p| [p.name, p.id] }),
(@priorities.collect { |p| [p.name, p.id] }),
{:required => true, :no_label => true}, :disabled => !@issue.leaf?, {:required => true, :no_label => true}, :disabled => !@issue.leaf?,
:class => "w150" %> :class => "w150" %>
<% end %> <% end %>
@ -60,11 +58,7 @@
<li> <li>
<label class="label02"><%= l(:field_start_date) %></label> <label class="label02"><%= l(:field_start_date) %></label>
<% if @issue.safe_attribute? 'start_date' %> <% if @issue.safe_attribute? 'start_date' %>
<%= f.text_field :start_date, <%= f.text_field :start_date, :size => 22, :disabled => !@issue.leaf?, :no_label => true, :required => @issue.required_attribute?('start_date') %>
:size => 22,
:disabled => !@issue.leaf?,
:no_label => true,
:required => @issue.required_attribute?('start_date') %>
<%= calendar_for('issue_start_date', 'start_date') if @issue.leaf? %> <%= calendar_for('issue_start_date', 'start_date') if @issue.leaf? %>
<% end %> <% end %>
</li> </li>
@ -72,10 +66,7 @@
<li> <li>
<label class="label02"><%= l(:field_due_date) %></label> <label class="label02"><%= l(:field_due_date) %></label>
<% if @issue.safe_attribute? 'due_date' %> <% if @issue.safe_attribute? 'due_date' %>
<%= f.text_field :due_date, :size => 22, <%= f.text_field :due_date, :size => 22, :disabled => !@issue.leaf?, :no_label => true, :required => @issue.required_attribute?('due_date') %>
:disabled => !@issue.leaf?,
:no_label => true,
:required => @issue.required_attribute?('due_date') %>
<%= calendar_for('issue_due_date', 'start_date') if @issue.leaf? %> <%= calendar_for('issue_due_date', 'start_date') if @issue.leaf? %>
<% end %> <% end %>
</li> </li>
@ -83,10 +74,7 @@
<li> <li>
<label class="label02"><%= l(:field_estimated_hours) %></label> <label class="label02"><%= l(:field_estimated_hours) %></label>
<% if @issue.safe_attribute? 'estimated_hours' %> <% if @issue.safe_attribute? 'estimated_hours' %>
<%= f.text_field :estimated_hours, :size => 22, <%= f.text_field :estimated_hours, :size => 22, :disabled => !@issue.leaf?, :no_label => true, :required => @issue.required_attribute?('estimated_hours') %>
:disabled => !@issue.leaf?,
:no_label => true,
:required => @issue.required_attribute?('estimated_hours') %>
<span class="mt3 ml5"><%= l(:field_hours) %></span> <span class="mt3 ml5"><%= l(:field_hours) %></span>
<% end %> <% end %>
</li> </li>

View File

@ -0,0 +1,52 @@
<!--属性-->
<div class="pro_info_box mb10">
<%= issue_fields_rows do |rows| %>
<ul class="fl" >
<li><p class="label03" >&nbsp;状态&nbsp;&nbsp;:&nbsp;</p><p class="pro_info_p"><%= @issue.status.name %></p>
</li>
<div class="cl"></div>
<% unless @issue.disabled_core_fields.include?('assigned_to_id') %>
<li><p class="label03" >&nbsp;指派给&nbsp;&nbsp;:&nbsp;</p><span class="pro_info_p"><%= @issue.assigned_to ? link_to_isuue_user(@issue.assigned_to) : "--" %></span>
</li>
<% end %>
<div class="cl"></div>
</ul>
<ul class="fl" >
<li><p class="label03" >&nbsp;优先级&nbsp;&nbsp;:&nbsp;</p><span class="pro_info_p" style="width:50px;"><%= @issue.priority.name %></span>
</li>
<div class="cl"></div>
<% unless @issue.disabled_core_fields.include?('done_ratio') %>
<li><p class="label03" >&nbsp;% 完成&nbsp;&nbsp;:&nbsp;</p><span class="pro_info_p" style="width:50px;"><%= @issue.done_ratio %>%</span>
</li>
<% end %>
<div class="cl"></div>
</ul>
<ul class="fl " >
<% unless @issue.disabled_core_fields.include?('start_date') %>
<li><p class="label03" style="width:50px;" >&nbsp;开始&nbsp;&nbsp;:&nbsp;</p><p class="pro_info_p"><%= format_date(@issue.start_date) %></p>
</li>
<% end %>
<div class="cl"></div>
<% unless @issue.disabled_core_fields.include?('estimated_hours') %>
<li><p class="label03" style="width:50px;">&nbsp;周期&nbsp;&nbsp;:&nbsp;</p><span class="pro_info_p"><%= l_hours(@issue.estimated_hours) %></span>
</li>
<% end %>
<div class="cl"></div>
</ul>
<ul class="fl " >
<% unless @issue.disabled_core_fields.include?('due_date') %>
<li><p class="label03" >&nbsp;计划完成&nbsp;&nbsp;:&nbsp;</p><span class="pro_info_p" style="width:120px;"><%= format_date(@issue.due_date)? format_date(@issue.due_date) : "--" %></span>
</li>
<% end %>
<div class="cl"></div>
<% unless @issue.disabled_core_fields.include?('fixed_version_id') %>
<li><p class="label03" >&nbsp;目标版本&nbsp;&nbsp;:&nbsp;</p><span class="pro_info_p" style="width:120px;"><%= (@issue.fixed_version ? link_to_version(@issue.fixed_version, :class => "pro_info_p") : "--") %></span>
</li>
<% end %>
<div class="cl"></div>
</ul>
<% end %><!--pro_info_box end-->
<%#= render_custom_fields_rows(@issue) %>
<%#= call_hook(:view_issues_show_details_bottom, :issue => @issue) %>
</div>
<!--pro_info_box 属性 end-->

View File

@ -14,7 +14,9 @@
<%= render :partial => 'history', :locals => {:issue => @issue, :journals => @journals} %> <%= render :partial => 'history', :locals => {:issue => @issue, :journals => @journals} %>
</div> </div>
<% end %> <% end %>
<div id="journal_issue_note" class="wiki"></div> <div id="journal_issue_note" class="wiki">
</div>
<input name="issue_quote_new" type="hidden" value="<%= %>" /> <input name="issue_quote_new" type="hidden" value="<%= %>" />
<fieldset><legend>回复</legend> <fieldset><legend>回复</legend>
<%= f.text_area :notes, :style => "width:99%;", :rows => "5", :no_label => true %> <%= f.text_area :notes, :style => "width:99%;", :rows => "5", :no_label => true %>

View File

@ -28,11 +28,7 @@
<li> <li>
<% if @issue.safe_attribute? 'subject' %> <% if @issue.safe_attribute? 'subject' %>
<label class="label"><span class="c_red f12">*</span>&nbsp;主题&nbsp;&nbsp;:&nbsp;</label> <label class="label"><span class="c_red f12">*</span>&nbsp;主题&nbsp;&nbsp;:&nbsp;</label>
<%= f.text_field :subject, <%= f.text_field :subject, :class => "w576", :maxlength => 255, :style => "font-size:small", :no_label => true %>
:class => "w576",
:maxlength => 255,
:style => "font-size:small",
:no_label => true %>
<!--Added by young--> <!--Added by young-->
<%= javascript_tag do %> <%= javascript_tag do %>
observeAutocompleteField('issue_subject', observeAutocompleteField('issue_subject',
@ -53,13 +49,7 @@
<%= f.label_for_field :description, :required => @issue.required_attribute?('description'), :no_label => true, :class => "label" %> <%= f.label_for_field :description, :required => @issue.required_attribute?('description'), :no_label => true, :class => "label" %>
<%#= link_to_function image_tag('edit.png'), '$(this).hide(); $("#issue_description_and_toolbar").show()' unless @issue.new_record? %> <%#= link_to_function image_tag('edit.png'), '$(this).hide(); $("#issue_description_and_toolbar").show()' unless @issue.new_record? %>
<%#= content_tag 'span', :id => "issue_description_and_toolbar" do %> <%#= content_tag 'span', :id => "issue_description_and_toolbar" do %>
<%= f.kindeditor :description,:editor_id => "issue_desc_editor", <%= f.kindeditor :description,:editor_id => "issue_desc_editor", :width=>'87%', :resizeType => 0, :no_label => true %>
# :rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min),
# :accesskey => accesskey(:edit),
# :class => "w583",
:width=>'87%',
:resizeType => 0,
:no_label => true %>
<%# end %> <%# end %>
<%#= wikitoolbar_for 'issue_description' %> <%#= wikitoolbar_for 'issue_description' %>
<% end %> <% end %>
@ -68,13 +58,13 @@
</ul> </ul>
</div> </div>
<li> <li>
<% if @copy_from && @copy_from.attachments.any? %> <%# if @copy_from && @copy_from.attachments.any? %>
<p> <!--<p>-->
<!-- 去除附件复制功能 --> <!-- 去除附件复制功能 -->
<!-- <label for="copy_attachments"><#%= l(:label_copy_attachments) %></label> <!-- <label for="copy_attachments"><#%= l(:label_copy_attachments) %></label>
<#%= check_box_tag 'copy_attachments', '1', @copy_attachments %> --> <#%= check_box_tag 'copy_attachments', '1', @copy_attachments %> -->
</p> <!--</p>-->
<% end %> <%# end %>
<% if @copy_from && !@copy_from.leaf? %> <% if @copy_from && !@copy_from.leaf? %>
<p> <p>
<label for="copy_subtasks"><%= l(:label_copy_subtasks) %></label> <label for="copy_subtasks"><%= l(:label_copy_subtasks) %></label>

View File

@ -1,13 +1,13 @@
<div class="splitcontent"> <div class="splitcontent">
<div class="splitcontentleft"> <div class="splitcontentleft">
<% i = 0 %> <% i = 0 %>
<% split_on = (@issue.custom_field_values.size / 2.0).ceil - 1 %> <% split_on = (@issue.custom_field_values.size / 2.0).ceil - 1 %>
<% @issue.editable_custom_field_values.each do |value| %> <% @issue.editable_custom_field_values.each do |value| %>
<p><%= custom_field_tag_with_label :issue, value, :required => @issue.required_attribute?(value.custom_field_id) %></p> <p><%= custom_field_tag_with_label :issue, value, :required => @issue.required_attribute?(value.custom_field_id) %></p>
<% if i == split_on -%> <% if i == split_on -%>
</div><div class="splitcontentright"> </div><div class="splitcontentright">
<% end -%> <% end -%>
<% i += 1 -%> <% i += 1 -%>
<% end -%> <% end -%>
</div> </div>
</div> </div>

View File

@ -12,6 +12,7 @@
<div class="ping_dispic"> <div class="ping_dispic">
<%= link_to image_tag(url_to_avatar(@issue.author), :width => 46, :height => 46), user_path(@issue.author), :class => "ping_dispic" %> <%= link_to image_tag(url_to_avatar(@issue.author), :width => 46, :height => 46), user_path(@issue.author), :class => "ping_dispic" %>
</div> </div>
<div class="talk_txt fl"> <div class="talk_txt fl">
<p class="pro_page_tit" style="word-break:break-all;"> <p class="pro_page_tit" style="word-break:break-all;">
<span class='<%= "#{get_issue_type(@issue.tracker_id)[0]} fl" %>' title="<%= get_issue_type(@issue.tracker_id)[1] %>"></span> <span class='<%= "#{get_issue_type(@issue.tracker_id)[0]} fl" %>' title="<%= get_issue_type(@issue.tracker_id)[1] %>"></span>
@ -20,100 +21,53 @@
</p><br/> </p><br/>
<div class="cl"></div> <div class="cl"></div>
由<a href="javascript:void(0)" class="problem_name"><%= @issue.author %></a> 由<a href="javascript:void(0)" class="problem_name"><%= @issue.author %></a>添加于 <%= format_time(@issue.created_on).html_safe %>
添加于 <%= format_time(@issue.created_on).html_safe %>
</div> </div>
<!--talk_txt end--> <!--talk_txt end-->
<a href="javascript:void(0)" class="talk_edit fr"<%= render :partial => 'action_menu' %></a> <a href="javascript:void(0)" class="talk_edit fr"<%= render :partial => 'action_menu' %></a>
<div class="cl"></div> <div class="cl"></div>
<div class="talk_info mb10" style="word-break:break-all;">
<% if @issue.description? || @issue.attachments.any? -%> <% if @issue.description? || @issue.attachments.any? -%>
<div class="talk_info mb10" style="word-break:break-all;">
<% if @issue.description? %> <% if @issue.description? %>
<%#= link_to l(:button_quote), quoted_issue_path(@issue.id), :remote => true, :method => 'post', :class => 'icon icon-comment' if authorize_for('issues', 'edit') %> <%#= link_to l(:button_quote), quoted_issue_path(@issue.id), :remote => true, :method => 'post', :class => 'icon icon-comment' if authorize_for('issues', 'edit') %>
<%= textAreailizable @issue, :description, :attachments => @issue.attachments %> <%= textAreailizable @issue, :description, :attachments => @issue.attachments %>
<% end %> <% end %>
</div> </div>
<% end -%>
<div class="pro_pic_box mb10"> <div class="pro_pic_box mb10">
<a href="javascript:void(0)" class="link_img fl"> <a href="javascript:void(0)" class="link_img fl">
<!--显示附件、图片--> <!--显示附件、图片-->
<%= link_to_attachment_project @issue, :thumbnails => true %></a><br/> <%= link_to_attachment_project @issue, :thumbnails => true %></a><br/>
<% end -%>
<%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %> <%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %>
</div><!--pro_pic_box end--> </div><!--pro_pic_box end-->
<div class="cl"></div> <div class="cl"></div>
<!--属性-->
<div class="pro_info_box mb10">
<%= issue_fields_rows do |rows| %>
<ul class="fl" >
<li><p class="label03" >&nbsp;状态&nbsp;&nbsp;:&nbsp;</p><p class="pro_info_p"><%= @issue.status.name %></p>
</li>
<div class="cl"></div>
<% unless @issue.disabled_core_fields.include?('assigned_to_id') %>
<li><p class="label03" >&nbsp;指派给&nbsp;&nbsp;:&nbsp;</p><span class="pro_info_p"><%= @issue.assigned_to ? link_to_isuue_user(@issue.assigned_to) : "--" %></span>
</li>
<% end %>
<div class="cl"></div>
</ul>
<ul class="fl" >
<li><p class="label03" >&nbsp;优先级&nbsp;&nbsp;:&nbsp;</p><span class="pro_info_p" style="width:50px;"><%= @issue.priority.name %></span>
</li>
<div class="cl"></div>
<% unless @issue.disabled_core_fields.include?('done_ratio') %>
<li><p class="label03" >&nbsp;% 完成&nbsp;&nbsp;:&nbsp;</p><span class="pro_info_p" style="width:50px;"><%= @issue.done_ratio %>%</span>
</li>
<% end %>
<div class="cl"></div>
</ul>
<ul class="fl " > <!--属性-->
<% unless @issue.disabled_core_fields.include?('start_date') %> <%= render :partial => 'attributes_show' %>
<li><p class="label03" style="width:50px;" >&nbsp;开始&nbsp;&nbsp;:&nbsp;</p><p class="pro_info_p"><%= format_date(@issue.start_date) %></p>
</li>
<% end %>
<div class="cl"></div>
<% unless @issue.disabled_core_fields.include?('estimated_hours') %>
<li><p class="label03" style="width:50px;">&nbsp;周期&nbsp;&nbsp;:&nbsp;</p><span class="pro_info_p"><%= l_hours(@issue.estimated_hours) %></span>
</li>
<% end %>
<div class="cl"></div>
</ul>
<ul class="fl " >
<% unless @issue.disabled_core_fields.include?('due_date') %>
<li><p class="label03" >&nbsp;计划完成&nbsp;&nbsp;:&nbsp;</p><span class="pro_info_p" style="width:120px;"><%= format_date(@issue.due_date)? format_date(@issue.due_date) : "--" %></span>
</li>
<% end %>
<div class="cl"></div>
<% unless @issue.disabled_core_fields.include?('fixed_version_id') %>
<li><p class="label03" >&nbsp;目标版本&nbsp;&nbsp;:&nbsp;</p><span class="pro_info_p" style="width:120px;"><%= (@issue.fixed_version ? link_to_version(@issue.fixed_version, :class => "pro_info_p") : "--") %></span>
</li>
<% end %>
<div class="cl"></div>
</ul>
<% end %><!--pro_info_box end-->
<%#= render_custom_fields_rows(@issue) %>
<%#= call_hook(:view_issues_show_details_bottom, :issue => @issue) %>
</div>
<!--pro_info_box 属性 end--> <!--pro_info_box 属性 end-->
<div class="cl"></div>
<%= link_to l(:button_quote), quoted_issue_path(@issue.id), :remote => true, :method => 'post', :class => 'talk_edit fr' if authorize_for('issues', 'edit') %></a> <%# 该应用是对issue主题内容的引用对应:to => 'journals#new %>
<!--<div class="cl"></div>-->
<!--<%#= link_to l(:button_quote), quoted_issue_path(@issue.id), :remote => true, :method => 'post', :class => 'talk_edit fr' if authorize_for('issues', 'edit') %>-->
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<!--problem_main end--> <!--problem_main end-->
<div style="clear: both;"></div> <div style="clear: both;"></div>
<!--留言--> <!--留言-->
<% if @issue.editable? %> <% if @issue.editable? %>
<div id="update"> <div id="update">
<%= render :partial => 'edit' %> <%= render :partial => 'edit' %>
</div> </div>
<p style="padding-top: 5px"></p> <p style="padding-top: 5px"></p>
<%#--引用时不能修改,剥离出引用内容--%>
<!--引用时不能修改,剥离出引用内容-->
<a remote="true" href="javascript:void(0)" class="blue_btn fr mr80" onclick="issue_desc_editor.sync();$('#issue-form').submit();"> <a remote="true" href="javascript:void(0)" class="blue_btn fr mr80" onclick="issue_desc_editor.sync();$('#issue-form').submit();">
<%= l(:button_submit) %> <%= l(:button_submit) %>
</a> </a>
<% end %> <% end %>
<%#= submit_tag l(:button_submit) %> <%#= submit_tag l(:button_submit) %>
<%#= preview_link preview_edit_issue_path(:project_id => @project, :id => @issue), 'issue-form' ,'preview',{:class => "blue_btn fr mr10"}%> <%#= preview_link preview_edit_issue_path(:project_id => @project, :id => @issue), 'issue-form' ,'preview',{:class => "blue_btn fr mr10"}%>
</div> </div>
@ -124,6 +78,7 @@
<%= render :partial => 'changesets', :locals => {:changesets => @changesets} %> <%= render :partial => 'changesets', :locals => {:changesets => @changesets} %>
</div> </div>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
<% other_formats_links do |f| %> <% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>

View File

@ -5,6 +5,7 @@ $('#issue_notes').val("<%= raw escape_javascript(@content) %>");
%> %>
$('#issue_private_notes').attr('checked', true); $('#issue_private_notes').attr('checked', true);
<% end %> <% end %>
//quote_issue_journal()
showAndScrollTo("update", "notes"); showAndScrollTo("update", "notes");
$('#notes').scrollTop = $('#notes').scrollHeight - $('#notes').clientHeight; $('#notes').scrollTop = $('#notes').scrollHeight - $('#notes').clientHeight;

View File

@ -369,6 +369,9 @@ $(document).ready(function () {
$('html, body').animate({scrollTop: $('#' + id).offset().top}, 400); $('html, body').animate({scrollTop: $('#' + id).offset().top}, 400);
} }
function quote_issue_journal(){
document.getElementById("#issue_notes").focus();
}
/*缺陷完成度决定缺陷状态*/ /*缺陷完成度决定缺陷状态*/
function PrecentChange(obj) { function PrecentChange(obj) {