Merge branch 'dev_newproject' of https://git.trustie.net/jacknudt/trustieforge into dev_newproject

This commit is contained in:
huang 2016-10-21 17:14:22 +08:00
commit bdfa28e762
6 changed files with 251 additions and 31 deletions

View File

@ -114,11 +114,20 @@ class VersionsController < ApplicationController
def show
respond_to do |format|
@issues = @version.fixed_issues.visible.
includes(:status, :tracker, :priority).
reorder("#{Tracker.table_name}.position, #{Issue.table_name}.id").
all
@issue_count = @issues.count
@limit = 20
@issue_pages = Paginator.new @issue_count, @limit, params['page'] || 1
# @offset ||= @issue_pages.offset
@issues = paginateHelper @issues, @limit
format.html {
@issues = @version.fixed_issues.visible.
includes(:status, :tracker, :priority).
reorder("#{Tracker.table_name}.position, #{Issue.table_name}.id").
all
# @issues = @version.fixed_issues.visible.
# includes(:status, :tracker, :priority).
# reorder("#{Tracker.table_name}.position, #{Issue.table_name}.id").
# all
}
format.api
# format.xls {
@ -175,7 +184,24 @@ class VersionsController < ApplicationController
end
def update
if request.put? && params[:version]
if request.put? && params[:version] && params[:flag].to_i == 1
@version.update_attribute(:status, params[:status])
if @version.save
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
redirect_to settings_project_path(@project, :tab => 'versions')
}
format.js
format.api { render_api_ok }
end
else
respond_to do |format|
format.html { render :action => 'edit' }
format.api { render_validation_errors(@version) }
end
end
else if request.put? && params[:version]
attributes = params[:version].dup
attributes.delete('sharing') unless @version.allowed_sharings.include?(attributes['sharing'])
@version.safe_attributes = attributes
@ -193,9 +219,9 @@ class VersionsController < ApplicationController
format.api { render_validation_errors(@version) }
end
end
end
end
end
end
def close_completed
if request.put?
@project.close_completed_versions

View File

@ -1854,6 +1854,16 @@ module ApplicationHelper
link_to l(:button_delete), url, options
end
def delete_version_link(url, options={})
options = {
:method => :delete,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'icon icon-del'
}.merge(options)
link_to "", url, options
end
def delete_link_version(url, options={})
options = {
:method => :delete,
@ -1923,12 +1933,12 @@ module ApplicationHelper
pcts << (100 - pcts[0])
width = options[:width] || '100px;'
legend = options[:legend] || ''
content_tag('table',
content_tag('span',
content_tag('tr',
(pcts[0] > 0 ? content_tag('td', '', :style => "width: #{pcts[0]}%;", :class => 'closed', :title => "已关闭:#{pcts[0]}%") : ''.html_safe) +
(pcts[0] > 0 ? content_tag('span', '', :style => "width: #{pcts[0]}%;", :class => 'roadmap_progressbar_inner', :title => "已关闭:#{pcts[0]}%") : ''.html_safe) #+
# (pcts[1] > 0 ? content_tag('td', '', :style => "width: #{pcts[1]}%;", :class => 'done', :title => "开发中:#{pcts[1]}%") : ''.html_safe) +
(pcts[1] > 0 ? content_tag('td', '', :style => "width: #{pcts[1]}%;", :class => 'todo', :title => "未完成:#{pcts[1]}%") : ''.html_safe), :style => "width: #{width}"
), :class => 'progress').html_safe
#(pcts[1] > 0 ? content_tag('span', '', :style => "width: #{pcts[1]}%;", :class => 'roadmap_progressbar ml5', :title => "未完成:#{pcts[1]}%") : ''.html_safe), :style => "width: #{width}"
), :class => 'roadmap_progressbar ml5').html_safe
# + content_tag('p', legend, :class => 'percent').html_safe
end

View File

