|
|
@ -1,146 +1,146 @@
|
|
|
|
<p class="lineh-25 font-22 mb20">上传教学案例</p>
|
|
|
|
<p class="lineh-25 font-22 mb20">上传教学案例</p>
|
|
|
|
<div class="library-form-container">
|
|
|
|
<div class="library-form-container">
|
|
|
|
<%= form_for(@library) do |f| %>
|
|
|
|
<%= form_for(@library) do |f| %>
|
|
|
|
<% tag_ids = @library.library_tags.map(&:id) %>
|
|
|
|
<% tag_ids = @library.library_tags.map(&:id) %>
|
|
|
|
<%= hidden_field_tag :apply_publish, false %>
|
|
|
|
<%= hidden_field_tag :apply_publish, false %>
|
|
|
|
<%= hidden_field_tag :tag_ids, tag_ids.join(',') %>
|
|
|
|
<%= hidden_field_tag :tag_ids, tag_ids.join(',') %>
|
|
|
|
<div class="edu-back-white">
|
|
|
|
<div class="edu-back-white">
|
|
|
|
<div class="padding30">
|
|
|
|
<div class="padding30">
|
|
|
|
<div class="clearfix">
|
|
|
|
<div class="clearfix">
|
|
|
|
<span class="upload_Title">标题</span>
|
|
|
|
<span class="upload_Title">标题</span>
|
|
|
|
<li class="fl">
|
|
|
|
<li class="fl">
|
|
|
|
<%= f.text_field :title, placeholder: '例如:软件工程教学案例', class: 'greyInput winput-300-35 mr20 fl' %>
|
|
|
|
<%= f.text_field :title, placeholder: '例如:软件工程教学案例', class: 'greyInput winput-300-35 mr20 fl' %>
|
|
|
|
<p style="height:20px;line-height:20px;"><span class="color-red none" id="title_notice">请输入标题</span></p>
|
|
|
|
<p style="height:20px;line-height:20px;"><span class="color-red none" id="title_notice">请输入标题</span></p>
|
|
|
|
</li>
|
|
|
|
</li>
|
|
|
|
<span class="color-grey-c font-12 fl mt6">简明扼要介绍文档/视频所包含的主要的内容</span>
|
|
|
|
<span class="color-grey-c font-12 fl mt6">简明扼要介绍文档/视频所包含的主要的内容</span>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="padding30 bor-top-greyE">
|
|
|
|
<div class="padding30 bor-top-greyE">
|
|
|
|
<div class="clearfix">
|
|
|
|
<div class="clearfix">
|
|
|
|
<span class="upload_Title">描述</span>
|
|
|
|
<span class="upload_Title">描述</span>
|
|
|
|
<div class="fl" style="width: 1078px">
|
|
|
|
<div class="fl" style="width: 1078px">
|
|
|
|
<div id="libraries_description" style="margin:0px">
|
|
|
|
<div id="libraries_description" style="margin:0px">
|
|
|
|
<%= f.text_area :content %>
|
|
|
|
<%= f.text_area :content %>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<p style="height:22px;line-height:22px;"><span class="color-red none" id="des_notice">请输入描述内容</span></p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<p style="height:22px;line-height:22px;"><span class="color-red none" id="des_notice">请输入描述内容</span></p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="clearfix mb20">
|
|
|
|
|
|
|
|
<span class="upload_Title">标签</span>
|
|
|
|
|
|
|
|
<ul class="fl libraries_tab">
|
|
|
|
|
|
|
|
<% LibraryTag.where(nil).each do |tag| %>
|
|
|
|
|
|
|
|
<li class="<%= tag_ids.include?(tag.id) ? 'active' : '' %>" data-id="<%= tag.id %>"><%= tag.name %></li>
|
|
|
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div style="padding-left: 62px">
|
|
|
|
|
|
|
|
<%= render partial: 'attachments/from_libraries', locals: { container: @library } %>
|
|
|
|
|
|
|
|
<p style="height:22px;line-height:22px;"><span class="color-red none" id="file_notice">请上传附件</span></p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="clearfix mb20">
|
|
|
|
<div class="padding30 bor-top-greyE">
|
|
|
|
<span class="upload_Title">标签</span>
|
|
|
|
<li class="lineh-25 color-grey-6 font-18 mb20">审核说明</li>
|
|
|
|
<ul class="fl libraries_tab">
|
|
|
|
<ul class="font-16">
|
|
|
|
<% LibraryTag.where(nil).each do |tag| %>
|
|
|
|
<li>平台管理员将对每天新上传的文档进行审核,审核通过的文档将公开显示,否则将私有化或移除</li>
|
|
|
|
<li class="<%= tag_ids.include?(tag.id) ? 'active' : '' %>" data-id="<%= tag.id %>"><%= tag.name %></li>
|
|
|
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div style="padding-left: 62px">
|
|
|
|
<div class="padding30 bor-top-greyE">
|
|
|
|
<%= render partial: 'attachments/from_libraries', locals: { container: @library } %>
|
|
|
|
<li class="lineh-25 color-grey-6 font-18 mb20">温馨提示</li>
|
|
|
|
<p style="height:22px;line-height:22px;"><span class="color-red none" id="file_notice">请上传附件</span></p>
|
|
|
|
<ul class="font-16">
|
|
|
|
|
|
|
|
<li>1.请勿上传已设置加密口令的文档资源;</li>
|
|
|
|
|
|
|
|
<li>2.可以上传符合教学案例标准的文档资料,如<a class="color-blue" target="_blank" href="https://www.educoder.net/boards/5909/topics/34799">案例入库标准</a>、<a target="_blank" class="color-blue" href="https://www.educoder.net/boards/5909/topics/34798">案例使用说明书</a>以及其他资料等,上传支持的文件最大容量:100MB;</li>
|
|
|
|
|
|
|
|
<li>3.请确保上传内容无侵权或违反国家关于互联网政策的不良行为;</li>
|
|
|
|
|
|
|
|
<li>4.请使用Chrome,Firefox,Safari,IE11(及以上版本)浏览器;</li>
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
</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.可以上传符合教学案例标准的文档资料,如<a class="color-blue" target="_blank" href="https://www.educoder.net/boards/5909/topics/34799">案例入库标准</a>、<a target="_blank" class="color-blue" href="https://www.educoder.net/boards/5909/topics/34798">案例使用说明书</a>以及其他资料等,上传支持的文件最大容量:100MB;</li>
|
|
|
|
|
|
|
|
<li>3.请确保上传内容无侵权或违反国家关于互联网政策的不良行为;</li>
|
|
|
|
|
|
|
|
<li>4.请使用Chrome,Firefox,Safari,IE11(及以上版本)浏览器;</li>
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="operate mt20 mb20 clearfix">
|
|
|
|
<div class="operate mt20 mb20 clearfix">
|
|
|
|
<% unless @library.published? %>
|
|
|
|
<% unless @library.published? %>
|
|
|
|
<%= 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-blueback-btn changebtn mr20 fl apply-publish-btn' %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<%= link_to '保存', 'javascript:void(0)', class: 'white-btn edu-blueline-btn changebtn mr20 fl submit-btn' %>
|
|
|
|
<%= link_to '保存', 'javascript:void(0)', class: 'white-btn edu-blueline-btn changebtn mr20 fl submit-btn' %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
/* ------------------------------- 描述md ------------------------------*/
|
|
|
|
/* ------------------------------- 描述md ------------------------------*/
|
|
|
|
editormd("libraries_description", {
|
|
|
|
editormd("libraries_description", {
|
|
|
|
width: "100%",
|
|
|
|
width: "100%",
|
|
|
|
height: 400,
|
|
|
|
height: 400,
|
|
|
|
syncScrolling: "single",
|
|
|
|
syncScrolling: "single",
|
|
|
|
//你的lib目录的路径,我这边用JSP做测试的
|
|
|
|
//你的lib目录的路径,我这边用JSP做测试的
|
|
|
|
path: "/editormd/lib/",
|
|
|
|
path: "/editormd/lib/",
|
|
|
|
tex: true,
|
|
|
|
tex: true,
|
|
|
|
watch:true,
|
|
|
|
watch:true,
|
|
|
|
toolbarIcons: function () {
|
|
|
|
toolbarIcons: function () {
|
|
|
|
// Or return editormd.toolbarModes[name]; // full, simple, mini
|
|
|
|
// Or return editormd.toolbarModes[name]; // full, simple, mini
|
|
|
|
// Using "||" set icons align right.
|
|
|
|
// Using "||" set icons align right.
|
|
|
|
return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"]
|
|
|
|
return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
toolbarCustomIcons: {
|
|
|
|
toolbarCustomIcons: {
|
|
|
|
testIcon: "<a type=\"inline\" class=\"latex\" ><div class='zbg'></div></a>",
|
|
|
|
testIcon: "<a type=\"inline\" class=\"latex\" ><div class='zbg'></div></a>",
|
|
|
|
testIcon1: "<a type=\"latex\" class=\"latex\" ><div class='zbg_latex'></div></a>"
|
|
|
|
testIcon1: "<a type=\"latex\" class=\"latex\" ><div class='zbg_latex'></div></a>"
|
|
|
|
},
|
|
|
|
},
|
|
|
|
//这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。
|
|
|
|
//这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。
|
|
|
|
saveHTMLToTextarea: true,
|
|
|
|
saveHTMLToTextarea: true,
|
|
|
|
autoFocus: false,
|
|
|
|
autoFocus: false,
|
|
|
|
// 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标
|
|
|
|
// 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标
|
|
|
|
dialogMaskOpacity: 0.6,
|
|
|
|
dialogMaskOpacity: 0.6,
|
|
|
|
placeholder: "请添加描述",
|
|
|
|
placeholder: "请添加描述",
|
|
|
|
imageUpload: true,
|
|
|
|
imageUpload: true,
|
|
|
|
imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"],
|
|
|
|
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
|
|
|
|
imageUploadURL: "<%= upload_with_markdown_path(container_id: 0, container_type: 'MarkDown') %>" //url
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
var submitForm = function(){
|
|
|
|
var submitForm = function(){
|
|
|
|
var title = $("input[name='library[title]']").val();
|
|
|
|
var title = $("input[name='library[title]']").val();
|
|
|
|
var content = $("textarea[name='library[content]']").val();
|
|
|
|
var content = $("textarea[name='library[content]']").val();
|
|
|
|
|
|
|
|
|
|
|
|
if (!title || title.length == 0) {
|
|
|
|
if (!title || title.length == 0) {
|
|
|
|
$("#title_notice").removeClass("none");
|
|
|
|
$("#title_notice").removeClass("none");
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
$("#title_notice").addClass("none");
|
|
|
|
$("#title_notice").addClass("none");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!content || content.length == 0) {
|
|
|
|
if (!content || content.length == 0) {
|
|
|
|
$("#des_notice").removeClass("none");
|
|
|
|
$("#des_notice").removeClass("none");
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
$("#des_notice").addClass("none");
|
|
|
|
$("#des_notice").addClass("none");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if($('.attachments_fields .attachment').length == 0){
|
|
|
|
if($('.attachments_fields .attachment').length == 0){
|
|
|
|
$("#file_notice").removeClass("none");
|
|
|
|
$("#file_notice").removeClass("none");
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
$("#file_notice").addClass("none");
|
|
|
|
$("#file_notice").addClass("none");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$('.library-form-container form').submit();
|
|
|
|
$('.library-form-container form').submit();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$(function(){
|
|
|
|
$(function(){
|
|
|
|
$('.apply-publish-btn').on('click', function(){
|
|
|
|
$('.apply-publish-btn').on('click', function(){
|
|
|
|
$("input[name='apply_publish']").val(true);
|
|
|
|
$("input[name='apply_publish']").val(true);
|
|
|
|
submitForm();
|
|
|
|
submitForm();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$('.submit-btn').on('click', submitForm);
|
|
|
|
$('.submit-btn').on('click', submitForm);
|
|
|
|
|
|
|
|
|
|
|
|
$(".libraries_tab").on("click","li",function(){
|
|
|
|
$(".libraries_tab").on("click","li",function(){
|
|
|
|
if($(this).hasClass("active")){
|
|
|
|
if($(this).hasClass("active")){
|
|
|
|
$(this).removeClass("active")
|
|
|
|
$(this).removeClass("active")
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
$(this).addClass("active")
|
|
|
|
$(this).addClass("active")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var ids = [];
|
|
|
|
var ids = [];
|
|
|
|
$('.libraries_tab li.active').each(function(){
|
|
|
|
$('.libraries_tab li.active').each(function(){
|
|
|
|
ids.push($(this).data('id'))
|
|
|
|
ids.push($(this).data('id'))
|
|
|
|
})
|
|
|
|
})
|
|
|
|
console.log('ids', ids)
|
|
|
|
console.log('ids', ids)
|
|
|
|
$('#tag_ids').val(ids);
|
|
|
|
$('#tag_ids').val(ids);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</script>
|