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

This commit is contained in:
daiao 2016-10-26 19:09:30 +08:00
commit 7a1177c199
7 changed files with 31 additions and 148 deletions

View File

@ -35,7 +35,7 @@ class VersionsController < ApplicationController
# 顶部导航
@project_menu_type = 7
type = params[:type]
version_all_count = Version.where(:project_id => @project.id)
version_all_count = Version.where(:project_id => @project.id).order("created_on desc")
case type
when nil,"1"
@versions = @project.versions
@ -113,6 +113,9 @@ class VersionsController < ApplicationController
end
def show
# 顶部导航
@project_menu_type = 7
respond_to do |format|
@version_issues = @version.fixed_issues.visible.
includes(:status, :tracker, :priority).
@ -255,26 +258,19 @@ class VersionsController < ApplicationController
end
def destroy
if @version.fixed_issues.empty?
begin
project = @version.project
issues = Issue.where(:fixed_version_id => @version.id)
@version.destroy
issues.update_all(:fixed_version_id, nil)
rescue Exception => e
puts e
end
respond_to do |format|
format.js
if params[:is_index]
format.html { redirect_to project_versions_path(@project) }
elsif params[:is_show]
format.html { redirect_to project_versions_path(@version) }
end
format.html { redirect_to project_versions_path(project)}
format.api { render_api_ok }
end
else
respond_to do |format|
format.html {
flash[:error] = l(:notice_unable_delete_version)
redirect_to settings_project_url(@project, :tab => 'versions')
}
format.api { head :unprocessable_entity }
end
end
end
def status_by

View File

@ -3,7 +3,7 @@
<div class="clear">
<h4 class="fl new_roadmap_listtitle"><%= link_to_version version, :name => version_anchor(version) %></h4><span class="fl <%= get_version_type(version.status) %> mt3 ml5"></span>
<%= link_to "导出Issue", version_path(version, :format => 'xls'), :class => "btn_newpro_grey fr" %>
<%= link_to "", version_path(version, :is_index => true), :method => "delete", :data => {:confirm => l(:text_are_you_sure)}, :class => "roadmap_icons_del fr mt5 mr5" if User.current.allowed_to?(:manage_versions, version.project) %>
<%= link_to "", version_path(version, :is_index => true), :method => "delete", :data => {:confirm => l(:text_are_you_sure_version)}, :class => "roadmap_icons_del fr mt5 mr5" if User.current.allowed_to?(:manage_versions, version.project) %>
<%# {:controller => 'versions', :action => 'destroy', :project_id => version.project, :is_index => true}, :class => "roadmap_icons_del fr mt5 mr5" if User.current.allowed_to?(:manage_versions, version.project) %>
<%= link_to "", edit_version_path(version, :is_index => true), :class => 'roadmap_icons_edit fr mt5', :remote => true %>
</div>

View File

@ -1,4 +1,3 @@
<% if version.issues_count > 0 %>
<li>已关闭 <span class="ml5 "><%= version.closed_issues_count%></span></li>
<li><span >/</span></li>
<li>issues<span class="ml5 "><%= version.issues_count%></span></li>
@ -8,48 +7,17 @@
<%= 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) %>
<%#= link_to "", {:controller => "versions", :action => "destroy", :project_id => @version.project_id}, :data => {:confirm => l(:text_are_you_sure_version)}, :class => "roadmap_icons_del fr mt5 mr5" if User.current.allowed_to?(:manage_versions, version.project) %>
<%= link_to "", version_path(version, :is_show => true), :method => "delete", :data => {:confirm => l(:text_are_you_sure_version)},:onclick => "confirm_can_delte", :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', :remote => true) 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();

View File

