课程大纲的回复

This commit is contained in:
cxt 2016-07-25 13:56:26 +08:00
parent 6c7925a7b4
commit 0564ddb6ea
13 changed files with 71 additions and 474 deletions

View File

@ -149,6 +149,9 @@ class UsersController < ApplicationController
@user_activity_id = params[:user_activity_id]
@activity_id = params[:activity_id]
@type = 'Issue'
when 'Syllabus'
@reply = JournalsForMessage.find params[:reply_id]
@type = 'Syllabus'
end
respond_to do |format|
format.js
@ -3342,6 +3345,8 @@ class UsersController < ApplicationController
when 'Syllabus'
obj = Syllabus.where('id = ?', params[:id].to_i).first
@journals = obj.journals_for_messages.reorder("created_on desc")
@type = 'Syllabus'
@user_activity_id = params[:div_id].to_i if params[:div_id]
when 'JournalsForMessage'
obj = JournalsForMessage.where('id = ?', params[:id].to_i).first
journals = []

View File

@ -112,6 +112,10 @@ class WordsController < ApplicationController
end
@is_in_course = params[:is_in_course].to_i
@course_activity = params[:course_activity].to_i
elsif @journal_destroyed.jour_type == 'Syllabus'
@syllabus = Syllabus.find @journal_destroyed.jour_id
@count = @syllabus.journals_for_messages.count
@comments = @syllabus.journals_for_messages.reorder("created_on desc").limit(3)
end
respond_to do |format|
format.js
@ -352,6 +356,35 @@ class WordsController < ApplicationController
render_403
end
end
#课程大纲的二级回复
def reply_to_syllabus
if User.current.logged?
@user = User.current
reply = JournalsForMessage.find params[:id].to_i
@syllabus = Syllabus.find reply.jour_id
if params[:reply_message].size>0 && User.current.logged? && @user
options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => @user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i}
feedback = Syllabus.add_syllabus_jour(@user, params[:reply_message], reply.jour_id, options)
if (feedback.errors.empty?)
if params[:asset_id]
ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids,feedback[:id],OwnerTypeHelper::JOURNALSFORMESSAGE
end
@syllabus.update_column('updated_at', Time.now)
@count = @syllabus.journals_for_messages.count
@comments = @syllabus.journals_for_messages.reorder("created_on desc").limit(3)
respond_to do |format|
format.js
end
else
flash[:error] = feedback.errors.full_messages[0]
end
end
else
render_403
end
end
def add_brief_introdution
user = User.current

View File

