From cde511e613ad766d1b6b06747169b5988363d31e Mon Sep 17 00:00:00 2001 From: miss <994230062@qq.com> Date: Sat, 30 Sep 2017 16:10:55 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=9A=84=E5=88=B7=E6=96=B0=E6=95=88=E6=9E=9C=E7=9A=84=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/games/_game_show.html.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/games/_game_show.html.erb b/app/views/games/_game_show.html.erb index ff1cc5a9d..26eddcaaf 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); } } From 5032b368f52da7682d8e8d47ddffea2e42f4307c Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 30 Sep 2017 16:33:59 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=81=E7=A7=BB?= =?UTF-8?q?=E5=8F=8A=E5=8F=91=E5=B8=83=E5=AE=9E=E8=AE=AD=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=E4=B8=8D=E5=90=8C=E6=AD=A5gitlab=E8=A7=92=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/games_controller.rb | 6 +++--- app/controllers/managements_controller.rb | 16 ++++++++-------- ...20170930081820_add_educoder_to_myshixun.rb | 12 ++++++++++++ .../20170930082930_modified_role_to_shixun.rb | 19 +++++++++++++++++++ 4 files changed, 42 insertions(+), 11 deletions(-) create mode 100644 db/migrate/20170930081820_add_educoder_to_myshixun.rb create mode 100644 db/migrate/20170930082930_modified_role_to_shixun.rb 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 29e087a28..3c03bd0de 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/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 From 90ade97d88dc029890dd876fbf9b5d911ec4574d Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 30 Sep 2017 16:38:38 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=BC=80=E5=90=AF=E6=8C=91=E6=88=98?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=E5=B0=86educoder=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E5=88=B0myshixun=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index b3d4cc084..c17c51ccb 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -417,6 +417,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) From cbf70d83cb2fb381123fb80f816ddbf9e3c8f75b Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 30 Sep 2017 16:43:12 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=85=81=E8=AE=B8=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E6=88=90=E5=91=98=E7=BC=96=E8=BE=91=E5=AE=9E=E8=AE=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/_link_to_functions.html.erb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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 %> From ddbad8ea773ef9cc075085066db8123a2906518a Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 30 Sep 2017 16:47:01 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/games/_game_show.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/games/_game_show.html.erb b/app/views/games/_game_show.html.erb index 26eddcaaf..9436b6fc2 100644 --- a/app/views/games/_game_show.html.erb +++ b/app/views/games/_game_show.html.erb @@ -103,7 +103,7 @@
- <%# if @tpm_modified %> + <% if @tpm_modified %>
@@ -127,7 +127,7 @@
- <%# end %> + <% end %>