admins: subject list && admins sidebar logo modify

dev_local_cqdsj
p31729568 5 years ago
parent 3acf68ba60
commit 2db1e078d5

@ -0,0 +1,50 @@
$(document).on('turbolinks:load', function() {
if ($('body.admins-subjects-index-page').length > 0) {
var $form = $('.subject-list-form');
// ************** 学校选择 *************
$form.find('.school-select').select2({
theme: 'bootstrap4',
placeholder: '请选择创建者单位',
minimumInputLength: 1,
ajax: {
delay: 500,
url: '/api/schools/for_option.json',
dataType: 'json',
data: function(params){
return { keyword: params.term };
},
processResults: function(data){
return { results: data.schools }
}
},
templateResult: function (item) {
if(!item.id || item.id === '') return item.text;
return item.name;
},
templateSelection: function(item){
if (item.id) {
}
return item.name || item.text;
}
});
// 清空
$form.on('click', '.clear-btn', function(){
$form.find('select[name="status"]').val('');
$form.find('.school-select').val('').trigger('change');
$form.find('input[name="keyword"]').val('');
$form.find('#homepage_show').attr('checked', false);
$form.find('#excellent').attr('checked', false);
$form.find('input[type="submit"]').trigger('click');
})
// 上传图片
$('.modal.admin-upload-file-modal').on('upload:success', function(e, data){
var $imageElement = $('.subject-image-' + data.source_id);
$imageElement.attr('src', data.url);
$imageElement.show();
$imageElement.next().html('重新上传');
})
}
});

