Feature #10020 ยป redmine-timelog.patch
../../redmine-1.3.0/app/controllers/timelog_controller.rb 2012-01-17 18:18:35.288107771 +0100 | ||
---|---|---|
249 | 249 |
if (issue_id = (params[:issue_id] || params[:time_entry] && params[:time_entry][:issue_id])).present? |
250 | 250 |
@issue = Issue.find(issue_id) |
251 | 251 |
@project = @issue.project |
252 |
elsif (project_id = (params[:project_id] || params[:time_entry] && params[:time_entry][:project_id])).present?
|
|
252 |
elsif (project_id = (params[:time_entry] && params[:time_entry][:project_id]) || params[:project_id]).present?
|
|
253 | 253 |
@project = Project.find(project_id) |
254 | 254 |
else |
255 | 255 |
render_404 |
../../redmine-1.3.0/app/helpers/timelog_helper.rb 2012-01-17 18:09:20.404133529 +0100 | ||
---|---|---|
31 | 31 |
end |
32 | 32 |
breadcrumb links |
33 | 33 |
end |
34 |
|
|
35 |
def projects_collection_for_select() |
|
36 |
return unless User.current.logged? |
|
37 |
collection = [] |
|
38 |
projects = Project.visible.find(:all, :order => 'lft') |
|
39 |
# projects = User.current.memberships.collect(&:project).compact.uniq |
|
40 |
if projects.any? |
|
41 |
projects.each { |p| collection << [p.name, p.id]} |
|
42 |
end |
|
43 |
collection |
|
44 |
end |
|
34 | 45 | |
35 | 46 |
# Returns a collection of activities for a select field. time_entry |
36 | 47 |
# 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 | ||
---|---|---|
10 | 10 |
<%= back_url_hidden_field_tag %> |
11 | 11 | |
12 | 12 |
<div class="box"> |
13 |
<p><%= f.select :project_id, projects_collection_for_select(), :required => true %></p> |
|
13 | 14 |
<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> |
14 | 15 |
<p><%= f.text_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p> |
15 | 16 |
<p><%= f.text_field :hours, :size => 6, :required => true %></p> |