Date: Tue, 10 Oct 2017 15:59:52 +0800
Subject: [PATCH 5/7] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=88=97=E8=A1=A8?=
=?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=B7=B7=E4=B9=B1=EF=BC=8Ceducoder=E5=88=9B?=
=?UTF-8?q?=E5=BB=BA=E7=9A=84C++=E7=A8=8B=E5=BA=8F=E8=AE=BE=E8=AE=A1?=
=?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=9C=89=E5=A4=9A=E6=9D=A1=E8=AE=B0=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/managements_controller.rb | 2 +-
.../managements/_classroom_list.html.erb | 2 +-
...71010071751_migrate_shixun_major_course.rb | 19 +++++++++++++++++++
3 files changed, 21 insertions(+), 2 deletions(-)
create mode 100644 db/migrate/20171010071751_migrate_shixun_major_course.rb
diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb
index 7e54df3f1..7ee69d2e9 100644
--- a/app/controllers/managements_controller.rb
+++ b/app/controllers/managements_controller.rb
@@ -823,7 +823,7 @@ end
@courselist= @courselist.where("name like '%#{search}%'")
end
end
- @courselist = @courselist.order("created_at #{@sx_order}")
+ @courselist = @courselist.order("id #{@sx_order}")
@courselist_count = @courselist.count
limit = 20
@is_remote = true
diff --git a/app/views/managements/_classroom_list.html.erb b/app/views/managements/_classroom_list.html.erb
index 0d6192326..dc321ffa0 100644
--- a/app/views/managements/_classroom_list.html.erb
+++ b/app/views/managements/_classroom_list.html.erb
@@ -23,7 +23,7 @@
|
- <%= courselist.name %>
+ <%= courselist.name %>
|
<%= courselist.courses.count %>
diff --git a/db/migrate/20171010071751_migrate_shixun_major_course.rb b/db/migrate/20171010071751_migrate_shixun_major_course.rb
new file mode 100644
index 000000000..40124ffa2
--- /dev/null
+++ b/db/migrate/20171010071751_migrate_shixun_major_course.rb
@@ -0,0 +1,19 @@
+# encoding: utf-8
+class MigrateShixunMajorCourse < ActiveRecord::Migration
+ def up
+ c_courses = CourseList.where("name = 'C++程序设计' and id != 5")
+ ShixunMajorCourse.where(:course_list_id => c_courses.map(&:id)).update_all(:course_list_id => 5)
+ c_courses.destroy_all
+
+ c_courses = CourseList.where("id in (70, 86)")
+ ShixunMajorCourse.where(:course_list_id => c_courses.map(&:id)).update_all(:course_list_id => 1)
+ c_courses.destroy_all
+
+ c_courses = CourseList.where("id = 84")
+ ShixunMajorCourse.where(:course_list_id => c_courses.map(&:id)).update_all(:course_list_id => 79)
+ c_courses.destroy_all
+ end
+
+ def down
+ end
+end
From 268a626e7a616f42bde61da30aa5832e639f5edb Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Tue, 10 Oct 2017 16:45:41 +0800
Subject: [PATCH 6/7] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E8=B7=AF=E5=BE=84?=
=?UTF-8?q?=E7=9A=84ke=E7=AE=80=E4=BB=8B=E5=92=8Cke=E5=AD=A6=E4=B9=A0?=
=?UTF-8?q?=E9=A1=BB=E7=9F=A5=EF=BC=8C=E9=83=BD=E6=94=B9=E4=B8=BAmd?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/subjects/edit.html.erb | 175 ++++++++++++++++-------
app/views/subjects/new.html.erb | 216 +++++++++++++++++++----------
app/views/subjects/show.html.erb | 29 +++-
public/javascripts/edu/base_edu.js | 12 +-
4 files changed, 296 insertions(+), 136 deletions(-)
diff --git a/app/views/subjects/edit.html.erb b/app/views/subjects/edit.html.erb
index 0f8baf4e9..845ad9424 100644
--- a/app/views/subjects/edit.html.erb
+++ b/app/views/subjects/edit.html.erb
@@ -1,6 +1,5 @@
-<% content_for :header_tags do %>
- <%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
-<% end %>
+<%= stylesheet_link_tag '/editormd/css/editormd' %>
+<%= javascript_include_tag '/editormd/editormd' %>
@@ -9,40 +8,28 @@
- <%= labelled_form_for @subject do |f| %>
-
-
-
-
- 请输入名称
-
-
+ <%= labelled_form_for @subject do |f| %>
+
+
+
+
+ 请输入名称
+
+
-
+
<%= hidden_field_tag :asset_id, params[:asset_id], :required => false, :style => 'display:none' %>
-
- <%= f.kindeditor :description, :editor_id => 'subject_description_editor',
- :owner_id => @subject.nil? ? 0: @subject.id,
- :owner_type => OwnerTypeHelper::SUBJECT,
- :local_storage_mdu => "subject_description_#{User.current.id}_#{@subject.id}",
- :local_storage_id => "desc",
- :width => '80%',
- :height => 200,
- :minHeight=>200,
- :placeholder => "请在此输入实训路径的简介",
- :class => 'talk_text fl',
- :input_html => { :id => 'new_subject_description',
- :class => 'talk_text fl',
- :maxlength => 5000 }
- %>
+
+
+
@@ -50,32 +37,116 @@
-
- <%= f.kindeditor :learning_notes, :editor_id => 'subject_learning_notes_editor',
- :owner_id => @subject.nil? ? 0: @subject.id,
- :owner_type => OwnerTypeHelper::SUBJECT,
- :local_storage_mdu => "subject_notes_#{User.current.id}_#{@subject.id}",
- :local_storage_id => "notes",
- :width => '80%',
- :height => 200,
- :minHeight=>200,
- :placeholder => "请在此输入实训路径的学习须知",
- :class => 'talk_text fl',
- :input_html => { :id => 'new_learning_notes',
- :class => 'talk_text fl',
- :maxlength => 5000 }
- %>
+
+
+
请输入学习须知
-
-
- <%= link_to "取消", subject_path(@subject), :class => "task-btn fl mr10 ml20" %>
- 保存
-
- <% end %>
+
+
+ <%= link_to "取消", subject_path(@subject), :class => "task-btn fl mr10 ml20" %>
+ 保存
+
+ <% end %>
+
-
-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/app/views/subjects/new.html.erb b/app/views/subjects/new.html.erb
index 42b2382d2..cfa6ae8ea 100644
--- a/app/views/subjects/new.html.erb
+++ b/app/views/subjects/new.html.erb
@@ -1,6 +1,6 @@
-<% content_for :header_tags do %>
- <%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
-<% end %>
+<%= stylesheet_link_tag '/editormd/css/editormd' %>
+<%= javascript_include_tag '/editormd/editormd' %>
+
@@ -9,81 +9,57 @@
- <%= labelled_form_for @subject do |f| %>
-
-
-
-
- 请输入名称
-
-
+ <%= labelled_form_for @subject do |f| %>
+
+
+
+
+ 请输入名称
+
+
-
-
-
- <%= hidden_field_tag :asset_id, params[:asset_id], :required => false, :style => 'display:none' %>
-
- <%= f.kindeditor :description, :editor_id => 'subject_description_editor',
- :owner_id => @subject.nil? ? 0: @subject.id,
- :owner_type => OwnerTypeHelper::SUBJECT,
- :local_storage_mdu => "subject_description_#{User.current.id}",
- :local_storage_id => "desc",
- :width => '80%',
- :height => 200,
- :minHeight=>200,
- :placeholder => "请在此输入实训路径的简介",
- :class => 'talk_text fl',
- :input_html => { :id => 'new_subject_description',
- :class => 'talk_text fl',
- :maxlength => 5000 }
- %>
-
-
-
- 请输入简介
-
-
-
-
- <%= f.kindeditor :learning_notes, :editor_id => 'subject_learning_notes_editor',
- :owner_id => @subject.nil? ? 0: @subject.id,
- :owner_type => OwnerTypeHelper::SUBJECT,
- :local_storage_mdu => "subject_notes_#{User.current.id}",
- :local_storage_id => "notes",
- :width => '80%',
- :height => 200,
- :minHeight=>200,
- :placeholder => "请在此输入实训路径的学习须知",
- :class => 'talk_text fl',
- :input_html => { :id => 'new_learning_notes',
- :class => 'talk_text fl',
- :maxlength => 5000 }
- %>
-
-
-
-
- 请输入学习须知
-
-
-
-
- <%= link_to "取消", subjects_path(), :class => "task-btn fl mr10 ml20" %>
- 保存
-
- <% end %>
-
-
+
+
+
+ <%= hidden_field_tag :asset_id, params[:asset_id], :required => false, :style => 'display:none' %>
+
+
+
+
+
+
+ 请输入简介
+
+
+
+
+
+
+
+
+
+
+ 请输入学习须知
+
+
+
+
+ <%= link_to "取消", subjects_path(), :class => "task-btn fl mr10 ml20" %>
+ 保存
+
+ <% end %>
+
+
\ No newline at end of file
+ /* ------------------------------- 简介md ------------------------------*/
+ var shixun_editormd = editormd("shixun_introduction", {
+ width : "80%",
+ height : 600,
+ syncScrolling : "single",
+ //你的lib目录的路径,我这边用JSP做测试的
+ path : "/editormd/lib/",
+ tex : 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 : "",
+ testIcon1 : ""
+ },
+ //这个配置在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 => @subject.id, :container_type => @subject.class) %>" //url
+ });
+
+ /* --------------------------------- 学习须知 -------------------------------------- */
+ var shixun_propaedeutics = editormd("shixun_propaedeutics", {
+ width : "80%",
+ height : 600,
+ syncScrolling : "single",
+ //你的lib目录的路径,我这边用JSP做测试的
+ path : "/editormd/lib/",
+ tex : 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 : "",
+ testIcon1 : ""
+ },
+ //这个配置在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 => @subject.id, :container_type => @subject.class) %>" //url
+ });
+ window.onload = function(){
+ console.log(shixun_editormd);
+
+ $("#shixun_introduction [type=\"latex\"]").bind("click", function(){
+ shixun_editormd.cm.replaceSelection("```latex");
+ shixun_editormd.cm.replaceSelection("\n");
+ shixun_editormd.cm.replaceSelection("\n");
+ shixun_editormd.cm.replaceSelection("```");
+ var __Cursor = shixun_editormd.cm.getDoc().getCursor();
+ shixun_editormd.cm.setCursor(__Cursor.line-1, 0);
+ });
+
+ $("#shixun_propaedeutics [type=\"latex\"]").bind("click", function(){
+ shixun_propaedeutics.cm.replaceSelection("```latex");
+ shixun_propaedeutics.cm.replaceSelection("\n");
+ shixun_propaedeutics.cm.replaceSelection("\n");
+ shixun_propaedeutics.cm.replaceSelection("```");
+ var __Cursor = shixun_propaedeutics.cm.getDoc().getCursor();
+ shixun_propaedeutics.cm.setCursor(__Cursor.line-1, 0);
+ });
+
+ $("#shixun_introduction [type=\"inline\"]").bind("click", function(){
+ shixun_editormd.cm.replaceSelection("$$$$");
+ var __Cursor = shixun_editormd.cm.getDoc().getCursor();
+ shixun_editormd.cm.setCursor(__Cursor.line, __Cursor.ch-2);
+ shixun_editormd.cm.focus();
+ });
+
+ $("#shixun_propaedeutics [type=\"inline\"]").bind("click", function(){
+ shixun_propaedeutics.cm.replaceSelection("$$$$");
+ var __Cursor = shixun_propaedeutics.cm.getDoc().getCursor();
+ shixun_propaedeutics.cm.setCursor(__Cursor.line, __Cursor.ch-2);
+ shixun_propaedeutics.cm.focus();
+ });
+ $("[type=\"inline\"]").attr("title", "行内公式");
+ $("[type=\"latex\"]").attr("title", "多行公式");
+
+ };
+
diff --git a/app/views/subjects/show.html.erb b/app/views/subjects/show.html.erb
index 10208015c..944631c62 100644
--- a/app/views/subjects/show.html.erb
+++ b/app/views/subjects/show.html.erb
@@ -1,3 +1,6 @@
+<%= stylesheet_link_tag '/editormd/css/editormd','/editormd/css/editormd.min.css' %>
+<%= 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'%>
<% if !@subject.description.blank? || User.current.manager_of_subject?(@subject) %>
@@ -8,8 +11,10 @@
<% end %>
-
- <%= @subject.description.blank? ? "暂未填写" : (@subject.description.html_safe) %>
+
<% end %>
@@ -142,7 +147,9 @@
<% end %>
- <%= @subject.learning_notes.blank? ? "暂未填写" : @subject.learning_notes.html_safe %>
+
+
+
教学团队
@@ -176,6 +183,22 @@
|