From fc921d37b0a029922ac1c26adfeb7a190e9e969a Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 27 Jun 2019 16:07:56 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 22 +++++++++---------- app/views/shixuns/_settings_edit.html.erb | 26 +++++++++++------------ 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index f0a9bc48..c0290b72 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -1060,6 +1060,7 @@ class ShixunsController < ApplicationController mirror_ids = (@shixun.shixun_mirror_repositories.blank? ? [] : @shixun.shixun_mirror_repositories.map(&:id)) update_miiror_id = [] @shixun.shixun_mirror_repositories.destroy_all + if params[:main_type].present? update_miiror_id << params[:main_type].to_i ShixunMirrorRepository.create(:shixun_id => @shixun.id, :mirror_repository_id => params[:main_type]) @@ -1071,21 +1072,18 @@ class ShixunsController < ApplicationController ShixunMirrorRepository.create(:shixun_id => @shixun.id, :mirror_repository_id => mirror) end end - # 超级管理员才能保存 中间层服务器pod信息的配置 - if User.current.admin? || User.current.business? - @shixun.shixun_service_configs.each_with_index do |config, index| - config.update_attributes(:cpu_limit => params[:cpu_limit][index], - :lower_cpu_limit => params[:lower_cpu_limit][index], - :memory_limit => params[:memory_limit][index], - # :resource_limit => params[:resource_limit][index], - :request_limit => params[:request_limit][index], - :mirror_repository_id => params[:mirror_id][index]) - end + @shixun.shixun_service_configs.destroy_all + params[:mirror_id].each_with_index do |mirror_id, index| + ShixunServiceConfig.create!(:shixun_id => @shixun.id, + :cpu_limit => params[:cpu_limit][index], + :lower_cpu_limit => params[:lower_cpu_limit][index], + :memory_limit => params[:memory_limit][index], + # :resource_limit => params[:resource_limit][index], + :request_limit => params[:request_limit][index], + :mirror_repository_id => mirror_id) end - - ActiveRecord::Base.transaction do begin @shixun.save! diff --git a/app/views/shixuns/_settings_edit.html.erb b/app/views/shixuns/_settings_edit.html.erb index 21ffacfb..b57bae4f 100644 --- a/app/views/shixuns/_settings_edit.html.erb +++ b/app/views/shixuns/_settings_edit.html.erb @@ -33,19 +33,19 @@ -
-

简介

-
-
-
- -
-

-

-
-
 
-
-
+ + + + + + + + + + + + +
From 2f5f6d113a26cbad0d2261d8539bc4517e37462a Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 27 Jun 2019 16:08:21 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/shixuns/_settings_edit.html.erb | 26 +++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/app/views/shixuns/_settings_edit.html.erb b/app/views/shixuns/_settings_edit.html.erb index b57bae4f..21ffacfb 100644 --- a/app/views/shixuns/_settings_edit.html.erb +++ b/app/views/shixuns/_settings_edit.html.erb @@ -33,19 +33,19 @@
- - - - - - - - - - - - - +
+

简介

+
+
+
+ +
+

+

+
+
 
+
+
From 39141fc803783c513c5d7286d6a597c6720a6c4d Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 27 Jun 2019 16:14:52 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=9C=AA=E7=99=BB=E5=BD=95=E6=97=B6?= =?UTF-8?q?=E6=B5=8F=E8=A7=88=E5=99=A8title=E6=98=BE=E7=A4=BA=E6=9B=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2bfc127d..5e86be7e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3079,7 +3079,7 @@ module ApplicationHelper elsif @syllabus title << (@syllabus.title.nil? ? "课堂" : @syllabus.title) else - title << (User.current.id == 2 ? "未登录" : User.current.show_name) + title << (User.current.id == 2 ? "Educoder实践教学" : User.current.show_name) end # if first_page.nil? || first_page.web_title.nil? # title << Setting.app_title unless Setting.app_title == title.last From 3c6848085f3ff92a3848f5ab1b4b1df12d2f8de7 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 27 Jun 2019 16:21:29 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5e86be7e..18473fbf 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3079,7 +3079,7 @@ module ApplicationHelper elsif @syllabus title << (@syllabus.title.nil? ? "课堂" : @syllabus.title) else - title << (User.current.id == 2 ? "Educoder实践教学" : User.current.show_name) + title << (User.current.anonymous? ? "Educoder实践教学" : User.current.show_name) end # if first_page.nil? || first_page.web_title.nil? # title << Setting.app_title unless Setting.app_title == title.last