From c2be8b4eececc3dfb3c846e6c15422290d18abad Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Wed, 28 Oct 2015 15:54:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=A4=A7=E7=BA=B2=E7=95=8C?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 2 +- app/controllers/courses_controller.rb | 5 ++ .../courses/_course_outlines_list.html.erb | 66 +++++++++++++++++++ app/views/courses/course_outline.js.erb | 8 +++ app/views/layouts/base_courses.html.erb | 5 ++ config/routes.rb | 1 + ...1028060607_add_column_outline_to_course.rb | 5 ++ db/schema.rb | 46 +++++++------ public/javascripts/course.js | 9 ++- public/stylesheets/courses.css | 9 +++ 10 files changed, 135 insertions(+), 21 deletions(-) create mode 100644 app/views/courses/_course_outlines_list.html.erb create mode 100644 app/views/courses/course_outline.js.erb create mode 100644 db/migrate/20151028060607_add_column_outline_to_course.rb diff --git a/Gemfile b/Gemfile index 87cd6dba2..3027c16cd 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ unless RUBY_PLATFORM =~ /w32/ gem 'iconv' end -gem 'grack', path:'./lib/grack' +gem 'grack', path:'lib/grack' gem 'gitlab', path: 'lib/gitlab-cli' gem 'rest-client' gem "mysql2", "= 0.3.18" diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index c8c482f81..1113de159 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -711,6 +711,11 @@ class CoursesController < ApplicationController end end + #从课程创建的老师那里选择课程大纲 + def course_outline + + end + #删除课程 #删除课程只是将课程的is_delete状态改为false,is_delete为false状态的课程只有管理员可以看到 def destroy diff --git a/app/views/courses/_course_outlines_list.html.erb b/app/views/courses/_course_outlines_list.html.erb new file mode 100644 index 000000000..efadbede9 --- /dev/null +++ b/app/views/courses/_course_outlines_list.html.erb @@ -0,0 +1,66 @@ + +
请选择课程大纲
+
+
+
+ + +
+
+ 未搜索到对应大纲,请重新输入 +
+ +
发布时间:2015-05-11
+ +
发布时间:2014-05-11
+ +
发布时间:2014-03-04
+ +
发布时间:2013-05-11
+ +
发布时间:2013-05-10
+ +
发布时间:2013-05-08
+ +
发布时间:2013-05-01
+
+
+
确定
+
取消
+
+
diff --git a/app/views/courses/course_outline.js.erb b/app/views/courses/course_outline.js.erb new file mode 100644 index 000000000..ea8f95c86 --- /dev/null +++ b/app/views/courses/course_outline.js.erb @@ -0,0 +1,8 @@ +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'course_outlines_list') %>'); +showModal('ajax-modal', '300px'); +$('#ajax-modal').css('height','360px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before(""); +$('#ajax-modal').parent().css("top","40%").css("left","46%"); +$('#ajax-modal').parent().addClass("courseOutlinePopup"); +$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); \ No newline at end of file diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 9b1dfbb7f..4eb036bbf 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -63,6 +63,11 @@ <%= l(:field_is_private)%> <% end %> + <%if @course.tea_id == User.current.id && @course.outline == 0%> + + 设置大纲 + + <% end %>
diff --git a/config/routes.rb b/config/routes.rb index 04dd05271..6af87a299 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -789,6 +789,7 @@ RedmineApp::Application.routes.draw do delete 'join_in/join_group', :to => 'courses#unjoin_group' get 'copy_course' match 'course_activity', :to => 'courses#course_activity', :via => :get, :as => "course_activity" + get 'course_outline' end collection do match 'join_private_courses', :via => [:get, :post] diff --git a/db/migrate/20151028060607_add_column_outline_to_course.rb b/db/migrate/20151028060607_add_column_outline_to_course.rb new file mode 100644 index 000000000..a666eba96 --- /dev/null +++ b/db/migrate/20151028060607_add_column_outline_to_course.rb @@ -0,0 +1,5 @@ +class AddColumnOutlineToCourse < ActiveRecord::Migration + def change + add_column :courses,:outline,:integer,:default => 0 + end +end diff --git a/db/schema.rb b/db/schema.rb index 7dab1b3a7..13853e0b4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20151022071804) do +ActiveRecord::Schema.define(:version => 20151028060607) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -443,6 +443,7 @@ ActiveRecord::Schema.define(:version => 20151022071804) do t.integer "is_public", :limit => 1, :default => 1 t.integer "inherit_members", :limit => 1, :default => 1 t.integer "open_student", :default => 0 + t.integer "outline", :default => 0 end create_table "custom_fields", :force => true do |t| @@ -527,26 +528,23 @@ ActiveRecord::Schema.define(:version => 20151022071804) do add_index "documents", ["created_on"], :name => "index_documents_on_created_on" add_index "documents", ["project_id"], :name => "documents_project_id" - create_table "dts", :primary_key => "Num", :force => true do |t| - t.string "Defect", :limit => 50 - t.string "Category", :limit => 50 - t.string "File" - t.string "Method" - t.string "Module", :limit => 20 - t.string "Variable", :limit => 50 - t.integer "StartLine" - t.integer "IPLine" - t.string "IPLineCode", :limit => 200 - t.string "Judge", :limit => 15 - t.integer "Review", :limit => 1 + create_table "dts", :force => true do |t| + t.string "IPLineCode" t.string "Description" - t.text "PreConditions", :limit => 2147483647 - t.text "TraceInfo", :limit => 2147483647 - t.text "Code", :limit => 2147483647 + t.string "Num" + t.string "Variable" + t.string "TraceInfo" + t.string "Method" + t.string "File" + t.string "IPLine" + t.string "Review" + t.string "Category" + t.string "Defect" + t.string "PreConditions" + t.string "StartLine" t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "enabled_modules", :force => true do |t| @@ -815,6 +813,16 @@ ActiveRecord::Schema.define(:version => 20151022071804) do add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" + create_table "journal_details_copy", :force => true do |t| + t.integer "journal_id", :default => 0, :null => false + t.string "property", :limit => 30, :default => "", :null => false + t.string "prop_key", :limit => 30, :default => "", :null => false + t.text "old_value" + t.text "value" + end + + add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id" + create_table "journal_replies", :id => false, :force => true do |t| t.integer "journal_id" t.integer "user_id" diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 3baa11970..921260a72 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -1222,4 +1222,11 @@ var autoTextarea2 = function (elem,elem2, extra, maxHeight) { addEvent(elem2, 'input', change); addEvent(elem2, 'focus', change); change(); -}; \ No newline at end of file +}; + +//课程大纲选择请求 +function course_outline(id){ + $.get( + ' /courses/'+id+'/course_outline' + ) +} \ No newline at end of file diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index d75b33c2f..39150ed73 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1089,3 +1089,12 @@ a.postRouteLink:hover {text-decoration:underline;} .ReplyToMessageContainer {border-bottom:1px solid #e3e3e3; width:632px; margin:0px auto; margin-top:15px; min-height:60px;} .ReplyToMessageInputContainer {width:582px; float:left;} + +/*课程大纲弹框*/ +.courseOutlinePopup {width:400px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-200px; z-index:1000;} +.courseOutlineSearchIcon{width:31px; height:25px; background-color:#ffffff; background:url(images/resource_icon_list.png) -40px -18px no-repeat; display:inline-block; float:left;} +.blogTitle {max-width:240px; font-size:12px; color:#484848; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;} +.blogBlock {overflow-x:hidden; max-height:200px; overflow-y:auto; margin-bottom:5px;} +.blogRow {width:280px; height:15px; line-height:15px;} +.blogSearchBox {border:1px solid #e6e6e6; width:280px; height:25px; background-color:#ffffff; margin-top:8px; margin-bottom:8px;} +.blogSearchContent {border:none; outline:none; background-color:#ffffff; width:236px; height:25px; padding-left:10px; display:inline-block; float:left;}