@ -1,278 +0,0 @@
<%# course_model %>
<% course_file_num = visable_attachemnts_incourse(@course).count%>
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
<% homework_num = visable_course_homework @course %>
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="utf-8">
<title>
<%= h html_title %>
</title>
<meta name="description" content="<%= Redmine::Info.app_name %>"/>
<meta name="keywords" content="issue,bug,tracker"/>
<%= csrf_meta_tag %>
<%= favicon %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup'%>
<%= javascript_include_tag "course","sy_public", "syllabus","header","attachments",'prettify' %>
<!-- page specific tags -->
<%= yield :header_tags -%>
<!-- MathJax的配置 -->
<script type="text/javascript"
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<!--<script type="text/javascript"-->
<!--src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">-->
<!--</script>-->
<!-- 配置 在生成的公式图片上去掉Math定义的右键菜单$$ $$ \( \) \[ \] 中的公式给予显示-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
showMathMenu: false,
showMathMenuMSIE: false,
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
</head>
<!--add by huang-->
<body onload="prettyPrint();">
<div class="navContainer mb10">
<% if User.current.logged? %>
<%= render :partial => 'layouts/logined_header' %>
<% else%>
<%= render :partial => 'layouts/unlogin_header' %>
<% end%>
</div>
<div class="cl"></div>
<div id="Container">
<div id="content">
<div id="LSide" class="fl">
<div class="project_info" style="position: relative" id="project_info_<%=@course.id %>">
<%=render :partial=>'layouts/project_info' %>
</div><!--课程信息 end-->
<div class="info_box">
<ul>
<li><%= l(:label_main_teacher)%> :&nbsp;&nbsp;<%= link_to(@course.teacher.lastname+@course.teacher.firstname, user_path(@course.teacher), :class => 'c_dblue') %></li>
<li><%= l(:label_class_period)%> :&nbsp;&nbsp;<span ><%= @course.class_period %> <%= l(:label_class_hour) %></span></li>
<li><%= l(:label_main_term)%> :&nbsp;&nbsp;<span><%= current_time_and_term @course %></span></li>
<% if @course.school%>
<li><%= l(:label_course_organizers)%> :&nbsp;&nbsp;<%= @course.school%></li>
<% end%>
</ul>
</div>
<%# 更新访问数,刷新的时候更新访问次数 %>
<% update_visiti_count @course %>
<%# over %>
<div class="subNavBox">
<% unless show_nav?(@course.course_activities.count) %>
<div class="subNav">
<%= link_to l(:label_activity), course_path(@course), :class => "f14 c_blue02" %>
<!--暂时不显示课程动态数,优化后在显示-->
<%= link_to "(#{@course.course_activities.count})", course_path(@course), :class => "subnav_num c_orange"%>
</div>
<% end %>
<% unless show_nav?(@course.homework_commons.count) %>
<div class="subNav">
<%= link_to l(:label_homework), homework_common_index_path(:course => @course.id), :class => "f14 c_blue02"%>
<%= link_to "(#{homework_num})", homework_common_index_path(:course => @course.id), :class => "subnav_num c_orange"%>
<%= link_to( "", homework_common_index_path(:course => @course.id,:is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_course_homework_new)}") if is_teacher %>
</div>
<% end %>
<% unless show_nav?(@course.news.count) %>
<div class="subNav">
<%= link_to "通知", course_news_index_path(@course), :class => "f14 c_blue02" %>
<%= link_to "(#{@course.news.count})", course_news_index_path(@course), :class => "subnav_num c_orange"%>
<%= link_to( "", new_course_news_path(@course,:is_new=>1), :class => 'courseMenuSetting', :title =>"#{l(:label_course_news_new)}") if is_teacher %>
</div>
<% end %>
<% unless show_nav?(course_file_num) %>
<div class="subNav">
<%= link_to l(:label_course_file), course_files_path(@course), :class => "f14 c_blue02" %>
<%= link_to "(#{course_file_num})", course_files_path(@course), :class => "subnav_num c_orange",:id=>'courses_files_count_nav' %>
<% if is_teacher || (@course.publish_resource == 1 && User.current.member_of_course?(@course)) %>
<!--link_to( "+#{l(:label_upload_files)}", course_files_path(@course), :class => 'subnav_green ml95 c_white')-->
<a class="courseMenuSetting" title="上传资源" href="javascript:void(0);" onclick="course_files_upload();"> </a>
<% end %>
</div>
<% end %>
<% unless show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %>
<div class="subNav">
<%= link_to l(:label_course_board), course_boards_path(@course), :class => "f14 c_blue02" %>
<%= link_to "(#{@course.boards.first ? (@course.boards.first.topics.count + Message.where("board_id =? and parent_id is not ?", @course.boards.first.id, nil).count) : 0})", course_boards_path(@course), :class => "subnav_num c_orange" %>
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_message_new)}") %>
</div>
<% end %>
<% unless show_nav?(course_feedback_count) %>
<div class="subNav">
<%= link_to l(:label_course_feedback), course_feedback_path(@course), :class => "f14 c_blue02" %>
<%= link_to "(#{course_feedback_count})", course_feedback_path(@course), :class => "subnav_num c_orange", :id => "course_jour_count"%>
<%= link_to "", course_feedback_path(@course), :class => 'courseMenuSetting', :title =>"#{l(:label_course_feedback)}", :id => "course_jour_count"%>
</div>
<% end %>
<% unless show_nav?(course_poll_count) %>
<div class="subNav">
<%= link_to l(:label_poll), poll_index_path(:polls_type => "Course", :polls_group_id => @course.id), :class => " f14 c_blue02"%>
<%= link_to "(#{course_poll_count})", poll_index_path(:polls_type => "Course", :polls_group_id => @course.id), :class => "subnav_num c_orange" %>
<%= link_to( "", new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => 'courseMenuSetting', :title =>"#{l(:label_new_poll)}") if is_teacher %>
</div>
<% end %>
<% unless show_nav?(User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status <> 1").count) %>
<div class="subNav">
<%= link_to "在线测验", exercise_index_path(:course_id => @course.id), :class => " f14 c_blue02"%>
<%= link_to "(#{User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status <> 1").count})", exercise_index_path(:course_id => @course.id), :class => "subnav_num c_orange" %>
<%= link_to( "", new_exercise_path(:course_id => @course.id), :class => 'courseMenuSetting', :title =>"新建试卷") if is_teacher %>
</div>
<% end %>
<%# 工具栏展开 %>
<% if @course.homework_commons.count == 0 || @course.news.count == 0 || course_file_num == 0 || course_poll_count == 0 || @course.exercises.count == 0 ||
course_feedback_count == 0 || @course.exercises.count == 0 || (@course.boards.first ? @course.boards.first.topics.count : 0) == 0 %>
<div class="subNav subNav_jiantou" id="expand_tools_expand"><%= l(:label_project_more) %></div>
<ul class="navContent" id="navContentCourse">
<%= render 'courses/tool_expand', :locals => {:is_teacher => is_teacher, :course_file_num => course_file_num} %>
</ul>
<% end %>
</div><!--项目侧导航 end-->
<%# 课程活跃度 %>
<div class="cl"></div>
<%= render :partial => 'courses/course_activity_users', :locals => {:course => @course} %>
<%# 课程英雄榜 %>
<%= render :partial => 'courses/course_heroes', :locals => {:course => @course} %>
<% if @course.description && !@course.description.blank? %>
<div class="project_intro">
<div id="course_description" class="course_description">
<h4 ><%= l(:label_course_brief_introduction)%></h4>
<div id="course_description_content">
<%= textilizable(@course.description) if @course.description && !@course.description.blank? %>
</div>
</div>
<div class="lg-foot" id="lg-foot" onclick="show_more_msg();">
<label id="expend_more_information" value="show_more"><%= l(:label_expend_information)%></label>
<span class="g-arr-down">
<img id="arrow" src="/images/jiantou.jpg" width="12" height="6" />
</span>
</div>
</div><!--项目简介 end-->
<% end %>
<div class="project_Label">
<h4 class="mb5" ><%= l(:label_tag)%></h4>
<div class="tag_h" >
<%= render :partial => 'tags/new_tag', :locals => {:obj => @course, :object_flag => "9"} %>
</div>
<div class="cl"></div>
</div><!--项目标签 end-->
<!--课程推荐-->
<%= render :partial => 'courses/recommendation', :locals => {:course => @course} %>
<div class="fontGrey5 mt10 ml10 mb10">访问计数 <%= @course.visits.to_i %> 自2016年5月</div>
</div><!--LSide end-->
<div id="RSide" class="fl">
<%= yield %>
<%#= render_flash_messages %>
<%#= call_hook :view_layouts_base_content %>
</div>
<div class="cl"></div>
</div><!--Content end-->
</div><!--Container end-->
<div class="cl"></div>
<%= render :partial => 'layouts/footer' %>
<div class="cl"></div>
<%= render :partial => 'layouts/new_feedback' %>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>
<div id="ajax-modal" style="display:none;"></div>
<%= call_hook :view_layouts_base_body_bottom %>
</body>
<script>
var blog_artile_list_html = '';
$(function(){
$(document).on('input','input[name="course_outline_search"]',function(e){
throttle(course_outline_search,window,e);
})
function throttle(method,context,e){
clearTimeout(method.tId);
method.tId=setTimeout(function(){
method.call(context,e);
},500);
}
function course_outline_search(e){
// if($(e.target).val().trim() == ''){
// return;
// }
$("#course_outline_hint").hide();
$.ajax({
url:'<%=search_course_outline_course_path(@course) %>'+"?&title="+ e.target.value,
type:'post',
success:function(data){
if(data.length != 0 ){
$("#course_outline_list").html('');
for(var i =0;i<data.length;i++){
var html = ' <ul class="blogRow"> '+
' <li class="fl"> '+
'<input name="outline_id" type="radio" value="'+data[i].blog_comment.id+'" class="courseSendCheckbox"/>'+
'</li>'+
'<li class="blogTitle fl">'+data[i].blog_comment.title+'</li>'+
'</ul>'+
'<div class="homeworkPublishTime">发布时间:'+data[i].blog_comment.created_at.match(/(\S*)T/)[1]+'</div>';
$("#course_outline_list").append(html)
}
}else{
$("#course_outline_list").html('');
$("#course_outline_hint").show();
}
}
})
}
})
//资源库上传附件
function course_files_upload(){
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_course_files',:locals => {:course => @course,:course_attachment_type => 1}) %>');
showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls");
}
// 鼠标经过的时候显示内容
function message_titile_show(obj,e)
{
obj.parent().parent().next("div").show();
obj.parent().next("div").css("top",e.pageY).css("left",e.pageX).css("position","absolute");
}
function message_titile_hide(obj)
{
obj.parent().parent().next("div").hide();
}
function message_titile_show2(obj,e)
{
obj.parent().next("div").show();
obj.parent().next("div").css("top",e.pageY).css("left",e.pageX).css("position","absolute");
}
function message_titile_hide2(obj)
{
obj.parent().next("div").hide();
}
$("#expand_tools_expand").click(function(){
$("#navContentCourse").toggle();
});
</script>
</html>

