Merge branch 'hjq_new_course' of http://repository.trustie.net/xianbo/trustie2 into hjq_new_course

Conflicts:
	app/views/courses/member.html.erb
	app/views/courses/settings.html.erb
	app/views/repositories/show.html.erb
	db/schema.rb

处理冲突
This commit is contained in:
huang 2015-12-08 09:10:21 +08:00
commit 068c305c06
4 changed files with 43 additions and 39 deletions

View File

@ -55,11 +55,11 @@ class CoursesController < ApplicationController
def join
if User.current.logged?
cs = CoursesService.new
@user = User.current
join = cs.join_course params,@user
@state = join[:state]
@course = join[:course]
cs = CoursesService.new
@user = User.current
join = cs.join_course params,@user
@state = join[:state]
@course = join[:course]
# else
# @course = Course.find_by_id params[:object_id]
# CourseMessage.create(:user_id => @course.tea_id, :course_id => @course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest')
@ -70,7 +70,7 @@ class CoursesController < ApplicationController
end
@object_id = params[:object_id]
respond_to do |format|
format.js #{ render :partial => 'set_join', :locals => {:user => @user, :course => @course, :object_id => params[:object_id]} }
format.js #{ render :partial => 'set_join', :locals => {:user => @user, :course => @course, :object_id => params[:object_id]} }
end
end
@ -85,7 +85,7 @@ class CoursesController < ApplicationController
end
end
def join_private_courses
respond_to do |format|
format.js
@ -98,14 +98,14 @@ class CoursesController < ApplicationController
c = cs.edit_course params,@course,User.current
@course = c[:course]
if @course.errors.full_messages.count <= 0
respond_to do |format|
format.html {
# render :layout => 'base_courses'
flash[:notice] = l(:notice_successful_update)
redirect_to settings_course_url(@course)
}
format.api { render_api_ok }
end
respond_to do |format|
format.html {
# render :layout => 'base_courses'
flash[:notice] = l(:notice_successful_update)
redirect_to settings_course_url(@course)
}
format.api { render_api_ok }
end
else
respond_to do |format|
format.html {
@ -134,8 +134,8 @@ class CoursesController < ApplicationController
courses = Course.visible.where("LOWER(name) like '%#{params[:name].to_s.downcase}%'").order("time desc, created_at desc")
@courses = paginateHelper courses,10
end
@name = params[:name]
@type = 'courses'
@name = params[:name]
@type = 'courses'
respond_to do |format|
format.html {
render :layout => 'course_base'
@ -277,7 +277,7 @@ class CoursesController < ApplicationController
def member
## 有角色参数的才是课程,没有的就是项目
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
@render_file = 'new_member_list'
@score_sort_by = "desc"
@canShowCode = User.current.allowed_to?(:as_teacher,@course) && params[:role] != '1'
@ -312,7 +312,7 @@ class CoursesController < ApplicationController
def export_course_member_excel
@all_members = student_homework_score(0,0,0,"desc")
filename="#{@course.teacher.lastname.to_s + @course.teacher.firstname.to_s }_#{@course.name}_#{@course.time.to_s + @course.term}#{l(:excel_member_list)}";
respond_to do |format|
format.xls {
send_data(member_to_xls(@all_members,@course.course_groups), :type => "text/excel;charset=utf-8; header=present",
@ -427,7 +427,7 @@ class CoursesController < ApplicationController
end
def course
@school_id = params[:school_id]
@school_id = params[:school_id]
per_page_option = 10
if @school_id == "0" or @school_id.nil?
@courses_all = Course.active.visible.
@ -515,8 +515,8 @@ class CoursesController < ApplicationController
def index
if !User.current.admin?
render_404
return
render_404
return
end
@course_type = params[:course_type]
@school_id = params[:school_id]
@ -565,7 +565,7 @@ class CoursesController < ApplicationController
respond_to do |format|
format.html {
render :layout => 'base'
render :layout => 'base'
}
format.atom {
courses = Course.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all
@ -684,10 +684,10 @@ class CoursesController < ApplicationController
end
def feedback
@course.journals_for_messages.each do |messages|
query = messages.course_messages.where("user_id = ?", User.current.id)
query.update_all(:viewed => true);
end
@course.journals_for_messages.each do |messages|
query = messages.course_messages.where("user_id = ?", User.current.id)
query.update_all(:viewed => true);
end
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
page = params[:page]
@ -738,20 +738,20 @@ class CoursesController < ApplicationController
#从课程创建的老师那里选择课程大纲
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
@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
@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
#设置或者更改课程的大纲
@ -797,7 +797,7 @@ class CoursesController < ApplicationController
def can_show_course
@first_page = FirstPage.find_by_page_type('project')
if @first_page.try(:show_course) == 2
render_404
render_404
end
end

View File

@ -6,6 +6,7 @@
</span>
<% end %>
</div>
</div>
<% if @subPage_title == l(:label_student_list)%>
<%= render :partial => 'course_student', :locals => {:members => @members} %>
<% else%>

View File

@ -25,12 +25,14 @@
<textarea id="copy_rep_content" class="cloneUrl mt5 fl" type="input" ><%=@repository.type.to_s=="Repository::Gitlab" ? @repos_url.to_s.lstrip : @repository.url %></textarea>
<a href="javascript:void(0);" class="clone_btn mt5" onclick="jsCopy()"><span class="vl_copy" title="点击复制版本库地址"></span></a>
<div class="fl mt5 ml15"><a href="javascript:void(0);" class="vl_btn fb" onclick="zip()"><span class="vl_zip"></span>ZIP</a> </div>
<!--<div class="fr mt5"><a href="javascript:void(0);" class="vl_btn fb" onclick="zip()"><span class="vl_fork"></span>Fork</a> <span href="javascript:void(0);" class="vl_btn_2 fb">0</span> </div>-->
<%# 针对公开项目:用户必须创建了项目,否则用户无法同步 %>
<% if User.current.id != @project.user_id || User.current.projects.count !=0 %> <!--<div class="fr mt5"><a href="javascript:void(0);" class="vl_btn fb" onclick="zip()"><span class="vl_fork"></span>Fork</a> <span href="javascript:void(0);" class="vl_btn_2 fb">0</span> </div>-->
<% unless User.current.id == @project.user_id %>
<div class="fr mt5"><%= link_to "<span class='vl_fork'></span>".html_safe+"Fork", {:controller => 'repositories', :action => 'forked'}, :class=>"vl_btn"%>
<span href="javascript:void(0);" class="vl_btn_2 fb"><%= @project.forked_count.to_i %></span>
</div>
<% end %>
<% end %>
<div class="cl"></div>
<div class="recordBanner mt10">
<% if @changesets && !@changesets.empty? %>

View File

@ -1160,6 +1160,7 @@ ActiveRecord::Schema.define(:version => 20151204062220) do
create_table "org_members", :force => true do |t|
t.integer "user_id"
t.integer "organization_id"
t.string "role"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end