FIX 调整云上实验配置

This commit is contained in:
Jasder 2020-08-07 14:34:26 +08:00
parent 25a3c8a372
commit ee8cbb8553
6 changed files with 9 additions and 26 deletions

View File

@ -1,6 +1,4 @@
class SettingsController < ApplicationController class SettingsController < ApplicationController
def show def show
@old_projects_url = nil
@old_projects_url = "https://www.trustie.net/users/#{current_user.try(:login)}/projects" if User.current.logged?
end end
end end

View File

@ -22,9 +22,10 @@ class Laboratory < ApplicationRecord
delegate :name, :navbar, :footer, :login_logo_url, :nav_logo_url, :tab_logo_url, :default_navbar, to: :laboratory_setting delegate :name, :navbar, :footer, :login_logo_url, :nav_logo_url, :tab_logo_url, :default_navbar, to: :laboratory_setting
# TODO 域名申请后更改
def site def site
rails_env = EduSetting.get('rails_env') rails_env = EduSetting.get('rails_env')
suffix = rails_env && rails_env != 'production' ? ".#{rails_env}.trustie.net" : '.trustie.net' suffix = rails_env && rails_env != 'production' ? "39.105.176.215" : '39.105.176.215'
identifier ? "#{identifier}#{suffix}" : '' identifier ? "#{identifier}#{suffix}" : ''
end end

View File

@ -4,7 +4,7 @@
<div class="box search-form-container laboratory-list-form"> <div class="box search-form-container laboratory-list-form">
<%= form_tag(admins_laboratories_path(unsafe_params), method: :get, class: 'form-inline search-form flex-1', remote: true) do %> <%= form_tag(admins_laboratories_path(unsafe_params), method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-6 col-md-4 ml-3', placeholder: '学校名称/二级域名前缀检索') %> <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-6 col-md-4 ml-3', placeholder: '二级域名前缀检索') %>
<%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %> <%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
<% end %> <% end %>

View File

@ -1,9 +1,9 @@
<% school = laboratory&.school %> <% school = laboratory&.school %>
<td><%= list_index_no((params[:page] || 1).to_i, index) %></td> <td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
<td class="text-left"><%= school&.name || 'Trustie主站' %></td> <td class="text-left"><%= school&.name || '可控开源社区' %></td>
<td class="text-left"> <td class="text-left">
<% if laboratory.identifier %> <% if laboratory.identifier %>
<%= link_to laboratory.site, "https://#{laboratory.site}", target: '_blank' %> <%= link_to laboratory.site, "http://#{laboratory.site}", target: '_blank' %>
<% else %> <% else %>
-- --
<% end %> <% end %>
@ -51,19 +51,5 @@
<% if school.present? && laboratory.id != 1 %> <% if school.present? && laboratory.id != 1 %>
<%= javascript_void_link '添加管理员', class: 'action', data: { laboratory_id: laboratory.id, toggle: 'modal', target: '.admin-add-laboratory-user-modal' } %> <%= javascript_void_link '添加管理员', class: 'action', data: { laboratory_id: laboratory.id, toggle: 'modal', target: '.admin-add-laboratory-user-modal' } %>
<%= link_to '同步用户', synchronize_user_admins_laboratory_path(laboratory), remote: true, data: { confirm: '确认同步该单位下的所有用户到云上实验室吗?' }, class: 'action' %> <%= link_to '同步用户', synchronize_user_admins_laboratory_path(laboratory), remote: true, data: { confirm: '确认同步该单位下的所有用户到云上实验室吗?' }, class: 'action' %>
<% end %> <% end %>
<div class="d-inline">
<%= javascript_void_link('更多', class: 'action dropdown-toggle', 'data-toggle': 'dropdown', 'aria-haspopup': true, 'aria-expanded': false) %>
<div class="dropdown-menu more-action-dropdown">
<%= link_to '轮播图', admins_laboratory_carousels_path(laboratory), class: 'dropdown-item' %>
<%= link_to '查看实训项目', admins_laboratory_laboratory_shixuns_path(laboratory), class: 'dropdown-item' %>
<%= link_to '查看实践课程', admins_laboratory_laboratory_subjects_path(laboratory), class: 'dropdown-item' %>
<% if school.present? && laboratory.id != 1 %>
<%= delete_link '删除', admins_laboratory_path(laboratory, element: ".laboratory-item-#{laboratory.id}"), class: 'dropdown-item delete-laboratory-action' %>
<% end %>
</div>
</div>
</td> </td>

View File

@ -45,7 +45,5 @@ json.setting do
json.main_site current_laboratory.main_site? json.main_site current_laboratory.main_site?
json.new_course default_course_links json.new_course default_course_links
json.old_projects_url @old_projects_url
end end