diff --git a/app/controllers/blog_comments_controller.rb b/app/controllers/blog_comments_controller.rb index 14a0a3536..42f1e2f20 100644 --- a/app/controllers/blog_comments_controller.rb +++ b/app/controllers/blog_comments_controller.rb @@ -60,10 +60,16 @@ class BlogCommentsController < ApplicationController @article.children.delete @article.delete redirect_to user_blogs_path(:user_id=>User.current) - else - root = @article.root - @article.delete - redirect_to user_blog_blog_comment_path(:user_id=>root.author_id,:blog_id=>root.blog_id,:id=>root.id) + else#如果是回复被删, + if params[:course_id] #如果呆了course_id过来了,那么这是要跳到课程大纲去的 + @article.delete + redirect_to show_course_outline_course_path(:id=>params[:course_id]) + else + root = @article.root + @article.delete + redirect_to user_blog_blog_comment_path(:user_id=>root.author_id,:blog_id=>root.blog_id,:id=>root.id) + end + end end @@ -81,6 +87,7 @@ class BlogCommentsController < ApplicationController @content = "> #{ll(Setting.default_language, :text_user_wrote, @blogComment.author.realname)}\n> " @temp = BlogComment.new + @course_id = params[:course_id] @temp.content = "
#{ll(Setting.default_language, :text_user_wrote, @blogComment.author.realname)}
#{@blogComment.content.html_safe}
".html_safe respond_to do | format| format.js @@ -114,7 +121,14 @@ class BlogCommentsController < ApplicationController #@article.save # redirect_to user_blogs_path(:user_id=>params[:user_id]) respond_to do |format| - format.html { redirect_to user_blog_blog_comment_path(:user_id=>@article.author_id,:blog_id=>@article.blog_id,:id=>@article)} + format.html { + if params[:course_id] #如果呆了course_id过来了,那么这是要跳到课程大纲去的 + redirect_to show_course_outline_course_path(:id=>params[:course_id]) + else + redirect_to user_blog_blog_comment_path(:user_id=>@article.author_id,:blog_id=>@article.blog_id,:id=>@article) + end + + } format.js end rescue Exception => e #如果上面的代码执行发生异常就捕获 diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 1216599a1..3c211b361 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -737,6 +737,13 @@ class CoursesController < ApplicationController end end + #显示课程大纲 + def show_course_outline + @article = BlogComment.find(@course.outline) + respond_to do |format| + format.html {render :layout => 'base_courses'} + end + end #删除课程 #删除课程只是将课程的is_delete状态改为false,is_delete为false状态的课程只有管理员可以看到 def destroy diff --git a/app/views/blog_comments/_simple_ke_reply_form.html.erb b/app/views/blog_comments/_simple_ke_reply_form.html.erb index fa7ff0c4a..d65dd3faa 100644 --- a/app/views/blog_comments/_simple_ke_reply_form.html.erb +++ b/app/views/blog_comments/_simple_ke_reply_form.html.erb @@ -17,6 +17,9 @@
<%= form_for @blog_comment, :as => :reply, :url => {:controller => 'blog_comments',:action => 'reply', :id => @blogComment.id}, :html => {:multipart => true, :id => 'new_form'} do |f| %> + <% if course_id%> + + <% end %>
diff --git a/app/views/blog_comments/quote.js.erb b/app/views/blog_comments/quote.js.erb index 4d16745ca..088b2cf67 100644 --- a/app/views/blog_comments/quote.js.erb +++ b/app/views/blog_comments/quote.js.erb @@ -1,5 +1,5 @@ if($("#reply_message_<%= @blogComment.id%>").length > 0) { - $("#reply_message_<%= @blogComment.id%>").replaceWith("<%= escape_javascript(render :partial => 'simple_ke_reply_form', :locals => {:reply => @blogComment,:temp =>@temp,:subject =>@subject}) %>"); + $("#reply_message_<%= @blogComment.id%>").replaceWith("<%= escape_javascript(render :partial => 'blog_comments/simple_ke_reply_form', :locals => {:reply => @blogComment,:temp =>@temp,:subject =>@subject,:course_id=>@course_id}) %>"); $(function(){ $('#reply_subject').val("<%= raw escape_javascript(@subject) %>"); $('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>"); diff --git a/app/views/courses/set_course_outline.js.erb b/app/views/courses/set_course_outline.js.erb index ad3b78189..febcb0b1f 100644 --- a/app/views/courses/set_course_outline.js.erb +++ b/app/views/courses/set_course_outline.js.erb @@ -1 +1,5 @@ -hideModal(); \ No newline at end of file +hideModal(); +<%if @course.tea_id == User.current.id && @course.outline == 0 %> +<% else %> + $("#course_outline_bar").html(' ') +<%end %> diff --git a/app/views/courses/show_course_outline.html.erb b/app/views/courses/show_course_outline.html.erb new file mode 100644 index 000000000..ff503d983 --- /dev/null +++ b/app/views/courses/show_course_outline.html.erb @@ -0,0 +1,160 @@ +<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor",'blog' %> + + + +
+
+
+ <%= link_to image_tag(url_to_avatar(@article.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@article.author) %> +
+
+ <% if @article.author.id == User.current.id%> + + + + + + + [设置大纲] + + <%end%> + +
+ +
+ <% if @article.try(:author).try(:realname) == ' ' %> + <%= link_to @article.try(:author), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% else %> + <%= link_to @article.try(:author).try(:realname), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% end %> +
+
<%= format_time( @article.created_on)%>
+
+
+ <%= @article.content.html_safe%> +
+
+
+ <%#= link_to_attachments_course @topic, :author => false %> + <% if @article.attachments.any?%> + <% options = {:author => true, :deletable => false} %> + <%= render :partial => 'blog_comments/attachments_links', :locals => {:attachments => @article.attachments, :options => options, :is_float => true} %> + <% end %> +
+
+
+
+
+ <% count=0 %> + <% if @article.parent %> + <% count=@article.parent.children.count%> + <% else %> + <% count=@article.children.count%> + <% end %> +
+ <% unless count == 0 %> +
+
回复(<%=count %>)
+
+ +
+
+ <%@article.children.reorder('created_on desc').each_with_index do |reply,i| %> + +
+
+ <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> +
+
+
+ <% if reply.try(:author).try(:realname) == ' ' %> + <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> + <% end %> +
+
+ <%= reply.content.html_safe%> +
+
+ <%= format_time(reply.created_on) %> + +
+

+
+
+
+ <% end %> +
+ + <% end %> +
+ <% if !@article.locked? && User.current.logged?%> +
+ +
+
+ <%= form_for :blog_comment, :url => {:action => 'reply',:controller => 'blog_comments',:user_id=>@article.author.id,:blog_id=>@article.blog_id, :id => @article.id}, :html => {:multipart => true, :id => 'message_form'} do |f| %> + + <%= render :partial => 'blog_comments/reply_form', :locals => {:f => f,:user=>@user,:article=>@article} %> + <%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'canel_message_replay();', :class => " grey_btn fr c_white mt10 mr5" %> + <%= link_to l(:button_submit), "javascript:void(0)", :onclick => 'submit_message_replay();', :class => "blue_btn fr c_white mt10", :style => "margin-right: 5px;" %> + <% end %> +
+
+
+ <% end %> +
+
\ No newline at end of file diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 43f754097..d7e7bba90 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -54,21 +54,47 @@
+ + + + + + + + + + + + + + + + + + +
- - <%= @course.name %> - - <% if @course.is_public == 0%> - + +
+ + <%= @course.name %> + + <% if @course.is_public == 0%> + + <%= l(:field_is_private)%> - <% end %> - <%if @course.tea_id == User.current.id %> - - 设置大纲 - - <% end %> -
+ <% end %> + + <%if @course.tea_id == User.current.id && (@course.outline == 0 || BlogComment.where(:id=>@course.outline).count == 0) %> + + <% elsif @course.tea_id == User.current.id && @course.outline != 0 && BlogComment.where(:id=>@course.outline).count != 0%> + + <% elsif @course.tea_id != User.current.id %> + <%end %> + +
+
<%= l(:label_account_identity_teacher)%>(<%= course_teacher_link teacher_num %>) diff --git a/config/routes.rb b/config/routes.rb index 3811bd43f..5be734dee 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -792,6 +792,7 @@ RedmineApp::Application.routes.draw do get 'course_outline' post 'search_course_outline' post 'set_course_outline' + get 'show_course_outline' end collection do match 'join_private_courses', :via => [:get, :post] diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 9fe75db34..744f1e07a 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1099,3 +1099,12 @@ a.postRouteLink:hover {text-decoration:underline;} .blogRow {width:280px; height:15px; line-height:15px;} .blogSearchBox {border:1px solid #e6e6e6; height:25px; background-color:#ffffff; margin-top:8px; margin-bottom:8px;}/*width:280px;*/ .blogSearchContent {border:none; outline:none; background-color:#ffffff; width:216px; height:25px; padding-left:10px; display:inline-block; float:left;} + +/*课程大纲图标样式20151028Tim*/ +.syllabusIcon {background:url("../images/course/syllabus.png") 0px 0px no-repeat; width: 17px; height: 16px; display: inline-block;} +.syllabusSetting {background:url("../images/course/syllabus.png") 0px -16px no-repeat; width: 20px; height: 16px; display: inline-block;} + +.syllabusSettingIcon {background:url(../images/course/syllabus_setting.png) 0px 0px no-repeat; width:20px; height:20px;} +.syllabusSettingIcon:hover {cursor: pointer} + +.pic_files{display:block; background:url(../images/public_icon.png) 0px -578px no-repeat; width:20px; height:15px;}