Merge branch 'dev_new_gitlab_huang' into develop

This commit is contained in:
huang 2017-09-30 16:48:40 +08:00
commit 2ee93c73f6
7 changed files with 50 additions and 17 deletions

View File

@ -51,11 +51,11 @@ class GamesController < ApplicationController
git push -f origin master
if [ $? -eq 0 ];then
echo -e 'git push succssed'
cd ../
rm -rf #{myshixun_rep_identifier}/
else
echo -e 'git push failed'
fi"
fi
cd ../
rm -rf #{myshixun_rep_identifier}/"
aFile =File.new(File.join("#{path}","#{@myshixun.identifier}.sh"), "w+")
if aFile
aFile.syswrite(script)

View File

@ -1593,14 +1593,14 @@ end
apply_action.update_attributes(:status => 1, :dealer_id => User.current.id)
shixun_modify_status_without_publish shixun, 1
# 实训发布后则不允许修改代码
g = Gitlab.client
shixun.shixun_members.each do |member|
gid = User.find(member.user_id).try(:gid)
g.edit_team_member(shixun.gpid, gid, 10) # 3代表角色master
end
# 加入超级管理员
admin_gid = User.where(:admin => 1).first.try(:gid)
g.add_team_member(shixun.gpid, admin_gid, 40) # 30代表角色master
# g = Gitlab.client
# shixun.shixun_members.each do |member|
# gid = User.find(member.user_id).try(:gid)
# g.edit_team_member(shixun.gpid, gid, 10) # 3代表角色master
# end
# # 加入超级管理员
# admin_gid = User.where(:admin => 1).first.try(:gid)
# g.add_team_member(shixun.gpid, admin_gid, 40) # 30代表角色master
end
@authorizations = ApplyAction.where(:container_type => "ApplyShixun", :status => 0)
@authorizations_count = @authorizations.count

View File

@ -424,6 +424,9 @@ class ShixunsController < ApplicationController
gshixun = g.fork(@shixun.gpid, User.current.gid)
if !gshixun.try(:id).blank?
myshixun.update_column(:gpid, gshixun.id) if myshixun.try(:gpid).blank?
# educoder 加入到myshixun中
myshixun_admin_gid = User.where(:login => "educoder").first.try(:gid)
g.add_team_member(gshixun.id, myshixun_admin_gid, 40) # 30代表角色master
commit_id = g.commits(@shixun.gpid).first.try(:id)
myshixun.update_column(:commit_id, commit_id)
rep = Repository.create!(:myshixun_id => myshixun.id, :identifier => gshixun.name,:project_id => -1, :shixun_id => -2)

View File

@ -217,6 +217,7 @@
success: function(data){
alert(data.status);
if(data.status == 200){
$('#ajax-indicator-base').html("").hide();
$('#'+target).html(data);
}
}

View File

@ -25,12 +25,10 @@
<%= "(#{number_to_human_size(@entry.size)})" if @entry.size %>
<% end %>
<% else %>
<% if @shixun.try(:status).to_i < 2 %>
<% if params[:controller] == "shixuns" && params[:action] == "entry_edit" %>
<a href="javascript:void(0);" onclick="$('#shixun_entry_update_id').submit();" class = "fl mr5">保存</a>
<% elsif params[:action] == "shixun_entry" || params[:action] == "entry_update" %>
<%= link_to "编辑", entry_edit_shixun_path(@shixun, :path => @path, :rev => @rev), :class => "fl mr5", :remote => true %>
<% end %>
<% if params[:controller] == "shixuns" && params[:action] == "entry_edit" %>
<a href="javascript:void(0);" onclick="$('#shixun_entry_update_id').submit();" class = "fl mr5">保存</a>
<% elsif params[:action] == "shixun_entry" || params[:action] == "entry_update" %>
<%= link_to "编辑", entry_edit_shixun_path(@shixun, :path => @path, :rev => @rev), :class => "fl mr5", :remote => true %>
<% end %>
<% end %>

View File

@ -0,0 +1,12 @@
class AddEducoderToMyshixun < ActiveRecord::Migration
def change
g = Gitlab.client
Myshixun.all.each do |myshixun|
# 加入超级管理员
if myshixun.gpid.present?
gid = User.where(:login => "educoder").first.try(:gid)
g.add_team_member(myshixun.gpid, gid, 40) # 30代表角色master
end
end
end
end

View File

@ -0,0 +1,19 @@
class ModifiedRoleToShixun < ActiveRecord::Migration
def up
begin
g = Gitlab.client
shixuns = Shixun.where(:status => 2)
shixuns.each do |shixun|
shixun.shixun_members.each do |member|
gid = User.find(member.user_id).try(:gid)
g.edit_team_member(shixun.gpid, gid, 40) # 3代表角色master
end
end
rescue Exception => e
puts e.message
end
end
def down
end
end