From dae907d0b82e75c83f394cbc283418c023baa892 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 8 Apr 2015 15:49:53 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E8=AF=BE=E7=A8=8B=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E6=B7=BB=E5=8A=A0=E8=AF=84=E8=AE=BA=202?= =?UTF-8?q?=E3=80=81=E8=AF=BE=E7=A8=8B=E9=80=9A=E7=9F=A5=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=203=E3=80=81=E8=AF=BE=E7=A8=8B=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E8=AF=84=E8=AE=BA=E5=8F=96=E6=B6=88=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/comments_controller.rb | 2 +- app/views/news/_course_show.html.erb | 93 +++++++------------------- public/javascripts/course.js | 10 ++- public/stylesheets/courses.css | 2 +- 4 files changed, 35 insertions(+), 72 deletions(-) diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 57ad9d4ce..bb84b1fa4 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -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] diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb index d44deb66e..f7c5145f0 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -1,63 +1,7 @@ - <%= javascript_include_tag "/assets/kindeditor/kindeditor" %> @@ -77,8 +21,9 @@
<%= link_to image_tag(url_to_avatar(@news.author),:width => 42,:height => 42), user_path(@news.author), :class => "problem_pic fl" %>
-

<%=h @news.title %>

- <%#= watcher_link(@news, User.current) %> +

+ <%=h @news.title %> +

<%= 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) %>
-
<%= textAreailizable(@news, :description) %>
<%= l(:label_create_time) %> : <%= format_time(@news.created_on) %>
+
+ <%= @news.description.html_safe %> +
+ <%= l(:label_create_time) %> : <%= format_time(@news.created_on) %> +
<%= link_to_attachments_course @news %>
@@ -97,13 +46,17 @@

<%= l(:label_comment_add) %>

<%= form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form") do %> -
+
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> <%= kindeditor_tag :comment, '',:height=>'100',:editor_id =>'comment_editor', :placeholder=>"最多250个字"%>

- <%= l(:label_cancel_with_space) %> - <%= l(:label_comment_with_space) %> + + <%= l(:label_cancel_with_space) %> + + + <%= l(:label_comment_with_space) %> +

<% end %>
@@ -116,12 +69,16 @@
<%= link_to image_tag(url_to_avatar(comment.author),:width => 42,:height => 42), user_path(comment.author)%>
- <%= link_to_user_header(comment.author,false,:class => 'c_blue fb fl mb10 ') if comment.respond_to?(:author) %><%= format_time(comment.created_on) %> + <%= link_to_user_header(comment.author,false,:class => 'c_blue fb fl mb10 ') if comment.respond_to?(:author) %> + + <%= format_time(comment.created_on) %> +
-

<%= textAreailizable(comment.comments) %>

+

<%= comment.comments.html_safe %>

-
<%= 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) %> +
+ <%= 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) %>
diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 64b8898f4..fcb72ee78 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -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() { diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index b9202279c..fa9e9787c 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -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; }*/