Project

General

Profile

Feature #10020 ยป redmine-timelog.patch

Olivier Jacquet, 2012-01-17 18:27

View differences:

../../redmine-1.3.0/app/controllers/timelog_controller.rb 2012-01-17 18:18:35.288107771 +0100
if (issue_id = (params[:issue_id] || params[:time_entry] && params[:time_entry][:issue_id])).present?
@issue = Issue.find(issue_id)
@project = @issue.project
elsif (project_id = (params[:project_id] || params[:time_entry] && params[:time_entry][:project_id])).present?
elsif (project_id = (params[:time_entry] && params[:time_entry][:project_id]) || params[:project_id]).present?
@project = Project.find(project_id)
else
render_404
../../redmine-1.3.0/app/helpers/timelog_helper.rb 2012-01-17 18:09:20.404133529 +0100
end
breadcrumb links
end
def projects_collection_for_select()
return unless User.current.logged?
collection = []
projects = Project.visible.find(:all, :order => 'lft')
# projects = User.current.memberships.collect(&:project).compact.uniq
if projects.any?
projects.each { |p| collection << [p.name, p.id]}
end
collection
end
# Returns a collection of activities for a select field. time_entry
# is optional and will be used to check if the selected TimeEntryActivity
../../redmine-1.3.0/app/views/timelog/edit.html.erb 2012-01-17 18:12:41.764124182 +0100
<%= back_url_hidden_field_tag %>
<div class="box">
<p><%= f.select :project_id, projects_collection_for_select(), :required => true %></p>
<p><%= f.text_field :issue_id, :size => 6 %> <em><%= h("#{@time_entry.issue.tracker.name} ##{@time_entry.issue.id}: #{@time_entry.issue.subject}") if @time_entry.issue %></em></p>
<p><%= f.text_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p>
<p><%= f.text_field :hours, :size => 6, :required => true %></p>
    (1-1/1)