Conflicts:
	db/schema.rb
This commit is contained in:
cxt 2015-10-30 13:59:33 +08:00
commit f5aaf7ac58
30 changed files with 2339 additions and 104 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

@ -56,14 +56,30 @@ class BlogCommentsController < ApplicationController
end
def destroy
@article = BlogComment.find(params[:id])
if @article.parent_id.nil? #如果是文章被删,那么跳转到用户博客界面
@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)
if @article.parent_id.nil? #如果是文章被删那么跳转到用户博客界面如果带了course_id过来那么就要跳转到课程首页
if params[:course_id]
@article.children.delete
@article.delete
@course = Course.find(params[:course_id])
@course.outline = 0
@course.save
redirect_to course_path(:id=>params[:course_id])
else
@article.children.delete
@article.delete
redirect_to user_blogs_path(:user_id=>User.current)
end
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 +97,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 +131,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,41 @@ class CoursesController < ApplicationController
end
end
#从课程创建的老师那里选择课程大纲
def course_outline
@teacher = User.find(@course.tea_id)
@blog_articles = @teacher.blog.articles
@is_in_show_outline_page = params[:is_in_show_outline_page]
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
@is_in_show_outline_page = params[:is_in_show_outline_page]
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

@ -252,9 +252,12 @@ update
else
#Modified by young
# (show_error_not_found; return) unless @entries
@changesets = @repository.latest_changesets(@path, @rev)
@changesets_count = @repository.latest_changesets(@path, @rev).count
@changesets_latest_coimmit = @changesets.first
g = Gitlab.client
@changesets = g.get ("/projects/#{@project.gpid}/repository/commits")
# @changesets = @repository.latest_changesets(@path, @rev)
# @changesets_count = @repository.latest_changesets(@path, @rev).count
@changesets_count = @changesets.count
@changesets_latest_coimmit = @changesets[0]
@properties = @repository.properties(@path, @rev)
@repositories = @project.repositories
@course_tag = params[:course]
@ -280,7 +283,9 @@ update
def changes
@entry = @repository.entry(@path, @rev)
(show_error_not_found; return) unless @entry
@changesets = @repository.latest_changesets(@path, @rev, Setting.repository_log_display_limit.to_i)
g = Gitlab.client
@changesets = g.get ("/projects/#{@project.gpid}/repository/commits?#{@rev}")
#@changesets = @repository.latest_changesets(@path, @rev, Setting.repository_log_display_limit.to_i)
@properties = @repository.properties(@path, @rev)
@changeset = @repository.find_changeset_by_name(@rev)
render :layout => 'base_projects'

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,10 +17,13 @@
<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>
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= reply.id%>'></p>
<% end%>

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,32 @@
<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 %>
<input name="is_in_show_outline_page" value="<%= show_page %>" type="hidden" />
<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="if($('input[name=outline_id]:radio:checked').length != 0 ) { $(this).parent().parent().submit(); }else{ return false;}">确定</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,:show_page=>@is_in_show_outline_page}) %>');
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,8 @@
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 %>
<%if @is_in_show_outline_page && @is_in_show_outline_page == 'Y'%>
window.location.href='<%=show_course_outline_course_path(@course) %>';
<% end %>

View File

