socialforge/app/views/issues/_form.html.erb

165 lines
9.4 KiB
Plaintext
Raw Normal View History

2015-04-15 16:34:34 +08:00
<%= labelled_fields_for :issue, @issue do |f| %>
2016-10-25 09:28:09 +08:00
<ul class="fl pro_new_conbox_left">
2015-04-15 16:34:34 +08:00
<li>
<% if @issue.safe_attribute? 'subject' %>
<label class="label"><span class="c_red f12">*</span>&nbsp;主题&nbsp;&nbsp;:&nbsp;</label>
2016-10-28 09:43:30 +08:00
<%= f.text_field :subject, :style => "font-size:small;width:606px;", :no_label => true %>
2015-04-15 16:34:34 +08:00
<!--Added by young-->
<%= javascript_tag do %>
observeAutocompleteField('issue_subject',
2015-04-24 15:20:37 +08:00
'<%= escape_javascript auto_complete_issues_path(:project_id => @project, :scope => (Setting.cross_project_issue_relations? ? 'all' : nil)) %>',
2015-04-15 16:34:34 +08:00
{ select: function(event, ui) {
$('input#issue_subject').val(ui.item.value);
}
});
<% end %>
<% end %>
2016-10-25 09:28:09 +08:00
<span ></span>
2015-04-15 16:34:34 +08:00
</li>
2016-10-25 09:28:09 +08:00
<li class="clear">
2015-04-15 16:34:34 +08:00
<% if @issue.safe_attribute? 'description' %>
<label class="label">&nbsp;描述&nbsp;&nbsp;:&nbsp;</label>
2015-04-15 16:34:34 +08:00
<%= f.label_for_field :description, :required => @issue.required_attribute?('description'), :no_label => true, :class => "label" %>
2015-05-27 11:08:05 +08:00
<%#= 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 %>
2016-10-25 09:28:09 +08:00
<%= 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 %>
2015-05-27 11:08:05 +08:00
<%# end %>
<%#= wikitoolbar_for 'issue_description' %>
2015-04-15 16:34:34 +08:00
<% end %>
</li>
2016-11-07 13:28:50 +08:00
<li class="fl">
<% if @issue.safe_attribute? 'tracker_id' %>
<label class="label mt3"><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 => "w110" %>
<% end %>
</li>
<li class="fl ml41">
<label class="label mt3"><span class="c_red f12">*</span><%= l(:field_status) %></label>
2016-10-25 09:28:09 +08:00
<%# if @issue.safe_attribute?('status_id') && @allowed_statuses.present? %>
<%= f.select :status_id, (@allowed_statuses.collect { |p| [p.name, p.id] }),
2016-11-07 13:28:50 +08:00
{:no_label => true},
:class => "w110" %>
2016-10-25 09:28:09 +08:00
</li>
2016-11-07 13:28:50 +08:00
<li class="fl ml41">
<label class="label mt3"><span class="c_red f12">*</span><%= l(:field_priority) %></label>
2016-10-25 09:28:09 +08:00
<% if @issue.safe_attribute? 'priority_id' %>
<%= f.select :priority_id, (@priorities.collect { |p| [p.name, p.id] }),
2016-11-07 13:28:50 +08:00
{:required => true, :no_label => true}, :disabled => !@issue.leaf?,
:class => "w110" %>
2016-10-25 09:28:09 +08:00
<% end %>
</li>
<li class="clear">
<label class="label"><%= l(:label_attachment_plural) %></label>
<%= render :partial => 'attachments/form', :locals => {:container => @issue} %>
</li>
<li class="clear">
2016-10-25 11:23:02 +08:00
<% if params[:action] == "new" %>
2016-10-28 09:43:30 +08:00
<a href="<%= project_issues_path(@project, :remote => true) %>" class="sy_btn_grey mr5 fr"> 取消</a>
2016-10-25 11:23:02 +08:00
<% else %>
2016-10-28 09:43:30 +08:00
<a href="javascript:void(0);" onclick="issueDetailShow();" class="sy_btn_grey mr5 fr" > 取消 </a>
2016-10-25 11:23:02 +08:00
<% end %>
<!--<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>-->
<input onclick="issue_desc_editor.sync();$('#issue-form').submit();" class="sy_btn_blue fr mr5" id="issue_confirm" style="width: 28px;color: #FFF" value="保存">
2016-10-25 09:28:09 +08:00
</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>
2016-10-28 18:47:23 +08:00
<li class=" clear" id="versions_assigned_id">
2016-10-25 09:28:09 +08:00
<% 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"} %>
2016-10-25 09:28:09 +08:00
<% end %>
</li>
2016-10-25 11:23:02 +08:00
<li class=" clear" id="assigned_to_tips">
2016-10-25 15:37:49 +08:00
<%= @issue.assigned_to.nil? ? "未指派" : "已指派" %>
2016-10-25 11:23:02 +08:00
</li>
2016-10-28 18:47:23 +08:00
<li class=" clear" >
<%= 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},
2016-11-07 13:28:50 +08:00
{:onchange => "change_milestone_tip();", :class => "w150"} %>
2016-10-25 09:28:09 +08:00
</li>
<li class=" clear" id="milestone_option_tips">
2016-10-25 15:37:49 +08:00
<%= @issue.fixed_version.nil? ? "无里程碑" : "已指派里程碑" %>
2016-10-27 16:33:00 +08:00
<% if params[:action] == "new" %>
<%= link_to "", new_project_version_path(@project, :is_issue => true, :issue_project_id => @project.id), :class => "pic_add mt5 ml5 fr", :remote => true %>
<% end %>
2016-10-25 09:28:09 +08:00
</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,
2016-11-07 13:28:50 +08:00
:required => @issue.required_attribute?('start_date'), :onchange=>"issue_start_date_change();",
:class=>"fl calendar_input", :style=>"width:170px;" %>
2016-10-25 09:28:09 +08:00
<%= calendar_for('issue_start_date', 'start_date') if @issue.leaf? %>
<% end %>
</li>
<li class=" clear" id="option_start_date_tips">
2016-10-25 15:37:49 +08:00
<%= @issue.start_date.nil? ? "未选择开始日期" : "已选择开始日期" %>
2016-10-25 09:28:09 +08:00
</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,
2016-11-07 13:28:50 +08:00
:required => @issue.required_attribute?('due_date'), :onchange=>"issue_end_date_change();",
:class=>"fl calendar_input",:style=>"width: 170px;", :placeholder=> "请选择结束日期" %>
2016-10-25 09:28:09 +08:00
<%= calendar_for('issue_due_date', 'start_date') if @issue.leaf? %>
<% end %>
</li>
<li class=" clear " id="option_end_date_tips">
2016-10-25 15:37:49 +08:00
<%= @issue.due_date.nil? ? "未选择结束日期" : "已选择结束日期" %>
2016-10-25 09:28:09 +08:00
</li>
<li class=" clear">
<% if @issue.safe_attribute? 'estimated_hours' %>
2016-11-07 13:28:50 +08:00
<%= f.text_field :estimated_hours, :size => 22, :disabled => !@issue.leaf?, :no_label => true,
:required => @issue.required_attribute?('estimated_hours'), :placeholder=> "请填写预计工时" %>
2016-10-25 09:28:09 +08:00
<% end %>
</li>
2016-11-07 13:28:50 +08:00
<li class=" clear"><%= l(:field_estimated_hours) %></li>
2016-10-25 09:28:09 +08:00
<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 %>
2016-11-07 13:28:50 +08:00
<li class=" clear">完成度</li>
2016-10-25 09:28:09 +08:00
</li>
2015-04-15 16:34:34 +08:00
</ul>
<% end %>
2016-10-25 09:28:09 +08:00
<script>
function change_assigned_tip() {
2016-10-28 18:47:23 +08:00
if( document.getElementById('issue_assigned_to_id').options[document.getElementById('issue_assigned_to_id').selectedIndex].value == 0 ){
$('#assigned_to_tips').html("未指派");
}
else{
$('#assigned_to_tips').html("已指派")};
2016-10-25 09:28:09 +08:00
}
2016-10-28 18:47:23 +08:00
function change_milestone_tip(version_id){
if( document.getElementById('issue_fixed_version_id').options[document.getElementById('issue_fixed_version_id').selectedIndex].value == 0 ){
$('#milestone_option_tips').html("未指派里程碑")}
else{
$('#milestone_option_tips').html("已指派里程碑")
};
2016-10-25 09:28:09 +08:00
}
function issue_start_date_change(){
$('#option_start_date_tips').html("已选择开始日期");
}
function issue_end_date_change() {
$('#option_end_date_tips').html("已选择结束日期");
}
2016-11-07 13:28:50 +08:00
// 里程碑添加默认选项
$("#issue_fixed_version_id option[value='']").remove();
$('#issue_fixed_version_id').prepend("<option value='0' selected='selected'>选择里程碑</option>")
2016-10-25 09:28:09 +08:00
</script>