This commit is contained in:
huang 2015-10-29 17:29:26 +08:00
commit 470fb3bfa6
24 changed files with 2220 additions and 1797 deletions

View File

@ -6,7 +6,7 @@ unless RUBY_PLATFORM =~ /w32/
gem 'iconv'
end
gem 'grack', path:'./lib/grack'
gem 'grack', path:'lib/grack'
gem 'gitlab', path: 'lib/gitlab-cli'
gem 'rest-client'
gem "mysql2", "= 0.3.18"

View File

@ -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 = "<blockquote>#{ll(Setting.default_language, :text_user_wrote, @blogComment.author.realname)} <br/>#{@blogComment.content.html_safe}</blockquote>".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 #如果上面的代码执行发生异常就捕获

View File

@ -711,6 +711,39 @@ class CoursesController < ApplicationController
end
end
#从课程创建的老师那里选择课程大纲
def course_outline
@teacher = User.find(@course.tea_id)
@blog_articles = @teacher.blog.articles
respond_to do |format|
format.js
end
end
#根据关键字搜索,查找方法一样的,但返回内容不一样
def search_course_outline
@article_title = params[:title]
@teacher = User.find(@course.tea_id)
@blog_articles = @teacher.blog.articles.like(@article_title)
render :json=>@blog_articles.to_json
end
#设置或者更改课程的大纲
def set_course_outline
@course.outline = params[:outline_id]
@course.save
respond_to do |format|
format.js
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状态改为falseis_delete为false状态的课程只有管理员可以看到
def destroy

View File

@ -163,9 +163,9 @@ class MembersController < ApplicationController
#给新成员和老师发送加入课程的消息发送者id放在CourseMessage的course_message_id字段中
#course_message_type设置为JoinCourse
#status = 0 表示给学生发status = 1表示给老师发
course_join = CourseMessage.new(:user_id =>user_id, :course_message_id=>User.current.id,:course_id => @course.id,:course_message_type=>"JoinCourse", :viewed => false, :status => 0)
course_join = CourseMessage.new(:user_id =>user_id, :course_message_id=>User.current.id,:course_id => @course.id,:course_message_type=>"JoinCourse", :content => role, :viewed => false, :status => 0)
course_join.save
CourseMessage.create(:user_id => User.current.id, :course_message_id => user_id, :course_id => @course.id, :course_message_type => "JoinCourse", :viewed => false, status => 1)
CourseMessage.create(:user_id => User.current.id, :course_message_id => user_id, :course_id => @course.id, :course_message_type => "JoinCourse",:content => role, :viewed => false, :status => 1)
members << member
#user_grades << UserGrade.new(:user_id => user_id, :course_id => @course.id)

View File

@ -628,10 +628,10 @@ module CoursesHelper
#重启、关闭课程按钮
def set_course_time course
id = "finish_course_#{course.id}"
linkPath = course_endTime_timeout?(course) ? restartcourse_course_path(course) : finishcourse_course_path(course, format: :js)
desc = course_endTime_timeout?(course) ? l(:label_course_reload) : l(:label_course_closed)
link_to "<span class='pr_close'></span>#{desc}".html_safe, linkPath, :remote => true, :method => :post, :id => id, :confirm => l(:label_course_closed_tips, :desc => desc), :class => "pr_join_a"
# id = "finish_course_#{course.id}"
# linkPath = course_endTime_timeout?(course) ? restartcourse_course_path(course) : finishcourse_course_path(course, format: :js)
# desc = course_endTime_timeout?(course) ? l(:label_course_reload) : l(:label_course_closed)
# link_to "<span class='pr_close'></span>#{desc}".html_safe, linkPath, :remote => true, :method => :post, :id => id, :confirm => l(:label_course_closed_tips, :desc => desc), :class => "pr_join_a"
end
#加入课程、退出课程按钮

View File