View File

@ -1,151 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title><%= h html_title %></title>
<meta name="description" content="<%= Redmine::Info.app_name %>" />
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'syllabus','css/common','css/public','css/structure','css/courses','css/popup','prettify',:media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "bootstrap","avatars","course",'attachments','prettify','syllabus'%>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= yield :header_tags -%>
<!-- MathJax的配置 -->
<script type="text/javascript"
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<!-- 配置 在生成的公式图片上去掉Math定义的右键菜单$$ $$ \( \) \[ \] 中的公式给予显示-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
showMathMenu: false,
showMathMenuMSIE: false,
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
</head>
<body onload="prettyPrint();">
<% is_current_user = User.current.logged?%>
<div class="navContainer">
<% if User.current.logged? %>
<%= render :partial => 'layouts/logined_header' %>
<% else%>
<%= render :partial => 'layouts/unlogin_header' %>
<% end%>
</div>
<div class="cl"></div>
<div class="homepageContentContainer">
<div class="homepageContent">
<div class="homepageLeft">
<div class="homepagePortraitContainer mt15" onmouseover="$('#syllabus_edit_title_png').show();$('#syllabus_edit_ng_name_png').show();" onmouseout="$('#syllabus_edit_title_png').hide();$('#syllabus_edit_ng_name_png').hide();">
<%=render :partial => 'layouts/syllabus_info' %>
</div>
<% update_visiti_count @syllabus %>
<div class="homepageLeftMenuContainer" id="syllabus_base_info" onmouseover="$('#syllabus_attr_edit').show();" onmouseout="$('#syllabus_attr_edit').hide();">
<%= render :partial => 'layouts/syllabus_base_info', :locals => {:syllabus => @syllabus} %>
</div>
<div class="homepageLeftMenuContainer">
<div class="homepageLeftMenuBlock">
<%=link_to '班级', {:controller => "syllabuses", :action => "syllabus_courselist", :id => @syllabus.id}, :class => 'homepageMenuText' %>
<% if is_current_user%>
<% if User.current == @syllabus.user && User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
<div class="courseMenu" id="courseMenu">
<ul>
<li class="courseMenuIcon fr" style="margin-right:10px;" id="courseMenuIcon">
<ul class="topnav_course_menu" id="topnav_course_menu">
<li>
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "menuGrey", :target => '_blank'%>
</li>
<li>
<%= link_to "加入班级",join_private_courses_courses_path,:remote => true,:class => "menuGrey",:method => "post"%>
</li>
</ul>
</li>
</ul>
</div>
<% else%>
<%=link_to "", join_private_courses_courses_path, :class => "homepageMenuSetting fr",:style => "margin-right:10px;", :remote => true, :title => "加入班级"%>
<% end%>
<% end%>
</div>
<% if User.current == @syllabus.user || User.current.admin?
all_courses = @syllabus.courses.where("is_delete = 0").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc")
else
all_courses = User.current.courses.visible.where("is_delete =? and syllabus_id =?", 0, @syllabus.id).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc")
end %>
<% courses = all_courses.limit(5) %>
<% all_count = all_courses.count%>
<div class="homepageLeftMenuCourses <%= courses.empty? ? 'none' : ''%>">
<div class = "leftCoursesList" id="homepageLeftMenuCourses">
<ul>
<%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => User.current,:all_count => all_count,:type =>'Syllabus',:page => 0} %>
</ul>
</div>
<% if !courses.empty? %>
<div class="homepageLeftMenuMore" id="user_hide_course">
<a href="javascript:void(0);" class="homepageLeftMenuHideIcon" id="hide_show_courseicon" onclick="leftCourseslistChange();"></a>
</div>
<% end %>
</div>
</div>
<div class="project_Label">
<h4 class="mb5" >标签:</h4>
<div class="tag_h">
<%= render :partial => 'tags/syllabus_tag', :locals => {:obj => @syllabus,:object_flag => "11"}%>
</div>
<div class="cl"></div>
</div>
<div class="fontGrey2 mt10 ml20">访问计数 <%=@syllabus.visits %> 自2016年7月</div>
</div><!--left end -->
<div class="homepageRight">
<%= yield %>
</div>
</div>
<%= render :partial => 'layouts/new_feedback' %>
</div>
<div class="cl"></div>
<%= render :partial => 'layouts/footer' %>
<div class="cl"></div>
<div id="ajax-modal" style="display:none;"></div>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>
<script type="text/javascript">
$(function() {
$('#user_hide_course').hide();
$("#syllabus_title_edit").live("blur", function () {
edit_syllabus_title('<%= edit_syllabus_title_syllabus_path(@syllabus.id)%>');
});
$("#syllabus_eng_name_edit").live("blur", function () {
edit_syllabus_eng_name('<%= edit_syllabus_eng_name_syllabus_path(@syllabus.id)%>');
});
$("#courseMenu").mouseenter(function () {
$("#topnav_course_menu").show();
});
$("#courseMenu").mouseleave(function () {
$("#topnav_course_menu").hide();
});
});
function leftCourseslistChange(){
$('#homepageLeftMenuCourses').slideToggle();
$('#hide_show_courseicon').toggleClass("homepageLeftMenuHideIcon");
$('#hide_show_courseicon').toggleClass("homepageLeftMenuMoreIcon");
}
function show_edit_base_info() {
$("#syllabus_base_info").html("<%=escape_javascript(render :partial => 'layouts/syllabus_edit_info', :locals => {:syllabus => @syllabus}) %>");
}
</script>
</body>
</html>

