forked from Gitlink/forgeplus
Add Setting button
This commit is contained in:
parent
63ae3fdea0
commit
248eadb918
|
@ -6,6 +6,12 @@ class Admins::LaboratoriesController < Admins::BaseController
|
||||||
@laboratories = paginate laboratories.preload(:laboratory_users)
|
@laboratories = paginate laboratories.preload(:laboratory_users)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
Admins::CreateLaboratoryService.call(create_params)
|
Admins::CreateLaboratoryService.call(create_params)
|
||||||
render_ok
|
render_ok
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
class Admins::LaboratorySettingsController < Admins::BaseController
|
class Admins::LaboratorySettingsController < Admins::BaseController
|
||||||
|
|
||||||
|
def new
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@laboratory = current_laboratory
|
@laboratory = current_laboratory
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
<tr>
|
||||||
|
<td><%= text_field_tag('navbar[][name]', "", id: nil, class: 'form-control', placeholder: "导航名称") %></td>
|
||||||
|
<td><%= text_field_tag('navbar[][link]', "", id: nil, class: 'form-control', placeholder: "导航链接") %></td>
|
||||||
|
<td class="text-center">
|
||||||
|
<%= check_box_tag('navbar[][hidden]', 0, false, id: nil, class: 'font-16') %>
|
||||||
|
</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<div class="btn btn-primary btn-sm" onclick="destroy_tr(this)">
|
||||||
|
<i class='fa fa-trash'></i>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
|
@ -0,0 +1 @@
|
||||||
|
$("#laboratories-show-content").append("<%= j render partial: "admins/laboratory_settings/add_tr" %>")
|
|
@ -143,18 +143,23 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group px-2 setting-item">
|
<div class="form-group px-2 setting-item">
|
||||||
<div class="setting-item-head"><h6>导航设置</h6></div>
|
<div class="setting-item-head">
|
||||||
|
<h6>导航设置
|
||||||
|
<%= link_to "<i class='fa fa-plus-circle'></i>".html_safe,new_admins_laboratory_laboratory_setting_path, remote: true, class: "btn btn-primary btn-sm"%>
|
||||||
|
</h6>
|
||||||
|
</div>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<div class="pl-0 py-3 setting-item-body">
|
<div class="pl-0 py-3 setting-item-body">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead class="thead-light">
|
<thead class="thead-light">
|
||||||
<tr>
|
<tr>
|
||||||
<th width="35%">导航名称</th>
|
<th width="30%">导航名称</th>
|
||||||
<th width="50%">导航链接</th>
|
<th width="50%">导航链接</th>
|
||||||
<th width="15%" class="text-center">是否展示</th>
|
<th width="10%" class="text-center">是否展示</th>
|
||||||
|
<th width="10%" class="text-center">操作</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody id="laboratories-show-content">
|
||||||
<% (setting.navbar || setting.default_navbar).each do |nav| %>
|
<% (setting.navbar || setting.default_navbar).each do |nav| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= text_field_tag('navbar[][name]', nav['name'], id: nil, class: 'form-control') %></td>
|
<td><%= text_field_tag('navbar[][name]', nav['name'], id: nil, class: 'form-control') %></td>
|
||||||
|
@ -162,6 +167,11 @@
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<%= check_box_tag('navbar[][hidden]', 0, !nav['hidden'], id: nil, class: 'font-16') %>
|
<%= check_box_tag('navbar[][hidden]', 0, !nav['hidden'], id: nil, class: 'font-16') %>
|
||||||
</td>
|
</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<div class="btn btn-primary btn-sm" onclick="destroy_tr(this)">
|
||||||
|
<i class='fa fa-trash'></i>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -185,3 +195,8 @@
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
<script>
|
||||||
|
function destroy_tr(that) {
|
||||||
|
$(that).parent().parent("tr").remove()
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -567,7 +567,7 @@ Rails.application.routes.draw do
|
||||||
post :update_sync_course
|
post :update_sync_course
|
||||||
end
|
end
|
||||||
|
|
||||||
resource :laboratory_setting, only: [:show, :update]
|
resource :laboratory_setting, only: [:show, :update, :new]
|
||||||
resource :laboratory_user, only: [:create, :destroy]
|
resource :laboratory_user, only: [:create, :destroy]
|
||||||
|
|
||||||
resources :carousels, only: [:index, :create, :update, :destroy] do
|
resources :carousels, only: [:index, :create, :update, :destroy] do
|
||||||
|
|
Loading…
Reference in New Issue