新版Issue新建页面

This commit is contained in:
daiao 2016-10-25 09:28:09 +08:00
parent d2e6333ed6
commit e3f0f222e6
7 changed files with 172 additions and 66 deletions

View File

@ -1067,6 +1067,24 @@ module ApplicationHelper
s.html_safe
end
def assigned_options_for_select(collection, selected=nil)
s = ''
s << content_tag('option', "#{l(:label_assiged_tip)}", :value => 0)
if collection.include?(User.current)
s << content_tag('option', "<< #{l(:label_me)} >>", :value => User.current.id)
end
groups = ''
collection.sort.each do |element|
selected_attribute = ' selected="selected"' if option_value_selected?(element, selected)
(element.is_a?(Group) ? groups : s) << %(<option value="#{element.id}"#{selected_attribute}>#{h element.show_name}</option>)
end
unless groups.empty?
s << %(<optgroup label="#{h(l(:label_group_plural))}">#{groups}</optgroup>)
end
s.html_safe
end
# Options for the new membership projects combo-box
def options_for_membership_project_select(principal, projects)
options = content_tag('option', "--- #{l(:actionview_instancetag_blank_option)} ---")

View File

@ -1,34 +1,14 @@
<%= labelled_fields_for :issue, @issue do |f| %>
<%#= call_hook(:view_issues_form_details_top, {:issue => @issue, :form => f}) %>
<div class="newpro_box">
<ul>
<ul class="fl pro_new_conbox_left">
<li>
<% if @issue.safe_attribute? 'tracker_id' %>
<label class="label"><span class="c_red f12">*</span>&nbsp;类型&nbsp;&nbsp;:&nbsp;</label>
<%= f.select :tracker_id, @issue.project.trackers.collect { |t| [t.name, t.id] },
{:required => true, :no_label => true},
#:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')",
:class => "w90" %>
{:required => true, :no_label => true},
#:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')",
:class => "w90" %>
<% end %>
</li>
<li>
<% if @issue.safe_attribute? 'is_private' %>
<%= f.check_box :is_private, :no_label => true, :class => "ml30" %>
<label class="fl ml5 mt3" for="issue_is_private" id="issue_is_private_label"><%= l(:field_is_private) %></label>
<label class="fl ml5 mt3" for="issue_is_private" id="issue_is_private_tips"><%= l(:field_is_private_tips)%></label>
<% end %>
</li>
<!--<li>-->
<!--<input type="checkbox" class="ml30">-->
<!--<label class="fl ml5 mt3">不需要评审</label>-->
<!--</li>-->
<div class="cl"></div>
<!--<li>-->
<!--<%# if @issue.safe_attribute? 'project_id' %>-->
<%#= f.select :project_id, project_tree_options_for_select(@issue.allowed_target_projects, :selected => @issue.project), {:required => true},
:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')" %>
<!--<%# end %>-->
<!--</li>-->
<li>
<% if @issue.safe_attribute? 'subject' %>
<label class="label"><span class="c_red f12">*</span>&nbsp;主题&nbsp;&nbsp;:&nbsp;</label>
@ -42,52 +22,133 @@
}
});
<% end %>
<% end %>
<span ></span>
</li>
<div class="cl"></div>
<li>
<li class="clear">
<% if @issue.safe_attribute? 'description' %>
<label class="label">&nbsp;描述&nbsp;&nbsp;:&nbsp;</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? %>
<%#= content_tag 'span', :id => "issue_description_and_toolbar" do %>
<%= f.kindeditor :description,:editor_id => "issue_desc_editor", :width=>'85%', :height =>170, :resizeType => 0, :no_label => true,at_id: @project.id, at_type: @project.class.to_s %>
<%= f.kindeditor :description,:editor_id => "issue_desc_editor", :width=>'85%', :height =>159, :resizeType => 0, :no_label => true, at_id: @project.id, at_type: @project.class.to_s %>
<%# end %>
<%#= wikitoolbar_for 'issue_description' %>
<% end %>
</li>
<div class="cl"></div>
<li>
<label class="label"><span class="c_red f12">*</span><%= l(:field_status) %></label>
<%# if @issue.safe_attribute?('status_id') && @allowed_statuses.present? %>
<%= f.select :status_id, (@allowed_statuses.collect { |p| [p.name, p.id] }),
{:no_label => true},
# ajax 刷新
#:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')",
:class => "w150" %>
<%# else %>
<%#= h(@issue.status.name) %>
<%# end %>
</li>
<li>
<label class="label"><span class="c_red f12">*</span><%= l(:field_priority) %></label>
<% if @issue.safe_attribute? 'priority_id' %>
<%= f.select :priority_id, (@priorities.collect { |p| [p.name, p.id] }),
{:required => true, :no_label => true}, :disabled => !@issue.leaf?,
:class => "w150" %>
<% end %>
</li>
<li class="clear">
<label class="label"><%= l(:label_attachment_plural) %></label>
<%= render :partial => 'attachments/form', :locals => {:container => @issue} %>
</li>
<li class="clear">
<a href="<%= project_issues_path(@project, :remote => true) %>" class="sy_btn_grey mr5 fr"> 取消</a>
<a href="javascript:void(0);" class="sy_btn_blue mr5 fr"> 保存并继续</a>
<a href="javascript:void(0);" onclick="issue_desc_editor.sync();$('#issue-form').submit();" class="sy_btn_blue mr5 fr" id="issue_confirm"> 保存</a>
</li>
</ul>
<ul class="fl pro_new_conbox_right ml10 mb10">
<li class="clear">
<% if @issue.safe_attribute? 'is_private' %>
<%= f.check_box :is_private, :no_label => true, :class => "fl pro_newissue_con_check" %>
<label class="fl ml5" for="issue_is_private" id="issue_is_private_label"><%= l(:field_is_private) %></label>
<label class="fl ml5" for="issue_is_private" id="issue_is_private_tips"><%= l(:field_set_private_tips)%></label>
<% end %>
</li>
<li class=" clear">
<% if @issue.safe_attribute? 'assigned_to_id' %>
<%= f.select :assigned_to_id, assigned_options_for_select(@issue.assignable_users, @issue.assigned_to),
{:required => @issue.required_attribute?('assigned_to_id'), :no_label => true},
{:onchange => "change_assigned_tip();",:class => "w150"} %>
<% end %>
</li>
<li class=" clear" id="assigned_to_tips">未指派</li>
<li class=" clear">
<% if @issue.safe_attribute?('fixed_version_id') && @issue.assignable_versions.any? %>
<%= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version),
{:include_blank => true, :required => @issue.required_attribute?('fixed_version_id'), :no_label => true},
{:onchange => "change_milestone_tip();",:class => "w150"} %>
<%#= link_to(image_tag('add.png', :style => 'vertical-align: middle;'),
new_project_version_path(@issue.project),
:remote => true,
:method => 'get',
:title => l(:label_version_new),
:tabindex => 200) if User.current.allowed_to?(:manage_versions, @issue.project) %>
<!--<a href="javascript:viod(0)" class="pic_add mt5 ml5"></a>-->
<% end %>
</li>
<li class=" clear" id="milestone_option_tips">
无里程碑
<%= link_to "", new_project_version_path(@issue.project), :class => "pic_add mt5 ml5 fr", :target => "_blank" %>
</li>
<li class=" clear" style="border:1px solid #c8c8c8;">
<% if @issue.safe_attribute? 'start_date' %>
<%= f.text_field :start_date, :size => 22, :disabled => !@issue.leaf?, :no_label => true,
:required => @issue.required_attribute?('start_date'), :onchange=>"issue_start_date_change();", :class=>"fl calendar_input", :style=>"width:170px;" %>
<%= calendar_for('issue_start_date', 'start_date') if @issue.leaf? %>
<% end %>
</li>
<li class=" clear" id="option_start_date_tips">
未选择开始日期
</li>
<li class=" clear" style="border:1px solid #c8c8c8;">
<label class="label02" ></label>
<% if @issue.safe_attribute? 'due_date' %>
<%= f.text_field :due_date, :size => 22, :disabled => !@issue.leaf?, :no_label => true,
:required => @issue.required_attribute?('due_date'), :onchange=>"issue_end_date_change();", :class=>"fl calendar_input",:style=>"width: 170px;" %>
<%= calendar_for('issue_due_date', 'start_date') if @issue.leaf? %>
<% end %>
</li>
<li class=" clear " id="option_end_date_tips">
未选择结束日期
</li>
<li class=" clear"><%= l(:field_estimated_hours) %></li>
<li class=" clear">
<% if @issue.safe_attribute? 'estimated_hours' %>
<%= f.text_field :estimated_hours, :size => 22, :disabled => !@issue.leaf?, :no_label => true, :required => @issue.required_attribute?('estimated_hours') %>
<% end %>
</li>
<li class=" clear">完成度</li>
<li class=" clear">
<% if @issue.safe_attribute?('done_ratio') && @issue.leaf? && Issue.use_field_for_done_ratio? %>
<%= f.select :done_ratio, ((0..10).to_a.collect { |r| ["#{r*10} %", r*10] }),
{:required => @issue.required_attribute?('done_ratio'), :no_label => true},
:onchange => "PrecentChange(this.value)",
:class => "w150" %>
<% end %>
</li>
</ul>
</div>
<li>
<% if @copy_from && !@copy_from.leaf? %>
<p>
<label for="copy_subtasks"><%= l(:label_copy_subtasks) %></label>
<%= check_box_tag 'copy_subtasks', '1', @copy_subtasks %>
</p>
<% end %>
</li>
<div class="cl"></div>
<li>
<br>
<label class="label"><%= l(:label_attachment_plural) %></label>
<%= render :partial => 'attachments/form', :locals => {:container => @issue} %>
</li>
<div class="cl"></div>
<div id="attributes">
<%= render :partial => 'issues/attributes' %>
</div>
<div class="cl"></div>
<%= call_hook(:view_issues_form_details_bottom, {:issue => @issue, :form => f}) %>
<% end %>
<a href="javascript:void(0);" onclick="issue_desc_editor.sync();$('#issue-form').submit();" class="blue_btn fl ml80" id="issue_confirm"> 确定</a>
<% if params[:action] == "new" %>
<% if @copy_from %>
<%= link_to "取消", issue_path(@copy_from), :class => "grey_btn fl mr50 ml10" %>
<% end %>
<% else %>
<a href="javascript:void(0);" onclick="issueDetailShow();" class="grey_btn fl mr50 ml10" > 取消 </a>
<% end %>
<script>
function change_assigned_tip() {
$('#assigned_to_tips').html("已指派");
}
function change_milestone_tip(){
$('#milestone_option_tips').html("已指派里程碑");
}
function issue_start_date_change(){
$('#option_start_date_tips').html("已选择开始日期");
}
function issue_end_date_change() {
$('#option_end_date_tips').html("已选择结束日期");
}
</script>

