<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor" %>
<style type="text/css">
    /*回复框*/
    .homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}
    .homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}
    .homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url(/images/public_icon.png)}
    .homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}
    .homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}
    .homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}
    .homepagePostReplyInputContainer .ke-outline {border: none;}
    .homepagePostReplyInputContainer .ke-inline-block {display: none;}
    .homepagePostReplyInputContainer .ke-container {float: left;}
</style>
<% homework_commons.each do |homework_common|%>
    <script type="text/javascript">
        $(function() {
            init_activity_KindEditor_data(<%= homework_common.id%>, null, "87%");
            showNormalImage('homework_description_<%= homework_common.id%>');
            if($("#intro_content_<%= homework_common.id%>").height() > 360) {
                $("#intro_content_show_<%= homework_common.id%>").show();
            }
            $("#intro_content_show_<%= homework_common.id%>").click(function(){
                $("#homework_description_<%= homework_common.id%>").toggleClass("maxh360");
                $("#homework_description_<%= homework_common.id%>").toggleClass("lh18");
                $("#intro_content_show_<%= homework_common.id%>").hide();
                $("#intro_content_hide_<%= homework_common.id%>").show();
            });
            $("#intro_content_hide_<%= homework_common.id%>").click(function(){
                $("#homework_description_<%= homework_common.id%>").toggleClass("maxh360");
                $("#homework_description_<%= homework_common.id%>").toggleClass("lh18");
                $("#intro_content_hide_<%= homework_common.id%>").hide();
                $("#intro_content_show_<%= homework_common.id%>").show();
            });
        });

        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();
            }
        }
    </script>
    <%= render :partial => 'users/user_homework_detail', :locals => {:homework_common => homework_common,:is_in_course => is_in_course} %>
<% end%>
<% if homework_commons.count == 10%>
    <% if is_in_course == 1%>
        <!-- 在课程内 -->
        <%= link_to "加载更多",homework_common_index_path(:course => course_id,:page => page,:is_in_course => is_in_course),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
    <% else%>
        <!-- 在个人主页 -->
        <%= link_to "加载更多",user_homeworks_user_path(User.current.id,:page => page,:is_in_course => is_in_course),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
    <% end%>
<% end%>