Merge branch 'dev_library' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into dev_library

dev_library
caishi 5 years ago
commit 784ddfbcb5

@ -1,11 +1,13 @@
class LibrariesController < ApplicationController
layout 'base_library'
before_filter :require_login
def index
libraries = Library.where(nil)
libraries =
if params[:filter] == 'mine'
if params[:type] == 'mine'
libraries.where(user_id: current_user.id).order('created_at desc')
else
libraries.where(status: :published).order('visited_count desc')
@ -14,11 +16,15 @@ class LibrariesController < ApplicationController
search = params[:search].to_s.strip
libraries = libraries.where('title LIKE ?', "%#{search}%") if search.present?
@libraries = paginateHelper libraries.includes(user: :user_extensions)
per_page = params[:per_page].to_i <= 0 ? 20 : params[:per_page].to_i
@libraries = paginateHelper libraries.includes(user: :user_extensions), per_page
end
def show
@library = Library.find(params[:id])
return redirect_to libraries_path unless admin_or_self?
@library_applies = @library.library_applies.where(status: :refused).order('created_at desc')
@library.increment_visited_count!
end
@ -28,22 +34,41 @@ class LibrariesController < ApplicationController
def create
@library = current_user.libraries.new
Libraries::SaveService.new(@library, current_user, params).call
redirect_to library_path(id: @library.id)
Libraries::SaveService.new(@library, current_user, form_params).call
if with_publish?
Libraries::SubmitService.new(current_library).call
redirect_to publish_success_libraries_path
else
flash[:message] = '保存成功'
render 'new'
end
rescue ActiveRecord::RecordInvalid => _
render 'new'
rescue Libraries::SubmitService::Error => ex
flash[:message] = ex.message
render 'new'
end
def edit
@library = current_library
redirect_to library_path(id: @library.id) unless @library.editable?
end
def update
@library = current_library
Libraries::SaveService.new(@library, current_user, params).call
redirect_to library_path(id: @library.id)
Libraries::SaveService.new(@library, current_user, form_params).call
if with_publish?
Libraries::SubmitService.new(current_library).call
redirect_to publish_success_libraries_path
else
flash[:message] = '保存成功'
render 'edit'
end
rescue ActiveRecord::RecordInvalid => _
render 'edit'
rescue Libraries::SubmitService::Error => ex
flash[:message] = ex.message
render 'edit'
end
def publish
@ -53,9 +78,28 @@ class LibrariesController < ApplicationController
render json: { status: 0, message: ex.message }
end
def publish_success
end
private
def current_library
@_current_library ||= current_user.libraries.find(params[:id])
end
def form_params
@_form_params ||= begin
hash = params[:library].presence || {}
hash[:attachment_ids] = (params[:attachments].presence || []).values.map{|h| h[:attachment_id]}
hash
end
end
def with_publish?
params[:apply_publish].to_s == 'true'
end
def admin_or_self?
@library.user_id == current_user.id || current_user.admin?
end
end

@ -7432,7 +7432,7 @@ def tiding_url tiding
when 'Department'
my_account_path
when 'Library'
tiding.tiding_type == 'System' ? library_applies_path : library_path(tiding.container_id)
tiding.tiding_type == 'Apply' ? library_applies_path : library_path(tiding.container_id)
end
end

@ -12,6 +12,8 @@ class Library < ActiveRecord::Base
validates :content, presence: true
validates :uuid, presence: true, uniqueness: true
acts_as_attachable
aasm(:status) do
state :pending, initiali: true
state :processing
@ -43,4 +45,8 @@ class Library < ActiveRecord::Base
def increment_visited_count!
Library.connection.execute("update libraries set visited_count = COALESCE(visited_count, 0) + 1 where id = #{id}")
end
def editable?
pending? || refused?
end
end

@ -359,12 +359,12 @@ class Tiding < ActiveRecord::Base
when 'Department'
"你选填的二级单位:#{self.container.try(:name)}(#{self.container.try(:school).name})因不符合规范,已被系统删除.请重新选择"
when 'Library'
library = Library.find_by(id: container_id)
library = Library.find_by_id(container_id)
if tiding_type == 'Apply'
"申请发布文库:#{library.try(:name)}"
"申请发布文库:#{library.try(:title)}"
elsif tiding_type == 'System'
text = status == 1 ? "审核已通过" : "审核未通过,<br/>原因:#{extra}"
"你提交的发布文库申请:#{library.try(:name)}#{text}"
"你提交的发布文库申请:#{library.try(:title)}#{text}"
end
else
logger.error "error type: 1"