View File

@ -7,6 +7,31 @@
$("#Container").css("width","1000px");
});
</script>
<!--新建缺陷开始-->
<div class="pro_new_con ">
<div class="pro_newissue_con clear">
<%= call_hook(:view_issues_new_top, {:issue => @issue}) %>
<%= labelled_form_for @issue, :url => project_issues_path(@project),
:html => {:id => 'issue-form', :multipart => true} do |f| %>
<%= error_messages_for 'issue' %>
<%= hidden_field_tag 'copy_from', params[:copy_from] if params[:copy_from] %>
<div>
<%= render :partial => 'issues/form', :locals => {:f => f} %>
</div>
<% end %>
</div>
</div>
<!--新建缺陷结束-->
<div class="homepageRight mt0 ml10" >
<div class="homepageRightBanner">
<div class="NewsBannerName">新建问题</div>
@ -18,7 +43,7 @@
<%= error_messages_for 'issue' %>
<%= hidden_field_tag 'copy_from', params[:copy_from] if params[:copy_from] %>
<div>
<%= render :partial => 'issues/form', :locals => {:f => f} %>
<%#= render :partial => 'issues/form', :locals => {:f => f} %>
</div>
<!--<%#= javascript_tag "$('#issue_subject').focus();" %>-->
<!--<a href="#" class="blue_btn fl ml80" onclick="issue_desc_editor.sync();$('#issue-form').submit();">-->

