<%= javascript_include_tag "jquery.infinitescroll.js" %>
<div class="project_r_h">
  <h2 class="project_h2"><%= l(:label_activity) %></h2>
</div>
<!--CONTENT LIST-->
<% unless @events_pages.empty? %>
    <% @events_pages.each do |e| -%>
        <!--创建-->
        <% if e.forge_act_type == "ProjectCreateInfo"%>
            <div class="problem_main">
              <a  class="problem_pic fl"><%= image_tag(url_to_avatar(e.user),  :width => "42", :height => "42") %></a>
                <div class="problem_txt fl mt5 break_word">
                    <%= link_to e.user,  user_path(e.user), :class => "problem_name c_orange fl" %> <span class="fl"> <%= l(:label_project_create) %> ：</span>
                    <%= link_to e.project.name,{} ,:class => "problem_tit fl fb" %></a><br />
                    <p class="mt5"><br /> <%= l :label_create_time %> ：<%= format_time(e.project.created_on) %></p>
                </div>
                <div class="cl"></div>
            </div>
        <% end %>
        <%  next if e.forge_act_type.safe_constantize.nil?
            act = e.forge_act;
            next if act.nil? %>
        <!--缺陷动态-->
        <% if e.forge_act_type == "Issue" %>
            <div class="problem_main">
              <a  class="problem_pic fl"><%= image_tag(url_to_avatar(act.author), :width => "42", :height => "42") %></a>
              <div class="problem_txt fl mt5 break_word list_style">
                <a class="problem_name fl ">
                  <%= h(e.project) if @project.nil? || @project.id != e.project_id %>
                  <%= link_to act.author, user_path(act.author), :class => "problem_name c_orange fl" %><span class="fl"> <%= l(:label_new_activity) %> ：</span>
                  <%= link_to format_activity_title("#{act.source_from}##{act.project_issues_index} (#{act.status}): #{act.tracker.name} #{act.subject}"),
                                {:controller => 'issues',
                                 :action => 'show',
                                 :id => act.id},
                                 :class => "problem_tit fl fb " %>
                </a><br />
                <p class="mt5 break_word"><%= act.description.html_safe %><br />
                  <%= l :label_activity_time %> ：<%= format_activity_day(act.created_on) %> <%= format_time(act.created_on, false) %>
                </p>
              </div>
              <div class="cl"></div>
            </div>
        <!--缺陷 jou留言 -->
        <% elsif e.forge_act_type == "Journal" %>
            <div class="problem_main">
              <a  class="problem_pic fl"><%= image_tag(url_to_avatar(e.user), :width => "42", :height => "42") %></a>
              <div class="problem_txt fl mt5 break_word">
                <a class="problem_name fl ">
                  <%= h(e.project) if @project.nil? || @project.id != e.project_id %>
                  <%= link_to h(e.user), user_path(e.user_id), :class => "problem_name c_orange fl" %><span class="fl"> <%= l(:label_new_activity) %> ：</span>
                  <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.project_issues_index}: #{act.issue.subject}"),
                              {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"}, :class => "problem_tit fl fb" %>
                </a><br />
                <p class="mt5 break_word"><%=  act.notes.html_safe %><br />
                  <%= l :label_activity_time %> ：<%= format_activity_day(act.created_on) %> <%= format_time(act.created_on, false) %></p>
              </div>
              <div class="cl"></div>
            </div>
        <!--message    -->
            <% elsif e.forge_act_type == "Message" %>
            <div class="problem_main">
              <a  class="problem_pic fl"><%= image_tag(url_to_avatar(e.user), :width => "42", :height => "42") %></a>
              <div class="problem_txt fl mt5 break_word list_style">
                <a class="problem_name fl ">
                  <%= h(e.project) if @project.nil? || @project.id != e.project_id %>
                  <%= link_to h(e.user), user_path(e.user_id), :class => "problem_name c_orange fl" %></a><span class="fl"> <%= l(:label_new_activity) %> ：</span>

                  <%= link_to format_activity_title("#{act.board.name}: #{act.subject}"),
                                project_boards_path(@project,:topic_id => act.id),
                               :class => "problem_tit fl fb " %>
                <br />
                <p class="mt5 break_word"><%= textAreailizable act,:content %><br />
                <div class="cl"></div>
                  <%= l :label_create_time %> ：<%= format_activity_day(act.created_on) %> <%= format_time(act.created_on, false) %></p>
              </div>
              <div class="cl"></div>
            </div>
        <!--new 新闻-->
        <% elsif e.forge_act_type == "News" %>
            <div class="problem_main">
              <a  class="problem_pic fl"><%= image_tag(url_to_avatar(e.user), :width => "42", :height => "42") %></a>
              <div class="problem_txt fl mt5 break_word list_style">
                <a class="problem_name fl ">
                  <%= h(e.project) if @project.nil? || @project.id != e.project_id %>
                  <%= link_to h(e.user), user_path(e.user_id), :class => "problem_name c_orange fl" %></a><span class="fl"> <%= l(:label_new_activity) %> ：</span>
                <a class="problem_tit fl fb">
                  <% unless act.nil? %>
                      <%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id}, :class => "problem_tit fl fb " %>
                  <% end %>
                </a><br />
                <p class="mt5 break_word"><%= textAreailizable act,:description %><br />
                  <%= l :label_create_time %> ：<%= format_activity_day(act.created_on) %> <%= format_time(act.created_on, false) %></p>
              </div>
              <div class="cl"></div>
            </div>

        <!--Attachment   -->
        <% elsif e.forge_act_type == "Attachment" %>
            <div class="problem_main">
              <a  class="problem_pic fl"><%= image_tag(url_to_avatar(e.user), :width => "42", :height => "42") %></a>
              <div class="problem_txt fl mt5 break_word">
                <a class="problem_name fl ">
                  <%= h(e.project) if @project.nil? || @project.id != e.project_id %>
                  <%= link_to h(e.user), user_path(e.user_id), :class => "problem_name c_orange fl" %></a><span class="fl"> <%= l(:label_new_activity) %> ：</span>
                  <%= link_to format_activity_title("#{l(:label_attachment)}: #{act.filename}"), {:controller => 'attachments', :action => 'show', :id => act.id}, :class => "problem_tit fl fb" %></a><br />
                <p class="mt5 break_word"><%= textAreailizable act,:description %><br />
                  <%= l :label_create_time %> ：<%= format_activity_day(act.created_on) %> <%= format_time(act.created_on, false) %></p>
              </div>
              <div class="cl"></div>
            </div>
        <% end %>
    <% end %>
<% end %>
<%= paginate @events_pages, :left => 3, :right => 3 %>