@ -19,6 +19,15 @@ class BlogComment < ActiveRecord::Base
after_save :add_user_activity
before_destroy :destroy_user_activity
scope :like, lambda {|arg|
if arg.blank?
where(nil)
else
pattern = "%#{arg.to_s.strip.downcase}%"
where(" LOWER(title) LIKE :p ", :p => pattern)
end
}
#在个人动态里面增加当前动态
def add_user_activity
if self.parent_id.nil? #只有发博文才插入动态

View File

@ -327,7 +327,7 @@ class CoursesService
end
else
if params[:course_password] == course.password
if params[:role] == "10"
if params[:role] == "10" || params[:role] == nil
members = []
members << Member.new(:role_ids => [10], :user_id => current_user.id)
course.members << members

View File

@ -17,6 +17,9 @@
<div nhname='new_message_<%= reply.id%>'>
<%= form_for @blog_comment, :as => :reply, :url => {:controller => 'blog_comments',:action => 'reply', :id => @blogComment.id}, :html => {:multipart => true, :id => 'new_form'} do |f| %>
<input type="hidden" name="quote[quote]" id="quote_quote">
<% if course_id%>
<input type="hidden" name="course_id" id="" value="<%= course_id%>">
<% end %>
<input type="hidden" name="blog_comment[title]" id="reply_subject">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="blog_comment[content]"></textarea>
<div nhname='toolbar_container_<%= reply.id%>' style="float:left; margin-left: 5px; padding-top:3px;"></div>

View File

@ -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) %>");

View File

@ -0,0 +1,31 @@
<div class="f16 fontBlue fb fl">请选择课程大纲</div>
<!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose"></a></div>-->
<div class="fl">
<form class="blogSearchBox">
<input type="text" name="course_outline_search" id="course_outline_search" placeholder="请输入大纲名称搜索" class="blogSearchContent" />
<!--<a href="javascript:void(0);" class="searchIconPopup"></a>-->
<!--<input class="searchIconPopup" name="commit" onfocus="this.blur();" style="border-style:none" type="submit" value="">-->
</form>
</div>
<span class="f12 c_red fl mb8" id="course_outline_hint" style="display: none">未搜索到对应大纲,请重新输入</span>
<%= form_tag(url_for(:controller=>'courses',:action=>'set_course_outline',:id=>course.id),:method=>'post',:remote=>'true') do %>
<div class="blogBlock fl" id="course_outline_list" >
<% unless articles.blank? %>
<% articles.each do |article|%>
<ul class="blogRow">
<li class="fl">
<input name="outline_id" type="radio" value="<%= article.id%>" class="courseSendCheckbox"/>
</li>
<li class="blogTitle fl"><%= article.title%></li>
</ul>
<div class="homeworkPublishTime">发布时间:<%= format_date(article.created_at)%></div>
<% end %>
<% end %>
</div>
<div>
<div class="courseSendSubmit"><a href="javascript:void(0);" class="sendSourceText" onclick="$(this).parent().parent().submit();">确定</a></div>
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText" onclick="hideModal();">取消</a></div>
</div>
<div class="cl"></div>
<% end %>

View File

@ -23,4 +23,6 @@
<% else %>
alert("未知错误,请稍后再试");
<% end %>
<% else %>
location.reload();
<% end %>

View File