@ -21,6 +21,8 @@ class Libraries::RefuseApplyService
library_apply.refuse
library_apply.save!
library.refuse!
# 将消息改为已处理
Tiding.where(container_id: library.id, container_type: 'Library', tiding_type: 'Apply', status: 0).update_all(status: 1)
notify_library_author!

@ -10,7 +10,7 @@
<% if defined?(container) && container && container.saved_attachments %>
<% container.attachments.each_with_index do |attachment, i| %>
<span class="attachment clearfix" id="attachments_p<%= i %>">
<i class="iconfont icon-fujian mr5 color-green fl mt7 font-14" aria-hidden="true"></i>
<i class="iconfont icon-fujian mr5 color-green fl font-14" aria-hidden="true"></i>
<% size = judge_Chinese_num attachment.filename %>
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'upload_filename readonly hidden color-grey fl', :size => size, :style => 'border:none; max-width:980px;white-space: nowrap; text-overflow:ellipsis;font-family: Consolas;', :readonly => 'readonly') %>
<span class="color-grey mr10 fl"><%= number_to_human_size attachment.filesize %></span>
@ -21,7 +21,7 @@
<% container.saved_attachments.each_with_index do |attachment, i| %>
<span class="attachment clearfix" id="attachments_p<%= i %>">
<label class="panel-form-label fl">&nbsp;</label>
<i class="iconfont icon-fujian mr5 color-green fl mt8 font-14" aria-hidden="true"></i>
<i class="iconfont icon-fujian mr5 color-green fl font-14" aria-hidden="true"></i>
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'hidden atta_input readonly color-grey fl', :style => 'border:none; max-width:980px;', :readonly => 'readonly') %>
<%= link_to('<i class="fa fa-trash-o mr5"></i>'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload fl mt2') unless attachment.id.nil? %>
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>

@ -25,6 +25,7 @@
<%= link_to "认证", department_ecs_path(:school_id => User.current.ec_school) %>
</li>
<% end %>
<li class="<%= params[:controller] == "libraries" ? "active" : "" %>"><%= link_to '文库', libraries_path %></li>
</ul>
<div class="posi-search" id="posi-search" style="display: none">
<div class="search-all clearfix">

@ -0,0 +1,71 @@
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="utf-8">
<title>
<%= h html_title %>
</title>
<meta name="description" content="高校智能课堂与综合实训平台"/>
<meta name="keywords" content="智能课堂,实训项目"/>
<%= csrf_meta_tag %>
<%= favicon %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'css/common', 'css/public', 'css/ketang', 'css/structure', 'prettify', 'css/courses', 'css/popup', 'css/syllabus', 'css/moduel', 'css/font-awesome', 'css/contest', 'css/font-awesome', 'css/edu-class', 'css/edu-popup', 'educoder/magic-check', 'css/edu-common', "css/edu-public", 'educoder/edu-main', 'educoder/edu-all' %>
<%= javascript_include_tag "avatars", "header", "attachments", 'prettify', "edu/application", 'jquery.datetimepicker.js', 'educoder/edu_application', 'educoder/edu_file' %>
<%= javascript_include_tag "/codemirror/lib/codemirror", "/codemirror/mode/javascript/javascript", "/codemirror/addon/hint/show-hint", "/codemirror/addon/hint/javascript-hint", "/codemirror/addon/selection/active-line", "/codemirror/addon/lint/javascript-lint", "/codemirror/addon/lint/css-lint", "/codemirror/addon/lint/lint", "/codemirror/addon/lint/json-lint", "/editormd/lib/codemirror/addon/lint/css-lint" %>
<%= stylesheet_link_tag "/codemirror/lib/codemirror" %>
<%= stylesheet_link_tag '/editormd/css/editormd' %>
<%= javascript_include_tag '/editormd/editormd', '/editormd/lib/marked.min.js', '/editormd/lib/prettify.min.js', '/editormd/lib/raphael.min.js', '/editormd/lib/underscore.min.js', '/editormd/lib/sequence-diagram.min.js',
'/editormd/lib/flowchart.min.js', '/editormd/lib/jquery.flowchart.min.js', '/editormd/editormd.js' %>
<%= yield :header_tags -%>
<!-- MathJax的配置 -->
<script type="text/javascript" src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
showMathMenu: false,
showMathMenuMSIE: false,
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
</head>
<!--add by huang-->
<body onload="prettyPrint();" style="height: 100%;background: #fff">
<div class="newContainer"> <!-- 页面全部内容 -->
<div class="newHeader" id="nHeader"> <!-- 头部 -->
<% if User.current.logged? %>
<%= render :partial => 'layouts/logined_header' %>
<% else %>
<%= render :partial => 'layouts/unlogin_header' %>
<% end %>
</div>
<div class="cl"></div>
<div class="newMain clearfix">
<%= yield %>
<!-------------------侧边提示区域-------------------------->
<%= render :partial => 'users/returnTop_btn' %>
</div>
<!----------------------- 左侧导航栏 ----------------------------->
<%#= render :partial => 'layouts/public_left_info' %>
<%= render :partial => 'layouts/footer' %>
<div class="cl"></div>
<%#= render :partial => 'layouts/new_feedback' %>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>
<div id="ajax-notice" style="display: none; text-align: center; bottom: 200px; left: 50%; margin-left: -70px; background: #a1a1a1; width: 140px; height: 80px; position: absolute; z-index: 999999;">
<p id="ajax_notice_p" style="text-align: center; color: #fff; font-size: 18px; padding-top: 26px;">分数已保存</p>
</div>
<div id="ajax-modal" style="display:none;"></div>
<%= call_hook :view_layouts_base_body_bottom %>
</div>
</body>
<script>
</script>
</html>

@ -0,0 +1,115 @@
<p class="lineh-25 font-22 mb20">上传文档</p>
<div class="library-form-container">
<%= form_for(@library) do |f| %>
<%= hidden_field_tag :apply_publish, false %>
<div class="edu-back-white">
<div class="padding30">
<p class="clearfix mb20">
<span class="upload_Title">标题</span>
<%= f.text_field :title, placeholder: '例如:软件工程教学案例', class: 'greyInput winput-240-35 mr20 fl' %>
<span class="color-grey-c font-12 fl mt5">简明扼要介绍文档&视频所包含的主要的内容</span>
</p>
<div>
<%= render partial: 'attachments/from_libraries', locals: { container: @library } %>
</div>
</div>
<div class="padding30 bor-top-greyE">
<div class="clearfix df">
<span class="upload_Title">描述</span>
<div class="flex1">
<div id="libraries_description">
<%= f.text_area :content %>
</div>
</div>
</div>
</div>
<div class="padding30 bor-top-greyE">
<li class="lineh-25 color-grey-6 font-18 mb20">审核说明</li>
<ul class="font-16">
<li>平台管理员将对每天新上传的文档进行审核,审核通过的文档将公开显示,否则将私有化或移除</li>
</ul>
</div>
<div class="padding30 bor-top-greyE">
<li class="lineh-25 color-grey-6 font-18 mb20">温馨提示</li>
<ul class="font-16">
<li>1.请勿上传已设置加密或只读的文档资源</li>
<li>2.可以上传教学积累和撰写的文档资料如教学案例、总结、心得等上传支持的文件最大容量100MB</li>
<li>3.上传涉及侵权内容的文档将会被移除。</li>
<li>4.为营造绿色网络环境,严禁上传违反国家关于互联网相关规定的内容</li>
<li>5.ChromeFirefoxSafariIE11及以上版本浏览器上传</li>
</ul>
</div>
</div>
<div class="operate mt20 mb20 clearfix">
<%= link_to '确认提交', 'javascript:void(0)', class: 'white-btn edu-blueback-btn changebtn mr20 fl apply-publish-btn' %>
<%= link_to '保存', 'javascript:void(0)', class: 'white-btn edu-blueline-btn changebtn mr20 fl submit-btn' %>
</div>
<% end %>
</div>
<script>
/* ------------------------------- 描述md ------------------------------*/
var editormd = editormd("libraries_description", {
width: "100%",
height: 210,
syncScrolling: "single",
//你的lib目录的路径我这边用JSP做测试的
path: "/editormd/lib/",
tex: true,
watch:false,
toolbarIcons: function () {
// Or return editormd.toolbarModes[name]; // full, simple, mini
// Using "||" set icons align right.
return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"]
},
toolbarCustomIcons: {
testIcon: "<a type=\"inline\" class=\"latex\" ><div class='zbg'></div></a>",
testIcon1: "<a type=\"latex\" class=\"latex\" ><div class='zbg_latex'></div></a>"
},
//这个配置在simple.html中并没有但是为了能够提交表单使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中方便post提交表单。
saveHTMLToTextarea: true,
autoFocus: false,
// 用于增加自定义工具栏的功能可以直接插入HTML标签不使用默认的元素创建图标
dialogMaskOpacity: 0.6,
placeholder: "请输入参考答案",
imageUpload: true,
imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"],
imageUploadURL: "<%= upload_with_markdown_path(container_id: 0, container_type: 'MarkDown') %>" //url
});
$(function(){
var submitForm = function(){
var title = $("input[name='library[title]']").val();
var content = $("textarea[name='library[content]']").val();
if (!title || title.length == 0) {
alert('请输入标题');
return
}
if (!content || content.length == 0) {
alert('请输入描述');
return
}
if($('.attachments_fields .attachment').length == 0){
alert('请上传附件');
return
}
$('.library-form-container form').submit();
};
$('.apply-publish-btn').on('click', function(){
$('input[name="apply_publish"]').val(true);
submitForm();
});
$('.submit-btn').on('click', submitForm);
var message = '<%= flash[:message] %>';
if (message.length > 0) {
alert(message);
}
})
</script>

@ -0,0 +1,28 @@
<div class="library_list">
<% if @libraries.present? %>
<% @libraries.each do |library| %>
<li class="library_list_item">
<img src="/<%= url_to_avatar(library.user) %>" width="50" height="50" class="radius mr15 mt3">
<div class="flex1">
<p class="task-hide font-16 mb15 lineh-20"><%= link_to library.title, library_path(library) %></p>
<p class="clearfix lineh-20">
<span class="color-grey-3 mr20"><%= link_to library.user.show_real_name, user_path(library.user) %></span>
<span class="color-grey-c mr20"><%= library.visited_count || 0 %> 浏览</span>
<span class="color-grey-c mr20">发布时间:<%= library.published_at.try(:strftime, '%Y-%m-%d %H:%M') %></span>
</p>
</div>
</li>
<% end %>
<% else %>
<%= render :partial => "welcome/no_data" %>
<% end %>
</div>
<div class="mt30 mb50 edu-txt-center clearfix">
<!--这里放分页-->
<div class="inline pages_user_show">
<ul>
<%= 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>

@ -0,0 +1,8 @@
<div class="educontent mb50">
<p class="mt10 mb20 clearfix lineh-20">
<%= link_to '文库', libraries_path, class: 'color-grey-9' %> &gt;
<span class="color-grey-3">编辑</span>
</p>
<%= render partial: 'form' %>
</div>

@ -2,53 +2,26 @@
<div class="edu-back-white mb30 mt30">
<p class="padding20-30 clearfix bor-bottom-greyE">
<span class="font-18 fl color-grey-3">文库</span>
<a href="javascript:void(0)" class="fr color-blue font-16 mt3">新建</a>
<%= link_to '新建', new_library_path, class: 'fr color-blue font-16 mt3' %>
</p>
<div class="clearfix pt20 pl30 pr30">
<ul class="fl library_nav">
<li class="active">全部</li>
<li>我的</li>
</ul>
<div class="pr fr"></div>
</div>
</div>
<div class="library_list">
<li class="library_list_item">
<img src="http://img4.duitang.com/uploads/item/201412/01/20141201183854_TRArc.thumb.700_0.png" width="50" height="50" class="radius mr15 mt3">
<div class="flex1">
<p class="task-hide font-16 mb15 lineh-20">软件项目的开发流程视频及其需求规格软件项目的开发流程视频及其需求规格软件项目的开发流程视频及其需求规格软件项目的开发流程视频及其需求规格软件项目的开发流程视频及其需求规格</p>
<p class="clearfix lineh-20">
<span class="color-grey-3 mr20">张莉</span>
<span class="color-grey-c mr20">188 浏览</span>
<span class="color-grey-c mr20">发布时间2018-05-15 15:45</span>
</p>
</div>
<li class="<%= params[:type] == 'mine' ? '' : 'active' %>">
<%= link_to '全部', libraries_path(search: params[:search]), remote: true %>
</li>
<li class="library_list_item">
<img src="http://img4.duitang.com/uploads/item/201412/01/20141201183854_TRArc.thumb.700_0.png" width="50" height="50" class="radius mr15 mt3">
<div class="flex1">
<p class="task-hide font-16 mb15 lineh-20">软件项目的开发流程视频及其需求规格软件项目的开发流程视频及其需求规格软件项目的开发流程视频及其需求规格软件项目的开发流程视频及其需求规格软件项目的开发流程视频及其需求规格</p>
<p class="clearfix lineh-20">
<span class="color-grey-3 mr20">张莉</span>
<span class="color-grey-c mr20">188 浏览</span>
<span class="color-grey-c mr20">发布时间2018-05-15 15:45</span>
</p>
</div>
<li class="<%= params[:type] == 'mine' ? 'active' : '' %>">
<%= link_to '我的', libraries_path(search: params[:search], type: 'mine'), remote: true %>
</li>
<li class="library_list_item">
<img src="http://img4.duitang.com/uploads/item/201412/01/20141201183854_TRArc.thumb.700_0.png" width="50" height="50" class="radius mr15 mt3">
<div class="flex1">
<p class="task-hide font-16 mb15 lineh-20">软件项目的开发流程视频及其需求规格软件项目的开发流程视频及其需求规格软件项目的开发流程视频及其需求规格软件项目的开发流程视频及其需求规格软件项目的开发流程视频及其需求规格</p>
<p class="clearfix lineh-20">
<span class="color-grey-3 mr20">张莉</span>
<span class="color-grey-c mr20">188 浏览</span>
<span class="color-grey-c mr20">发布时间2018-05-15 15:45</span>
</p>
</ul>
<div class="edu-position fr">
<%= hidden_field_tag(:type, params[:type]) %>
<input class="winput-240-30 panel-box-sizing" placeholder="输入文库标题、编号进行检索" type="text" id="search_name">
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey" id="search"><i class="fa fa-search"></i></a>
</div>
</div>
</li>
</div>
<div class="mt30 mb50 edu-txt-center clearfix">
<!--这里放分页-->
<div class="library-list-container">
<%= render partial: 'library_list' %>
</div>
</div>
<script>
@ -56,6 +29,23 @@
$(".library_nav").on("click","li",function(){
$(".library_nav li").removeClass("active");
$(this).addClass("active");
})
});
var searchFunc = function() {
var search = $("#search_name").val();
var type = $("input[name='type']").val();
$.ajax({
url: "/libraries",
dataType: 'script',
data: {search: search, type: type}
});
};
$("#search").live("click", searchFunc);
$('#search_name').bind('keypress',function(event) {
if (event.keyCode == "13") {
searchFunc();
}
});
})
</script>

