diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index 438c6f8ee..dee8d5bf5 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -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) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index ca8c7f1a3..aa2857ae1 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -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 diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 779669ce1..921bdf161 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -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) diff --git a/app/views/games/_game_show.html.erb b/app/views/games/_game_show.html.erb index 18e5eded5..9436b6fc2 100644 --- a/app/views/games/_game_show.html.erb +++ b/app/views/games/_game_show.html.erb @@ -217,6 +217,7 @@ success: function(data){ alert(data.status); if(data.status == 200){ + $('#ajax-indicator-base').html("").hide(); $('#'+target).html(data); } } diff --git a/app/views/repositories/_link_to_functions.html.erb b/app/views/repositories/_link_to_functions.html.erb index 96fd56e5c..8e92cb14f 100644 --- a/app/views/repositories/_link_to_functions.html.erb +++ b/app/views/repositories/_link_to_functions.html.erb @@ -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" %> - 保存 - <% 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" %> + 保存 + <% 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 %> diff --git a/db/migrate/20170930081820_add_educoder_to_myshixun.rb b/db/migrate/20170930081820_add_educoder_to_myshixun.rb new file mode 100644 index 000000000..5da60315e --- /dev/null +++ b/db/migrate/20170930081820_add_educoder_to_myshixun.rb @@ -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 diff --git a/db/migrate/20170930082930_modified_role_to_shixun.rb b/db/migrate/20170930082930_modified_role_to_shixun.rb new file mode 100644 index 000000000..6f3ee61e1 --- /dev/null +++ b/db/migrate/20170930082930_modified_role_to_shixun.rb @@ -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