Permalink
Browse files

Task params saving update

  • Loading branch information...
1 parent fb7e394 commit dff3caa7a110a7a32efde30f42d17bb512d8a00a Marcin Jędras committed Mar 18, 2010
Showing with 15 additions and 10 deletions.
  1. +15 −10 app/controllers/issue_sprints_controller.rb
@@ -64,16 +64,21 @@ def update_task
value = obj.find(params[:value]) unless params[:value].blank?
task = Issue.find(params[:task_id])
eval "task.#{params[:field]}=#{value ? value.id : "nil"}"
- task.save!
- @issue_statuses = IssueStatus.find(:all)
- @project_users = User.find(:all, :joins => :members, :conditions => ["members.project_id = ?", @project.id])
- status = done_ratio_to_status(task)
-
- render :update do |page|
- page.replace "task_wrap_#{task.id}", ""
- page.insert_html :bottom, "tasks_#{ status }_us_#{task.user_story_id}", :partial => "shared/task_view",
- :locals => {:task => task, :issue_statuses => @issue_statuses,
- :project_users => @project_users}
+ if task.save
+ @issue_statuses = IssueStatus.find(:all)
+ @project_users = User.find(:all, :joins => :members, :conditions => ["members.project_id = ?", @project.id])
+ status = done_ratio_to_status(task)
+
+ render :update do |page|
+ page.replace "task_wrap_#{task.id}", ""
+ page.insert_html :bottom, "tasks_#{ status }_us_#{task.user_story_id}", :partial => "shared/task_view",
+ :locals => {:task => task, :issue_statuses => @issue_statuses,
+ :project_users => @project_users}
+ end
+ else
+ render :update do |page|
+ page.insert_html :top, "content", content_tag('div', t(:error_changing_status), :class => "error", :id => "errorExplanation")
+ end
end
end

0 comments on commit dff3caa

Please sign in to comment.