View File

@ -53,7 +53,7 @@
<% comments = @syllabus.journals_for_messages.reorder("created_on desc").limit(3) %>
<% if count > 0 %>
<div class="" id="reply_div_<%= @syllabus.id %>">
<%= render :partial => 'users/all_replies', :locals => {:comments => comments}%>
<%=render :partial => 'users/news_replies', :locals => {:comments => comments, :type => 'Syllabus'} %>
</div>
<% end %>
<div class="homepagePostReplyContainer borderBottomNone minHeight48">

View File

@ -1,39 +0,0 @@
<ul>
<% comments.each do |comment| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= comment.id %>');
autoUrl('reply_content_<%= comment.id %>');
});
</script>
<li class="homepagePostReplyContainer" nhname="reply_rec">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher">
<%= link_to comment.creator_user.show_name, user_url_in_org(comment.creator_user.id), :class => "newsBlue mr10 f14" %>
<%= time_from_now(comment.created_time) %>
<span id="reply_praise_count_<%=comment.id %>">
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
</span>
</div>
<% if !comment.content_detail.blank? || comment.class == Journal %>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
<% if comment.class == Journal %>
<% if comment.details.any? %>
<% details_to_strings(comment.details).each do |string| %>
<p><%= string %></p>
<% end %>
<% end %>
<P><%= comment.notes.html_safe %></P>
<% else %>
<%= comment.content_detail.html_safe %>
<% end %>
</div>
<% end %>
</div>
<div class="cl"></div>
</li>
<% end %>
</ul>

