Browse Source

Fixed: IssueController#edit doesn't set default Activity as default (#1302).

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1461 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/0.8.0-RC1
Jean-Philippe Lang 16 years ago
parent
commit
d6daeca40a

+ 1
- 0
app/controllers/issues_controller.rb View File

@edit_allowed = User.current.allowed_to?(:edit_issues, @project) @edit_allowed = User.current.allowed_to?(:edit_issues, @project)
@activities = Enumeration::get_values('ACTI') @activities = Enumeration::get_values('ACTI')
@priorities = Enumeration::get_values('IPRI') @priorities = Enumeration::get_values('IPRI')
@time_entry = TimeEntry.new
respond_to do |format| respond_to do |format|
format.html { render :template => 'issues/show.rhtml' } format.html { render :template => 'issues/show.rhtml' }
format.atom { render :action => 'changes', :layout => false, :content_type => 'application/atom+xml' } format.atom { render :action => 'changes', :layout => false, :content_type => 'application/atom+xml' }

+ 6
- 0
app/models/time_entry.rb View File

validates_numericality_of :hours, :allow_nil => true validates_numericality_of :hours, :allow_nil => true
validates_length_of :comments, :maximum => 255 validates_length_of :comments, :maximum => 255


def after_initialize
if new_record?
self.activity ||= Enumeration.default('ACTI')
end
end
def before_validation def before_validation
self.project = issue.project if issue && project.nil? self.project = issue.project if issue && project.nil?
end end

+ 5
- 0
test/fixtures/enumerations.yml View File

name: Development name: Development
id: 10 id: 10
opt: ACTI opt: ACTI
is_default: true
enumerations_011:
name: QA
id: 11
opt: ACTI

+ 11
- 1
test/functional/timelog_controller_test.rb View File

@response = ActionController::TestResponse.new @response = ActionController::TestResponse.new
end end
def test_create
def test_get_edit
@request.session[:user_id] = 3
get :edit, :project_id => 1
assert_response :success
assert_template 'edit'
# Default activity selected
assert_tag :tag => 'option', :attributes => { :selected => 'selected' },
:content => 'Development'
end
def test_post_edit
@request.session[:user_id] = 3 @request.session[:user_id] = 3
post :edit, :project_id => 1, post :edit, :project_id => 1,
:time_entry => {:comments => 'Some work on TimelogControllerTest', :time_entry => {:comments => 'Some work on TimelogControllerTest',

Loading…
Cancel
Save