@ -0,0 +1,3 @@
$('input[name="type"]').val('<%= params[:type].to_s %>');
$('#search_name').val('<%= params[:search].to_s %>');
$('.library-list-container').html('<%= j render(partial: 'library_list') %>')

@ -1,81 +1,8 @@
<%= javascript_include_tag "/codemirror/lib/codemirror", "/codemirror/mode/javascript/javascript", "/codemirror/addon/hint/show-hint", "/codemirror/addon/hint/javascript-hint", "/codemirror/addon/selection/active-line", "/codemirror/addon/lint/javascript-lint", "/codemirror/addon/lint/css-lint", "/codemirror/addon/lint/lint", "/codemirror/addon/lint/json-lint", "/editormd/lib/codemirror/addon/lint/css-lint" %>
<%= stylesheet_link_tag "/codemirror/lib/codemirror" %>
<%= stylesheet_link_tag '/editormd/css/editormd' %>
<%= javascript_include_tag '/editormd/editormd' %>
<div class="educontent mb50">
<p class="mt10 mb20 clearfix lineh-20">
<a href="javascript:void(0)" class="color-grey-9">胡莎莎</a> &gt;
<a href="javascript:void(0)" class="color-grey-9">文库</a> &gt;
<%= link_to '文库', libraries_path, class: 'color-grey-9' %> &gt;
<span class="color-grey-3">新建</span>
</p>
<p class="lineh-25 font-22 mb20">上传文档</p>
<div class="edu-back-white">
<div class="padding30">
<p class="clearfix mb20">
<span class="upload_Title">标题</span>
<input type="text" class="greyInput winput-240-35 mr20 fl" placeholder="例如:软件工程教学案例"/>
<span class="color-grey-c font-12 fl mt5">简明扼要介绍文档&视频所包含的主要的内容</span>
</p>
<div>
<%= render :partial => 'attachments/from_libraries', :locals => {:container => @homework} %>
</div>
</div>
<div class="padding30 bor-top-greyE">
<div class="clearfix df">
<span class="upload_Title">描述</span>
<div class="flex1">
<div id="libraries_description">
<textarea name="libraries[description]"><%#= @introduction_sample || @shixun.description %></textarea>
</div>
</div>
</div>
</div>
<div class="padding30 bor-top-greyE">
<li class="lineh-25 color-grey-6 font-18 mb20">审核说明</li>
<ul class="font-16">
<li>平台管理员将对每天新上传的文档进行审核,审核通过的文档将公开显示,否则将私有化或移除</li>
</ul>
</div>
<div class="padding30 bor-top-greyE">
<li class="lineh-25 color-grey-6 font-18 mb20">温馨提示</li>
<ul class="font-16">
<li>1.请勿上传已设置加密或只读的文档资源</li>
<li>2.可以上传教学积累和撰写的文档资料如教学案例、总结、心得等上传支持的文件最大容量100MB</li>
<li>3.上传涉及侵权内容的文档将会被移除。</li>
<li>4.为营造绿色网络环境,严禁上传违反国家关于互联网相关规定的内容</li>
<li>5.ChromeFirefoxSafariIE11及以上版本浏览器上传</li>
</ul>
</div>
</div>
</div>
<script>
/* ------------------------------- 描述md ------------------------------*/
var shixun_editormd = editormd("libraries_description", {
width: "100%",
height: 210,
syncScrolling: "single",
//你的lib目录的路径我这边用JSP做测试的
path: "/editormd/lib/",
tex: true,
watch:false,
toolbarIcons: function () {
// Or return editormd.toolbarModes[name]; // full, simple, mini
// Using "||" set icons align right.
return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"]
},
toolbarCustomIcons: {
testIcon: "<a type=\"inline\" class=\"latex\" ><div class='zbg'></div></a>",
testIcon1: "<a type=\"latex\" class=\"latex\" ><div class='zbg_latex'></div></a>"
},
//这个配置在simple.html中并没有但是为了能够提交表单使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中方便post提交表单。
saveHTMLToTextarea: true,
autoFocus: false,
// 用于增加自定义工具栏的功能可以直接插入HTML标签不使用默认的元素创建图标
dialogMaskOpacity: 0.6,
placeholder: "请输入参考答案",
imageUpload: true,
imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"],
imageUploadURL: "<%#= upload_with_markdown_path(:container_id => @shixun.id, :container_type => @shixun.class) %>" //url
});
</script>
<%= render partial: 'form' %>
</div>

