<%= content_for(:header_tags) do %>
    <%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<% end %>
<script>
    $(document).ready(function(){
        $("#relateProject,.relatePInfo").mouseover(function(){
            $(".relatePInfo").css("display","block");
        });
        $("#relateProject,.relatePInfo").mouseout(function(){
            $(".relatePInfo").css("display","none");
        });
        $(".coursesLineGrey").mouseover(function(){
            $(this).css("color","#ffffff");
        });
        $(".coursesLineGrey").mouseout(function(){
            $(this).css("color","#808080");
        });
        $(".homepagePostSetting,.coursesLineGrey").mouseover(function(){
            $(this).prev().css("color","#ffffff");
            $(this).css("z-index", "9999");
        });
        $(".homepagePostSetting").mouseout(function(){
            $(this).prev().css("color","#808080");
            $(this).css("z-index", "1");
        });
    })
</script>

<% user_activities.each do |user_activity|
  if user_activities %>
        <script>
            function expand_reply_input(id) {
                $(id).toggle();
            }

            $(function() {
                sd_create_editor_from_data(<%= user_activity.id %>, null, "100%", "<%= user_activity.class.to_s %>");
            });
        </script>
        <% if user_activity.act_type == "Project" %>
            <%= render :partial => 'project_create', :locals => {:activity => user_activity,:user_activity_id =>user_activity.id} %>
        <% else %>
            <% act= user_activity.act  %>
            <%if act %>

                    <% case user_activity.container_type.to_s %>
                    <% when 'Course' %>
                        <% case user_activity.act_type.to_s %>
                        <% when 'HomeworkCommon' %>
                            <%# cache (act) do %>
                            <% hidden_courses = Setting.find_by_name("hidden_courses") %>
                            <% unvisiable = hidden_courses && hidden_courses.value == "1"%>
                            <% if !unvisiable %>
                                <%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id,:hw_status => 1} %>
                            <% end %>
                            <%# end %>
                        <% when 'News' %>
                        <%# cache [act, act.comments.count] do %>
                            <%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
                        <%# end %>
                        <% when 'Message'%>
                            <%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %>
                        <% when 'Poll' %>
                            <%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id} %>
                        <% when 'Course'%>
                        <%# cache (act) do %>
                            <%= render :partial => 'users/course_create', :locals => {:activity => act, :user_activity_id => act.id} %>
                        <%# end%>
                        <% when 'JournalsForMessage'%>
                        <%= render :partial => 'users/course_journalsformessage', :locals => {:activity => act, :user_activity_id => user_activity.id} %>
                        <% end %>
                    <% when 'Project' %>
                        <% case user_activity.act_type.to_s %>
                        <% when 'Issue' %>
                        <%# cache [act, act.journals.count, act.attachments.count] do%>
                            <%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id, :user_id => user_id} %>
                        <%# end %>
                        <% when 'Message' %>
                            <%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %>
                        <% when 'Project'%>
                        <%# cache (act) do %>
                            <%= render :partial => 'project_create', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
                        <%# end %>
                        <% end %>
                    <% when 'Principal' %>
                        <% case user_activity.act_type.to_s %>
                            <% when 'JournalsForMessage' %>
                            <% unless act.private == 1 && (!User.current || (User.current && act.jour_id != User.current.id && act.user_id != User.current.id)) %>
                                <%= render :partial => 'user_journalsformessage', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
                            <% end %>
                        <% end %>
                    <% when 'Blog'%>
                        <%# cache (act) do %>
                        <% case user_activity.act_type.to_s %>
                        <% when 'BlogComment' %>
                            <%# if !(act.blog.homepage_id and act.id == act.blog.homepage_id) %>
                                <%= render :partial => 'user_blog', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
                            <%# end %>
                        <% end %>
                        <%# end %>
                    <% end %>

            <% end %>
            <% end %>
        <% end %>
<% end %>

<% if user_activities.count == 10%>
<!--
    <div id="show_more_activities" class="loadMore mt10 f_grey">点击展开更多<%#=link_to "", user_activities_path(@user.id,:type => type,:page => page),:id => "more_activities_link",:remote => "true",:class => "none" %></div>
-->
    <%= link_to "点击展开更多",user_activities_path(@user.id,:type => type,:page => page),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%>
<% end%>

<!--
<script type="text/javascript">
  $("#show_more_activities").mouseover(function(){
      $("#more_activities_link").click();
  });
</script>-->