/app/views/timeline/list.html.erb

https://github.com/gururea/jobsworth · Ruby HTML · 106 lines · 94 code · 12 blank · 0 comment · 16 complexity · 294c98babf312142e849e05d34e1e29f MD5 · raw file

  1. <%= render :partial => "panel" %>
  2. <table width="100%" cellpadding="0" cellspacing="0">
  3. <tr>
  4. <td valign="top">
  5. <table cellpadding="0" width="100%" cellspacing="0" class="content" style="padding-left: 1em; padding-right: 1em;">
  6. <tr>
  7. <td colspan="3" align=left class="page_header">
  8. <%=_ 'Timeline' %>
  9. </td>
  10. </tr>
  11. <tr>
  12. <td align="left" style="padding-top:0.5em;" nowrap id="tasks_filter" colspan="3">
  13. <%
  14. @users = objects_to_names_and_ids(@logs.map { |l| l.user }.uniq.compact.sort_by{ |u| u.name })
  15. filter_count = 0
  16. %>
  17. <%= form_tag( {:controller => 'timeline', :action => 'list'}, {:name => 'time_line_filters'} ) do %>
  18. <select name="filter_date" id="filter_date" onchange="time_line_filters.submit();">
  19. <% @dates = [[_("[All Time]"), "0"], [_("This Week"),"1"], [_("Last Week"),"2"],[_("This Month"),"3"],[_("Last Month"),"4"],[_("This Year"),"5"],[_("Last Year"),"6"]] %>
  20. <%= options_for_select @dates, params[:filter_date] %>
  21. </select>
  22. <% if current_user.projects.any? %>
  23. <select name="filter_project" id="filter_project" onchange="time_line_filters.submit();">
  24. <option value="0" class="select_default"><%= _("[Any Project]") %></option>
  25. <% projects = current_user.projects.includes(:customer).except(:order).order("customers.name, projects.name") %>
  26. <% client_projects = grouped_client_projects_options(projects)%>
  27. <% client_projects.each do |c| %>
  28. <optgroup class="select_heading" label="<%= c.first %>">
  29. <% c.last.each do |p| %>
  30. <option value="<%=p.last%>" class="select_item"<%= " selected" if p.last.to_s == params[:filter_project] %>><%= p.first %></option>
  31. <% end %>
  32. </optgroup>
  33. <% end %>
  34. </select>
  35. <% end %>
  36. <select name="filter_user" id="filter_user" onchange="time_line_filters.submit();">
  37. <% @users = [[_("[Any User]"), "0"]] + @users %>
  38. <%= options_for_select @users, params[:filter_user].to_i %>
  39. </select>
  40. <select name="filter_status" id="filter_status" onchange="time_line_filters.submit();">
  41. <%
  42. @status = [[_("[Any Type]"), "-1"],
  43. [_("Closed"), EventLog::TASK_COMPLETED.to_s],
  44. [_("Work Log"), EventLog::TASK_WORK_ADDED.to_s],
  45. [_("Resolution Change"), EventLog::TASK_REVERTED.to_s],
  46. [_("Created"), EventLog::TASK_CREATED.to_s],
  47. [_("Comment"), EventLog::TASK_COMMENT.to_s],
  48. [_("Modified"), EventLog::TASK_MODIFIED.to_s]]
  49. @status << [_("Forum Posts"), EventLog::FORUM_NEW_POST.to_s] if current_user.company.show_forum?
  50. @status << [_("Wiki Additions"), EventLog::WIKI_CREATED.to_s] if current_user.company.show_wiki?
  51. @status << [_("Wiki Changes"), EventLog::WIKI_MODIFIED.to_s] if current_user.company.show_wiki?
  52. @status << [_("Resource password request"), EventLog::RESOURCE_PASSWORD_REQUESTED.to_s] if current_user.use_resources?
  53. %>
  54. <%= options_for_select @status, params[:filter_status] %>
  55. </select>
  56. <%= hidden_field_tag "filter_task", params[:filter_task] || 0 %>
  57. <% end %>
  58. </td>
  59. </tr>
  60. <tr><td colspan="3">&nbsp;</td></tr>
  61. <tr><td colspan="3">
  62. <span class="paging_header">
  63. <%= will_paginate(@logs, { :next_label => _('Next') + ' &raquo;', :prev_label => '&laquo; ' + _('Previous'), :params => @filter_params } ) %>
  64. </span>
  65. </td>
  66. </tr>
  67. <%
  68. day = 0
  69. for log in @logs
  70. if day != tz.utc_to_local(log.started_at).day
  71. day = tz.utc_to_local(log.started_at).day
  72. %>
  73. <tr>
  74. <td class="log_header" colspan="3">
  75. <strong>
  76. <%= tz.utc_to_local(log.started_at).strftime_localized("%A, %d %B %Y") %>
  77. </strong>
  78. </td>
  79. </tr>
  80. <% end %>
  81. <% if log.is_a? WorkLog %>
  82. <%= render :partial => 'activities/log_row', :locals => { :log => log } %>
  83. <% else %>
  84. <% if log.target_type == 'WorkLog' %>
  85. <%= render :partial => 'activities/log_row', :locals => { :log => @worklogs[log.target_id] } %>
  86. <% else %>
  87. <%= render :partial => 'activities/other_row', :locals => {:log => log } %>
  88. <% end %>
  89. <% end %>
  90. <% end %>
  91. </table>
  92. </td>
  93. </tr>
  94. </table>