@ -0,0 +1,9 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'course_outlines_list',:locals => {:articles=>@blog_articles,:course=>@course}) %>');
showModal('ajax-modal', '300px');
//$('#ajax-modal').css('height','250px');
$('#ajax-modal').css('padding-top','0px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before(' <a href="javascript:void(0);" onclick="hideModal()" class="resourceClose" style="margin-left: 285px"></a>');
$('#ajax-modal').parent().css("top","30%").css("left","50%");
$('#ajax-modal').parent().addClass("courseOutlinePopup");
$('#ajax-modal').css("padding-left","16px")//.css("padding-bottom","16px");

View File

@ -4,7 +4,7 @@ $("#join_in_course_header").html("<%= escape_javascript(join_in_course_header(@c
<% if @state %>
<% if @state == 0 %>
alert("加入成功");
hidden_join_course_form();
hideModal();
$("#try_join_course_link").replaceWith("<a href='<%=url_for(:controller => 'homework_common', :action => 'index',:course=>@course.id, :host=>Setting.host_course)%>' target='_blank' class='blue_n_btn fr mt20'>提交作品</a>");
window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
<% elsif @state == 1 %>

View File

@ -0,0 +1,5 @@
hideModal();
<%if @course.tea_id == User.current.id && @course.outline == 0 %>
<% else %>
$("#course_outline_bar").html('<a href="<%=show_course_outline_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>')
<%end %>

View File

@ -0,0 +1,160 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor",'blog' %>
<script type="text/javascript">
$(function(){
$("#RSide").removeAttr("id");
$("#Container").css("width","1000px");
});
</script>
<script>
function expand_reply(container,btnid){
var target = $(container).children();
var btn = $(btnid);
if(btn.data('init')=='0'){
btn.data('init',1);
btn.html('收起回复');
target.show();
}else{
btn.data('init',0);
btn.html('展开更多');
target.hide();
target.eq(0).show();
target.eq(1).show();
target.eq(2).show();
}
}
$(function() {
init_activity_KindEditor_data(<%= @article.id%>,null,"85%");
showNormalImage('message_description_<%= @article.id %>');
});
</script>
<div class="postRightContainer ml10" onmouseover="$('#message_setting_<%= @article.id%>').show();" onmouseout="$('#message_setting_<%= @article.id%>').hide();">
<div class="postThemeContainer">
<div class="postDetailPortrait">
<%= link_to image_tag(url_to_avatar(@article.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@article.author) %>
</div>
<div class="postThemeWrap">
<% if @article.author.id == User.current.id%>
<!--<div class="homepagePostSetting" id="message_setting_<%#= @article.id%>" >-->
<!--<ul>-->
<!--<li class="syllabusSettingIcon" >-->
<!--</li>-->
<!--</ul>-->
<!--</div>-->
<a class="syllabusSettingIcon fr" style="width: 100px" onclick="course_outline('<%= @course.id%>')" ><span class="f14 fontGrey2" style="padding-left: 20px">[设置大纲]</span>
</a>
<%end%>
<div class="postDetailTitle fl" style="width: 550px !important;">
<a href="javascript:void(0);" class="f14 linkGrey4 fb" style="overflow:hidden;">主题: <%= @article.title%></a>
</div>
<div class="cl"></div>
<div class="postDetailCreater">
<% 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 %>
</div>
<div class="postDetailDate mb5"><%= format_time( @article.created_on)%></div>
<div class="cl"></div>
<div class="memo-content upload_img break_word" id="message_description_<%= @article.id %>" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" >
<%= @article.content.html_safe%>
</div>
<div class="cl"></div>
<div class=" fl" style="width: 600px">
<%#= 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 %>
</div>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
<% count=0 %>
<% if @article.parent %>
<% count=@article.parent.children.count%>
<% else %>
<% count=@article.children.count%>
<% end %>
<div class="homepagePostReply">
<% unless count == 0 %>
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复(<%=count %></div>
<div class="homepagePostReplyBannerTime"></div>
<!-- <div class="homepagePostReplyBannerMore">
<%# if @reply_count > 2%>
<a href="javascript:void(0);" class="replyGrey" id="reply_btn_<%#= @topic.id%>" onclick="expand_reply('#reply_div_<%#= @topic.id %>','#reply_btn_<%#= @topic.id%>')" data-count="<%#= @reply_count %>" data-init="0" >点击展开更多回复</a>
<%# end %>
</div>-->
</div>
<div class="" id="reply_div_<%= @article.id %>">
<%@article.children.reorder('created_on desc').each_with_index do |reply,i| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_message_description_<%= reply.id %>');
});
</script>
<div class="homepagePostReplyContainer" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id%>').hide();">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher">
<% 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 %>
</div>
<div class="homepagePostReplyContent upload_img break_word" id="reply_message_description_<%= reply.id %>">
<%= reply.content.html_safe%>
</div>
<div style="margin-top: -7px; margin-bottom: 5px">
<%= format_time(reply.created_on) %>
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
<%= link_to(
l(:button_reply),
{:controller => 'blog_comments',:action => 'quote',:user_id=>reply.author_id,:blog_id=>reply.blog_id, :id => reply.id,:course_id=>@course.id},
:remote => true,
:method => 'get',
:class => 'fr newsBlue',
:title => l(:button_reply)) if !@article.locked? && User.current.logged? %>
<%= link_to(
l(:button_delete),
{:controller => 'blog_comments',:action => 'destroy',:user_id=>reply.author_id,:blog_id=>reply.blog_id, :id => reply.id,:course_id=>@course.id},
:method => :delete,
:class => 'fr newsGrey mr10',
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if reply.author.id == User.current.id %>
</div>
</div>
<p id="reply_message_<%= reply.id%>"></p>
</div>
<div class="cl"></div>
</div>
<% end %>
</div>
<% end %>
<div class="cl"></div>
<% if !@article.locked? && User.current.logged?%>
<div class="talkWrapMsg" nhname="about_talk_reply">
<em class="talkWrapArrow"></em>
<div class="cl"></div>
<div class="talkConIpt ml5 mb10" id="reply<%= @article.id %>">
<%= 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| %>
<input type="hidden" name="course_id" value="<%= @course.id%>">
<%= 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 %>
<div class="cl"></div>
</div>
</div>
<% end %>
</div>
</div>

View File

@ -54,17 +54,47 @@
</div>
<div class="cl"></div>
<div>
<a class="pr_info_name c_dark fb break_word fl" href="http://<%= Setting.host_course%>/courses/<%= @course.id%>" target="_blank">
<%= @course.name %>
</a>
<% if @course.is_public == 0%>
<!--<div >-->
<!--<a class="pr_info_name fl c_dark fb break_word" href="http://<%#= Setting.host_course%>/courses/<%#= @course.id%>" target="_blank">-->
<!--<%#= @course.name %>-->
<!--</a>-->
<!--<%# if @course.is_public == 0%>-->
<!--<span class="img_private ">-->
<!--<%#= l(:field_is_private)%>-->
<!--</span>-->
<!--<%# end %>-->
<!--<%#if @course.tea_id == User.current.id && @course.outline == 0 %>-->
<!--<span>-->
<!--<a href="javascript:void(0)" onclick="course_outline('<%#= @course.id%>');">设置大纲</a>-->
<!--</span>-->
<!--<%# else%>-->
<!--<span>-->
<!--<a href="javascript:void(0)" onclick="course_outline('<%#= @course.id%>');">设置大纲</a>-->
<!--</span>-->
<!--<%# end %>-->
<!--</div>-->
<div >
<a class="pr_info_name fl c_dark fb break_word" href="http://<%= Setting.host_course%>/courses/<%= @course.id%>" target="_blank"></a>
<div>
<a class="pr_info_name c_dark fb break_word fl" href="http://<%= Setting.host_course%>/courses/<%= @course.id%>" target="_blank">
<%= @course.name %>
</a>
<% if @course.is_public == 0%>
<!--<span class="img_private "></span>-->
<span class="img_private mr5 fl">
<%= l(:field_is_private)%>
</span>
<% end %>
<a href="javascript:void(0);" title="课程大纲" class="mr5 syllabusIcon fl"> </a><a href="javascript:void(0);" title="课程大纲" class="mr5 syllabusSetting fl"> </a>
</div>
<% end %>
<span id="course_outline_bar">
<%if @course.tea_id == User.current.id && (@course.outline == 0 || BlogComment.where(:id=>@course.outline).count == 0) %>
<a href="javascript:void(0);" title="设置课程大纲" onclick="course_outline('<%= @course.id%>')" class="mr5 syllabusSetting fl"> </a>
<% elsif @course.tea_id == User.current.id && @course.outline != 0 && BlogComment.where(:id=>@course.outline).count != 0%>
<a href="<%=show_course_outline_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
<% elsif @course.tea_id != User.current.id %>
<%end %>
</span>
</div>
</div>
<div class="cl"></div>
<div class="pr_info_foot ">
<%= l(:label_account_identity_teacher)%><%= course_teacher_link teacher_num %>
@ -167,5 +197,50 @@
<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_hint").show();
}
}
})
}
})
</script>
</html>