@ -21,9 +21,12 @@
flex-direction: column;
&-logo {
padding-left: 5px;
overflow: hidden;
margin-bottom: 10px;
& > .logo-label {
display: none;
}
}
}
@ -54,7 +57,7 @@
-ms-transform: translateX(50%);
transform: translateX(50%);
}
ul ul a {
padding: 10px !important;
@ -76,6 +79,23 @@
display: flex;
flex-direction: row;
justify-content: space-between;
&-logo {
display: flex;
justify-content: space-between;
align-items: center;
& > img {
width: 40px;
height: auto;
}
& > .logo-label {
font-size: 18px;
color: darkgrey;
margin-left: 10px;
}
}
}
#sidebarCollapse {
@ -183,7 +203,7 @@
ul li a {
padding: 10px;
font-size: 0.85em;
i {
margin-right: 0;
display: block;
@ -194,7 +214,7 @@
& > ul > li > a > i {
font-size: 1.8em;
}
ul ul a {
padding: 10px !important;
}

@ -0,0 +1,8 @@
class Admins::SubjectsController < Admins::BaseController
def index
default_sort('created_at', 'desc')
subjects = Admins::SubjectQuery.call(params)
@subjects = paginate subjects.includes(:repertoire, :subject_level_system, user: { user_extension: :school })
end
end

@ -0,0 +1,11 @@
module Admins::SubjectsHelper
def display_subject_status(subject)
style =
case subject.status
when 0 then 'text-secondary'
when 1 then 'text-warning'
when 2 then 'text-success'
end
raw content_tag(:span, t("subject.status.#{subject.status}"), class: style)
end
end

@ -14,7 +14,13 @@ module CustomSortable
return relations unless self.class.check_sort_parameter_validate(sort_by.to_s, sort_direction.to_s)
order_method = self.class.sort_options[:reorder] ? :reorder : :order
relations.send(order_method, "#{sort_by} #{sort_direction}")
default_table = self.class.sort_options[:default_table]
if default_table.present?
relations.send(order_method, "#{default_table}.#{sort_by} #{sort_direction}")
else
relations.send(order_method, "#{sort_by} #{sort_direction}")
end
end
module ClassMethods
@ -23,6 +29,7 @@ module CustomSortable
@_sort_options[:default_by] = opts[:default_by].to_s
@_sort_options[:default_direction] = opts[:default_direction].to_s
@_sort_options[:reorder] = opts[:reorder]
@_sort_options[:default_table] = opts[:default_table]
@_sort_columns = columns.map(&:to_s)
end

@ -7,6 +7,7 @@ class Subject < ApplicationRecord
#status :0 编辑中 1 审核中 2 发布
belongs_to :repertoire
belongs_to :user
belongs_to :subject_level_system, optional: true
has_many :stages, -> { order("stages.position ASC") }, dependent: :destroy

@ -0,0 +1,5 @@
class SubjectLevelSystem < ApplicationRecord
default_scope { order(level: :asc) }
has_many :subjects, dependent: :nullify
end

@ -0,0 +1,45 @@
class Admins::SubjectQuery < ApplicationQuery
include CustomSortable
attr_reader :params
sort_columns :created_at, default_by: :created_at, default_direction: :desc, default_table: 'subjects'
def initialize(params)
@params = params
end
def call
subjects = Subject.all
# 状态过滤
status =
case params[:status].to_s.strip
when 'pending' then 0
when 'applying' then 1
when 'published' then 2
end
subjects = subjects.where(status: status) if status
# 创建者单位
if params[:school_id].present?
subjects = subjects.joins(user: :user_extension).where(user_extensions: { school_id: params[:school_id] })
end
# 首页展示、金课
%i[homepage_show excellent].each do |column|
if params[column].present? && params[column].to_s == 'true'
subjects = subjects.where(column => true)
end
end
# 关键字
keyword = params[:keyword].to_s.strip
if keyword
sql = 'CONCAT(lastname, firstname) LIKE :keyword OR subjects.name LIKE :keyword'
subjects = subjects.joins(:user).where(sql, keyword: "%#{keyword}%")
end
custom_sort(subjects, params[:sort_by], params[:sort_direction])
end
end

@ -36,12 +36,14 @@
<%= javascript_void_link '添加管理员', class: 'action', data: { laboratory_id: laboratory.id, toggle: 'modal', target: '.admin-add-laboratory-user-modal' } %>
<% end %>
<%= 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' %>
<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' %>
<% if school.present? && laboratory.id != 1 %>
<%= delete_link '删除', admins_laboratory_path(laboratory, element: ".laboratory-item-#{laboratory.id}"), class: 'dropdown-item delete-laboratory-action' %>
<% end %>
<% 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>

@ -1,9 +1,13 @@
<% sidebar_collapse = request.cookies['admin_sidebar_collapse'].to_s == 'true' %>
<nav id="sidebar" class="<%= sidebar_collapse ? 'active' : '' %>" data-current-controller="<%= admin_sidebar_controller %>">
<div class="sidebar-header">
<a href="/" class="sidebar-header-logo" data-toggle="tooltip" title="返回主站">
<%= image_tag('logo.png') %>
</a>
<div class="sidebar-header-logo">
<img src="/images/<%= url_to_avatar(current_user) %>" />
<span class="logo-label">后台管理</span>
</div>
<!-- <a href="/" class="sidebar-header-logo" data-toggle="tooltip" title="返回主站">-->
<%#= image_tag('logo.png') %>
<!-- </a>-->
<div id="sidebarCollapse" class="navbar-btn <%= sidebar_collapse ? 'active' : '' %>">
<i class="fa fa-chevron-left fold" data-toggle="tooltip" data-placement="right" data-boundary="window" title="收起"></i>
<i class="fa fa-bars unfold" data-toggle="tooltip" data-placement="right" data-boundary="window" title="展开"></i>
@ -29,6 +33,12 @@
<% end %>
</li>
<li>
<%= sidebar_item_group('#subject-submenu', '实践课程', icon: 'th-list') do %>
<li><%= sidebar_item(admins_subjects_path, '课程列表', icon: 'cog', controller: 'admins-subjects') %></li>
<% end %>
</li>
<li>
<%= sidebar_item_group('#schools-submenu', '单位管理', icon: 'building') do %>
<li><%= sidebar_item(admins_schools_path, '单位列表', icon: 'university', controller: 'admins-schools') %></li>

@ -17,7 +17,7 @@
<span class="input-group-text">文件</span>
</div>
<div class="custom-file">
<input type="file" name="file" class="upload-file-input" id="upload-file-input">
<input type="file" name="file" class="upload-file-input" accept="<%= accept ||= '*' %>" id="upload-file-input">
<label class="custom-file-label file-names" for="upload-file-input">选择文件</label>
</div>
</div>

@ -0,0 +1,39 @@
<% define_admin_breadcrumbs do %>
<% add_admin_breadcrumb('课程配置') %>
<% end %>
<div class="box search-form-container subject-list-form">
<%= form_tag(admins_subjects_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
<div class="form-group mr-1">
<label for="status">状态:</label>
<% status_options = [['全部', ''], ['编辑中', 'pending'], ['审核中', 'applying'], ['已发布', 'published']] %>
<%= select_tag(:status, options_for_select(status_options), class: 'form-control') %>
</div>
<div class="form-group col-12 col-md-3">
<label for="school_name">单位:</label>
<%= select_tag :school_id, options_for_select([''], params[:school_id]), class: 'form-control school-select flex-1' %>
</div>
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-12 col-md-2 mr-3', placeholder: '创建者/课程名称检索') %>
<div class="form-check mr-2">
<%= hidden_field_tag(:homepage_show, false, id:'') %>
<%= check_box_tag(:homepage_show, true, params[:homepage_show].to_s == 'true', class: 'form-check-input') %>
<label class="form-check-label" for="homepage_show">只看首页展示</label>
</div>
<div class="form-check mr-2">
<%= hidden_field_tag(:excellent, false, id:'') %>
<%= check_box_tag(:excellent, true, params[:excellent].to_s == 'true', class: 'form-check-input') %>
<label class="form-check-label" for="excellent">只看金课</label>
</div>
<%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
<input type="reset" class="btn btn-secondary clear-btn" value="清空"/>
<% end %>
</div>
<div class="box subject-list-container">
<%= render partial: 'admins/subjects/shared/list', locals: { subjects: @subjects } %>
</div>

@ -0,0 +1 @@
$('.subject-list-container').html("<%= j( render partial: 'admins/subjects/shared/list', locals: { subjects: @subjects } ) %>");

@ -0,0 +1,73 @@
<table class="table table-hover text-center subject-list-table">
<thead class="thead-light">
<tr>
<th width="14%" class="text-left">名称</th>
<th width="6%">阶段数</th>
<th width="6%">实训数</th>
<th width="8%">技术体系</th>
<th width="8%">等级体系</th>
<th width="8%">封面</th>
<th width="8%">创建者</th>
<th width="10%">单位</th>
<th width="8%">开课人数</th>
<th width="10%"><%= sort_tag('创建时间', name: 'created_at', path: admins_subjects_path) %></th>
<th width="7%">状态</th>
<th width="14%">操作</th>
</tr>
</thead>
<tbody>
<% if subjects.present? %>
<% subjects.each do |subject| %>
<tr class="subject-item-<%= subject.id %>">
<td class="text-left">
<%= link_to(subject.name, subject_path(subject), target: '_blank') %>
<span class="badge badge-pill badge-success homepage-show-badge" style="<%= subject.homepage_show? ? '' : 'display:none' %>">首页</span>
<span class="badge badge-pill badge-info excellent-badge" style="<%= subject.excellent? ? '' : 'display:none' %>">金课</span>
</td>
<td><%= subject.stages_count %></td>
<td><%= subject.shixuns_count %></td>
<td><%= display_text subject.repertoire&.name %></td>
<td><%= display_text subject.subject_level_system&.name %></td>
<td>
<% image_exists = Util::FileManage.exists?(subject) %>
<%= image_tag(image_exists ? Util::FileManage.source_disk_file_url(subject) : '', height: 40, class: "w-100 preview-image subject-image-#{subject.id}", style: image_exists ? '' : 'display:none') %>
<%= javascript_void_link image_exists ? '重新上传' : '上传图片', class: 'action upload-image-action', data: { source_id: subject.id, source_type: 'Subject', toggle: 'modal', target: '.admin-upload-file-modal' } %>
</td>
<td><%= subject.user.real_name %></td>
<td><%= subject.user.school_name %></td>
<td><%= subject.student_count %></td>
<td><%= subject.created_at&.strftime('%Y-%m-%d %H:%M') %></td>
<td>
<%= display_subject_status(subject) %>
</td>
<td>
<%#= javascript_void_link('编辑', class: 'edit-action') %>
<%#= javascript_void_link('隐藏', class: 'hide-action', style: subject.hidden? ? 'display:none' : '') %>
<%#= javascript_void_link('取消隐藏', class: 'active-action', style: subject.hidden? ? '' : 'display:none') %>
<%# if subject.published? %>
<!-- <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">-->
<%#= javascript_void_link('首页展示', class: 'dropdown-item homepage-show-action', style: subject.homepage_show? ? 'display:none' : '') %>
<%#= javascript_void_link('取消首页展示', class: 'dropdown-item homepage-hide-action', style: subject.homepage_show? ? '' : 'display:none') %>
<%#= javascript_void_link('选为金课', class: 'dropdown-item excellent-action', style: subject.excellent? ? 'display:none' : '') %>
<%#= javascript_void_link('取消金课', class: 'dropdown-item cancel-excellent-action', style: subject.excellent? ? '' : 'display:none') %>
<%#= delete_link '删除', admins_subjects_path(subject, element: ".subject-item-#{subject.id}"), class: 'delete-subject-action' %>
<!-- </div>-->
<!-- </div>-->
<%# end %>
</td>
</tr>
<% end %>
<% else %>
<%= render 'admins/shared/no_data_for_table' %>
<% end %>
</tbody>
</table>
<%= render partial: 'admins/shared/paginate', locals: { objects: subjects } %>
<%= render partial: 'admins/shared/modal/upload_file_modal', locals: { title: '上传图片', accept: 'image/*' } %>

@ -43,13 +43,15 @@
<%= javascript_void_link '加锁', class: 'action lock-action', data: { id: user.id }, style: user.locked? || user.registered? ? 'display: none;' : '' %>
<% end %>
<%= javascript_void_link('更多', class: 'action dropdown-toggle', 'data-toggle': 'dropdown', 'aria-haspopup': true, 'aria-expanded': false) %>
<div class="dropdown-menu more-action-dropdown">
<%= javascript_void_link('奖励', class: 'dropdown-item reward-grade-action', data: { toggle: 'modal', target: '.admin-users-reward-grade-modal', id: user.id }) %>
<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">
<%= javascript_void_link('奖励', class: 'dropdown-item reward-grade-action', data: { toggle: 'modal', target: '.admin-users-reward-grade-modal', id: user.id }) %>
<%= javascript_void_link '恢复禁密账号', class: 'dropdown-item reset-login-times-action', data: { id: user.id } %>
<%= javascript_void_link '恢复禁密账号', class: 'dropdown-item reset-login-times-action', data: { id: user.id } %>
<%= delete_link '删除', admins_user_path(user, element: ".user-item-#{user.id}"), class: 'dropdown-item delete-user-action' %>
<%= delete_link '删除', admins_user_path(user, element: ".user-item-#{user.id}"), class: 'dropdown-item delete-user-action' %>
</div>
</div>
</td>
</tr>

@ -0,0 +1,6 @@
'zh-CN':
subject:
status:
'0': 编辑中
'1': 审核中
'2': 已发布

@ -1048,6 +1048,8 @@ Rails.application.routes.draw do
resources :weapp_adverts, only: [:index, :create, :update, :destroy] do
post :drag, on: :collection
end
resources :subjects, only: [:index]
end
namespace :cooperative do

File diff suppressed because one or more lines are too long

@ -26136,12 +26136,16 @@ input.form-control {
/* line 23, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active .sidebar-header-logo {
padding-left: 5px;
overflow: hidden;
margin-bottom: 10px;
}
/* line 30, app/assets/stylesheets/admins/sidebar.scss */
/* line 27, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active .sidebar-header-logo > .logo-label {
display: none;
}
/* line 33, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active ul li a {
padding: 10px;
text-align: center;
@ -26152,12 +26156,12 @@ input.form-control {
justify-content: center;
}
/* line 37, app/assets/stylesheets/admins/sidebar.scss */
/* line 40, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active ul li a span {
display: none;
}
/* line 39, app/assets/stylesheets/admins/sidebar.scss */
/* line 42, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active ul li a i {
margin-right: 0;
display: block;
@ -26167,7 +26171,7 @@ input.form-control {
height: 20px;
}
/* line 49, app/assets/stylesheets/admins/sidebar.scss */
/* line 52, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active .dropdown-toggle::after {
top: auto;
bottom: 10px;
@ -26176,17 +26180,17 @@ input.form-control {
transform: translateX(50%);
}
/* line 58, app/assets/stylesheets/admins/sidebar.scss */
/* line 61, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active ul ul a {
padding: 10px !important;
}
/* line 61, app/assets/stylesheets/admins/sidebar.scss */
/* line 64, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active ul ul a span {
display: none;
}
/* line 63, app/assets/stylesheets/admins/sidebar.scss */
/* line 66, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active ul ul a i {
margin-left: 0px;
display: block;
@ -26195,7 +26199,7 @@ input.form-control {
height: 10px;
}
/* line 73, app/assets/stylesheets/admins/sidebar.scss */
/* line 76, app/assets/stylesheets/admins/sidebar.scss */
#sidebar .sidebar-header {
padding: 20px;
background: #272822;
@ -26208,7 +26212,30 @@ input.form-control {
justify-content: space-between;
}
/* line 81, app/assets/stylesheets/admins/sidebar.scss */
/* line 83, app/assets/stylesheets/admins/sidebar.scss */
#sidebar .sidebar-header-logo {
display: -webkit-box;
display: flex;
-webkit-box-pack: justify;
justify-content: space-between;
-webkit-box-align: center;
align-items: center;
}
/* line 88, app/assets/stylesheets/admins/sidebar.scss */
#sidebar .sidebar-header-logo > img {
width: 40px;
height: auto;
}
/* line 93, app/assets/stylesheets/admins/sidebar.scss */
#sidebar .sidebar-header-logo > .logo-label {
font-size: 18px;
color: darkgrey;
margin-left: 10px;
}
/* line 101, app/assets/stylesheets/admins/sidebar.scss */
#sidebar #sidebarCollapse {
display: -webkit-box;
display: flex;
@ -26220,7 +26247,7 @@ input.form-control {
text-align: right;
}
/* line 88, app/assets/stylesheets/admins/sidebar.scss */
/* line 108, app/assets/stylesheets/admins/sidebar.scss */
#sidebar #sidebarCollapse.active {
width: 40px;
height: 30px;
@ -26229,27 +26256,27 @@ input.form-control {
border-radius: 3px;
}
/* line 95, app/assets/stylesheets/admins/sidebar.scss */
/* line 115, app/assets/stylesheets/admins/sidebar.scss */
#sidebar #sidebarCollapse.active i.fold {
display: none;
}
/* line 96, app/assets/stylesheets/admins/sidebar.scss */
/* line 116, app/assets/stylesheets/admins/sidebar.scss */
#sidebar #sidebarCollapse.active i.unfold {
display: block;
}
/* line 99, app/assets/stylesheets/admins/sidebar.scss */
/* line 119, app/assets/stylesheets/admins/sidebar.scss */
#sidebar #sidebarCollapse i.fold {
display: block;
}
/* line 102, app/assets/stylesheets/admins/sidebar.scss */
/* line 122, app/assets/stylesheets/admins/sidebar.scss */
#sidebar #sidebarCollapse i.unfold {
display: none;
}
/* line 105, app/assets/stylesheets/admins/sidebar.scss */
/* line 125, app/assets/stylesheets/admins/sidebar.scss */
#sidebar a, #sidebar a:hover, #sidebar a:focus {
color: inherit;
text-decoration: none;
@ -26257,25 +26284,25 @@ input.form-control {
transition: all 0.3s;
}
/* line 111, app/assets/stylesheets/admins/sidebar.scss */
/* line 131, app/assets/stylesheets/admins/sidebar.scss */
#sidebar > ul > li > a > i {
width: 14px;
height: 14px;
}
/* line 117, app/assets/stylesheets/admins/sidebar.scss */
/* line 137, app/assets/stylesheets/admins/sidebar.scss */
#sidebar ul.components {
padding: 20px 0;
border-bottom: 1px solid #3f3f3f;
}
/* line 122, app/assets/stylesheets/admins/sidebar.scss */
/* line 142, app/assets/stylesheets/admins/sidebar.scss */
#sidebar ul p {
color: #fff;
padding: 10px;
}
/* line 127, app/assets/stylesheets/admins/sidebar.scss */
/* line 147, app/assets/stylesheets/admins/sidebar.scss */
#sidebar ul li > a {
padding: 10px;
font-size: 1em;
@ -26283,25 +26310,25 @@ input.form-control {
text-align: left;
}
/* line 133, app/assets/stylesheets/admins/sidebar.scss */
/* line 153, app/assets/stylesheets/admins/sidebar.scss */
#sidebar ul li > a i {
margin-right: 10px;
font-size: 1em;
margin-bottom: 5px;
}
/* line 141, app/assets/stylesheets/admins/sidebar.scss */
/* line 161, app/assets/stylesheets/admins/sidebar.scss */
#sidebar ul li a:hover, #sidebar ul li a.active {
color: #fff;
background: #276891;
}
/* line 147, app/assets/stylesheets/admins/sidebar.scss */
/* line 167, app/assets/stylesheets/admins/sidebar.scss */
#sidebar ul li.active > a, #sidebar ul a[aria-expanded="true"] {
color: #fff;
}
/* line 152, app/assets/stylesheets/admins/sidebar.scss */
/* line 172, app/assets/stylesheets/admins/sidebar.scss */
#sidebar ul ul a {
font-size: 0.9em !important;
padding-left: 30px !important;
@ -26309,7 +26336,7 @@ input.form-control {
}
@media (max-width: 768px) {
/* line 162, app/assets/stylesheets/admins/sidebar.scss */
/* line 182, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active {
padding: 10px 5px;
min-width: 40px;
@ -26319,39 +26346,39 @@ input.form-control {
-webkit-transform: none;
transform: none;
}
/* line 170, app/assets/stylesheets/admins/sidebar.scss */
/* line 190, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active .sidebar-header {
padding: 0px;
}
/* line 173, app/assets/stylesheets/admins/sidebar.scss */
/* line 193, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active .sidebar-header .sidebar-header-logo {
display: none;
}
/* line 177, app/assets/stylesheets/admins/sidebar.scss */
/* line 197, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active .sidebar-header #sidebarCollapse {
width: 30px;
height: 20px;
}
/* line 183, app/assets/stylesheets/admins/sidebar.scss */
/* line 203, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active ul li a {
padding: 10px;
font-size: 0.85em;
}
/* line 187, app/assets/stylesheets/admins/sidebar.scss */
/* line 207, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active ul li a i {
margin-right: 0;
display: block;
margin-bottom: 5px;
}
/* line 194, app/assets/stylesheets/admins/sidebar.scss */
/* line 214, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active > ul > li > a > i {
font-size: 1.8em;
}
/* line 198, app/assets/stylesheets/admins/sidebar.scss */
/* line 218, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active ul ul a {
padding: 10px !important;
}
/* line 207, app/assets/stylesheets/admins/sidebar.scss */
/* line 227, app/assets/stylesheets/admins/sidebar.scss */
.dropdown-toggle::after {
top: auto;
bottom: 10px;

@ -138478,6 +138478,56 @@ $(document).on('turbolinks:load', function() {
}
})
;
$(document).on('turbolinks:load', function() {
if ($('body.admins-subjects-index-page').length > 0) {
var $form = $('.subject-list-form');
// ************** 学校选择 *************
$form.find('.school-select').select2({
theme: 'bootstrap4',
placeholder: '请选择创建者单位',
minimumInputLength: 1,
ajax: {
delay: 500,
url: '/api/schools/for_option.json',
dataType: 'json',
data: function(params){
return { keyword: params.term };
},
processResults: function(data){
return { results: data.schools }
}
},
templateResult: function (item) {
if(!item.id || item.id === '') return item.text;
return item.name;
},
templateSelection: function(item){
if (item.id) {
}
return item.name || item.text;
}
});
// 清空
$form.on('click', '.clear-btn', function(){
$form.find('select[name="status"]').val('');
$form.find('.school-select').val('').trigger('change');
$form.find('input[name="keyword"]').val('');
$form.find('#homepage_show').attr('checked', false);
$form.find('#excellent').attr('checked', false);
$form.find('input[type="submit"]').trigger('click');
})
// 上传图片
$('.modal.admin-upload-file-modal').on('upload:success', function(e, data){
var $imageElement = $('.subject-image-' + data.source_id);
$imageElement.attr('src', data.url);
$imageElement.show();
$imageElement.next().html('重新上传');
})
}
});
$(document).on('turbolinks:load', function() {
if ($('body.admins-user-statistics-index-page').length > 0) {
var $form = $('.user-statistic-list-form');
Loading…
Cancel
Save