+ <%= render partial: 'admins/mirror_repositories/shared/list', locals: { mirrors: @mirrors } %>
+
+
+<%= render 'admins/mirror_repositories/shared/replace_mirror_modal' %>
\ No newline at end of file
diff --git a/app/views/admins/mirror_repositories/index.js.erb b/app/views/admins/mirror_repositories/index.js.erb
new file mode 100644
index 000000000..58ccb1ef8
--- /dev/null
+++ b/app/views/admins/mirror_repositories/index.js.erb
@@ -0,0 +1 @@
+$('.mirror-repository-list-container').html("<%= j( render partial: 'admins/mirror_repositories/shared/list', locals: { mirrors: @mirrors } ) %>");
\ No newline at end of file
diff --git a/app/views/admins/mirror_repositories/merge.js.erb b/app/views/admins/mirror_repositories/merge.js.erb
new file mode 100644
index 000000000..585ecb1af
--- /dev/null
+++ b/app/views/admins/mirror_repositories/merge.js.erb
@@ -0,0 +1,5 @@
+$.notify({ message: '操作成功' },{ type: 'success' });
+
+setTimeout(function(){
+ window.location.reload();
+}, 500)
\ No newline at end of file
diff --git a/app/views/admins/mirror_repositories/new.html.erb b/app/views/admins/mirror_repositories/new.html.erb
new file mode 100644
index 000000000..792fe0857
--- /dev/null
+++ b/app/views/admins/mirror_repositories/new.html.erb
@@ -0,0 +1,8 @@
+<%
+ define_admin_breadcrumbs do
+ add_admin_breadcrumb('镜像管理', admins_mirror_repositories_path)
+ add_admin_breadcrumb('新建镜像')
+ end
+%>
+
+<%= render partial: 'admins/mirror_repositories/shared/form', locals: { mirror: @mirror, form_action: 'create' } %>
\ No newline at end of file
diff --git a/app/views/admins/mirror_repositories/shared/_choose_mirror_modal.html.erb b/app/views/admins/mirror_repositories/shared/_choose_mirror_modal.html.erb
new file mode 100644
index 000000000..99c846c70
--- /dev/null
+++ b/app/views/admins/mirror_repositories/shared/_choose_mirror_modal.html.erb
@@ -0,0 +1,42 @@
+
+ <%= simple_form_for([:admins, mirror], url: { action: form_action }, html: { class: 'edit-mirror col-md-12' }, defaults: { wrapper_html: { class: 'col-md-4' } }) do |f| %>
+ <% unless mirror.new_record? %>
+
+ <%= f.input :mirrorID, label: '镜像ID', input_html: { readonly: true, class: 'form-control-plaintext' } %>
+ <%= f.input :name, label: '镜像名称', input_html: { readonly: true, class: 'form-control-plaintext' } %>
+
+ <% end %>
+
+
+ <%= f.input :type_name, as: :string, label: '镜像别名 *' %>
+
+
+ <%= f.label :main_type, label: '类别' %>
+ <%= f.select :main_type, [['主类别', 1],['小类别', 0]], {}, class: 'form-control optional' %>
+
+
+
+
+ <%= f.input :time_limit, as: :integer, label: '评测时限(S)' %>
+ <%= f.input :resource_limit, as: :integer, label: '磁盘限制(K)' %>
+
+
+
+ <%= f.input :cpu_limit, as: :integer, label: 'CPU限制(核)' %>
+ <%= f.input :memory_limit, as: :integer, label: '内存限制(M)' %>
+
+
+
+ <%= f.input :description, as: :text, label: '描述', wrapper_html: { class: 'col-md-8' } %>
+
+
+
+ <%= f.input :status, as: :radio_buttons, label: '状态', collection: [%w(未发布 0), %w(已发布 1)], wrapper_html: { class: 'col-md-4' } %>
+
+
+
+ <%= f.button :submit, value: '保存', class: 'btn-primary mr-3 px-4', 'data-disable-with': '保存中...' %>
+ <%= link_to '取消', admins_mirror_repositories_path, class: 'btn btn-secondary px-4' %>
+
+ <% end %>
+
\ No newline at end of file
diff --git a/app/views/admins/mirror_repositories/shared/_list.html.erb b/app/views/admins/mirror_repositories/shared/_list.html.erb
new file mode 100644
index 000000000..b4c2df70e
--- /dev/null
+++ b/app/views/admins/mirror_repositories/shared/_list.html.erb
@@ -0,0 +1,54 @@
+
- <% if objects.size.nonzero? %>
+ <% if objects && objects.size.nonzero? %>
<%= page_entries_info objects %>
<% end %>
<%= paginate objects, views_prefix: 'admins', remote: true %>
diff --git a/app/views/admins/shared/_sidebar.html.erb b/app/views/admins/shared/_sidebar.html.erb
index ab30e8bd3..8c995ec45 100644
--- a/app/views/admins/shared/_sidebar.html.erb
+++ b/app/views/admins/shared/_sidebar.html.erb
@@ -20,6 +20,12 @@
<% end %>
+
+ <%= sidebar_item_group('#shixun-submenu', '实训管理', icon: 'window-restore') do %>
+ <%= sidebar_item(admins_mirror_repositories_path, '镜像管理', icon: 'cubes', controller: 'admins-mirror_repositories') %>
+ <% end %>
+
+
<%#= sidebar_item_group('#course-submenu', '课堂+', icon: 'mortar-board') do %>
diff --git a/app/views/admins/users/edit.html.erb b/app/views/admins/users/edit.html.erb
index 3f9d71b96..22ac1f18e 100644
--- a/app/views/admins/users/edit.html.erb
+++ b/app/views/admins/users/edit.html.erb
@@ -131,7 +131,7 @@
<%= f.button :submit, value: '保存', class: 'btn-primary mr-3 px-4' %>
- <%= link_to '取消', 'javascript:history.go(-1)', class: 'btn btn-secondary px-4' %>
+ <%= link_to '取消', admins_users_path, class: 'btn btn-secondary px-4' %>
<% end %>
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 7e2cf72f3..285bb7e1a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -786,6 +786,13 @@ Rails.application.routes.draw do
post :refuse
end
end
+ resources :mirror_repositories, only: [:index, :new, :create, :edit, :update, :destroy] do
+ collection do
+ post :merge
+ get :for_select
+ end
+ end
+ resources :choose_mirror_repositories, only: [:new, :create]
end
#git 认证回调