View File

@ -18,13 +18,6 @@
<script type="text/javascript">
function clickCanel(){hideModal("#popbox02");}
function clickSure()
{
if ($('#new_join_course').submit())
{
hideModal("#popbox02");
}
}
</script>
</head>
@ -40,7 +33,7 @@
<label>请输入课程密码:</label>
<%= text_field_tag 'course_password', nil, :style=>'width:300px;'%>
<div class="ni_btn">
<a href="javascript:" class="tijiao" onclick="clickSure();" >
<a href="javascript:" class="tijiao" onclick="$('#new_join_course').submit();" >
确&nbsp;&nbsp;定
</a>
<a href="javascript:" class="tijiao" onclick="clickCanel();">

View File

@ -426,10 +426,16 @@
</p>
<p>课程名称:<%= ma.course_message.name %></p>
<p>开课学期:<%= ma.course_message.time.to_s + '年' + ma.course_message.term %></p>
<div class="fl">课程描述:</div>
<div class="ml60"><%= ma.course_message.description.html_safe %></div>
<p>学时总数:<%= ma.course_message.class_period%></p>
<p>课程ID<span style="color:red;"><%= ma.course_message.id %></span></p>
<p>课程密码:<span style="color:red;"><%= ma.course_message.password %></span></p>
<p>学时总数:<%= ma.course_message.class_period %></p>
<p>创建时间:<%= format_time(ma.course_message.created_at) %></p>
<p>您可以点击左上角的“配置”按钮修改课程基本信息添加及删除课程成员。您也可以把课程ID及密码告诉学生和其他成员让他们输入ID及密码加入课程。</p>
<% if ma.course_message.is_public %>
<p>您的课程是公开的,所有人都能访问您的课程。若不想设置为公开,您可以在配置中设置。</p>
<% else %>
<p>您的课程是私有的,非课程成员不能访问您的课程。如果想设置为公开,您可以在配置中设置。</p>
<% end %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
@ -505,7 +511,7 @@
<% end %>
<!--被老师拉入课程-->
<% if ma.course_message_type == "JoinCourse" %>
<% if ma.course_message_type == "JoinCourse" and ma.status == 0 %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id) %></a>
@ -521,8 +527,44 @@
</li>
<div style="display: none" class="message_title_red system_message_style">
<% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %>
<p>课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)</p>
<p>课程描述:<%= ma.course.description.blank? ? '无':ma.course.description %></p>
<% teacher = User.find(ma.course_message_id) %>
<p><%= teacher.show_name %>(<%= teacher %>)老师把您加入了课程,详情如下:</p>
<p>课程名称:<%= ma.course.name %></p>
<p>开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %></p>
<p>课程ID<%= ma.course.id %></p>
<p>课时总数:<%= ma.course.class_period %></p>
<% else %>
<p>
您已经被移出该私有课程,非课程成员没有权限访问私有课程
</p>
<% end %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<!--被老师拉入课程-->
<% if ma.course_message_type == "JoinCourse" and ma.status == 1 %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"></a>
</li>
<li class="homepageNewsPubType fl">
<span class="newsBlue homepageNewsPublisher">系统提示</span>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">您增加了新的课程成员:</span>
</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to User.find(ma.course_message_id), user_path(ma.course_message_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:onmouseover => "message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %></a>
</li>
<div style="display: none" class="message_title_red system_message_style">
<% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %>
<p>您增加了新的课程成员,详情如下:</p>
<p>成员:<%= User.find(ma.course_message_id) %></p>
<p>课程名称:<%= ma.course.name %></p>
<p>开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %></p>
<p>课程ID<%= ma.course.id %></p>
<p>课时总数:<%= ma.course.class_period %></p>
<% else %>
<p>
@ -551,8 +593,12 @@
</li>
<div style="display: none" class="message_title_red system_message_style">
<% if ma.course.is_public? || User.current.member_of?(ma.course) || User.current.admin? %>
<p>课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)</p>
<p>课程描述:<%= ma.course.description.blank? ? '无' : ma.course.description %></p>
<p>您已被<%= User.find(ma.course_message_id).show_name %>老师移出了课程,详情如下:</p>
<p>课程名称:<%= ma.course.name %></p>
<p>开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %></p>
<% if !ma.content.nil? %>
<p>担任角色:<%= ma.content %></p>
<% end %>
<p>学时总数:<%= ma.course.class_period %></p>
<% else %>
<p>