@ -0,0 +1,212 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor",'blog' %>
<style type="text/css">
/*回复框*/
div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
div.ke-toolbar .ke-outline{border:none;}
.ke-inline-block{display: none;}
div.ke-container{float:left;}
</style>
<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,"87%");
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 User.current && @article.author.id == User.current.id%>
<div class="homepagePostSetting" id="message_setting_<%= @article.id%>" style="display: none">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<a class="postOptionLink " onclick="course_outline('<%= @course.id%>','Y')" >重设大纲</a>
</li>
<li>
<%= link_to(
'删除大纲',
{:controller => 'blog_comments',:action => 'destroy',:user_id=>BlogComment.find(@course.outline).author_id,:blog_id=>BlogComment.find(@course.outline).blog_id, :id => @course.outline,:course_id=>@course.id},
:method => :delete,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
) if User.current && User.current.id == @article.author.id %>
</li>
</ul>
</li>
</ul>
</div>
<!--<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>-->
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= @article.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@article.author_id), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer" style="margin-top: 8px">
<div nhname='new_message_<%= @article.id%>' style="display:none;">
<%= form_for 'blog_comment',:url => {:action => 'reply',:controller => 'blog_comments',:user_id=>@article.author.id,:blog_id=>@article.blog_id, :id => @article.id},:method => "post",:html => {:multipart => true, :id => 'message_form'} do |f|%>
<input type="hidden" name="course_id" value="<%= @course.id%>"
<input type="hidden" name="blog_comment[title]" value="RE:<%= @article.title%>">
<input type="hidden" name="blog_comment[sticky]" value="0">
<input type="hidden" name="quote[quote]" value="">
<input type="hidden" name="blog_comment[locked]" value="0">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @article.id%>' name="blog_comment[content]"></textarea>
<div nhname='toolbar_container_<%= @article.id%>' style="float:left; margin-left: 5px;"></div>
<a id="new_message_submit_btn_<%= @article.id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= @article.id%>'></p>
<% end%>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
<% end %>
</div>
</div>

View File

@ -54,17 +54,51 @@
</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 User.current && @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 User.current && @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 User.current && @course.tea_id != User.current.id && !@course.is_public? && User.current.member_of_course?(@course)%>
<a href="<%=show_course_outline_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
<% elsif User.current && @course.tea_id != User.current.id && @course.is_public?%>
<a href="<%=show_course_outline_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
<%else%>
<%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 +201,51 @@
<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();
}
}
})
}
})
</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