View File

@ -12,9 +12,9 @@
<% @version_issue_assigned_name.each do | assigned | %>
<tr>
<td><%= User.find(assigned[0]).show_name %></td>
<td><%= Issue.where(:fixed_version_id => @version.id,:assigned_to_id => assigned[0]).count %></td>
<td><%= Issue.where(:fixed_version_id => @version.id,:assigned_to_id => assigned[0], :status_id => 3).count %></td>
<td><%= Issue.where(:fixed_version_id => @version.id,:assigned_to_id => assigned[0], :status_id => 5).count %></td>
<td><%= Issue.where(:fixed_version_id => @version.id, :assigned_to_id => assigned[0]).count %></td>
<td><%= Issue.where(:fixed_version_id => @version.id, :assigned_to_id => assigned[0], :status_id => 3).count %></td>
<td><%= Issue.where(:fixed_version_id => @version.id, :assigned_to_id => assigned[0], :status_id => 5).count %></td>
<td><%= Issue.where(fixed_version_id: @version.id, assigned_to_id: assigned[0], status_id: [1,2,4]).count %></td>
</tr>
<% end %>

View File

@ -253,6 +253,7 @@ zh:
field_done_ratio: "% 完成"
field_is_private: 私有
field_is_private_tips: (设置为“私有”后本问题将仅对项目成员可见)
field_set_private_tips: (仅对项目成员可见)
field_watcher: 跟踪者
label_relates_to: 关联到
label_duplicates: 重复