View File

@ -36,7 +36,7 @@
:onmouseout => "message_titile_hide($(this))" %></a>
</li>
<div style="display: none" class="message_title_red system_message_style">
<% if ma.project.is_public? || User.current.member_of?(ma.project) %>
<% if ma.project.is_public? || User.current.member_of?(ma.project) || User.current.admin? %>
<p>
项目名称:<%= ma.project.name %>
</p>
@ -69,7 +69,7 @@
:onmouseout => "message_titile_hide($(this))" %></a>
</li>
<div style="display: none" class="message_title_red system_message_style">
<% if ma.project.is_public? || User.current.member_of?(ma.project) %>
<% if ma.project.is_public? || User.current.member_of?(ma.project) || User.current.admin? %>
<p>
项目名称:<%= ma.project.name %>
</p>

View File

@ -789,6 +789,10 @@ RedmineApp::Application.routes.draw do
delete 'join_in/join_group', :to => 'courses#unjoin_group'
get 'copy_course'
match 'course_activity', :to => 'courses#course_activity', :via => :get, :as => "course_activity"
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]

View File

@ -0,0 +1,5 @@
class AddColumnOutlineToCourse < ActiveRecord::Migration
def change
add_column :courses,:outline,:integer,:default => 0
end
end

File diff suppressed because it is too large Load Diff