@ -1,23 +1,56 @@
<!--Modified by young-->
<% if version.issues_count > 0 %>
<p class="f14 mb5">&#187;<%= l(:label_versions_progress)%></p>
<%= progress_bar([version.closed_percent], :width => '648px;', :legend => ('%0.0f%' % version.completed_percent)) %>
<p class="progress-info">
<%#= link_to(l(:label_x_issues, :count => version.issues_count),
project_issues_path(version.project, :status_id => '*', :fixed_version_id => version, :set_filter => 1), :class =>"c_dblue",) %>
<a class="c_dblue" target="_blank"><%=version.issues_count%>&nbsp;问题</a>
&nbsp;
(<%#= link_to_if(version.closed_issues_count > 0, l(:label_x_closed_issues_abbr, :count => version.closed_issues_count),
project_issues_path(version.project, :status_id => 'c', :fixed_version_id => version, :set_filter => 1), :class =>"c_dblue") %>
<% if version.closed_issues_count > 0 %>
<a class="c_dblue" target="_blank"><%end%><%=version.closed_issues_count%>&nbsp;已关闭</a>
&#8212;
<%#= link_to_if(version.open_issues_count > 0, l(:label_x_open_issues_abbr, :count => version.open_issues_count),
project_issues_path(version.project, :status_id => 'o', :fixed_version_id => version, :set_filter => 1), :class =>"c_dblue") %>
<% if version.open_issues_count > 0%>
<a class="c_dblue" target="_blank"><%end%><%=version.open_issues_count%>&nbsp;打开</a>
)
</p>
<li>已关闭 <span class="ml5 "><%=version.closed_issues_count%></span></li>
<li><span >/</span></li>
<li>issues<span class="ml5 "><%=version.issues_count%></span></li>
<li>
<%= progress_bar([version.closed_percent], :width => '300px;', :legend => ('%0.0f%' % version.completed_percent)) %>
<span class="ml5 c_red">
<%= version.closed_percent.round %>%
</span>
</li>
<%#= labelled_form_for @version,:html=>{:id=>"new_project_version_form"} do |f| %>
<%#= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]}, :class=>"fr new_roadmap_select", :blur => "remote_function(#new_project_version_form);"%>
<%# end %>
<%= form_tag({:controller => 'versions', :action => 'update', :version => @version, :flag => 1},:remote => 'true', :method =>:put, :id=>"version-#{@version.id}-status-form", :class => 'fr new_roadmap_select') do %>
<%= select( :versions, :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]},
{ :include_blank => false, :selected=> @version.status ? @version.status : 0},
{ :onchange =>"remote_function('#version-#{@version.id}-status-form');", :id =>"status", :name => "status",:class=>"fr new_roadmap_select"}) %>
<% end %>
<%= delete_version_link version_path(@version, :back_url => url_for(:controller => 'versions',
:action => 'index',
:project_id => @version.project)),:class=>'roadmap_icons_del fr mt5 mr5' if User.current.allowed_to?(:manage_versions, @version.project) %>
<%= link_to("", edit_version_path(@version), :class => 'roadmap_icons_edit fr mt5 ') if User.current.allowed_to?(:manage_versions, @version.project) %>
<%= call_hook(:view_versions_show_contextual, { :version => @version, :project => @project }) %>
<% else %>
<div class="flash error"><%= l(:label_roadmap_no_issues) %></div>
<% end %>
<!--Modified by young-->
<%# if version.issues_count > 0 %>
<!-- <p class="f14 mb5">&#187;<%#= l(:label_versions_progress)%></p>
<%#= progress_bar([version.closed_percent], :width => '648px;', :legend => ('%0.0f%' % version.completed_percent)) %>
<p class="progress-info">
<%#= link_to(l(:label_x_issues, :count => version.issues_count),
project_issues_path(version.project, :status_id => '*', :fixed_version_id => version, :set_filter => 1), :class =>"c_dblue",) %>
<a class="c_dblue" target="_blank"><%#=version.issues_count%>&nbsp;问题</a>
&nbsp;
(<%#= link_to_if(version.closed_issues_count > 0, l(:label_x_closed_issues_abbr, :count => version.closed_issues_count),
project_issues_path(version.project, :status_id => 'c', :fixed_version_id => version, :set_filter => 1), :class =>"c_dblue") %>
<%# if version.closed_issues_count > 0 %>
<a class="c_dblue" target="_blank"><%#end%><%#=version.closed_issues_count%>&nbsp;已关闭</a>
&#8212;
<%#= link_to_if(version.open_issues_count > 0, l(:label_x_open_issues_abbr, :count => version.open_issues_count),
project_issues_path(version.project, :status_id => 'o', :fixed_version_id => version, :set_filter => 1), :class =>"c_dblue") %>
<%# if version.open_issues_count > 0%>
<a class="c_dblue" target="_blank"><%#end%><%#=version.open_issues_count%>&nbsp;打开</a>
)
</p>
<%# else %>
<div class="flash error"><%#= l(:label_roadmap_no_issues) %></div>
<%# end %>-->
<script>
function remote_function(id) {
$(id).submit();
}
</script>

View File

@ -0,0 +1 @@
<span class="fl <%= get_version_type(@version.status) %> mt3 ml5"></span>

View File

