TPM的简介与设置页面的简介更换成Md

This commit is contained in:
daiao 2017-05-18 09:49:58 +08:00
parent 08c4c7ee79
commit cdb7484849
4 changed files with 55 additions and 54 deletions

View File

@ -1,21 +1,35 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: true,init_activity: true) %>
<% end %>
<%= stylesheet_link_tag '/editormd/css/editormd','/editormd/css/editormd.min' %>
<%= javascript_include_tag '/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'%>
<style>
.editormd-html-preview {
width: 96%;
}
</style>
<div class="task-pm-content">
<div class="task-pm-box mt20">
<div class="panel-header ">
<div class="panel-header">
<h3 class="shixun_title">简介</h3>
</div>
<div class="task-paner-con break_full_word">
<p>
<%= h @shixun.description.html_safe %>
</p>
<div class="task-paner-con break_full_word" id="challenge_editorMd_description">
<textarea style="display:none;"><%= @shixun.description %></textarea>
</div>
</div>
<div id="challenge_list">
<%= render :partial => "content_list" %>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
/* -------------- 简介Md -------------------- */
var shixunDescr = editormd.markdownToHTML("challenge_editorMd_description", {
htmlDecode: "style,script,iframe", // you can filter tags decode
taskList: true,
tex: true, // 默认不解析
flowChart: true, // 默认不解析
sequenceDiagram: true // 默认不解析
});
});
</script>

View File

@ -1,6 +1,3 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
<% end %>
<div class="panel-form task-setting-tab">
<ul>
<%= labelled_form_for @shixun do |f| %>
@ -11,27 +8,19 @@
</li>
<li class="clearfix">
<label class="panel-form-label fl">简介:</label>
<%= f.kindeditor :description, :editor_id => 'shixun_setting_editor',
:owner_id => @shixun.nil? ? 0: @shixun.id,
:owner_type => OwnerTypeHelper::PROJECT,
:width => '89.7%',
:height => 300,
:minHeight=> 300,
:class => 'fl ml5 w690',
:input_html => { :id => 'project_description',
:class => 'courses_text fl',
:maxlength => 5000 }
%>
<div id="setting_introduction" class="new_li fl" style="margin-bottom: 0px">
<textarea name="shixun[description]"><%= @shixun.description %></textarea>
</div>
</li>
<li class="clearfix">
<label class="panel-form-label fl">语言:</label>
<%= select_tag :language, options_for_select(["Java","C","C++","Python","Ruby","Mysql-Java"], @shixun.language), :id => 'shixun[language]', :style => "height:40px;" %>
</li>
<li class="clearfix">
<!-- <li class="clearfix">
<label class="panel-form-label fl">公开:</label>
<input type="checkbox" <%= @shixun.is_public ? "checked" : ""%> class="fl mt15 mr10" name="shixun[is_public]" />
<input type="checkbox" <%#= @shixun.is_public ? "checked" : ""%> class="fl mt15 mr10" name="shixun[is_public]" />
<span class="fl" style="line-height: 40px;">(选中为公开实训,不选中为私有实训;私有实训仅自己可见。)</span>
</li>
</li>-->
<li class="clearfix">
<a href="javascript:void(0)" class="task-btn task-btn-green fr " onclick="submit_edit_shixun(<%= @shixun.id %>);" >保存</a>
</li>
@ -54,9 +43,30 @@
//配置-信息提交
function submit_edit_shixun(id) {
shixun_setting_editor.sync();
if (regex_shixun_name()) {
$("#edit_shixun_" + id).submit();
}
}
/* ------------------------------- 简介md ------------------------------ */
setting_editormd = editormd("setting_introduction", {
width : "89.7%",
height : 300,
syncScrolling : "single",
//你的lib目录的路径我这边用JSP做测试的
path : "/editormd/lib/",
toolbarIcons : function() {
// Or return editormd.toolbarModes[name]; // full, simple, mini
// Using "||" set icons align right.
return ["bold", "italic", "|", "list-ul", "list-ol", "|", "image", "code", "code-block", "|", "table", "watch", "clear"]
},
//这个配置在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>

View File

@ -5,7 +5,7 @@
<p class="mb10 mt10"><i class="fa fa-map-marker mr5 color-grey" ></i>
<a href="<%= user_path(User.current) %>"><%= User.current.show_name %></a> > <a href="<%= shixuns_path %>">项目实训</a> > 新建实训
</p>
<div class="edu-con-top ">
<div class="edu-con-top">
<p class="ml15 color-grey">新建实训</p>
</div>
<%= render :partial => 'form' %>

View File

@ -1,3 +1,5 @@
<%= stylesheet_link_tag '/editormd/css/editormd','/editormd/css/editormd.min.css' %>
<%= javascript_include_tag '/editormd/editormd.min.js' %>
<div class="task-pm-content mb20">
<div class="task-pm-box mt20">
<div class="tab_content clearfix" >
@ -25,32 +27,7 @@
</div>
</div>
</div>
<% if false %>
<div class="pro_new_setting clear mb10">
<div class="pro_new_setting_leftnav fl">
<ul>
<% show_memu = show_project_memu User.current %>
<li><a href="javascript:void(0)" id="pro_st_tb_1" class="<%= show_memu == 'edit_project' ? 'active' : ''%>" onclick="project_setting(1);">信息</a></li>
<!--<li id="pro_st_tb_5" class="pro_st_normaltab" onclick="project_setting(5);">问题类别</li>-->
<li><a href="javascript:void(0)" id="pro_st_tb_6" class="<%= show_memu == 'manage_repository' ? 'active' : ''%>" onclick="project_setting(6);">版本库</a></li>
<!--<li><a href="javascript:void(0)" id="pro_st_tb_7" class="<%#= show_memu == 'trainig_task' ? 'active' : ''%>" onclick="project_setting(7);">实训任务</a></li>-->
</ul>
</div>
<div class="pro_new_setting_conbox fl ml10">
<div class="<%= show_memu == 'edit_project' ? 'pro_st_dis' : 'pro_st_undis'%>" id="pro_st_tbc_01">
<%= render :partial=> "shixuns/settings_edit" %>
</div><!--tbc_01 end-->
<div class="<%= show_memu == 'manage_repository' ? 'pro_st_dis' : 'pro_st_undis'%>" id="pro_st_tbc_06">
<%= render :partial=>"shixuns/settings_repository" %>
</div><!--tbc_06 end-->
<!--<div class="<%#= show_memu == 'training_task' ? 'pro_st_dis' : 'pro_st_undis'%>" id="pro_st_tbc_07">-->
<!--<%#= render :partial=>"shixuns/settings_challenges" %>-->
<!--</div>&lt;!&ndash;tbc_06 end&ndash;&gt;-->
</div>
</div>
<% end %>
<script type="text/javascript">
function g(o){return document.getElementById(o);}
function HoverLi(n){