diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 5f7888365..4a83498e9 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -361,22 +361,23 @@ update @repository.url = @repository.identifier @repository.project_id = -1 ActiveRecord::Base.transaction do - begin if request.post? && @repository.save - s = Trustie::Gitlab::Sync.new - s.create_shixun(@shixun, @repository) - raise "sync failed" if @shixun.gpid.blank? - redirect_to(:controller => 'repositories', :action => 'shixun_show', :shixun_id => @shixun, :identifier => @repository.try(:identifier)) + begin + s = Trustie::Gitlab::Sync.new + gproject = s.create_shixun(@shixun, @repository) + raise "sync failed" if @shixun.gpid.blank? + redirect_to(:controller => 'repositories', :action => 'shixun_show', :shixun_id => @shixun, :identifier => @repository.try(:identifier)) + rescue Exception => e + @shixun.update_attribute(:gpid, nil) + if @repository.id + @repository.destroy + end + end else - redirect_to settings_shixun_url(@shixun, :tab => 'repositories',:repository_error_message => @repository.errors.full_messages) + respond_to do |format| + format.js{flash[:notice] = "版本库创建失败"} + end end - rescue Gitlab::Error::Forbidden => e - @message = l(:label_pull_request_forbidden) - rescue Gitlab::Error::NotFound => e - @message = l(:label_pull_request_notfound) - rescue Exception => e - puts e - end end elsif @project # 判断版本库创建者是否有同名版本库,避免版本库路径一致问题 diff --git a/app/views/shixuns/_settings_repository.html.erb b/app/views/shixuns/_settings_repository.html.erb index f5acca9a4..d63e8240f 100644 --- a/app/views/shixuns/_settings_repository.html.erb +++ b/app/views/shixuns/_settings_repository.html.erb @@ -58,7 +58,7 @@ function project_repository_commit() { - if(regex_repoistory_name()) +// if(regex_repoistory_name()) { $("#new_repository").submit(); } diff --git a/app/views/shixuns/_shixun_top.html.erb b/app/views/shixuns/_shixun_top.html.erb index e33c790a6..d23af7500 100644 --- a/app/views/shixuns/_shixun_top.html.erb +++ b/app/views/shixuns/_shixun_top.html.erb @@ -38,10 +38,6 @@
  • <%= link_to 1 > 0 ? "#{l(:project_module_training_tasks)}#{switch_integer_into_k 99999}".html_safe : "#{l(:project_module_training_tasks)}", shixun_challenges_url(@shixun), :class => "pro_new_proname", :title => "#{99999}" %>
  • - -
  • - <%= link_to 1 > 0 ? "#{l(:project_module_boards)}#{switch_integer_into_k 99999}".html_safe : "#{l(:project_module_boards)}", project_boards_path(@shixun), :class => "pro_new_proname", :title => "#{99999}" %> -
  • <% unless @shixun.repository.nil? %>