View File

@ -1222,4 +1222,16 @@ var autoTextarea2 = function (elem,elem2, extra, maxHeight) {
addEvent(elem2, 'input', change);
addEvent(elem2, 'focus', change);
change();
};
};
//课程大纲选择请求
function course_outline(id){
$.get(
' /courses/'+id+'/course_outline'
)
}
//$(function(){
// $('#course_outline_search').on('input',function(){
// alert('<%= @course.id%>')
// })
//})

View File

@ -1090,7 +1090,21 @@ a.postRouteLink:hover {text-decoration:underline;}
.ReplyToMessageContainer {border-bottom:1px solid #e3e3e3; width:632px; margin:0px auto; margin-top:15px; min-height:60px;}
.ReplyToMessageInputContainer {width:582px; 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;}
/*课程大纲弹框*/
.courseOutlinePopup {width:400px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-200px; z-index:1000;}
.searchIconPopup{width:31px; height:25px; background-color:#ffffff; background:url(../images/homepage_icon.png) 5px -394px no-repeat; display:inline-block; float:left; cursor: pointer;}
.searchIconPopup:hover {background:url(../images/homepage_icon.png) 5px -420px no-repeat;}
.blogTitle {max-width:240px; font-size:12px; color:#484848; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.blogBlock {overflow-x:hidden; max-height:200px;min-height: 200px; overflow-y:auto; margin-bottom:5px;}
.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;}