@ -1,4 +1,3 @@
<div class="educontent edu-back-white mt20 successPage">
<div>
<img src="/images/educoder/success.png" width="100" class="mb30">
@ -8,8 +7,8 @@
</div>
<p class="lineh-30 ed-txt-center font-16 color-grey-9 font-bd mb15">通过平台管理员审核后,即可公开显示</p>
<li class="inline">
<a href="javascript:void(0)" class="white-btn edu-blueline-btn changebtn mr20 fl">查看已上传文档</a>
<a href="javascript:void(0)" class="white-btn edu-blueback-btn changebtn fl">继续上传</a>
<%= link_to '查看已上传文档', libraries_path(type: 'mine'), class: 'white-btn edu-blueline-btn changebtn mr20 fl' %>
<%= link_to '继续上传', new_library_path, class: 'white-btn edu-blueback-btn changebtn fl' %>
</li>
</div>
</div>

@ -1,15 +1,26 @@
<%
admin_or_self = User.current.admin? || @library.user_id == User.current.id
%>
<div class="educontent mb50">
<p class="mt10 mb20 clearfix lineh-20">
<a href="javascript:void(0)" class="color-grey-9">胡莎莎</a> &gt;
<a href="javascript:void(0)" class="color-grey-9">文库</a> &gt;
<span class="color-grey-3">新建</span>
<%= link_to '文库', libraries_path, class: 'color-grey-9' %> &gt;
<span class="color-grey-3">详情</span>
</p>
<p class="lineh-25 mb20 clearfix">
<span class="font-22 fl mr10 task-hide" style="max-width: 800px">C语言程序教学案例</span>
<span class="font-22 fl mr10 task-hide" style="max-width: 800px"><%= @library.title %></span>
<% if admin_or_self %>
<% if @library.pending? %>
<span class="fl edu-filter-btn edu-activity-green mt5">草稿</span>
<a href="javascript:void(0)" class="fr color-grey-9 mt5">返回</a>
<% elsif @library.processing? %>
<span class="fl edu-filter-btn edu-activity-green mt5">审核中</span>
<% elsif @library.refused? %>
<span class="fl edu-filter-btn edu-activity-orange mt5">未通过</span>
<% end %>
<% end %>
<%= link_to('返回', libraries_path, class: 'fr color-grey-9 mt5') %>
</p>
<div class="edu-back-white">
<% if admin_or_self && !@library.published? && @library_applies.size > 0 %>
<div class="padding30">
<p class="mb10 clearfix">
<span class="color-grey-6 font-16 mr10">私有化原因</span>
@ -17,41 +28,42 @@
<a href="javascript:void(0)" class="color-blue fr" at="0" onclick="getMore(this)">点击展开<i class="iconfont icon-xiajiantou color-blue font-14 ml5"></i></a>
</p>
<div class="private_reason">
<% @library_applies.each do |apply| %>
<li>
<p class="color-grey-9">2018-12-25 03:58</p>
<p class="lineh-25 font-16 break-word">文档&视频的任何位置(包括文档标题、简介、文档等),都不允许出现任何有推广或宣传目的内容,如电话号码、电子邮箱地址、即时通讯工具号码等具体联系信息以及广告宣传语等,其中被警告多次而仍然添加广告内容的用户会被判定为广告用户,将接受封号处罚。</p>
</li>
<li>
<p class="color-grey-9">2018-12-25 03:58</p>
<p class="lineh-25 font-16 break-word">文档&视频的任何位置(包括文档标题、简介、文档等),都不允许出现任何有推广或宣传目的内容,如电话号码、电子邮箱地址、即时通讯工具号码等具体联系信息宣传语等,其中被警告多次而仍然添加广告内容的用户会被判定为广告用户,将接受封号处罚。</p>
<p class="color-grey-9"><%= apply.updated_at.strftime('%Y-%m-%d %H:%M') %></p>
<p class="lineh-25 font-16 break-word"><%= apply.reason %></p>
</li>
<% end %>
</div>
</div>
<% end %>
<div class="padding30 bor-top-greyE">
<p class="mb10 clearfix">
<span class="color-grey-6 font-16 mr10">详情</span>
<a href="javascript:void(0)" class="white-btn edu-blueline-btn fr">编辑</a>
<% if admin_or_self && @library.editable? %>
<%= link_to '编辑', edit_library_path(id: @library.id), class: 'white-btn edu-blueline-btn fr' %>
<% end %>
</p>
<div class="df mb20">
<img src="http://img4.duitang.com/uploads/item/201412/01/20141201183854_TRArc.thumb.700_0.png" width="50" height="50" class="radius mr15 mt3"/>
<img src="<%= url_to_avatar(@library.user) %>" width="50" height="50" class="radius mr15 mt3"/>
<div class="flex1">
<li class="font-16">胡莎莎</li>
<li class="font-16"><%= @library.user.show_real_name %></li>
<li class="clearfix">
<span class="fl color-grey-9 mr20">国防科技大学</span>
<span class="fl color-grey-9">教授</span>
<span class="fl color-grey-9 mr20"><%= @library.user.school_name %></span>
<span class="fl color-grey-9"><%= @library.user.identity %></span>
<span class="fr">
<span class="fl color-grey-9 mr30">编码:<span class="color-grey-6">2018120409235950611737</span></span>
<span class="fl color-grey-9">上传时间:<span class="color-grey-6">2018-12-04 09:23</span></span>
<span class="fl color-grey-9 mr30">编码:<span class="color-grey-6"><%= @library.uuid %></span></span>
<span class="fl color-grey-9">上传时间:<span class="color-grey-6"><%= @library.created_at.strftime('%Y-%m-%d %H:%M') %></span></span>
</span>
</li>
</div>
</div>
<div>
<div class="break_full_word new_li" id="labraries_editorMd_content">
<textarea style="display:none;"><!---内容---></textarea>
<textarea style="display:none;"><%= @library.content %></textarea>
</div>
<div class="mt10">
<!--附件-->
<%= render partial: 'attachments/links', locals: { attachments: @library.attachments, options: {} } %>
</div>
</div>
</div>
@ -63,11 +75,11 @@
if(at=="0"){
$(item).html('点击收起<i class="iconfont icon-shangjiantou color-blue font-14 ml5"></i>');
$(item).attr("at","1");
$(".private_reason").css({height:"auto"});
$(".private_reason").css({maxHeight:"unset"});
}else{
$(item).html('点击展开<i class="iconfont icon-xiajiantou color-blue font-14 ml5"></i>');
$(item).attr("at","0");
$(".private_reason").css({height:"166px"});
$(".private_reason").css({maxHeight:"150px"});
}
}
var homeworkDescr = editormd.markdownToHTML("labraries_editorMd_content", {
@ -78,19 +90,3 @@
sequenceDiagram: true // 默认不解析
});
</script>
<div class="educontent edu-back-white mt20 successPage">
<div>
<img src="/images/educoder/success.png" width="100" class="mb30">
<div class="lineh-30 ed-txt-center font-24 color-grey-3 font-bd mb15">
<p>恭喜!</p>
<p>文档上传成功</p>
</div>
<p class="lineh-30 ed-txt-center font-16 color-grey-9 font-bd mb15">通过平台管理员审核后,即可公开显示</p>
<li class="inline">
<a href="javascript:void(0)" class="white-btn edu-blueline-btn changebtn mr20 fl">查看已上传文档</a>
<a href="javascript:void(0)" class="white-btn edu-blueback-btn changebtn fl">继续上传</a>
</li>
</div>
</div>