@ -1,3 +1,138 @@
<!--里程碑详情开始-->
<div class="new_roadmap_conbox mb10">
<div class="new_roadmap_info_top clear ">
<a href="<%= project_roadmap_path(@project) %>" class="fl linkBlue2 mt3" >
<span class="new_roadmap_icons_back mr5"></span>
返回里程碑列表
</a>
<span class="ml5 mr5 fl f14">|</span>
<h4 class="fl new_roadmap_listtitle"><%= h(@version.name) %></h4>
<ul id="version_status_con_id">
<%= render :partial => 'versions/type_ico', :locals => {:version => @version} %>
</ul>
<p class="fr mt3 c_grey02">
<span class="muban-icons-clock "></span>
<% if @version.completed? %>
<%= format_date(@version.effective_date) %>
<% elsif @version.effective_date %>
<%= due_date_distance_in_words(@version.effective_date) %>(<%= format_date(@version.effective_date) %>)
<% end %>
</p>
</div>
<div class="clear new_roadmap_listbox">
<ul class="new_roadmap_list_txt clear mb5">
<%= render :partial => 'versions/overview', :locals => {:version => @version} %>
</ul>
<div class="c_grey02">
<p><%= @version.description %></p>
</div>
</div>
</div>
<div class="new_roadmap_conbox " >
<div class=" clear">
<ul class="new_roadmap_nav fl" >
<li id="new_roadmap_nav_1" class="new_roadmap_nav_hover " onclick="HoverLi(1);">
<a href="javascript:void(0);" id="new_roadmap_type_1" class="new_roadmap_type_nomal" >所有issues</a>
</li>
<li id="new_roadmap_nav_2" onclick="HoverLi(2);" >
<a href="javascript:void(0);" id="new_roadmap_type_2" class="new_roadmap_type_nomal" >issues统计</a>
</li>
</ul>
</div>
<div id="new_roadmap_content_1">
<div class="pd15box">
<table class="new_roadmap_table " cellpadding="0" cellspacing="0">
<thead>
<tr>
<th>ID</th>
<th>标题</th>
<th>类型</th>
<th>指派给</th>
<th>更新时间</th>
<th>状态</th>
<th>完成度</th>
</tr>
</thead>
<tbody>
<% @issues.each do |issue| %>
<tr>
<td>#<%= issue.id %></td>
<td><p class="new_roadmap_info_title" title="<%= issue.subject %>"><%= issue.subject %></p> </td>
<td> <%= issue.tracker %> </td>
<td><p class="new_roadmap_info_name"><%= User.find(issue.try(:assigned_to_id)).show_name %></p></td>
<td><%= format_time issue.updated_on %></td>
<td><%= issue.status.name %></td>
<td><span class="<%= issue.done_ratio == 100 ? "c_green" : "c_red" %>" ><%= issue.done_ratio %>%</span></td>
</tr>
<% end %>
</tbody>
</table>
</div>
<%= link_to "导出", version_path(@version, :format => 'xls'), :class=>"btn_newpro_grey fl mt10 ml15 "%>
<div class="pages fr" style="width:auto; display:inline-block; margin-right:10px;">
<div>
<%= pagination_links_full @issue_pages, @issue_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true%>
</div>
<div class="cl"></div>
</div><!--翻页 end-->
<div class="cl"></div>
</div><!--new_roadmap_content_1 end-->
<div id="new_roadmap_content_2" class="undis">
<!--缺陷统计开始-->
<div class=" ml15 mr10 mb15">
<table class="new_roadmap_table " cellpadding="0" cellspacing="0">
<thead>
<tr>
<th>指派给</th>
<th>全部</th>
<th>完成</th>
<th>关闭</th>
<th>待完成</th>
</tr>
</thead>
<tbody>
<tr>
<td>李冰冰</td>
<td>29</td>
<td>5</td>
<td>4</td>
<td>1</td>
</tr>
<tr>
<td>李冰冰</td>
<td>29</td>
<td>5</td>
<td>4</td>
<td>1</td>
</tr>
<tr>
<td>李冰冰</td>
<td>29</td>
<td>5</td>
<td>4</td>
<td>1</td>
</tr>
<tr>
<td>Total</td>
<td>29</td>
<td>5</td>
<td>4</td>
<td>1</td>
</tr>
</tbody>
</table>
</div>
<!--缺陷列表结束-->
</div><!--new_roadmap_content_2 end-->
</div><!--new_roadmap end-->
<!--里程碑详情结束-->
<!--modified by young-->
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_roadmap) %></h2>
@ -83,5 +218,19 @@
<% html_title @version.name %>
<script>
$(".project_r_h").parent().css({"width":"730px","background-color":"#fff","padding":"10px","margin-left":"10px","margin-bottom":"10px"});
//issues列表
function g(o){
return document.getElementById(o);
}
function HoverLi(n){
//如果有N个标签,就将i<=N;
for(var i=1;i<=2;i++){
g('new_roadmap_nav_'+i).className='new_roadmap_nav_nomal';
g('new_roadmap_type_'+i).className='new_roadmap_type_nomal';
g('new_roadmap_content_'+i).className='undis';
}
g('new_roadmap_nav_'+n).className='new_roadmap_nav_hover';
g('new_roadmap_type_'+n).className='new_roadmap_type_hover';
g('new_roadmap_content_'+n).className='dis';
}
</script>

View File

@ -0,0 +1 @@
$('#version_status_con_id').html('<%= escape_javascript( render :partial => 'versions/type_ico', :locals => {:version => @version}) %>');