@ -1,53 +1,35 @@
<% show_revision_graph = ( @repository.supports_revision_graph? && path.blank? ) %>
<%= if show_revision_graph && revisions && revisions.any?
indexed_commits, graph_space = index_commits(revisions, @repository.branches) do |scmid|
url_for(
:controller => 'repositories',
:action => 'revision',
:id => project,
:repository_id => @repository.identifier_param,
:rev => scmid)
end
render :partial => 'revision_graph',
:locals => {
:commits => indexed_commits,
:space => graph_space
}
end %>
<%= form_tag(
{:controller => 'repositories', :action => 'diff', :id => project,
:repository_id => @repository.identifier_param, :path => to_path_param(path)},
:method => :get
) do %>
<table class="list changesets">
<thead><tr>
<th>#</th>
<th></th>
<th></th>
<th><%= l(:label_date) %></th>
<th><%= l(:field_author) %></th>
<th><%= l(:field_comments) %></th>
</tr></thead>
<!--<thead><tr>-->
<!--<th>#</th>-->
<!--<th></th>-->
<!--<th></th>-->
<!--<th><%= l(:label_date) %></th>-->
<!--<th><%= l(:field_author) %></th>-->
<!--<th><%= l(:field_comments) %></th>-->
<!--</tr></thead>-->
<tbody>
<% show_diff = revisions.size > 1 %>
<% line_num = 1 %>
<% revisions.each do |changeset| %>
<tr class="changeset <%= cycle 'odd', 'even' %>">
<% id_style = (show_revision_graph ? "padding-left:#{(graph_space + 1) * 20}px" : nil) %>
<%= content_tag(:td, :class => 'id', :style => id_style) do %>
<%= link_to_revision(changeset, @repository) %>
<% end %>
<td class="checkbox"><%= radio_button_tag('rev', changeset.identifier, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('#cbto-#{line_num+1}').attr('checked',true);") if show_diff && (line_num < revisions.size) %></td>
<td class="checkbox"><%= radio_button_tag('rev_to', changeset.identifier, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('#cb-#{line_num}').attr('checked')) {$('#cb-#{line_num-1}').attr('checked',true);}") if show_diff && (line_num > 1) %></td>
<td class="committed_on"><%= format_time(changeset.committed_on) %></td>
<td class="author"><%= h truncate(changeset.author.to_s, :length => 30) %></td>
<td class="comments"><%= textilizable(truncate_at_line_break(changeset.comments)) %></td>
<td class="id"><%= h truncate(changeset.id.to_s, :length => 20) %></td>
<!--<td class="checkbox"><%#= radio_button_tag('rev_to', changeset.id, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('#cb-#{line_num}').attr('checked')) {$('#cb-#{line_num-1}').attr('checked',true);}") if show_diff && (line_num > 1) %></td>-->
<td class="committed_on"><%= format_time(changeset.created_at) %></td>
<td class="author"><%= h truncate(changeset.author_name.to_s, :length => 30) %></td>
<td class="comments"><%= textilizable(truncate_at_line_break(changeset.message)) %></td>
</tr>
<% line_num += 1 %>
<% end %>
</tbody>
</table>
<p style="padding-top: 10px;">
<%= submit_tag(l(:label_view_diff), :name => nil, :class=>"c_blue") if show_diff %>
<%#= submit_tag(l(:label_view_diff), :name => nil, :class=>"c_blue") if show_diff %>
</p>
<% end %>

View File

@ -30,10 +30,10 @@
<div class="cl"></div>
<div class="recordBanner mt10">
<% if @changesets && !@changesets.empty? %>
<%= image_tag(url_to_avatar(@changesets_latest_coimmit.user), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %>
<span class="fl"><div class="fb fontGrey3 mr5 fl"><%=link_to @changesets_latest_coimmit.user, user_path(@changesets_latest_coimmit.user) %></div>
<div class="fl">提交于<%= time_tag(@changesets_latest_coimmit.committed_on) %></div>
<div class="commit_content_dec fl" title="<%= @changesets_latest_coimmit.comments %>"><%= @changesets_latest_coimmit.comments %></div>
<%= image_tag(url_to_avatar(@changesets_latest_coimmit.author_name), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %>
<span class="fl"><div class="fb fontGrey3 mr5 fl"><%=link_to @changesets_latest_coimmit.author_name, user_path(@changesets_latest_coimmit.author_name) %></div>
<div class="fl">提交于<%= time_tag(@changesets_latest_coimmit.created_at) %></div>
<div class="commit_content_dec fl" title="<%= @changesets_latest_coimmit.comments %>"><%= @changesets_latest_coimmit.message %></div>
</span>
<% end %>
<span class="fr mr5 "><font class="fb ml2 mr2 vl_branch mt2">
@ -59,15 +59,7 @@
<!-- 代码修订 -->
<%= render_properties(@properties) %>
<% if authorize_for('repositories', 'revisions') %>
<% if @changesets && !@changesets.empty? %>
<% has_branches = (!@repository.branches.nil? && @repository.branches.length > 0)
sep = '' %>
<% if @repository.supports_all_revisions? && @path.blank? %>
<%= link_to l(:label_view_all_revisions_commits), :action => 'revisions', :id => @project, :repository_id => @repository.identifier_param %>
<% end %> |
<% end %>
<% end %>
<a href="https://<%=Setting.host_name %>/forums/1/memos/1232" >如何提交代码</a>
<% content_for :header_tags do %>

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

@ -375,7 +375,7 @@ zh:
#
label_project_new_description: '项目可以是软件开发项目,也可以是协作研究项目。'
field_name: 名称
field_identifier: 标识
field_identifier: 版本库名
field_enterprise_name: 组织名称
label_organization_choose: --请选择组织--
text_length_between: "长度必须在 %{min} 到 %{max} 个字符之间。"

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

@ -7,7 +7,7 @@ namespace :gitlab do
# User.where(username: 'root').find_each do |user|
s = Trustie::Gitlab::Sync.new
User.find_each do |user|
s.sync_user(user)
s.sync_user(user)
end
end

View File

@ -22,7 +22,10 @@ module Trustie
def sync_user(user)
u = add_user(user)
user.save! if u
if (!("day,none,all".include? user.mail_notification) or user.mail_notification.blank?)
user.mail_notification = "day"
end
user.save!
end
def sync_project(project, opt={})

View File

@ -1246,4 +1246,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'+"?is_in_show_outline_page="+(arguments[1] ? arguments[1] : 'N')
)
}
//$(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: 20px; overflow-y:auto; margin-bottom:5px;width: 246px}
.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;}