@ -66,7 +66,7 @@
if (data && data.status != -1) {
$('#authentication_list .admin-con-box.apply-' + id).remove();
if($('#authentication_list .admin-con-box').length < 5){
if($('#authentication_list .admin-con-box').length == 0){
location.reload();
}
} else {

@ -77,7 +77,7 @@
if (data && data.status != -1) {
$('#authentication_list .admin-con-box.apply-' + id).remove();
if($('#authentication_list .admin-con-box').length < 5){
if($('#authentication_list .admin-con-box').length == 0){
location.reload();
}
} else {

@ -2659,7 +2659,7 @@ RedmineApp::Application.routes.draw do ## oauth相关
resource :sso, only: [:show, :create]
resources :libraries do
post :publish, on: :member
get :publish_success, on: :collection
end
get '/:sub_dir_name', :to => 'org_subfields#show', :as => 'show_subfield_without_id'

@ -7,7 +7,7 @@ class CreateLibraries < ActiveRecord::Migration
t.text :content
t.string :uuid, unique: true
t.string :status
t.integer :visited_count
t.integer :visited_count, default: 0
t.datetime :published_at
t.timestamps

@ -3355,7 +3355,7 @@ line-height: 16px;display: inline-block;color: rgba(65, 140, 205, 1) !important;
width: 100%;background: #F2F9FF;justify-content: center;align-items: center;display: -webkit-flex;text-align: center;
height: 120px;border-radius: 4px;border:1px dashed #4cacff;
}
.private_reason{overflow: hidden}
.private_reason{overflow: hidden;max-height:150px;}
.private_reason li{margin-bottom: 10px;}
.successPage{
justify-content: center;align-items: center;display: -webkit-flex;height: 570px;text-align: center;margin-bottom: 50px;

@ -529,6 +529,10 @@ a.edu-blueback-btn{padding: 0px 10px;background: #4CACFF;color: #fff!important;b
a.edu-blueline-btn{padding: 0px 10px;color: #4CACFF!important;border: 1px solid #4CACFF;}
a.edu-blueback-btn:hover{background-color: #459BE6;}
a.edu-blueline-btn:hover{border:1px solid #459BE6;color: #459BE6!important;}
input.edu-blueback-btn{padding: 0px 10px;background: #4CACFF;color: #fff!important;border: 1px solid #4CACFF;}
input.edu-blueline-btn{padding: 0px 10px;color: #4CACFF!important;border: 1px solid #4CACFF;}
input.edu-blueback-btn:hover{background-color: #459BE6;}
input.edu-blueline-btn:hover{border:1px solid #459BE6;color: #459BE6!important;}
a.edu-orangeback-btn{background-color: #ff7500;color: #fff!important;border:1px solid #FF7500}
a.edu-orangeback-btn:hover{background-color: #F06200;}

Loading…
Cancel
Save