View File

@ -763,6 +763,7 @@ zh:
label_disabled: 禁用
label_show_completed_versions: 显示已完成的版本
label_me:
label_assiged_tip: 指派给:未指派
label_board: 讨论区
label_board_new: 新建讨论区
label_board_plural: 讨论区

View File

@ -743,7 +743,7 @@ a:hover.hw_btn_blue,a:active.hw_btn_blue{ background: #3b94d6; color:#fff;}
.issues_form_filter select:focus,.issues_form_filter input:focus{border:1px solid #c8c8c8; border-right:none;}
.issues_form_filter select{appearance:none;-moz-appearance:none;-webkit-appearance:none; background: url("../images/project/arrow.png") no-repeat scroll right center transparent;}
input.issues_calendar_input{ padding-left:5px; color:#444; border-right:none;}
.issues_data_img{ display:block; width:25px; height:33px; border:1px solid #c8c8c8; border-left:none; background:url("../images/public_icon.png") -29px 9px no-repeat; }
.issues_data_img{ display:block; width:25px; height:33px; border:1px solid #c8c8c8; border-left:none; background:url("/images/public_icon.png") -29px 9px no-repeat; }
/* 缺陷Tab */
.issues_con_list{border:1px solid #dbdbdb; }
#issues_list_nav {border-bottom:1px solid #d0d0d0;}
@ -761,7 +761,7 @@ input.issues_calendar_input{ padding-left:5px; color:#444; border-right:none;}
.issues_filter_data input{height:28px;width:91px; border:1px solid #c8c8c8;background-color:#fff;}
.issues_form_filter select{appearance:none;-moz-appearance:none;-webkit-appearance:none; background: url("../images/project/arrow.png") no-repeat scroll right center transparent;}
input.issues_calendar_input{ padding-left:5px; color:#444; border-right:none;}
.issues_data_img{ display:block; width:25px; height:28px; border:1px solid #c8c8c8; border-left:none; background: url("../images/public_icon.png") -27px 7px no-repeat; }
.issues_data_img{ display:block; width:25px; height:28px; border:1px solid #c8c8c8; border-left:none; background: url("/images/public_icon.png") -27px 7px no-repeat; }
.issues_list_box{ padding:15px; padding-right: 0px; border-bottom:1px dashed #c8c8c8;}
.issues_list_titlebox{ font-size:14px; font-weight:bold; margin-bottom:8px;}