ADD 后台系统配置管理功能

This commit is contained in:
jasder
2021-09-10 15:29:08 +08:00
parent 36adfcf016
commit 4c41d50506
35 changed files with 505 additions and 105 deletions
@@ -0,0 +1,38 @@
<div class="modal fade edu_setting-change-modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"><%= type == "create" ? "新增" : "编辑" %></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<%= form_for @edu_setting, url: {controller: "edu_settings", action: "#{type}"} do |p| %>
<div class="modal-body">
<div class="form-group">
<label>
变量名 <span class="ml10 color-orange mr20">*</span>
</label>
<%= p.text_field :name, class: "form-control input-lg",required: true%>
</div>
<div class="form-group">
<label>
变量值 <span class="ml10 color-orange mr20">*</span>
</label>
<%= p.text_field :value, class: "form-control input-lg",required: true%>
</div>
<div class="form-group">
<label>
备注说明
</label>
<%= p.text_area :description, class: "form-control", placeholder: ""%>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
<%= p.submit "确认", class: "btn btn-primary submit-btn" %>
</div>
<% end %>
</div>
</div>
</div>
@@ -0,0 +1,36 @@
<table class="table table-hover text-center subject-list-table">
<thead class="thead-light">
<tr>
<th width="5%">序号</th>
<th width="15%">变量名</th>
<th width="35%">变量值</th>
<th width="20%">备注说明</th>
<th width="10%"><%= sort_tag('创建时间', name: 'created_at', path: admins_edu_settings_path) %></th>
<th width="10%">操作</th>
</tr>
</thead>
<tbody>
<% if edu_settings.present? %>
<% edu_settings.each_with_index do |edu_setting, index| %>
<tr class="edu_setting-item-<%= edu_setting.id %>">
<td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
<td>
<%= edu_setting.name %>
</td>
<td><%= edu_setting.value %></td>
<td><%= overflow_hidden_span display_text(edu_setting.description), width: 200 %></td>
<td><%= edu_setting.created_at&.strftime('%Y-%m-%d %H:%M') %></td>
<td class="action-container">
<%= link_to "编辑", edit_admins_edu_setting_path(edu_setting), remote: true, class: "action" %>
<%= link_to "删除", admins_edu_setting_path(edu_setting), method: :delete, data:{confirm: "确认删除的吗?"}, class: "action" %>
</td>
</tr>
<% end %>
<% else %>
<%= render 'admins/shared/no_data_for_table' %>
<% end %>
</tbody>
</table>
<%= render partial: 'admins/shared/paginate', locals: { objects: edu_settings } %>
@@ -0,0 +1,2 @@
$("#edu_setting-modals").html("<%= j render(partial: 'admins/edu_settings/form', locals: {type: 'update'}) %>")
$(".edu_setting-change-modal").modal('show');
@@ -0,0 +1,22 @@
<% define_admin_breadcrumbs do %>
<% add_admin_breadcrumb('全局变量配置') %>
<% end %>
<div class="box search-form-container edu_settings-list-form">
<%= form_tag(admins_edu_settings_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
<%= text_field_tag(:search, params[:search], class: 'form-control col-12 col-md-2 mr-3', placeholder: '关键字检索') %>
<%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
<input type="reset" class="btn btn-secondary clear-btn" value="清空"/>
<% end %>
<%= link_to "新增", new_admins_edu_setting_path, remote: true, class: "btn btn-primary pull-right", "data-disabled-with":"...新增" %>
</div>
<div class="box py-0 pt-4 pl-4 daily-school-statistic-title">
说明:该界面适用于存储全局变量.
</div>
<div class="box admin-list-container edu_settings-list-container">
<%= render partial: 'admins/edu_settings/list', locals: { edu_settings: @edu_settings } %>
</div>
<div id="edu_setting-modals">
</div>
@@ -0,0 +1 @@
$('.edu_settings-list-container').html("<%= j( render partial: 'admins/edu_settings/list', locals: { edu_settings: @edu_settings } ) %>");
+2
View File
@@ -0,0 +1,2 @@
$("#edu_setting-modals").html("<%= j render(partial: 'admins/edu_settings/form', locals: {type: 'create'}) %>")
$(".edu_setting-change-modal").modal('show');