View File

@ -76,6 +76,20 @@
:class => 'fr mr20',
:title => l(:button_delete)
) if comment.user_id == User.current.id %>
<% elsif type == 'Syllabus' %>
<span style="position: relative" class="fr mr20">
<%= link_to(
l(:button_reply),
{:controller => 'users', :action => 'reply_to', :reply_id => comment.id, :type => type},
:remote => true,
:method => 'get',
:title => l(:button_reply)) %>
<span id="reply_iconup_<%= comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
</span>
<% if User.current.admin? || User.current == Syllabus.find(activity_id).user || comment.user == User.current%>
<%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20", :title => l(:button_delete)) %>
<% end %>
<% end %>
</span>
<div class="cl"></div>

View File

@ -1,4 +1,4 @@
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBanner" id="reply_banner_<%=user_activity_id %>">
<div class="homepagePostReplyBannerCount">
<span>回复</span>
<span class="reply_iconup" > ︿</span>

View File

@ -82,6 +82,15 @@
<div class="cl"></div>
<p nhname='contentmsg_<%= reply.id%>' class="fl"></p>
<% end %>
<% elsif @type == 'Syllabus' %>
<%= form_for('new_form',:url => {:controller => 'words', :action => 'reply_to_syllabus', :id => reply.id},:method => "post", :remote => true) do |f| %>
<input type="hidden" name="reply[subject]" id="reply_subject">
<div nhname='toolbar_container_<%= reply.id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="reply_message"></textarea>
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= reply.id%>'></p>
<% end%>
<% end %>
</div>
<div class="cl"></div>

