|
|
|
@ -1,146 +1,146 @@
|
|
|
|
|
<p class="lineh-25 font-22 mb20">上传教学案例</p>
|
|
|
|
|
<div class="library-form-container">
|
|
|
|
|
<%= form_for(@library) do |f| %>
|
|
|
|
|
<% tag_ids = @library.library_tags.map(&:id) %>
|
|
|
|
|
<%= hidden_field_tag :apply_publish, false %>
|
|
|
|
|
<%= hidden_field_tag :tag_ids, tag_ids.join(',') %>
|
|
|
|
|
<div class="edu-back-white">
|
|
|
|
|
<div class="padding30">
|
|
|
|
|
<div class="clearfix">
|
|
|
|
|
<span class="upload_Title">标题</span>
|
|
|
|
|
<li class="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>
|
|
|
|
|
</li>
|
|
|
|
|
<span class="color-grey-c font-12 fl mt6">简明扼要介绍文档/视频所包含的主要的内容</span>
|
|
|
|
|
<% tag_ids = @library.library_tags.map(&:id) %>
|
|
|
|
|
<%= hidden_field_tag :apply_publish, false %>
|
|
|
|
|
<%= hidden_field_tag :tag_ids, tag_ids.join(',') %>
|
|
|
|
|
<div class="edu-back-white">
|
|
|
|
|
<div class="padding30">
|
|
|
|
|
<div class="clearfix">
|
|
|
|
|
<span class="upload_Title">标题</span>
|
|
|
|
|
<li class="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>
|
|
|
|
|
</li>
|
|
|
|
|
<span class="color-grey-c font-12 fl mt6">简明扼要介绍文档/视频所包含的主要的内容</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="padding30 bor-top-greyE">
|
|
|
|
|
<div class="clearfix">
|
|
|
|
|
<span class="upload_Title">描述</span>
|
|
|
|
|
<div class="fl" style="width: 1078px">
|
|
|
|
|
<div id="libraries_description" style="margin:0px">
|
|
|
|
|
<%= f.text_area :content %>
|
|
|
|
|
<div class="padding30 bor-top-greyE">
|
|
|
|
|
<div class="clearfix">
|
|
|
|
|
<span class="upload_Title">描述</span>
|
|
|
|
|
<div class="fl" style="width: 1078px">
|
|
|
|
|
<div id="libraries_description" style="margin:0px">
|
|
|
|
|
<%= f.text_area :content %>
|
|
|
|
|
</div>
|
|
|
|
|
<p style="height:22px;line-height:22px;"><span class="color-red none" id="des_notice">请输入描述内容</span></p>
|
|
|
|
|
</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 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 %>
|
|
|
|
|
<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 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 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="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">
|
|
|
|
|
<% unless @library.published? %>
|
|
|
|
|
<%= link_to '申请发布', 'javascript:void(0)', class: 'white-btn edu-blueback-btn changebtn mr20 fl apply-publish-btn' %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<%= link_to '保存', 'javascript:void(0)', class: 'white-btn edu-blueline-btn changebtn mr20 fl submit-btn' %>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="operate mt20 mb20 clearfix">
|
|
|
|
|
<% unless @library.published? %>
|
|
|
|
|
<%= link_to '申请发布', 'javascript:void(0)', class: 'white-btn edu-blueback-btn changebtn mr20 fl apply-publish-btn' %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<%= link_to '保存', 'javascript:void(0)', class: 'white-btn edu-blueline-btn changebtn mr20 fl submit-btn' %>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
/* ------------------------------- 描述md ------------------------------*/
|
|
|
|
|
editormd("libraries_description", {
|
|
|
|
|
width: "100%",
|
|
|
|
|
height: 400,
|
|
|
|
|
syncScrolling: "single",
|
|
|
|
|
//你的lib目录的路径,我这边用JSP做测试的
|
|
|
|
|
path: "/editormd/lib/",
|
|
|
|
|
tex: true,
|
|
|
|
|
watch:true,
|
|
|
|
|
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"]
|
|
|
|
|
},
|
|
|
|
|
/* ------------------------------- 描述md ------------------------------*/
|
|
|
|
|
editormd("libraries_description", {
|
|
|
|
|
width: "100%",
|
|
|
|
|
height: 400,
|
|
|
|
|
syncScrolling: "single",
|
|
|
|
|
//你的lib目录的路径,我这边用JSP做测试的
|
|
|
|
|
path: "/editormd/lib/",
|
|
|
|
|
tex: true,
|
|
|
|
|
watch:true,
|
|
|
|
|
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
|
|
|
|
|
});
|
|
|
|
|
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
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var submitForm = function(){
|
|
|
|
|
var title = $("input[name='library[title]']").val();
|
|
|
|
|
var content = $("textarea[name='library[content]']").val();
|
|
|
|
|
var submitForm = function(){
|
|
|
|
|
var title = $("input[name='library[title]']").val();
|
|
|
|
|
var content = $("textarea[name='library[content]']").val();
|
|
|
|
|
|
|
|
|
|
if (!title || title.length == 0) {
|
|
|
|
|
$("#title_notice").removeClass("none");
|
|
|
|
|
return
|
|
|
|
|
}else{
|
|
|
|
|
$("#title_notice").addClass("none");
|
|
|
|
|
}
|
|
|
|
|
if (!content || content.length == 0) {
|
|
|
|
|
$("#des_notice").removeClass("none");
|
|
|
|
|
return
|
|
|
|
|
}else{
|
|
|
|
|
$("#des_notice").addClass("none");
|
|
|
|
|
}
|
|
|
|
|
if (!title || title.length == 0) {
|
|
|
|
|
$("#title_notice").removeClass("none");
|
|
|
|
|
return
|
|
|
|
|
}else{
|
|
|
|
|
$("#title_notice").addClass("none");
|
|
|
|
|
}
|
|
|
|
|
if (!content || content.length == 0) {
|
|
|
|
|
$("#des_notice").removeClass("none");
|
|
|
|
|
return
|
|
|
|
|
}else{
|
|
|
|
|
$("#des_notice").addClass("none");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if($('.attachments_fields .attachment').length == 0){
|
|
|
|
|
$("#file_notice").removeClass("none");
|
|
|
|
|
return
|
|
|
|
|
}else{
|
|
|
|
|
$("#file_notice").addClass("none");
|
|
|
|
|
}
|
|
|
|
|
if($('.attachments_fields .attachment').length == 0){
|
|
|
|
|
$("#file_notice").removeClass("none");
|
|
|
|
|
return
|
|
|
|
|
}else{
|
|
|
|
|
$("#file_notice").addClass("none");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('.library-form-container form').submit();
|
|
|
|
|
};
|
|
|
|
|
$('.library-form-container form').submit();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$(function(){
|
|
|
|
|
$('.apply-publish-btn').on('click', function(){
|
|
|
|
|
$("input[name='apply_publish']").val(true);
|
|
|
|
|
submitForm();
|
|
|
|
|
});
|
|
|
|
|
$('.submit-btn').on('click', submitForm);
|
|
|
|
|
$(function(){
|
|
|
|
|
$('.apply-publish-btn').on('click', function(){
|
|
|
|
|
$("input[name='apply_publish']").val(true);
|
|
|
|
|
submitForm();
|
|
|
|
|
});
|
|
|
|
|
$('.submit-btn').on('click', submitForm);
|
|
|
|
|
|
|
|
|
|
$(".libraries_tab").on("click","li",function(){
|
|
|
|
|
if($(this).hasClass("active")){
|
|
|
|
|
$(this).removeClass("active")
|
|
|
|
|
}else{
|
|
|
|
|
$(this).addClass("active")
|
|
|
|
|
}
|
|
|
|
|
var ids = [];
|
|
|
|
|
$('.libraries_tab li.active').each(function(){
|
|
|
|
|
ids.push($(this).data('id'))
|
|
|
|
|
})
|
|
|
|
|
console.log('ids', ids)
|
|
|
|
|
$('#tag_ids').val(ids);
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
$(".libraries_tab").on("click","li",function(){
|
|
|
|
|
if($(this).hasClass("active")){
|
|
|
|
|
$(this).removeClass("active")
|
|
|
|
|
}else{
|
|
|
|
|
$(this).addClass("active")
|
|
|
|
|
}
|
|
|
|
|
var ids = [];
|
|
|
|
|
$('.libraries_tab li.active').each(function(){
|
|
|
|
|
ids.push($(this).data('id'))
|
|
|
|
|
})
|
|
|
|
|
console.log('ids', ids)
|
|
|
|
|
$('#tag_ids').val(ids);
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
</script>
|