@ -28,7 +28,7 @@
</div>
</div>
</div>
<div class="new_roadmap_conbox " >
<div class="new_roadmap_conbox mb10" >
<div class=" clear">
<ul class="new_roadmap_nav fl" >
<li id="new_roadmap_nav_1" class="new_roadmap_nav_hover " onclick="HoverLi(1);">
@ -68,7 +68,7 @@
</tbody>
</table>
</div>
<%= link_to "导出", version_path(@version, :format => 'xls'), :class=>"btn_newpro_grey fl mt10 ml15 "%>
<%= link_to "导出", version_path(@version, :format => 'xls'), :class=>"btn_newpro_grey fl mt10 ml15 mb10"%>
<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%>
@ -92,88 +92,6 @@
<!--里程碑详情结束-->
<!--modified by young-->
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_roadmap) %></h2>
</div>
<div class="contextual" style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
<%= link_to(l(:button_edit), edit_version_path(@version), :class => 'icon icon-edit') if User.current.allowed_to?(:manage_versions, @version.project) %>
<%#= link_to_if_authorized(l(:button_edit_associated_wikipage,
:page_title => @version.wiki_page_title.truncate(30, omission: '...')),
{:controller => 'wiki',
:action => 'edit',
:project_id => @version.project,
:id => Wiki.titleize(@version.wiki_page_title)},
:class => 'icon icon-edit') unless @version.wiki_page_title.blank? || @version.project.wiki.nil? %>
<%= delete_link version_path(@version, :back_url => url_for(:controller => 'versions',
:action => 'index',
:project_id => @version.project)) if User.current.allowed_to?(:manage_versions, @version.project) %>
<%= call_hook(:view_versions_show_contextual, { :version => @version, :project => @project }) %>
</div>
<h3 style="word-break: break-all;word-wrap: break-word;color: #64BDD9;">
<%= h(@version.name) %>
</h3>
<div id="roadmap">
<%= render :partial => 'versions/overview', :locals => {:version => @version} %>
<%= render(:partial => "wiki/content", :locals => {:content => @version.wiki_page.content}) if @version.wiki_page %>
<div class="splitcontent">
<% if @version.estimated_hours > 0 || User.current.allowed_to?(:view_time_entries, @project) %>
<fieldset class="time_tracter f14"><legend><%= l(:label_time_tracking) %></legend>
<table>
<tr>
<th>
<p class="fl c_grey f12"><%= l(:field_estimated_hours) %></p>
</th>
<td class="total-hours">
<%= html_hours(l_hours(@version.estimated_hours)) %>
</td>
</tr>
<% if User.current.allowed_to?(:view_time_entries, @project) %>
<tr>
<th>
<p class="fr c_grey f12"><%= l(:label_spent_time) %></p>
</th>
<td class="total-hours">
<%= html_hours(l_hours(@version.spent_hours)) %>
</td>
</tr>
<% end %>
</table>
</fieldset>
<% end %>
<div id="status_by" style="margin-top:10px;"><!--by young-->
<%= render_issue_status_by(@version, params[:status_by]) if @version.fixed_issues.count > 0 %>
</div>
</div>
<% if @issues.present? %>
<%= form_tag({}) do -%>
<table class="list related-issues">
<caption>
<%= l(:label_related_issues) %>
</caption>
<%- @issues.each do |issue| -%>
<tr class="hascontextmenu">
<td class="checkbox">
<%= check_box_tag 'ids[]', issue.id, false, :id => nil %>
</td>
<td>
<%= link_to_issue(issue, :project => (@project != issue.project)) %>
</td>
</tr>
<% end %>
</table>
<% end %>
<%= context_menu issues_context_menu_path %>
<% end %>
</div>
<%= call_hook :view_versions_show_bottom, :version => @version %>
<% html_title @version.name %>

View File

@ -188,6 +188,7 @@ zh:
text_are_you_sure: 您确定要删除吗? #js 提示
text_are_you_sure_version: 删除里程碑不会删除里程碑对应的Issue您确定要删除吗
text_history_are_you_sure: 本资源有多个版本,你确定要全部删除吗?
text_delete_project_are_you_sure: 本项目包含版本库,项目删除后,版本库将被彻底删除。您确定删除吗?
text_are_you_sure_out: 你确定要退出该班级吗?

View File

@ -61,7 +61,7 @@ zh:
notice_failed_to_save_members: "成员保存失败: %{errors}."
notice_no_issue_selected: "未选择任何问题!请选择您要编辑的问题。"
notice_default_data_loaded: 成功载入默认设置。
notice_unable_delete_version: 无法删除版本
notice_unable_delete_version: 该里程碑中设置关联有Issue无法删除
notice_unable_delete_time_entry: 无法删除工时
notice_issue_done_ratios_updated: 问题完成度已更新。
notice_gantt_chart_truncated: "这个表是截断的因为它超过了可以显示的最大数量(%{max})"

View File

@ -993,7 +993,7 @@ a.pullreques_pull_name{display: block; margin-left: 10px;max-width:80px; color:#
.pullreques_change_list li:last-child{ border-bottom: none;}
.pullreques_icons_add{background: url(/images/new_project/icons_issue.png) 0 -374px no-repeat; display: inline-block; width: 19px; height: 16px;}
.pullreques_icons_del{background: url(/images/new_project/icons_issue.png) 0 -399px no-repeat; display: inline-block; width: 19px; height: 16px;}
.pullreques_icons_new{background: url(/images/new_project/icons_issue.png) 0 -421px no-repeat; display: inline-block; width: 19px; height: 16px;}
.pullreques_icons_new{background: url(/images/new_project/icons_issue.png) 0 -421px no-repeat; display: inline-block; width: 19px; height: 17px;}
.PullReques_minselect{border:1px solid #e1e1e1; height: 30px; line-height: 30px; width: 262px;color: #666;}
.PullReques_maxinput{ width:900px;border:1px solid #e1e1e1; height: 30px; line-height: 30px; color: #666;}
.PullReques_textarea{width:900px;border:1px solid #e1e1e1; height: 80px; line-height: 1.9; color: #666;}