<%= content_for(:header_tags) do %>
    <%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<% end %>
<script>
    var onUserCard = false;
    var onImage = false;
    $(document).ready(function(){
        $("#relateProject,.relatePInfo").mouseover(function(){
            $(".relatePInfo").css("display","block");
        })
        $("#relateProject,.relatePInfo").mouseout(function(){
            $(".relatePInfo").css("display","none");
        })
        $(".homepagePostPortrait").mouseover(function(){
            onImage = true;
            $(this).children(".userCard").css("display","block");
        })
        $(".homepagePostPortrait").mouseout(function(){
            var cur = $(this);
            onImage = false;
            setTimeout(function(){
                if (onUserCard == false && onImage == false){
                    $(cur).children(".userCard").css("display", "none");
                }
            }, 500);
        })
        $(".userCard").mouseover(function(){
            onUserCard = true;
            $(this).css("display","block");
        })
        $(".userCard").mouseout(function(){
            onUserCard = false;
            $(this).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>
<style type="text/css">
</style>
<% course_activities.includes(:course_act).each do |activity| if course_activities %>
        <script>
            function expand_reply(container, btnid) {
                var target = $(container);
                var btn = $(btnid);
                if (btn.data('init') == '0') {
                    btn.data('init', 1);
                    btn.html('收起回复');
                    target.show();
                } else {
                    btn.data('init', 0);
                    btn.html('展开更多');
                    target.hide();
                    target.eq(0).show();
                    target.eq(1).show();
                    target.eq(2).show();
                }
            }

            $(function () {
                sd_create_editor_from_data(<%= activity.id%>, null, "100%", "<%= activity.class.to_s %>");
            });
        </script>
            <% if activity && activity.course_act %>
                <% act = activity.course_act %>
                <% case activity.course_act_type.to_s %>
                <% when 'HomeworkCommon' %>
                    <%= render :partial => 'users/course_homework', :locals => {:activity => act, :user_activity_id => activity.id, :course_activity => 1} %>
                <% when 'News' %>
                    <%= render :partial => 'users/course_news', :locals => {:activity => act, :user_activity_id => activity.id} %>
                <% when 'Message' %>
                    <%= render :partial => 'users/course_message', :locals => {:activity => act, :user_activity_id => activity.id,:is_course=>1,:is_board=>0} %>
                <% when 'Poll' %>
                    <%= render :partial => 'users/course_poll', :locals => {:activity => act, :user_activity_id => activity.id} %>
                <% when 'JournalsForMessage' %>
                    <%= render :partial => 'users/course_journalsformessage', :locals => {:activity => act, :user_activity_id => activity.id} %>
                <% when 'Attachment' %>
                    <%= render :partial => 'users/course_attachment', :locals => {:activity => act, :user_activity_id => activity.id} %>
                <% when 'Course' %>
                    <%= render :partial => 'users/course_create', :locals => {:activity => act, :user_activity_id => activity.id} %>
                <% end %>
            <% end %>
    <% end %>
<% end %>

<% if course_activities.count == 10 %>
    <!--<div id="show_more_course_activities" class="loadMore mt10 f_grey">点击展开更多<%#= link_to "", course_activity_path(@course.id, :type => type, :page => page), :id => "more_course_activities_link", :remote => "true", :class => "none" %></div>-->
    <%= link_to "点击展开更多",course_activity_path(@course.id, :type => type, :page => page),:id => "show_more_course_activities",:remote => "true",:class => "loadMore mt10 f_grey"%>
<% end %>

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