项目里程碑详情页面

This commit is contained in:
daiao 2016-10-21 16:16:26 +08:00
parent 624cba3228
commit fa453090aa
6 changed files with 33 additions and 11 deletions

View File

@ -184,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
@ -202,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

@ -1933,11 +1933,12 @@ module ApplicationHelper
pcts << (100 - pcts[0])
width = options[:width] || '100px;'
legend = options[:legend] || ''
content_tag('span',
content_tag('tr',
(pcts[0] > 0 ? content_tag('span', '', :style => "width: 300px;", :class => 'roadmap_progressbar ml5', :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('span', '', :style => "width: 300px;", :class => 'roadmap_progressbar ml5', :title => "未完成:#{pcts[1]}%") : ''.html_safe), :style => "width: #{width}"
)
#(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

@ -5,16 +5,16 @@
<li>
<%= progress_bar([version.closed_percent], :width => '300px;', :legend => ('%0.0f%' % version.completed_percent)) %>
<span class="ml5 c_red">
<%= version.closed_percent.to_i == 0 ? 0 : version.closed_percent %>%
<%= 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},:remote=>'true', :method =>:put, :id=>"version-#{@version.id}-status-form", :class => 'fr new_roadmap_select') do %>
<%= 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"}) %>
{ :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',

View File

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

View File

@ -1,5 +1,5 @@
<!--里程碑详情开始-->
<div class="new_roadmap_conbox mb10" >
<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>
@ -7,7 +7,9 @@
</a>
<span class="ml5 mr5 fl f14">|</span>
<h4 class="fl new_roadmap_listtitle"><%= h(@version.name) %></h4>
<span class="fl roadmap_blueicon mt3 ml5"></span>
<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? %>

View File

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