<% tickets_scope = Issue.visible.open.joins(:helpdesk_ticket).where(:assigned_to_id => User.current.id) %> <% tickets = tickets_scope.limit(10) %>

<%= l(:my_helpdesk_tickets) %> (<%= tickets_scope.count %>)

<% if tickets && tickets.any? %> <%= form_tag({}, :data => {:cm_url => issues_context_menu_path}) do %> <% for ticket in tickets %> <% end %>
<%=l(:field_subject)%> <%=l(:field_project)%> <%=l(:label_helpdesk_contact)%> <%=l(:label_helpdesk_last_message)%>
<%= check_box_tag("ids[]", ticket.id, false, :style => 'display:none;', :id => nil) %> <%= link_to "##{ticket.id} - #{truncate(ticket.subject.html_safe, :length => 60)}", issue_path(ticket) %> (<%=h ticket.status %>) <%= link_to_project(ticket.project) %> <%= contact_tag(ticket.customer) + (ticket.customer_company.blank? ? "" : " (#{ticket.customer_company})") if ticket.customer %> <%= (ticket.last_message.blank? ? ticket.description : ticket.last_message).truncate(250) %>
<% end %> <% else %>

<%= l(:label_no_data) %>

<% end %> <% if tickets.length > 0 %>

<%= link_to l(:label_helpdesk_view_all_tickets), :controller => 'issues', :action => 'index', :set_filter => 1, :assigned_to_id => 'me', :customer => "*", :status_id => "o", :c => ["project", "tracker", "status", "subject", "customer", "customer_company", "last_message"], # :op => {:assigned_to_id => "=", :customer => "*", :status_id => "o"}, :sort => 'priority:desc,updated_on:desc' %>

<% end %> <% content_for :header_tags do %> <%= auto_discovery_link_tag(:atom, {:controller => 'issues', :action => 'index', :set_filter => 1, :assigned_to_id => 'me', :format => 'atom', :key => User.current.rss_key}, {:title => l(:label_assigned_to_me_issues)}) %> <% end %>