Change Forum

This commit is contained in:
sylor_huang@126.com 2020-10-13 19:25:17 +08:00
parent 141bf1a488
commit 5639a69f78
83 changed files with 781 additions and 307 deletions

View File

@ -0,0 +1,4 @@
$(document).on('turbolinks:load', function() {
var $addSectionModal = $('.admin-import-user-modal');
});

View File

@ -0,0 +1,7 @@
// .admins-banned-users-index-page {
// .width240 {
// width: 240px;
// }
// .mr15{margin-right: 15px;}
// .mt2{margin-top: 2px;}
// }

View File

@ -136,5 +136,36 @@
background: #fff;
}
.mt-10{margin-top: 10px;}
.nav_blueline_status{
list-style-type: none;
padding: 0;
margin: 0;
li {
padding: 0px 15px;
border-radius: 15px;
border: 1px solid #CDCDCD;
height: 30px;
line-height: 30px;
float: left;
margin-right: 30px;
a {
color: #CDCDCD!important;
display: block;
}
};
li.active {
border: 1px solid #4CACFF;
a {
color: #4CACFF!important;
}
}
}
.fr{float: right;}
.width240 {
width: 240px;
}
.mr15{margin-right: 15px;}
.mt2{margin-top: 2px;}
}

View File

@ -0,0 +1,24 @@
.admins-forum-sections-index-page {
.color-grey{color: #888;}
.grid-item-top {
display: grid;
grid-template-columns: max-content 1fr;
align-self: start;
}
.mt20{margin-top: 20px;}
.none{display: none;}
.color-red{color: red!important;}
.upload-image-100 {
height: 100px;
width: 100px;
border-radius: 8px;
text-align: center;
/* line-height: 100px; */
background: #f5f5f5;
color: #999;
position: relative;
}
.pointer {
cursor: pointer;
}
}

View File

@ -0,0 +1,5 @@
.admins-memos-index-page {
.users-list-container {
text-align: center;
}
}

View File

@ -0,0 +1,31 @@
class Admins::ApplyDestroyController < Admins::BaseController
def index
memos = Memo.where(destroy_status: 1).includes(:author).order("created_at desc")
@memos = paginate memos
respond_to do |format|
format.html
format.js
end
end
def confirm_apply_destroy
memo = Memo.find(params[:id])
apply_status = params[:confirm]
if apply_status == "delete"
memo.destroy
extra = "d_2"
Tiding.create!(:user_id => memo.author_id, :trigger_user_id => 0,
container_id: memo.id, container_type: 'Memo',
:viewed => 0, :tiding_type => "System", :extra => "d_2")
else
memo.common!
memo.save
extra = "d_3"
Tiding.create!(:user_id => memo.author_id, :trigger_user_id => 0,
container_id: memo.id, container_type: 'Memo',
:viewed => 0, :tiding_type => "System", :extra => "d_3")
end
@status = 1
@message = "操作成功"
end
end

View File

@ -22,13 +22,14 @@ class Admins::BannedUsersController < Admins::BaseController
end
banned_users = banned_users.order("updated_at desc")
page = (params[:page] || 1).to_i
per_page = 15
@banned_users_count = banned_users.size
@banned_users_pages = Paginator.new @banned_users_count, per_page, page
@banned_users = banned_users.limit(@banned_users_pages.per_page).offset(@banned_users_pages.offset).to_a
@banned_users = paginate banned_users
# page = (params[:page] || 1).to_i
# per_page = 15
# @banned_users_pages = Paginator.new @banned_users_count, per_page, page
# @banned_users = banned_users.limit(@banned_users_pages.per_page).offset(@banned_users_pages.offset).to_a
end

View File

@ -22,13 +22,14 @@ class Admins::ForumAppliesController < Admins::BaseController
forum_applies = forum_applies.joins(:user).where("LOWER(users.login) LIKE ? or LOWER(concat(users.lastname, users.firstname)) LIKE ?", "%#{@search_name}%", "%#{@search_name}%")
end
forum_applies = forum_applies.order("apply_forums.updated_at desc")
page = (params[:page] || 1).to_i
per_page = 15
@forum_applies_count = forum_applies.size
@forum_applies_pages = Paginator.new @forum_applies_count, per_page, page
@forum_applies = forum_applies.limit(@forum_applies_pages.per_page).offset(@forum_applies_pages.offset).to_a
@forum_applies = paginate forum_applies
# page = (params[:page] || 1).to_i
# per_page = 15
# @forum_applies_pages = Paginator.new @forum_applies_count, per_page, page
# @forum_applies = forum_applies.limit(@forum_applies_pages.per_page).offset(@forum_applies_pages.offset).to_a
end

View File

@ -9,11 +9,16 @@ class Admins::ForumSectionsController < Admins::BaseController
forum_sections = ForumSection.roots.includes(:forum_moderators).order("position desc")
@max_position = forum_sections&.maximum(:position).to_i
@min_position = forum_sections&.minimum(:position).to_i
@forum_sections_count = forum_sections.count
page = (params[:page] || 1).to_i
per_page = 15
@forum_sections_pages = Paginator.new @forum_sections_count, per_page, page
@forum_sections = forum_sections.limit(@forum_sections_pages.per_page).offset(@forum_sections_pages.offset).to_a
@forum_sections_count = forum_sections.size
# page = (params[:page] || 1).to_i
# per_page = 15
# @forum_sections_pages = Paginator.new @forum_sections_count, per_page, page
# @forum_sections = forum_sections.limit(@forum_sections_pages.per_page).offset(@forum_sections_pages.offset).to_a
@forum_sections = paginate forum_sections
respond_to do |format|
format.html
format.js
end
end
def new

View File

@ -0,0 +1,16 @@
class Admins::MemoReplyListsController < Admins::BaseController
def index
@memo_hidden_type = params[:hidden] || ""
memos = Memo.where("parent_id is not null").includes(:author, :parent)
if @memo_hidden_type.present?
memos = memos.where(hidden: @memo_hidden_type.to_s == "hidden")
end
memos = memos.order("created_at desc")
@memos = paginate memos
respond_to do |format|
format.html
format.js
end
end
end

View File

@ -2,8 +2,6 @@ class Admins::MemosController < Admins::BaseController
# include Admins::BaseHelper
# 帖子
def index
@menu_type = 8
@sub_type = 3
@memo_hidden_type = params[:hidden] || ""
memos = Memo.where(parent_id: nil).includes(:author)
@ -18,38 +16,6 @@ class Admins::MemosController < Admins::BaseController
end
end
def apply_destroy_memos
@menu_type = 8
@sub_type = 2
memos = Memo.where(destroy_status: 1).includes(:author).order("created_at desc")
@memos = paginate memos
respond_to do |format|
format.html
format.js
end
end
def confirm_apply_destroy
memo = Memo.find(params[:id])
apply_status = params[:confirm]
if apply_status == "delete"
memo.destroy
extra = "d_2"
Tiding.create!(:user_id => memo.author_id, :trigger_user_id => 0,
container_id: memo.id, container_type: 'Memo',
:viewed => 0, :tiding_type => "System", :extra => "d_2")
else
memo.common!
memo.save
extra = "d_3"
Tiding.create!(:user_id => memo.author_id, :trigger_user_id => 0,
container_id: memo.id, container_type: 'Memo',
:viewed => 0, :tiding_type => "System", :extra => "d_3")
end
@status = 1
@message = "操作成功"
end
def memo_homepage_show
memo = Memo.find params[:id]
memo.update_column(:homepage_show, params[:checked]) unless memo.hidden?
@ -89,25 +55,25 @@ class Admins::MemosController < Admins::BaseController
def delete_memo
memo = Memo.find params[:id]
memo.destroy if memo.hidden?
redirect_to memo.parent_id.present? ? memo_reply_list_managements_path : messages_list_managements_path
redirect_to memo.parent_id.present? ? admins_memo_reply_lists_path : admins_memos_path
end
def memo_reply_list
@menu_type = 8
@sub_type = 4
@memo_hidden_type = params[:hidden] || ""
Rails.logger.info("======================sub_type==================#@sub_type")
# def memo_reply_list
# @menu_type = 8
# @sub_type = 4
# @memo_hidden_type = params[:hidden] || ""
# Rails.logger.info("======================sub_type==================#@sub_type")
memos = Memo.where("parent_id is not null").includes(:author, :parent)
if @memo_hidden_type.present?
memos = memos.where(hidden: @memo_hidden_type.to_s == "hidden")
end
memos = memos.order("created_at desc")
@memos = paginate memos
respond_to do |format|
format.html
format.js
end
end
# memos = Memo.where("parent_id is not null").includes(:author, :parent)
# if @memo_hidden_type.present?
# memos = memos.where(hidden: @memo_hidden_type.to_s == "hidden")
# end
# memos = memos.order("created_at desc")
# @memos = paginate memos
# respond_to do |format|
# format.html
# format.js
# end
# end
end

View File

@ -0,0 +1,15 @@
class Admins::UploadImagesController < Admins::BaseController
def create
@attachment = Attachment.new(:file => request.raw_post)
@attachment.author = User.current
@attachment.filename = params[:filename].presence || Redmine::Utils.random_hex(16)
if @attachment.save
@status = 1
else
@status = -1
end
respond_to do |format|
format.js
end
end
end

View File

@ -0,0 +1,2 @@
class CheckedAction < ApplicationRecord
end

View File

@ -1,31 +0,0 @@
<div class="edu-back-white mt20 mb20 clearfix padding20">
<ul class="fl mt2 nav_blueline_status">
<li class="<%= @banned_type == "banned" ? "active" : "" %>" >
<%= link_to "禁言用户 #{@banned_users_size > 0 ? "(#{@banned_users_size})" : ""}", admin_banned_users_path(banned_type: "banned"),remote: true %>
</li>
<li class="<%= @banned_type == "unbanned" ? "active" : "" %>">
<%= link_to "解除禁言记录", admin_banned_users_path(banned_type: "unbanned"),remote: true %>
</li>
</ul>
<ul class="fr">
<input type="text" name="search_banned_user" value="<%= @search_params %>" class="winput-240-35 fl mr10 " placeholder="请输入用户名称进行搜索">
<a href="javascript:void(0)" class="edu-default-btn edu-blueback-btn fl mr15 mt2" id="searchBanned">搜索</a>
<%= link_to "清除", admin_banned_users_path(search: nil, banned_type: @banned_type),remote: true, class: "edu-default-btn edu-greyback-btn fl mt2 mr15" %>
</ul>
</div>
<div id="banned-user-item">
<%= render partial: "admin/banned_users/banned_user_item" %>
</div>
<script>
$("#searchBanned").on("click",function () {
let task_status = "<%= @banned_type %>";
let search_name =$("input[name='search_banned_user']").val();
$.ajax({
url: "<%= admin_banned_users_path %>",
type: "get",
dataType: "script",
data: {banned_type:task_status,search: search_name }
});
});
</script>

View File

@ -1,3 +0,0 @@
<div class="edu-class-container" id="banned-users-container">
<%= render partial: "admin/banned_users/banned_users_items" %>
</div>

View File

@ -1 +0,0 @@
$("#banned-users-container").html("<%= j render partial: "admin/banned_users/banned_users_items" %>")

View File

@ -1,33 +0,0 @@
<div class="edu-back-white mt20 mb20 clearfix padding20">
<ul class="fl mt2 nav_blueline_status">
<li class="<%= @select_type == "unconfirm" ? "active" : "" %>" >
<%= link_to "待审批", admin_forum_applies_path(select_type: "unconfirm"),remote: true %>
</li>
<li class="<%= @select_type == "confirm" ? "active" : "" %>">
<%= link_to "已审批", admin_forum_applies_path(select_type: "confirm"),remote: true %>
</li>
</ul>
<ul class="fr">
<input type="text" name="search_section_name" value="<%= @section_name %>" class="winput-240-35 fl mr10 " placeholder="请输入板块名称进行检索">
<input type="text" name="search_user_name" value="<%= @search_name %>" class="winput-240-35 fl mr10 " placeholder="请输入用户名称进行检索">
<a href="javascript:void(0)" class="edu-default-btn edu-blueback-btn fl mr15 mt2" id="searchApplies">搜索</a>
<%= link_to "清除", admin_forum_applies_path(user_name: nil,section_name: nil, select_type: @select_type),remote: true, class: "edu-default-btn edu-greyback-btn fl mt2 mr15" %>
</ul>
</div>
<div id="forum-apply-item">
<%= render partial: "admin/forum_applies/forum_apply_item" %>
</div>
<script>
$("#searchApplies").on("click",function () {
let select_status = "<%= @select_type %>";
let search_name =$("input[name='search_user_name']").val();
let section_name = $("input[name='search_section_name']").val();
$.ajax({
url: "<%= admin_forum_applies_path %>",
type: "get",
dataType: "script",
data: {select_type:select_status,user_name: search_name, section_name: section_name }
});
});
</script>

View File

@ -1,3 +0,0 @@
<div class="edu-class-container" id="forum-applies-container">
<%= render partial: "admin/forum_applies/forum_applies_items" %>
</div>

View File

@ -1,8 +0,0 @@
<a href="javascript:void(0)" class="fl" ><%= children_forum.try(:title) %></a>
<span href="javascript:void(0)" class="menu_operate ml20 fr" onclick="first_menu_action(this)">
<i class="iconfont icon-sandian color-grey-6 font-12"> </i>
<div class="operateList">
<%= link_to "重命名", edit_admin_forum_section_path(children_forum, children_forum: true), remote: true %>
<%= link_to "删除", admin_forum_section_path(children_forum, children_forum: true),method: :delete, data:{confirm: "确认删除吗?"}, remote: true %>
</div>
</span>

View File

@ -1,3 +0,0 @@
<tr id="forum-section-detail-<%= forum.id %>">
<%= render partial: "admin/forum_sections/td_forum_section", locals: {forum: forum} %>
</tr>

View File

@ -1,49 +0,0 @@
<%=javascript_include_tag '../javascripts/attachments.js' %>
<div class="task-popup" style="width:500px;">
<div class="task-popup-title clearfix f14">
<%= parent_id.present? ? "新建二级版块" : "新建一级版块" %>
</div>
<%= form_tag(admin_forum_sections_path, method: :post, class: "", remote: true) do %>
<%= hidden_field_tag :parent_id,parent_id %>
<div class="task-popup-content ml55">
<div class="grid-item-top">
<span class="mr10 color-grey">名称:</span>
<div>
<%= text_field_tag :title, nil,class: "winput-300-35", placeholder: "请输入名称最大限制20个字符", maxlength: 20 %>
<div id="edit_forum_section_notice" class="none color-red">不能重名</div>
</div>
</div>
<div class="grid-item-top mt20">
<span class="mr10 color-grey">描述:</span>
<div>
<%= text_area_tag :description,nil,class: "width300", placeholder: "请输入描述", maxlength: 200, rows: 4 %>
<div id="new_forum_section_notice" class="none color-red">不能超过200字</div>
</div>
</div>
<div class="grid-item-top mt20">
<span class="mr10 color-grey">封面:</span>
<div>
<div class="upload-image-100 pointer" onclick="$('#_file_section_picture').click();" id="admin-logo-upload">
<div style="line-height: 100px;">上传封面</div>
</div>
<div class="none poa top-bottom-0">
<%=render partial: "admin/forum_sections/upload_logo" %>
</div>
<div class="font-12 color-grey">
尺寸 100*100支持.jpg .jpeg .bmp .gif .png格式照片。
</div>
</div>
</div>
</div>
<div class="cl"></div>
<div class="edu-txt-center mbt10">
<li class="inline">
<a href="javascript:void(0)" class="task-btn fl mr50" onclick="hideModal();">取消</a>
<%= submit_tag "确定", class: "edu-default-btn edu-blueback-btn" %>
</li>
</div>
<% end %>
</div>

View File

@ -1,19 +0,0 @@
<%= file_field_tag 'attachments[dummy][file]',
:id => "_file_section_picture",
:class => ie8? ? '':'file_selector',
:onchange => "addInputFiles_board(this, '','"+"submit_resource"+"');",
:style => ie8? ? '': 'display:none',
accept: 'image/png,image/gif,image/jpeg,image/jpg,image/bmp',
:data => {
:max_file_size => 5120.kilobytes,
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(5120.kilobytes)),
:max_concurrent_uploads => 1,
:upload_path => upload_image_path(:format => 'js'),
:description_placeholder => l(:label_optional_description),
:field_is_public => l(:field_is_public),
:are_you_sure => l(:text_are_you_sure),
:file_count => l(:label_file_count),
:delete_all_files => l(:text_are_you_sure_all),
:label_file_uploding => l(:label_file_uploding),
:containerid => ""
} %>

View File

@ -1,2 +0,0 @@
var htmlvalue = "<%= j render :partial => 'admin/forum_sections/edit_forum' %>";
pop_box_new(htmlvalue, 520, 400);

View File

@ -1,3 +0,0 @@
<div class="edu-class-container" id="forum-section-container">
<%= render partial: "managements/forums_plateSetting.html.erb" %>
</div>

View File

@ -1,2 +0,0 @@
var htmlvalue = "<%= j render :partial => 'admin/forum_sections/new_forum', locals: {parent_id: @parent_id} %>";
pop_box_new(htmlvalue, 520, 400);

View File

@ -1 +0,0 @@
$("#children-forum-section-<%= @forum_section.id %>").html("<%= j render partial: "admin/forum_sections/children_forum_sections", locals: {children_forums: @children_forums} %>")

View File

@ -1 +0,0 @@
$("#forum-section-recommend-<%= @forum_section.id %>").html("<%= j render partial: "admin/forum_sections/recommend_forum_sections", locals: {forum: @forum_section} %>")

View File

@ -0,0 +1,71 @@
<div class="box admin-list-container users-list-container">
<table class="table table-hover users-list-table">
<thead class="thead-light">
<tr>
<th width="9%">序号</th>
<th width="15%">作者</th>
<th width="32%" class="edu-txt-left" style="white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">标题</th>
<th width="18%">发布时间<i class="fa fa-long-arrow-down %> color-light-green ml5"></i></th>
<th>回复数</th>
<th width="18%">操作</th>
</tr>
</thead>
<tbody>
<% @memos.each_with_index do |memo,index| %>
<tr id="apply_destroy_memo_<%= memo.id %>">
<td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
<td>
<%= link_to(memo.try(:author).try(:show_real_name), "/users/#{memo.author.login}", target: "_blank") %>
</td>
<td class="edu-txt-left" style="white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">
<%= link_to(memo.subject, "/forums/#{memo.id}/detail", target: "_blank") %>
</td>
<td><%= format_time(memo.created_at) %></td>
<td>
<%= link_to(memo.replies_count, "/forums/#{memo.id}/detail", target: "_blank") %>
</td>
<td>
<%= link_to '拒绝', confirm_apply_destroy_admins_apply_destroy_index_path(id: memo.id, confirm: "reject"), method: :post, remote: true, data: {confirm: "拒绝删除该帖子吗?"} %>
<%= link_to '同意', confirm_apply_destroy_admins_apply_destroy_index_path(id: memo.id, confirm: "delete"), method: :post, remote: true, data: {confirm: "确认删除该帖子吗?"} %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<%= render partial: 'admins/shared/paginate', locals: { objects: @memos } %>
<script>
$(".magic-checkbox").on("click", function() {
var $link = $(this);
var id = $link.data('id');
var url = $link.data('url');
var checked = $link.is(':checked');
$.ajax({
url: url,
type: 'post',
data: {
id: id,
checked: checked
},
dataType: 'json',
success: function(data) {
if ($link.data('type') === 'hidden') {
console.log('#home_show_' + id, !checked);
$('#home_show_' + id).attr('disabled', !checked);
if (checked) {
$('.delete-link-' + id).hide();
} else {
$('.delete-link-' + id).show();
}
}
},
error: function() {
notice_box('操作失败');
$link.attr('checked', !checked);
}
})
});
</script>

View File

@ -0,0 +1 @@
$("#apply_destroy_memo_<%= params[:id] %>").remove()

View File

@ -0,0 +1,9 @@
<% define_admin_breadcrumbs do %>
<% add_admin_breadcrumb('申请删帖', admins_apply_destroy_index_path) %>
<% end %>
<div class="edu-class-container">
<div class="ex_container" id="apply_destory_memos">
<%= render :partial => "admins/apply_destroy/apply_destroy_memos_list" %>
</div>
</div>

View File

@ -0,0 +1 @@
$("#apply_destory_memos").html('<%= escape_javascript( render :partial => 'admins/apply_destroy/apply_destroy_memos_list') %>');

View File

@ -1,9 +1,7 @@
<div class="edu-back-white pl30 pr30 mb30">
<% if @banned_users_count == 0 %>
<%= render :partial => "welcome/no_data" %>
<% else %>
<% if @banned_users_count > 0 %>
<% @banned_users.each do |ban| %>
<% user = ban.user %>
<% author = ban.author %>
@ -36,12 +34,5 @@
<% end %>
<% end %>
<div style="text-align:center;" class="new_expand">
<div class="pages_user_show" style="width:auto; display:inline-block;margin: 18px 0;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @banned_users_pages, @banned_users_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>
<%= render partial: 'admins/shared/paginate', locals: { objects: @banned_users } %>
</div>

View File

@ -0,0 +1,32 @@
<div class="box admin-list-container users-list-container">
<ul class="fl mt2 nav_blueline_status">
<li class="<%= @banned_type == "banned" ? "active" : "" %>" >
<%= link_to "禁言用户 #{@banned_users_size > 0 ? "(#{@banned_users_size})" : ""}", admins_banned_users_path(banned_type: "banned"),remote: true %>
</li>
<li class="<%= @banned_type == "unbanned" ? "active" : "" %>">
<%= link_to "解除禁言记录", admins_banned_users_path(banned_type: "unbanned"),remote: true %>
</li>
</ul>
<ul class="fr">
<input type="text" name="search_banned_user" value="<%= @search_params %>" class="form-control mr15 fl width240" placeholder="请输入用户名称进行搜索">
<a href="javascript:void(0)" class="btn btn-primary fl mr15 btn-sm" id="searchBanned">搜索</a>
<%= link_to "清除", admins_banned_users_path(search: nil, banned_type: @banned_type),remote: true, class: "btn btn-secondary fl btn-sm" %>
</ul>
</div>
<div id="banned-user-item">
<%= render partial: "admins/banned_users/banned_user_item" %>
</div>
<script>
$("#searchBanned").on("click",function () {
let task_status = "<%= @banned_type %>";
let search_name =$("input[name='search_banned_user']").val();
$.ajax({
url: "<%= admins_banned_users_path %>",
type: "get",
dataType: "script",
data: {banned_type:task_status,search: search_name }
});
});
</script>

View File

@ -0,0 +1,6 @@
<% define_admin_breadcrumbs do %>
<% add_admin_breadcrumb('禁言列表', admins_banned_users_path) %>
<% end %>
<div class="edu-class-container" id="banned-users-container">
<%= render partial: "admins/banned_users/banned_users_items" %>
</div>

View File

@ -0,0 +1 @@
$("#banned-users-container").html("<%= j render partial: "admins/banned_users/banned_users_items" %>")

View File

@ -0,0 +1,33 @@
<div class="box admin-list-container users-list-container">
<ul class="fl mt2 nav_blueline_status">
<li class="<%= @select_type == "unconfirm" ? "active" : "" %>" >
<%= link_to "待审批", admins_forum_applies_path(select_type: "unconfirm"),remote: true %>
</li>
<li class="<%= @select_type == "confirm" ? "active" : "" %>">
<%= link_to "已审批", admins_forum_applies_path(select_type: "confirm"),remote: true %>
</li>
</ul>
<ul class="fr">
<input type="text" name="search_section_name" value="<%= @section_name %>" class="form-control mr15 fl width240 " placeholder="请输入板块名称进行检索">
<input type="text" name="search_user_name" value="<%= @search_name %>" class="form-control mr15 fl width240 " placeholder="请输入用户名称进行检索">
<a href="javascript:void(0)" class="btn btn-primary fl mr15 mt2 btn-sm" id="searchApplies">搜索</a>
<%= link_to "清除", admins_forum_applies_path(user_name: nil,section_name: nil, select_type: @select_type),remote: true, class: "btn btn-secondary fl btn-sm" %>
</ul>
</div>
<div id="forum-apply-item">
<%= render partial: "admins/forum_applies/forum_apply_item" %>
</div>
<script>
$("#searchApplies").on("click",function () {
let select_status = "<%= @select_type %>";
let search_name =$("input[name='search_user_name']").val();
let section_name = $("input[name='search_section_name']").val();
$.ajax({
url: "<%= admins_forum_applies_path %>",
type: "get",
dataType: "script",
data: {select_type:select_status,user_name: search_name, section_name: section_name }
});
});
</script>

View File

@ -1,8 +1,6 @@
<div class="edu-back-white pl30 pr30 mb30">
<!-- 签订协议托管-待审批 -->
<% if @forum_applies_count == 0 %>
<%= render :partial => "welcome/no_data" %>
<% else %>
<% if @forum_applies_count > 0 %>
<% @forum_applies.each do |apply| %>
<% user = apply&.user %>
<% if user.present? %>
@ -13,14 +11,8 @@
<% end %>
<% end %>
<div style="text-align:center;" class="new_expand">
<div class="pages_user_show" style="width:auto; display:inline-block;margin: 18px 0;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @forum_applies_pages, @forum_applies_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>
<%= render partial: 'admins/shared/paginate', locals: { objects: @forum_applies } %>
</div>
<script type="text/javascript">

View File

@ -20,7 +20,8 @@
<% end %>
<% else %>
<%= link_to "私信", message_detail_user_path(current_user, :user_id => apply.user_id), :class => "edu-default-btn edu-orangeline-btn ml20 fl",target:"_blank" %>
<a href="javascript:void(0)" class="edu-default-btn edu-blueline-btn ml20 fl" onclick='custom_confirm_remote_box("<%= confirm_apply_admin_forum_apply_path(id:apply.id,review_result:"0") %>","是否同意申请版主?","post");'>同意</a>
<%= link_to "同意", confirm_apply_admins_forum_apply_path(id:apply.id,review_result:"0"),remote: true, method: :post, class: "edu-default-btn edu-blueline-btn ml20 fl", data:{confirm: "是否同意申请版主?"} %>
<%# <%= link_to "拒绝", confirm_apply_admins_forum_apply_path(id:apply.id,review_result:"0"),remote: true, method: :post, class: "edu-default-btn edu-blueline-btn ml20 fl", data:{confirm: "是否同意申请版主?"} %> %>
<a href="javascript:void(0)" class="edu-default-btn edu-greyline-btn ml20 fl" onclick="refuseClick(<%= apply.id %>)">拒绝</a>
<% end %>
</span>
@ -32,7 +33,7 @@
<p class="color-orange lineh-35 mt10"><span class="fl color-orange mr5">拒绝原因:</span><%= apply&.reviews&.apply_forum&.first&.reason.to_s %></p>
<% end %>
<% if apply.is_confirm != 2 %>
<%= labelled_form_for apply, :url => confirm_apply_admin_forum_apply_path(apply, is_confirm: apply.is_confirm), :html => {id:"refuseContent_#{apply.id}",class:"none",method: :post, remote: true} do |f| %>
<%= labelled_form_for apply, :url => confirm_apply_admins_forum_apply_path(apply, is_confirm: apply.is_confirm), :html => {id:"refuseContent_#{apply.id}",class:"none",method: :post, remote: true} do |f| %>
<div class="df mt10">
<input type="hidden" id="review_result_type" name="review_result" value="1" />
<span class="refuse_reason color-orange mr5"><%= apply.is_confirm == 0 ? "拒绝原因" : "撤销审核原因" %>:</span>

View File

@ -3,7 +3,7 @@
<% if @is_confirm == 0 %>
$("#forum-apply-action-<%= @forum_apply.id %>").remove()
<% else %>
$("#forum-apply-action-<%= @forum_apply.id %>").html("<%= j render partial: "admin/forum_applies/item_list", locals: {user: @forum_apply.user, apply: @forum_apply} %>")
$("#forum-apply-action-<%= @forum_apply.id %>").html("<%= j render partial: "admins/forum_applies/item_list", locals: {user: @forum_apply.user, apply: @forum_apply} %>")
<% end %>
<% end %>
op_know("<%= @message %>")

View File

@ -0,0 +1,7 @@
<% define_admin_breadcrumbs do %>
<% add_admin_breadcrumb('版主审批', admins_forum_applies_path) %>
<% end %>
<div class="edu-class-container" id="forum-applies-container">
<%= render partial: "admins/forum_applies/forum_applies_items" %>
</div>

View File

@ -1 +1 @@
$("#forum-applies-container").html("<%= j render partial: "admin/forum_applies/forum_applies_items" %>")
$("#forum-applies-container").html("<%= j render partial: "admins/forum_applies/forum_applies_items" %>")

View File

@ -1,5 +1,5 @@
<% if @forum_status > 0 %>
$("#forum_sections_moderators_<%= @forum_section.id %>").html("<%= j render partial: "admin/forum_moderators/forum_moderator_item", locals: {users: @forum_moderators, forum: @forum_section} %>")
$("#forum_sections_moderators_<%= @forum_section.id %>").html("<%= j render partial: "admins/forum_moderators/forum_moderator_item", locals: {users: @forum_moderators, forum: @forum_section} %>")
op_know("添加成功")
<% else %>
op_know("没有选择版主")

View File

@ -1,4 +1,4 @@
var htmlvalue = "<%= j render :partial => 'admin/forum_moderators/new_forum_moderators' %>";
var htmlvalue = "<%= j render :partial => 'admins/forum_moderators/new_forum_moderators' %>";
pop_box_new(htmlvalue, 520, 400);
function search_forum_users(target) {

View File

@ -0,0 +1,8 @@
<a href="javascript:void(0)" class="fl" ><%= children_forum.try(:title) %></a>
<span href="javascript:void(0)" class="menu_operate ml20 fr" onclick="first_menu_action(this)">
<i class="iconfont icon-sandian color-grey-6 font-12"> </i>
<div class="operateList">
<%= link_to "重命名", edit_admins_forum_section_path(children_forum, children_forum: true), remote: true %>
<%= link_to "删除", admins_forum_section_path(children_forum, children_forum: true),method: :delete, data:{confirm: "确认删除吗?"}, remote: true %>
</div>
</span>

View File

@ -2,7 +2,7 @@
<ul class="set_l_submenu">
<% children_forums.each do |children_forum| %>
<li class="clearfix" id="children-forum-detail-<%= children_forum.id %>">
<%= render partial: "admin/forum_sections/children_forum_detail", locals: {children_forum: children_forum} %>
<%= render partial: "admins/forum_sections/children_forum_detail", locals: {children_forum: children_forum} %>
</li>
<% end %>
</ul>

View File

@ -3,7 +3,7 @@
<div class="task-popup-title clearfix f14">
<%= @forum_section.parent_id.present? ? "重命名二级版块" : "重命名一级版块" %>
</div>
<%= form_tag(admin_forum_section_path(@forum_section, children_forum: @children_forum), method: :put, class: "", remote: true) do %>
<%= form_tag(admins_forum_section_path(@forum_section, children_forum: @children_forum), method: :put, class: "", remote: true) do %>
<div class="task-popup-content ml55">
<div class="grid-item-top">
<span class="mr10 color-grey">名称:</span>
@ -24,13 +24,13 @@
<div>
<div class="upload-image-100 pointer" onclick="$('#_file_section_picture').click();" id="admin-logo-upload">
<% if @attachment.present? %>
<%= render partial: "admin/forum_sections/show_image_forum", locals: {logo_url: download_attachment_path(@attachment.id), attachment: @attachment, image_type: 'image'} %>
<%= render partial: "admins/forum_sections/show_image_forum", locals: {logo_url: download_attachment_path(@attachment.id), attachment: @attachment, image_type: 'image'} %>
<% else %>
<div style="line-height: 100px;">上传封面</div>
<% end %>
</div>
<div class="none poa top-bottom-0">
<%=render partial: "admin/forum_sections/upload_logo" %>
<%=render partial: "admins/forum_sections/upload_logo" %>
</div>
<div class="font-12 color-grey">
尺寸 100*100支持.jpg .jpeg .bmp .gif .png格式照片。

View File

@ -0,0 +1,3 @@
<tr id="forum-section-detail-<%= forum.id %>">
<%= render partial: "admins/forum_sections/td_forum_section", locals: {forum: forum} %>
</tr>

View File

@ -0,0 +1,73 @@
<div class="box admin-list-container users-list-container">
<table class="table table-hover users-list-table">
<thead class="thead-light">
<tr>
<th width="30%" class="edu-txt-left">
<span class="pl15">版块</span>
<%= javascript_void_link "<i class='fa fa-plus-circle'></i>".html_safe, class: 'btn btn-primary btn-sm', data: { toggle: 'modal', target: '.admins-add-forum-section-modal'}, parent_id: "" %>
</th>
<th width="30%">主页推荐</th>
<th width="40%" class="edu-txt-left"><span class="pl15">一级版主任命/解除</span></th>
</tr>
</thead>
<tbody id="forum-section-contents">
<% if @forum_sections_count > 0 %>
<% @forum_sections.each do |forum| %>
<%= render partial: "admins/forum_sections/forum_section_detail", locals: {forum: forum} %>
<% end %>
<% else %>
<tr id="forum-section-detail-no-data">
<td colspan="100">
没有数据
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="edu-back-white mt10">
<%= render partial: 'admins/shared/paginate', locals: { objects: @forum_sections } %>
</div>
<script>
function first_menu_click(that) {
var target = $(that);
var menu_i = target.find(".fa");
var children_tags = target.parent().parent().find(".set_l_submenu");
if(menu_i.hasClass("fa-plus-square-o")){
menu_i.removeClass("fa-plus-square-o").addClass("fa-minus-square-o");
children_tags.addClass("active")
}else{
menu_i.removeClass("fa-minus-square-o").addClass("fa-plus-square-o");
children_tags.removeClass("active")
}
}
function first_menu_action(that) {
var target = $(that);
var target_action = target.find(".operateList");
if(target_action.hasClass("active")){
$(".operateList").removeClass("active");
target_action.removeClass("active");
}else {
$(".operateList").removeClass("active");
target_action.addClass("active");
}
}
function recommend_form_submit(id) {
$("#"+id).trigger("click")
}
$(document).mouseup(function(e){
var _con = $('.menu_operate'); // 设置目标区域
if(!_con.is(e.target) && _con.has(e.target).length === 0){
_con.find(".operateList").removeClass("active")
}
});
</script>

View File

@ -0,0 +1,29 @@
<div class="task-popup" style="width:500px;"><div class="task-popup-title clearfix">提示</div>
<div class="task-popup-content">
<div class="df padding10-20">
<span class="fl mt3">名称:</span>
<div class="flex1">
<input type="text" class="input-100-35" name="itemName" placeholder="请输入名称最大限制20个字符"/>
<p class="mt5" style="height: 18px;line-height: 18px"><span class="color-red none" id="name_notice">请输入名称</span></p>
</div>
</div>
</div>
<div class="clearfix mb20 edu-txt-center">
<a href="javascript:void(0);" class="task-btn mr25" onclick="hideModal();">取消</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange" onclick="sureFun();">确定</a>
</div>
</div>
<script>
function sureFun() {
var name=$("input[name='itemName']").val();
if(name == ""){
$("#name_notice").removeClass("none").html("请输入名称");
return;
}else if(name.length > 20){
$("#name_notice").removeClass("none").html("名称内容不能超过20个字符");
return;
}else{
$("#name_notice").addClass("none").html("");
}
}
</script>

View File

@ -0,0 +1,45 @@
<div class="task-popup" style="width:500px;">
<div class="task-popup-title clearfix f14">
<%= parent_id.present? ? "新建二级版块" : "新建一级版块" %>
</div>
<%= form_tag(admins_forum_sections_path, method: :post, class: "", remote: true) do %>
<%= hidden_field_tag :parent_id,parent_id %>
<div class="task-popup-content ml55">
<div class="grid-item-top">
<span class="mr10 color-grey">名称:</span>
<div>
<%= text_field_tag :title, nil,class: "form-control input-lg", placeholder: "请输入名称最大限制20个字符", maxlength: 20 %>
<div id="edit_forum_section_notice" class="none color-red">不能重名</div>
</div>
</div>
<div class="grid-item-top mt20">
<span class="mr10 color-grey">描述:</span>
<div>
<%= text_area_tag :description,nil,class: "width300", placeholder: "请输入描述", maxlength: 200, rows: 4 %>
<div id="new_forum_section_notice" class="none color-red">不能超过200字</div>
</div>
</div>
<div class="grid-item-top mt20">
<span class="mr10 color-grey">封面:</span>
<div>
<div class="upload-image-100 pointer" onclick="$('#_file_section_picture').click();" id="admin-logo-upload">
<div style="line-height: 100px;">上传封面</div>
</div>
<div class="none poa top-bottom-0">
<%= render partial: "admins/forum_sections/upload_logo" %>
</div>
<div class="font-12 color-grey">
尺寸 100*100支持.jpg .jpeg .bmp .gif .png格式照片。
</div>
</div>
</div>
</div>
<div class="cl"></div>
<div class="edu-txt-center mbt10">
<li class="inline">
<a href="javascript:void(0)" class="task-btn fl mr50" onclick="hideModal();">取消</a>
<%= submit_tag "确定", class: "edu-default-btn edu-blueback-btn" %>
</li>
</div>
<% end %>
</div>

View File

@ -1,5 +1,5 @@
<p class="ml10">
<%= form_tag(recommend_forums_admin_forum_section_path(forum), method: :post, remote: true) do %>
<%= form_tag(recommend_forums_admins_forum_section_path(forum), method: :post, remote: true) do %>
<span class="fl mr15">
<%= radio_button_tag :is_recommend, 0, forum.is_recommend == 0, id: "forum_is_recommend_#{forum.id}_0", class: "magic-radio", onchange: "recommend_form_submit('forum_recommend_submit_#{forum.id}')" %>
<label for="forum_is_recommend_<%= forum.id %>_0">不推荐</label>

View File

@ -9,9 +9,9 @@
<i class="iconfont icon-sandian color-grey-6 font-12">
</i>
<div class="operateList">
<%= link_to "重命名", edit_admin_forum_section_path(forum), remote: true %>
<%= link_to "删除", admin_forum_section_path(forum),method: :delete, data:{confirm: "确认删除吗?"}, remote: true %>
<%= link_to "新增子版块".html_safe, new_admin_forum_section_path(parent_id: forum.id),remote: true %>
<%= link_to "重命名", edit_admins_forum_section_path(forum), remote: true %>
<%= link_to "删除", admins_forum_section_path(forum),method: :delete, data:{confirm: "确认删除吗?"}, remote: true %>
<%= link_to "新增子版块".html_safe, new_admins_forum_section_path(parent_id: forum.id),remote: true %>
<% if forum&.position.to_i != @min_position %>
<%= link_to "下移",move_admin_forum_section_path(forum,opr:"down"), method: :post, remote: true %>
<% end %>
@ -22,20 +22,20 @@
</span>
</div>
<div id="children-forum-section-<%= forum.id %>">
<%= render partial: "admin/forum_sections/children_forum_sections", locals: {children_forums: forum.get_children_section("desc")} %>
<%= render partial: "admins/forum_sections/children_forum_sections", locals: {children_forums: forum.get_children_section("desc")} %>
</div>
</li>
</td>
<td id="forum-section-recommend-<%= forum.id %>">
<%= render partial: "admin/forum_sections/recommend_forum_sections", locals: {forum: forum} %>
<%= render partial: "admins/forum_sections/recommend_forum_sections", locals: {forum: forum} %>
</td>
<td>
<div class="grid-item pbt5">
<div class="grid-item-1">
<%= link_to "<i class='fa fa-plus-square-o'></i>".html_safe,new_admin_forum_section_forum_moderator_path(forum), class: "font-20 color-blue mr10", title: "添加版主", remote: true %>
<%= link_to "<i class='fa fa-plus-square-o'></i>".html_safe,new_admins_forum_section_forum_moderator_path(forum), class: "font-20 color-blue mr10", title: "添加版主", remote: true %>
</div>
<div class="width100 inline-block edu-txt-left" id="forum_sections_moderators_<%= forum.id %>">
<%= render partial: "admin/forum_moderators/forum_moderator_item", locals: {users: forum.forum_moderators, forum: forum} %>
<%= render partial: "admins/forum_moderators/forum_moderator_item", locals: {users: forum.forum_moderators, forum: forum} %>
</div>
</div>

View File

@ -0,0 +1,20 @@
<%= file_field_tag 'attachments[dummy][file]',
:id => "_file_section_picture",
:class => 'file_selector',
:onchange => "addInputFiles_board(this);",
:style =>'display:none',
accept: 'image/png,image/gif,image/jpeg,image/jpg,image/bmp',
:data => {
:max_file_size => 5120.kilobytes,
:max_concurrent_uploads => 1,
:upload_path => admins_upload_images_path(:format => 'js'),
} %>
<script>
function addInputFiles_board(file) {
}
</script>

View File

@ -4,9 +4,9 @@
<% elsif @forum_status[:status] > 0 %>
op_know("<%= @forum_status[:msg] %>")
<% if params[:parent_id].present? %>
$("#forum-section-detail-<%= params[:parent_id] %>").html("<%= j render partial: "admin/forum_sections/td_forum_section", locals: {forum: @parent_forum} %>")
$("#forum-section-detail-<%= params[:parent_id] %>").html("<%= j render partial: "admins/forum_sections/td_forum_section", locals: {forum: @parent_forum} %>")
<% else %>
$("#forum-section-contents").prepend("<%= j render partial: "admin/forum_sections/forum_section_detail", locals: {forum: @forum_section} %>")
$("#forum-section-contents").prepend("<%= j render partial: "admins/forum_sections/forum_section_detail", locals: {forum: @forum_section} %>")
<% end %>
<% else %>

View File

@ -0,0 +1,2 @@
var htmlvalue = "<%= j render :partial => 'admins/forum_sections/edit_forum' %>";
pop_box_new(htmlvalue, 520, 400);

View File

@ -0,0 +1,11 @@
<% define_admin_breadcrumbs do %>
<% add_admin_breadcrumb('版块管理', admins_forum_sections_path) %>
<% end %>
<div class="edu-class-container">
<div class="ex_container" id="leave_message">
<%= render partial: "admins/forum_sections/forums_plateSetting.html.erb" %>
</div>
</div>
<%= render partial: 'admins/forum_sections/shared/add_section' %>

View File

@ -0,0 +1,2 @@
var htmlvalue = "<%= j render :partial => 'admins/forum_sections/new_forum', locals: {parent_id: @parent_id} %>";
pop_box_new(htmlvalue, 520, 400);

View File

@ -0,0 +1 @@
$("#children-forum-section-<%= @forum_section.id %>").html("<%= j render partial: "admins/forum_sections/children_forum_sections", locals: {children_forums: @children_forums} %>")

View File

@ -0,0 +1 @@
$("#forum-section-recommend-<%= @forum_section.id %>").html("<%= j render partial: "admins/forum_sections/recommend_forum_sections", locals: {forum: @forum_section} %>")

View File

@ -0,0 +1,54 @@
<% parent_id = params[:parent_id] %>
<div class="modal fade admins-add-forum-section-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"> <%= parent_id.present? ? "新建二级版块" : "新建一级版块" %></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<%= form_tag(admins_forum_sections_path, method: :post, class: "", remote: true) do %>
<div class="modal-body">
<%= hidden_field_tag :parent_id,parent_id %>
<div>
<div class="grid-item-top">
<span class="mr10 color-grey">名称:</span>
<div>
<%= text_field_tag :title, nil,class: "form-control input-lg", placeholder: "请输入名称最大限制20个字符", maxlength: 20 %>
</div>
</div>
<div class="grid-item-top mt20">
<span class="mr10 color-grey">描述:</span>
<div>
<%= text_area_tag :description,nil,class: "form-control input-lg", placeholder: "请输入描述", maxlength: 200, rows: 4 %>
</div>
</div>
<div class="grid-item-top mt20">
<span class="mr10 color-grey">封面:</span>
<div>
<div class="upload-image-100 pointer" onclick="$('#_file_section_picture').click();" id="admin-logo-upload">
<div style="line-height: 100px;">上传封面</div>
</div>
<div class="none poa top-bottom-0">
<input type="file" name="attachments[dummy][file]" id="_file_section_picture">
<%# <%=render partial: "admins/forum_sections/upload_logo"> %>
</div>
<div class="font-12 color-grey">
尺寸 100*100支持.jpg .jpeg .bmp .gif .png格式照片。
</div>
</div>
</div>
<div class="grid-item-top mt20 none" id="add-section-forum">
<%=render partial: "admins/forum_sections/shared/error_section", locals: {error_messages: ""} %>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
<%= submit_tag "确定", class: "btn btn-primary submit-btn" %>
</div>
<% end %>
</div>
</div>
</div>

View File

@ -0,0 +1,6 @@
<span class="mr10 color-grey">错误:</span>
<div class="color-red">
<%= error_messages %>
</div>

View File

@ -4,9 +4,9 @@ $("#edit_forum_section_notice").siblings("input").addClass("error_tip");
<% elsif @edit_forum_status[:status] > 0 %>
op_know("<%= @edit_forum_status[:msg] %>")
<% if params[:children_forum].present? %>
$("#children-forum-detail-<%= @forum_section.id %>").html("<%= j render partial: "admin/forum_sections/children_forum_detail", locals: {children_forum: @forum_section} %>")
$("#children-forum-detail-<%= @forum_section.id %>").html("<%= j render partial: "admins/forum_sections/children_forum_detail", locals: {children_forum: @forum_section} %>")
<% else %>
$("#forum-section-detail-<%= @forum_section.id %>").html("<%= j render partial: "admin/forum_sections/td_forum_section", locals: {forum: @forum_section} %>")
$("#forum-section-detail-<%= @forum_section.id %>").html("<%= j render partial: "admins/forum_sections/td_forum_section", locals: {forum: @forum_section} %>")
<% end %>
<% else %>
op_know("<%= @edit_forum_status[:msg] %>")

View File

@ -0,0 +1,89 @@
<div class="box search-form-container user-list-form">
<ul class="fl mt2 nav_blueline_status">
<li class="<%= @memo_hidden_type == "show" ? "active" : "" %>">
<%= link_to "已审核", admins_memo_reply_lists_path(hidden: "show"), remote: true, class: "cancel-type-choose" %>
</li>
<li class="<%= @memo_hidden_type == "hidden" ? "active" : "" %>">
<%= link_to "未审核", admins_memo_reply_lists_path(hidden: "hidden"), remote: true, class: "cancel-type-choose" %>
</li>
</ul>
</div>
<div class="box admin-list-container users-list-container">
<table class="table table-hover users-list-table">
<thead class="thead-light">
<tr>
<th width="6%">序号</th>
<th width="20%" class="edu-txt-left">来源</th>
<th width="30%" class="edu-txt-left" style="white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">评论内容</th>
<th width="10%">评论者</th>
<th width="12%">评论时间<i class="fa fa-long-arrow-down %> color-light-green ml5" ></i></th>
<th width="10%">审核</th>
<th width="10%">操作</th>
</tr>
</thead>
<tbody>
<% @memos.each_with_index do |memo,index| %>
<tr>
<td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
<td class="edu-txt-left" style="white-space:nowrap; overflow:hidden; text-overflow:ellipsis;padding-right: 10px;">
<%= link_to(memo.root.subject, forum_path(memo.root)+"/detail", :target => "_blank") %>
</td>
<td class="edu-txt-left" style="white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">
<%= sanitize memo.content %>
</td>
<td>
<%= link_to(memo.try(:author).try(:show_real_name), "/users/#{memo.author.login}", target: "_blank") %>
</td>
<td><%= format_time(memo.created_at) %></td>
<td>
<%= check_box_tag(:hidden, 1, !memo.hidden?, id: "hidden-check-box-#{memo.id}", class: 'magic-checkbox', data: { id: memo.id, url: memo_hidden_admins_memos_path, type: 'hidden' }) %>
<label for="hidden-check-box-<%= memo.id %>" style="top:-1px;left: 15px;"></label>
<span style="margin-left: 5px;">通过</span>
</td>
<td>
<%= link_to '查看', forum_path(memo.root)+"/detail?reply_id=#{memo.id}", target: '_blank' %>
<%= link_to '删除', delete_memo_admins_memos_path(id: memo.id), method: :delete, class: "delete-link-#{memo.id}", data: { confirm: '确认删除该帖子吗?' }, style: memo.hidden? ? '' : 'display: none' %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<%= render partial: 'admins/shared/paginate', locals: { objects: @memos } %>
<script>
$(".magic-checkbox").on("click", function() {
var $link = $(this);
var id = $link.data('id');
var url = $link.data('url');
var checked = $link.is(':checked');
$.ajax({
url: url,
type: 'post',
data: {
id: id,
checked: checked
},
dataType: 'json',
success: function(data) {
if ($link.data('type') === 'hidden') {
console.log('#home_show_' + id, !checked);
$('#home_show_' + id).attr('disabled', !checked);
if (checked) {
$('.delete-link-' + id).hide();
} else {
$('.delete-link-' + id).show();
}
}
},
error: function() {
notice_box('操作失败');
$link.attr('checked', !checked);
}
})
});
</script>

View File

@ -0,0 +1,9 @@
<% define_admin_breadcrumbs do %>
<% add_admin_breadcrumb('帖子管理', admins_memos_path) %>
<% end %>
<div class="edu-class-container">
<div class="ex_container" id="leave_message">
<%= render :partial => "admins/memo_reply_lists/message_list" %>
</div>
</div>

View File

@ -0,0 +1 @@
$("#leave_message").html('<%= escape_javascript( render :partial => 'admins/memo_reply_lists/message_list') %>');

View File

@ -29,13 +29,6 @@
</td>
<td class="edu-txt-left" style="white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">
<%= sanitize memo.content %>
<%
=begin%>
<%= link_to(forum_path(memo.parent, reply_id: memo.id)+"/detail", :target => "_blank") do %>
<%= sanitize memo.content %>
<% end %>
<%
=end%>
</td>
<td>
<%= link_to(memo.try(:author).try(:show_real_name), user_path(memo.author)) %>
@ -59,14 +52,8 @@
<% end %>
</tbody>
</table>
<div style="text-align:center;" class="new_expand">
<div class="pages_user_show" style="width:auto; display:inline-block;margin: 18px 0;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>
<%= render partial: 'admins/shared/paginate', locals: { objects: @memos } %>
<script>
$(".magic-checkbox").live("click", function () {
var $link = $(this);

View File

@ -1,4 +1,5 @@
<div class="edu-back-white mt20 mb20 clearfix padding20">
<div class="box search-form-container user-list-form">
<ul class="fl mt2 nav_blueline_status">
<li class="<%= @memo_hidden_type == "show" ? "active" : "" %>">
<%= link_to "已审核", admins_memos_path(hidden: "show"), remote: true, class: "cancel-type-choose" %>
@ -8,9 +9,9 @@
</li>
</ul>
</div>
<table class="edu-pop-table edu-txt-center" cellpadding="0" cellspacing="0" style="table-layout: fixed">
<thead>
<div class="box admin-list-container users-list-container">
<table class="table table-hover users-list-table">
<thead class="thead-light">
<tr>
<th width="9%">序号</th>
<th width="15%">作者</th>
@ -25,23 +26,23 @@
<tbody>
<% @memos.each_with_index do |memo,index| %>
<tr>
<td><%= (@obj_pages.page - 1) * @obj_pages.per_page + index + 1 %></td>
<td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
<td>
<%= link_to(memo.try(:author).try(:show_real_name), user_path(memo.author)) %>
<%= link_to(memo.try(:author).try(:show_real_name), "/users/#{memo.author.login}", target: "_blank") %>
</td>
<td class="edu-txt-left" style="white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">
<% if memo.parent_id.nil? || memo.subject.starts_with?('RE:')%>
<%= link_to(memo.subject, forum_path(memo)+"/detail") %>
<%= link_to(memo.subject, forum_path(memo)+"/detail",target: "_blank") %>
<% else %>
<%= link_to("RE:"+memo.subject, forum_path(memo)+"/detail", :target => "_blank") %>
<% end %>
</td>
<td><%= format_time(memo.created_at) %></td>
<td>
<%= link_to(memo.replies_count, forum_path(memo)+"/detail") %>
<%= link_to(memo.replies_count, forum_path(memo)+"/detail", target: "_blank") %>
</td>
<td>
<%= check_box_tag(:hidden, 1, !memo.hidden?, id: "hidden-check-box-#{memo.id}", class: 'magic-checkbox', data: { id: memo.id, url: memo_hidden_managements_path, type: 'hidden' }) %>
<%= check_box_tag(:hidden, 1, !memo.hidden?, id: "hidden-check-box-#{memo.id}", class: 'magic-checkbox', data: { id: memo.id, url: memo_hidden_admins_memos_path, type: 'hidden' }) %>
<label for="hidden-check-box-<%= memo.id %>" style="top:-1px;left: 15px;"></label>
<span style="margin-left: 5px;">通过</span>
</td>
@ -49,22 +50,25 @@
<p class="inline">
<span class="fl">
<%= check_box_tag(:home_show, 1, memo.homepage_show, id: "home_show_#{memo.id}", class: 'magic-checkbox', disabled: memo.hidden?,
data: { id: memo.id, url: memo_homepage_show_managements_path, type: 'home_show' }) %>
data: { id: memo.id, url: memo_homepage_show_admins_memos_path, type: 'home_show' }) %>
<label for="home_show_<%= memo.id %>">&nbsp;</label>
</span>
</p>
</td>
<td>
<%= link_to '查看', forum_path(memo), target: '_blank' %>
<%= link_to '删除', delete_memo_managements_path(id: memo.id), method: :delete, class: "delete-link-#{memo.id}", data: { confirm: '确认删除该帖子吗?' }, style: memo.hidden? ? '' : 'display: none' %>
<%= link_to '查看', forum_path(memo)+"/detail", target: '_blank' %>
<%= link_to '删除', delete_memo_admins_memos_path(id: memo.id), method: :delete, class: "delete-link-#{memo.id}", data: { confirm: '确认删除该帖子吗?' }, style: memo.hidden? ? '' : 'display: none' %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<%= render partial: 'admins/shared/paginate', locals: { objects: @memos } %>
<script>
$(".magic-checkbox").live("click", function() {
$(".magic-checkbox").on("click", function() {
var $link = $(this);
var id = $link.data('id');

View File

@ -1,6 +1,9 @@
<% define_admin_breadcrumbs do %>
<% add_admin_breadcrumb('帖子管理', admins_memos_path) %>
<% end %>
<div class="edu-class-container">
<div class="ex_container" id="leave_message">
<%= render :partial => "admins/memos/message_list" %>
</div>
</div>

View File

@ -0,0 +1 @@
$("#leave_message").html('<%= escape_javascript( render :partial => 'admins/memos/message_list') %>');

View File

@ -31,9 +31,9 @@
<li>
<%= sidebar_item_group('#memos-submenu', '交流论坛', icon: 'columns') do %>
<li><%= sidebar_item(admins_memos_path, '帖子', icon: 'columns', controller: 'admins-memos') %></li>
<li><%= sidebar_item(apply_destroy_memos_admins_memos_path, '申请删帖', icon: 'trash', controller: 'admins-memos') %></li>
<li><%= sidebar_item(memo_reply_list_admins_memos_path, '回复', icon: 'mail-reply-all', controller: 'admins-project_categories') %></li>
<li><%= sidebar_item(admins_project_licenses_path, '版块配置', icon: 'tags', controller: 'admins-forum_sections') %></li>
<li><%= sidebar_item(admins_apply_destroy_index_path, '申请删帖', icon: 'trash', controller: 'admins-apply_destroy') %></li>
<li><%= sidebar_item(admins_memo_reply_lists_path, '回复', icon: 'mail-reply-all', controller: 'admins-memo_reply_lists') %></li>
<li><%= sidebar_item(admins_forum_sections_path, '版块配置', icon: 'tags', controller: 'admins-forum_sections') %></li>
<li><%= sidebar_item(admins_banned_users_path, '禁言列表', icon: 'ban', controller: 'admins-banned_users') %></li>
<li><%= sidebar_item(admins_forum_applies_path, '版主审批', icon: 'check-square-o', controller: 'admins-forum_applies') %></li>
<% end %>

View File

@ -0,0 +1,3 @@
<% if @status > 0 %>
$("#admin-logo-upload").html("<%= j render partial: "admins/forum_sections/show_image_forum", locals: {logo_url: download_named_attachment_path(@attachment, @attachment.filename), attachment: @attachment, image_type: params[:image_type] || 'image' } %>")
<% end %>

View File

@ -462,19 +462,22 @@ Rails.application.routes.draw do
resources :project_categories
resources :project_licenses
resources :project_ignores
resources :banned_users do
resources :banned_users, only: [:index] do
collection do
post :confirm_banned
end
end
resources :apply_destroy, only: :index do
collection do
post :confirm_apply_destroy
end
end
resources :memo_reply_lists, only: :index
resources :memos, only: :index do
collection do
get 'apply_destroy_memos'
post 'confirm_apply_destroy'
post 'memo_homepage_show'
post 'memo_hidden'
delete 'delete_memo'
get 'memo_reply_list'
end
end
resources :forum_applies do
@ -482,6 +485,12 @@ Rails.application.routes.draw do
post :confirm_apply
end
end
# resources :banned_users, only: :index do
# member do
# post :confirm_banned
# end
# end
resources :upload_images, only: :create
resources :forum_sections do
member do
get "order_forums"

View File

@ -0,0 +1,14 @@
class CreateCheckedActions < ActiveRecord::Migration[5.2]
def change
create_table :checked_actions do |t|
t.integer "user_id"
t.string "action_type"
t.datetime "action_at"
t.integer "checkable_id"
t.string "checkable_type"
t.timestamps
end
add_index :checked_actions, :user_id
add_index :checked_actions, :action_type
end
end

View File

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe CheckedAction, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end