<style type="text/css">
    div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
    span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
    span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
    div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
    span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
    span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
    div.ke-toolbar .ke-outline{border:none;}

    div.respond-form .reply_btn{margin-left:565px;margin-top:5px;}
    div.recall_con{width:570px;}
    div.recall_con .reply_btn{margin-left:525px;margin-top:5px;}
    /*.ke-container{height: 80px !important;}*/
</style>
<%= content_for(:header_tags) do %>
    <%= import_ke(enable_at:  true, prettify: false, init_activity: true) %>
    <%= javascript_include_tag "init_KindEditor"  %>
<% end %>
<script >
    init_KindEditor_data('',80);
</script>
<div class="msg_box fl mb10" id='leave-message'>
  <h4><%= l(:label_leave_message) %></h4>

  <% if !User.current.logged?%>
      <div style="font-size: 14px;margin:20px;">
        <%= l(:label_user_login_tips) %>
        <%= link_to l(:label_user_login_new), signin_path %>
        <hr/>
      </div>
  <% else %>
      <div nhname='new_message_' style="display:none;">
        <%= form_for('new_form',:url =>  {:controller => 'words', :action => 'leave_course_message'}, :html=>{:id => "course_feedback_new"},:method => "post") do |f|%>
            <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
            <div nhname='toolbar_container_' ></div>
            <textarea placeholder="有问题或有建议，请直接给我留言吧！" nhname='new_message_textarea_' name="new_form[course_message]"></textarea>
            <p nhname='contentmsg_'></p>
            <a id="new_message_cancel_btn_" href="javascript:void(0)" class="grey_btn fr mt10">取消</a>
            <a href="javascript:void(0);" class="blue_btn fr ml10 mt10" id="new_message_submit_btn_" >留言</a>
        <% end %>
      </div>
  <% end %>
</div>

<div class="cl"></div>

<div id="history">
  <%= render :partial => 'history',:locals => { :contest => @contest, :journals => @jour, :state => false} %>
</div>
<ul class="wlist">
  <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<div style="display:none;"><a href="#" id="nhjump"></a></div>

<script type="text/javascript">

    $(function(){
        KindEditor.ready(function(K){
            $("a[nhname='reply_btn']").live('click',function(){
                var params = {};
                params.kindutil = K;
                params.container = $(this).parent('div').parent('div');
                params.div_form = $(">.respond-form",params.container);
                params.form = $("form",params.div_form);
                params.textarea = $("textarea[name='user_notes']",params.div_form);
                params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
                params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
                params.submit_btn = $("input[nhname='submit_btn']",params.div_form);
                params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form);
                params.height = 55;
                params.editor = init_editor(params);
                init_form(params);
                params.cancel_btn.click(function(){
                    nh_reset_form(params);
                });
                params.submit_btn.one('click', function () {
                    params.form.submit();
                });
                params.textarea.data('init',1);
                params.cancel_btn.click();
                toggleAndSettingWordsVal(params.div_form, params.textarea);
                setTimeout(function(){
                    if(!params.div_form.is(':hidden')){
                        params.textarea.show();
                        params.textarea.focus();
                        params.textarea.hide();
                    }
                },300);
            });
        });
    });

</script>
