parent
663c9aad60
commit
dae907d0b8
|
@ -27,7 +27,7 @@ class CommentsController < ApplicationController
|
|||
raise Unauthorized unless @news.commentable?
|
||||
|
||||
@comment = Comment.new
|
||||
@comment.safe_attributes = params[:comment]
|
||||
@comment.comments = params[:comment]
|
||||
@comment.author = User.current
|
||||
if @news.comments << @comment
|
||||
if params[:asset_id]
|
||||
|
|
|
@ -1,63 +1,7 @@
|
|||
<script type="text/javascript">
|
||||
function regexTitle()
|
||||
{
|
||||
var name = $("#news_title").val();
|
||||
if(name.length ==0)
|
||||
{
|
||||
$("#title_notice_span").text("标题不能为空");
|
||||
$("#title_notice_span").css('color','#ff0000');
|
||||
$("#title_notice_span").focus();
|
||||
return false;
|
||||
}
|
||||
else if(name.length <= 60)
|
||||
{
|
||||
$("#title_notice_span").text("填写正确");
|
||||
$("#title_notice_span").css('color','#008000');
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#title_notice_span").text("标题超过60个字符");
|
||||
$("#title_notice_span").css('color','#ff0000');
|
||||
$("#title_notice_span").focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function regexDescription()
|
||||
{
|
||||
var name = $("#news_description").val();
|
||||
if(name.length ==0)
|
||||
{
|
||||
$("#description_notice_span").text("描述不能为空");
|
||||
$("#description_notice_span").css('color','#ff0000');
|
||||
$("#description_notice_span").focus();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#description_notice_span").text("填写正确");
|
||||
$("#description_notice_span").css('color','#008000');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function submitNews()
|
||||
{
|
||||
news_description_editor.sync();
|
||||
if(regexTitle() && regexDescription())
|
||||
{
|
||||
$("#news-form").submit();
|
||||
}
|
||||
}
|
||||
function submitComment()
|
||||
{
|
||||
comment_editor.sync();
|
||||
$("#add_comment_form").submit();
|
||||
}
|
||||
<script>
|
||||
function clearMessage()
|
||||
{
|
||||
$("#comment_comments").val("");
|
||||
$("#news_comment").html("<%= escape_javascript(hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none') %><%= escape_javascript(kindeditor_tag :comment, '',:height=>'100',:editor_id =>'comment_editor', :placeholder=>"最多250个字")%>");
|
||||
}
|
||||
</script>
|
||||
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
|
||||
|
@ -77,8 +21,9 @@
|
|||
<div class="problem_main">
|
||||
<%= link_to image_tag(url_to_avatar(@news.author),:width => 42,:height => 42), user_path(@news.author), :class => "problem_pic fl" %>
|
||||
<div class="problem_txt fl mt5">
|
||||
<h4 class="r_txt_tit mb5"> <%=h @news.title %></h4>
|
||||
<%#= watcher_link(@news, User.current) %>
|
||||
<h4 class="r_txt_tit mb5">
|
||||
<%=h @news.title %>
|
||||
</h4>
|
||||
<%= link_to(l(:button_edit),
|
||||
edit_news_path(@news),
|
||||
:class => 'talk_edit fr',
|
||||
|
@ -86,7 +31,11 @@
|
|||
:onclick => '$("#edit-news").show(); return false;') if User.current.allowed_to?(:manage_news, @course) %>
|
||||
<%= delete_link(news_path(@news),:class => 'talk_edit fr') if User.current.allowed_to?(:manage_news, @course) %>
|
||||
<div class="cl"></div>
|
||||
<div class="mb5"><%= textAreailizable(@news, :description) %><br /> <%= l(:label_create_time) %> : <%= format_time(@news.created_on) %></div>
|
||||
<div class="mb5">
|
||||
<%= @news.description.html_safe %>
|
||||
<br />
|
||||
<%= l(:label_create_time) %> : <%= format_time(@news.created_on) %>
|
||||
</div>
|
||||
<%= link_to_attachments_course @news %>
|
||||
<!--<a href="#" class=" link_file">附件:爱覅俄方if.zip(27.5kB)</a> -->
|
||||
</div>
|
||||
|
@ -97,13 +46,17 @@
|
|||
<div class="msg_box">
|
||||
<h4><%= l(:label_comment_add) %></h4>
|
||||
<%= form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form") do %>
|
||||
<div class="box" >
|
||||
<div class="box" id="news_comment">
|
||||
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
||||
<%= kindeditor_tag :comment, '',:height=>'100',:editor_id =>'comment_editor', :placeholder=>"最多250个字"%>
|
||||
</div>
|
||||
<p class="mt10">
|
||||
<a href="#" class="grey_btn fr ml10" onclick="clearMessage();"><%= l(:label_cancel_with_space) %></a>
|
||||
<a href="#" class="blue_btn fr" onclick="submitComment();"><%= l(:label_comment_with_space) %></a>
|
||||
<a href="javascript:void(0)" class="grey_btn fr ml10" onclick="clearMessage();">
|
||||
<%= l(:label_cancel_with_space) %>
|
||||
</a>
|
||||
<a href="javascript:void(0)" class="blue_btn fr" onclick="submitComment();">
|
||||
<%= l(:label_comment_with_space) %>
|
||||
</a>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -116,12 +69,16 @@
|
|||
<div class="ping_dispic"><%= link_to image_tag(url_to_avatar(comment.author),:width => 42,:height => 42), user_path(comment.author)%></div>
|
||||
<div class="ping_discon">
|
||||
<div class="ping_distop">
|
||||
<%= link_to_user_header(comment.author,false,:class => 'c_blue fb fl mb10 ') if comment.respond_to?(:author) %><span class="c_grey fr"><%= format_time(comment.created_on) %></span>
|
||||
<%= link_to_user_header(comment.author,false,:class => 'c_blue fb fl mb10 ') if comment.respond_to?(:author) %>
|
||||
<span class="c_grey fr">
|
||||
<%= format_time(comment.created_on) %>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
<p><%= textAreailizable(comment.comments) %></p>
|
||||
<p><%= comment.comments.html_safe %></p>
|
||||
</div>
|
||||
<div class="ping_disfoot"><%= link_to_if_authorized_course image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment},
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete, :title => l(:button_delete) %>
|
||||
<div class="ping_disfoot">
|
||||
<%= link_to_if_authorized_course image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment},
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete, :title => l(:button_delete) %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -158,7 +158,7 @@ function regexTitle()
|
|||
{
|
||||
$("#title_notice_span").text("标题不能为空");
|
||||
$("#title_notice_span").css('color','#ff0000');
|
||||
$("#title_notice_span").focus();
|
||||
$("#news_title").focus();
|
||||
return false;
|
||||
}
|
||||
else if(name.length <= 60)
|
||||
|
@ -171,7 +171,7 @@ function regexTitle()
|
|||
{
|
||||
$("#title_notice_span").text("标题超过60个字符");
|
||||
$("#title_notice_span").css('color','#ff0000');
|
||||
$("#title_notice_span").focus();
|
||||
$("#news_title").focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -214,6 +214,12 @@ function submitFocus(obj)
|
|||
$(obj).focus();
|
||||
}
|
||||
|
||||
function submitComment()
|
||||
{
|
||||
comment_editor.sync();
|
||||
$("#add_comment_form").submit();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////课程讨论区
|
||||
function course_board_submit_message_replay()
|
||||
{
|
||||
|
|
|
@ -175,7 +175,7 @@ a:hover.work_edit{color: #fff; background: #64bdd9;}
|
|||
.wzan a{ display: block;}
|
||||
a.wzan_img{background:url(images/pic_zan.png) 0 -59px no-repeat; display:block; height:31px; width:30px; color:#fff;}
|
||||
a.wzan_visited{background:url(images/pic_zan.png) 0 0 no-repeat;}
|
||||
.msg_box{ width:670px; height:200px; border-bottom:1px dashed #CCC; padding-top:10px;}
|
||||
.msg_box{ width:670px; height:205px; border-bottom:1px dashed #CCC; padding-top:10px;}
|
||||
.msg_box h4{ }
|
||||
.msg_box textarea{width:658px;height:90px;padding:5px;overflow:hidden;background-color: #ffffff; border:1px solid #CCC; margin:5px 0px; color:#666; font-size:12px; }
|
||||
/*.msg_box a{ float:right; display:block; width:50px; height:22px; background:#15bccf; padding-top:3px; color:#fff; margin-left:10px; text-align:center; margin-top:5px; }*/
|
||||
|
|
Loading…
Reference in New Issue