View File

@ -8,8 +8,6 @@ $('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :p
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i, :homepage => @homepage}) %>');
<% elsif params[:type] == 'OrgDocumentComment' %>
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals, :user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i}) %>');
<% elsif params[:type] == 'News' || params[:type] == 'Issue' %>
<% elsif params[:type] == 'News' || params[:type] == 'Issue' || params[:type] == 'Syllabus' %>
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/news_replies', :locals => {:comments => @journals, :user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i}) %>');
<% else %>
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/all_replies', :locals => {:comments => @journals}) %>');
<% end %>

View File

@ -1,6 +1,6 @@
<% if @journal_destroyed.nil? %>
alert('<%=l(:notice_failed_delete)%>');
<% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication','HomeworkCommon'].include? @journal_destroyed.jour_type)%>
<% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication','HomeworkCommon','Syllabus'].include? @journal_destroyed.jour_type)%>
<% if @is_user%>
<% if @activity %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>");
@ -18,6 +18,9 @@
<% else %>
<% if @bid && @jours_count %>
$('#jours_count').html("<%= @jours_count %>");
<% elsif @syllabus %>
$("#reply_banner_<%=@syllabus.id %>").replaceWith("<%=escape_javascript(render :partial => 'users/reply_banner', :locals => {:count => @count, :activity => @syllabus, :user_activity_id => @syllabus.id}) %>");
$("#reply_div_<%=@syllabus.id %>").html("<%=escape_javascript(render :partial => 'users/news_replies', :locals => {:comments => @comments, :type => 'Syllabus', :user_activity_id => @syllabus.id, :activity_id => @syllabus.id}) %>");
<% elsif @course && @jours_count%>
<% if @user_activity_id %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>");

View File

@ -0,0 +1,2 @@
$("#reply_banner_<%=@syllabus.id %>").replaceWith("<%=escape_javascript(render :partial => 'users/reply_banner', :locals => {:count => @count, :activity => @syllabus, :user_activity_id => @syllabus.id}) %>");
$("#reply_div_<%=@syllabus.id %>").html("<%=escape_javascript(render :partial => 'users/news_replies', :locals => {:comments => @comments, :type => 'Syllabus'}) %>");

View File

@ -1232,6 +1232,7 @@ RedmineApp::Application.routes.draw do
post 'words/:id/leave_syllabus_message', :to => 'words#leave_syllabus_message', :as => "leave_syllabus_message"
post 'words/:id/leave_homework_message', :to => 'words#leave_homework_message', :as => "leave_homework_message"
post 'words/:id/reply_to_homework', :to => 'words#reply_to_homework', :as => "reply_to_homework"
post 'words/:id/reply_to_syllabus', :to => 'words#reply_to_syllabus', :as => "reply_to_syllabus"
post 'join_in/join', :to => 'courses#join', :as => 'join'
delete 'join_in/join', :to => 'courses#unjoin'