Patch #249 ยป time_selector.diff
app/views/layouts/base.rhtml (working copy) | ||
---|---|---|
44 | 44 |
<%= text_field_tag 'q', @question, :size => 20, :class => 'small', :accesskey => accesskey(:quick_search) %> |
45 | 45 |
<% end %> |
46 | 46 |
<%= render :partial => 'layouts/project_selector' if User.current.memberships.any? %> |
47 |
<%= render :partial => 'layouts/time_selector' if User.current.memberships.any? %> |
|
47 | 48 |
</div> |
48 | 49 |
|
49 | 50 |
<h1><%= h(@project ? @project.name : Setting.app_title) %></h1> |
app/views/layouts/_time_selector.rhtml (working copy) | ||
---|---|---|
1 |
<% user_projects_by_root = User.current.projects.find(:all, :include => :parent).group_by(&:root) %> |
|
2 |
<select onchange="if (this.value != '') { window.location = this.value; }"> |
|
3 |
<option selected><%= l(:label_spent_time) %></option> |
|
4 |
<option disabled>---</option> |
|
5 |
<% user_projects_by_root.keys.sort.each do |root| %> |
|
6 |
<%= content_tag('option', h(root.name), :value => url_for(:controller => 'timelog', :action => 'edit', :project_id => root)) %> |
|
7 |
<% user_projects_by_root[root].sort.each do |project| %> |
|
8 |
<% next if project == root %> |
|
9 |
<%= content_tag('option', ('» ' + h(project.name)), :value => url_for(:controller => 'timelog', :action => 'edit', :project_id => project)) %> |
|
10 |
<% end %> |
|
11 |
<% end %> |
|
12 |
</select> |