Browse Source

FIX 调整云上实验配置

pull/278/head
Jasder 5 years ago
parent
commit
ee8cbb8553
6 changed files with 9 additions and 26 deletions
  1. +0
    -2
      app/controllers/settings_controller.rb
  2. +2
    -1
      app/models/laboratory.rb
  3. +2
    -2
      app/views/admins/laboratories/index.html.erb
  4. +3
    -17
      app/views/admins/laboratories/shared/_laboratory_item.html.erb
  5. +1
    -1
      app/views/admins/laboratory_settings/show.html.erb
  6. +1
    -3
      app/views/settings/show.json.jbuilder

+ 0
- 2
app/controllers/settings_controller.rb View File

@@ -1,6 +1,4 @@
class SettingsController < ApplicationController
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

+ 2
- 1
app/models/laboratory.rb 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

# TODO 域名申请后更改
def site
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}" : ''
end


+ 2
- 2
app/views/admins/laboratories/index.html.erb View File

@@ -4,7 +4,7 @@

<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 %>
<%= 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': '搜索中...') %>
<% end %>

@@ -16,4 +16,4 @@
</div>

<%= render 'admins/laboratories/shared/create_laboratory_modal' %>
<%= render 'admins/laboratories/shared/add_laboratory_user_modal' %>
<%= render 'admins/laboratories/shared/add_laboratory_user_modal' %>

+ 3
- 17
app/views/admins/laboratories/shared/_laboratory_item.html.erb View File

@@ -1,9 +1,9 @@
<% school = laboratory&.school %>
<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">
<% if laboratory.identifier %>
<%= link_to laboratory.site, "https://#{laboratory.site}", target: '_blank' %>
<%= link_to laboratory.site, "http://#{laboratory.site}", target: '_blank' %>
<% else %>
--
<% end %>
@@ -51,19 +51,5 @@
<% if school.present? && laboratory.id != 1 %>
<%= 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' %>
<% 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>
<% end %>
</td>

+ 1
- 1
app/views/admins/laboratory_settings/show.html.erb View File

@@ -184,4 +184,4 @@
<%= link_to '取消', admins_laboratories_path, class: 'btn btn-secondary px-4' %>
</div>
<% end %>
</div>
</div>

+ 1
- 3
app/views/settings/show.json.jbuilder View File

@@ -45,7 +45,5 @@ json.setting do

json.main_site current_laboratory.main_site?
json.new_course default_course_links
json.old_projects_url @old_projects_url


end
end

Loading…
Cancel
Save