diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb
index e15edf86a..2cd49d0a8 100644
--- a/app/controllers/versions_controller.rb
+++ b/app/controllers/versions_controller.rb
@@ -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,25 +258,18 @@ 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
- 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.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
+ issues.update_all(:fixed_version_id, nil)
+ rescue Exception => e
+ puts e
+ end
+ respond_to do |format|
+ format.js
+ format.html { redirect_to project_versions_path(project)}
+ format.api { render_api_ok }
end
end
diff --git a/app/views/versions/_list.html.erb b/app/views/versions/_list.html.erb
index 732476fc0..55cc53f3b 100644
--- a/app/views/versions/_list.html.erb
+++ b/app/views/versions/_list.html.erb
@@ -3,7 +3,7 @@
<%= link_to_version version, :name => version_anchor(version) %>
<%= 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 %>
diff --git a/app/views/versions/_overview.html.erb b/app/views/versions/_overview.html.erb
index 8190750e9..f81ef4f86 100644
--- a/app/views/versions/_overview.html.erb
+++ b/app/views/versions/_overview.html.erb
@@ -1,55 +1,23 @@
-<% if version.issues_count > 0 %>
-已关闭 <%=version.closed_issues_count%>
+已关闭 <%= version.closed_issues_count%>
/
-issues<%=version.issues_count%>
+issues<%= version.issues_count%>
<%= progress_bar([version.closed_percent], :width => '300px;', :legend => ('%0.0f%' % version.completed_percent)) %>
<%= version.closed_percent.round %>%
- <%#= 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) %>
+<%= 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 %>
+<%#= 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 %>
- <%= l(:label_roadmap_no_issues) %>
-<% end %>
-
-<%# if version.issues_count > 0 %>
-
+