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 1/5] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=A4=A7=E7=BA=B2?= =?UTF-8?q?=E7=95=8C=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;} From 0de97fb9efb736b883168db3d6cb8fa96ffa51a7 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 29 Oct 2015 09:04:04 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=85=B3=E6=B3=A8=E7=9A=84=E4=BA=BA=EF=BC=8Csql=E4=BC=9A?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 175c8ce51..7c41dd038 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -949,7 +949,7 @@ class UsersController < ApplicationController when "current_user" @user_activities = UserActivity.where("user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))").order('updated_at desc').limit(10).offset(@page * 10) else - blog_ids = "("+@user.blog.id.to_s+","+User.watched_by(@user.id).map{|u| u.blog.id}.join(',')+")" + blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")" @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" + "or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+ "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " + @@ -957,7 +957,7 @@ class UsersController < ApplicationController end else # @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id})").order('updated_at desc').limit(10).offset(@page * 10) - blog_ids = "("+@user.blog.id.to_s+","+User.watched_by(@user.id).map{|u| u.blog.id}.join(',')+")" + blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")" @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" + "or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+ "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " + From b67afc2b9509e3e960a581f770c289d352b32289 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 29 Oct 2015 09:07:26 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=A4=A7=E7=BA=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/_course_outlines_list.html.erb | 56 +++---------------- app/views/courses/course_outline.js.erb | 9 +-- app/views/layouts/base_courses.html.erb | 24 ++++++++ config/routes.rb | 1 + public/javascripts/course.js | 7 ++- public/stylesheets/courses.css | 9 +-- 6 files changed, 49 insertions(+), 57 deletions(-) diff --git a/app/views/courses/_course_outlines_list.html.erb b/app/views/courses/_course_outlines_list.html.erb index efadbede9..cb7c52cfb 100644 --- a/app/views/courses/_course_outlines_list.html.erb +++ b/app/views/courses/_course_outlines_list.html.erb @@ -1,14 +1,15 @@ -
请选择课程大纲
-
+
请选择课程大纲
+
- - + + +
- 未搜索到对应大纲,请重新输入 -
+ +
  • @@ -16,48 +17,7 @@
  • 博客一
发布时间:2015-05-11
-
    -
  • - -
  • -
  • 高等数学-14学期
  • -
-
发布时间:2014-05-11
-
    -
  • - -
  • -
  • 博客二
  • -
-
发布时间:2014-03-04
-
    -
  • - -
  • -
  • 高等数学-13学期
  • -
-
发布时间:2013-05-11
-
    -
  • - -
  • -
  • 博客三-浅谈前段开发中所应用到的最新侧导航样式设计30案例
  • -
-
发布时间: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 index ea8f95c86..300ba6466 100644 --- a/app/views/courses/course_outline.js.erb +++ b/app/views/courses/course_outline.js.erb @@ -1,8 +1,9 @@ $('#ajax-modal').html('<%= escape_javascript(render :partial => 'course_outlines_list') %>'); showModal('ajax-modal', '300px'); -$('#ajax-modal').css('height','360px'); +//$('#ajax-modal').css('height','250px'); +$('#ajax-modal').css('padding-top','0px'); $('#ajax-modal').siblings().remove(); -$('#ajax-modal').before(""); -$('#ajax-modal').parent().css("top","40%").css("left","46%"); +$('#ajax-modal').before(' '); +$('#ajax-modal').parent().css("top","30%").css("left","50%"); $('#ajax-modal').parent().addClass("courseOutlinePopup"); -$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); \ No newline at end of file +$('#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 4eb036bbf..4e9868efe 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -171,5 +171,29 @@ <%= call_hook :view_layouts_base_body_bottom %> + \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 6af87a299..bdbdea619 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -790,6 +790,7 @@ RedmineApp::Application.routes.draw do get 'copy_course' match 'course_activity', :to => 'courses#course_activity', :via => :get, :as => "course_activity" get 'course_outline' + post 'search_course_outline' end collection do match 'join_private_courses', :via => [:get, :post] diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 921260a72..ddd323166 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -1229,4 +1229,9 @@ function course_outline(id){ $.get( ' /courses/'+id+'/course_outline' ) -} \ No newline at end of file +} +//$(function(){ +// $('#course_outline_search').on('input',function(){ +// alert('<%= @course.id%>') +// }) +//}) \ No newline at end of file diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 39150ed73..9fe75db34 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1092,9 +1092,10 @@ a.postRouteLink:hover {text-decoration:underline;} /*课程大纲弹框*/ .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;} +.searchIconPopup{width:31px; height:25px; background-color:#ffffff; background:url(../images/homepage_icon.png) 5px -394px no-repeat; display:inline-block; float:left; cursor: pointer;} +.searchIconPopup:hover {background:url(../images/homepage_icon.png) 5px -420px no-repeat;} .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;} +.blogBlock {overflow-x:hidden; max-height:200px;min-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;} +.blogSearchBox {border:1px solid #e6e6e6; height:25px; background-color:#ffffff; margin-top:8px; margin-bottom:8px;}/*width:280px;*/ +.blogSearchContent {border:none; outline:none; background-color:#ffffff; width:216px; height:25px; padding-left:10px; display:inline-block; float:left;} From ac82910aa5f30c6084270b75d8df2cf04cb033a3 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 29 Oct 2015 11:53:52 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=A4=A7=E7=BA=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 21 +++++++++++++++ app/models/blog_comment.rb | 9 +++++++ .../courses/_course_outlines_list.html.erb | 27 +++++++++++-------- app/views/courses/course_outline.js.erb | 2 +- app/views/courses/set_course_outline.js.erb | 1 + app/views/layouts/base_courses.html.erb | 27 ++++++++++++++++--- config/routes.rb | 1 + 7 files changed, 73 insertions(+), 15 deletions(-) create mode 100644 app/views/courses/set_course_outline.js.erb diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 1113de159..1216599a1 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -713,7 +713,28 @@ class CoursesController < ApplicationController #从课程创建的老师那里选择课程大纲 def course_outline + @teacher = User.find(@course.tea_id) + @blog_articles = @teacher.blog.articles + respond_to do |format| + format.js + end + end + + #根据关键字搜索,查找方法一样的,但返回内容不一样 + def search_course_outline + @article_title = params[:title] + @teacher = User.find(@course.tea_id) + @blog_articles = @teacher.blog.articles.like(@article_title) + render :json=>@blog_articles.to_json + end + #设置或者更改课程的大纲 + def set_course_outline + @course.outline = params[:outline_id] + @course.save + respond_to do |format| + format.js + end end #删除课程 diff --git a/app/models/blog_comment.rb b/app/models/blog_comment.rb index 9bb28ddd8..27da33121 100644 --- a/app/models/blog_comment.rb +++ b/app/models/blog_comment.rb @@ -19,6 +19,15 @@ class BlogComment < ActiveRecord::Base after_save :add_user_activity before_destroy :destroy_user_activity + scope :like, lambda {|arg| + if arg.blank? + where(nil) + else + pattern = "%#{arg.to_s.strip.downcase}%" + where(" LOWER(title) LIKE :p ", :p => pattern) + end + } + #在个人动态里面增加当前动态 def add_user_activity if self.parent_id.nil? #只有发博文才插入动态 diff --git a/app/views/courses/_course_outlines_list.html.erb b/app/views/courses/_course_outlines_list.html.erb index cb7c52cfb..b8a8bfd2a 100644 --- a/app/views/courses/_course_outlines_list.html.erb +++ b/app/views/courses/_course_outlines_list.html.erb @@ -8,19 +8,24 @@
- + + <%= form_tag(url_for(:controller=>'courses',:action=>'set_course_outline',:id=>course.id),:method=>'post',:remote=>'true') do %>
-
    -
  • - -
  • -
  • 博客一
  • -
-
发布时间:2015-05-11
- + <% unless articles.blank? %> + <% articles.each do |article|%> +
    +
  • + +
  • +
  • <%= article.title%>
  • +
+
发布时间:<%= format_date(article.created_at)%>
+ <% end %> + <% end %>
- - + +
+<% end %> diff --git a/app/views/courses/course_outline.js.erb b/app/views/courses/course_outline.js.erb index 300ba6466..f747661b8 100644 --- a/app/views/courses/course_outline.js.erb +++ b/app/views/courses/course_outline.js.erb @@ -1,4 +1,4 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'course_outlines_list') %>'); +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'course_outlines_list',:locals => {:articles=>@blog_articles,:course=>@course}) %>'); showModal('ajax-modal', '300px'); //$('#ajax-modal').css('height','250px'); $('#ajax-modal').css('padding-top','0px'); diff --git a/app/views/courses/set_course_outline.js.erb b/app/views/courses/set_course_outline.js.erb new file mode 100644 index 000000000..ad3b78189 --- /dev/null +++ b/app/views/courses/set_course_outline.js.erb @@ -0,0 +1 @@ +hideModal(); \ 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 4e9868efe..43f754097 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -63,7 +63,7 @@ <%= l(:field_is_private)%> <% end %> - <%if @course.tea_id == User.current.id && @course.outline == 0%> + <%if @course.tea_id == User.current.id %> 设置大纲 @@ -172,6 +172,7 @@ <%= call_hook :view_layouts_base_body_bottom %> + +
+
+
+ <%= link_to image_tag(url_to_avatar(@article.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@article.author) %> +
+
+ <% if @article.author.id == User.current.id%> + + + + + + + [设置大纲] + + <%end%> + +
+ +
+ <% if @article.try(:author).try(:realname) == ' ' %> + <%= link_to @article.try(:author), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% else %> + <%= link_to @article.try(:author).try(:realname), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% end %> +
+
<%= format_time( @article.created_on)%>
+
+
+ <%= @article.content.html_safe%> +
+
+
+ <%#= link_to_attachments_course @topic, :author => false %> + <% if @article.attachments.any?%> + <% options = {:author => true, :deletable => false} %> + <%= render :partial => 'blog_comments/attachments_links', :locals => {:attachments => @article.attachments, :options => options, :is_float => true} %> + <% end %> +
+
+
+
+
+ <% count=0 %> + <% if @article.parent %> + <% count=@article.parent.children.count%> + <% else %> + <% count=@article.children.count%> + <% end %> +
+ <% unless count == 0 %> +
+
回复(<%=count %>)
+
+ +
+
+ <%@article.children.reorder('created_on desc').each_with_index do |reply,i| %> + +
+
+ <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> +
+
+
+ <% if reply.try(:author).try(:realname) == ' ' %> + <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> + <% end %> +
+
+ <%= reply.content.html_safe%> +
+
+ <%= format_time(reply.created_on) %> + +
+

+
+
+
+ <% end %> +
+ + <% end %> +
+ <% if !@article.locked? && User.current.logged?%> +
+ +
+
+ <%= form_for :blog_comment, :url => {:action => 'reply',:controller => 'blog_comments',:user_id=>@article.author.id,:blog_id=>@article.blog_id, :id => @article.id}, :html => {:multipart => true, :id => 'message_form'} do |f| %> + + <%= render :partial => 'blog_comments/reply_form', :locals => {:f => f,:user=>@user,:article=>@article} %> + <%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'canel_message_replay();', :class => " grey_btn fr c_white mt10 mr5" %> + <%= link_to l(:button_submit), "javascript:void(0)", :onclick => 'submit_message_replay();', :class => "blue_btn fr c_white mt10", :style => "margin-right: 5px;" %> + <% end %> +
+
+
+ <% end %> +
+
\ 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 43f754097..d7e7bba90 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -54,21 +54,47 @@
+ + + + + + + + + + + + + + + + + + +
- - <%= @course.name %> - - <% if @course.is_public == 0%> - + +
+ + <%= @course.name %> + + <% if @course.is_public == 0%> + + <%= l(:field_is_private)%> - <% end %> - <%if @course.tea_id == User.current.id %> - - 设置大纲 - - <% end %> -
+ <% end %> + + <%if @course.tea_id == User.current.id && (@course.outline == 0 || BlogComment.where(:id=>@course.outline).count == 0) %> + + <% elsif @course.tea_id == User.current.id && @course.outline != 0 && BlogComment.where(:id=>@course.outline).count != 0%> + + <% elsif @course.tea_id != User.current.id %> + <%end %> + +
+
<%= l(:label_account_identity_teacher)%>(<%= course_teacher_link teacher_num %>) diff --git a/config/routes.rb b/config/routes.rb index 3811bd43f..5be734dee 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -792,6 +792,7 @@ RedmineApp::Application.routes.draw do get 'course_outline' post 'search_course_outline' post 'set_course_outline' + get 'show_course_outline' end collection do match 'join_private_courses', :via => [:get, :post] diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 9fe75db34..744f1e07a 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1099,3 +1099,12 @@ a.postRouteLink:hover {text-decoration:underline;} .blogRow {width:280px; height:15px; line-height:15px;} .blogSearchBox {border:1px solid #e6e6e6; height:25px; background-color:#ffffff; margin-top:8px; margin-bottom:8px;}/*width:280px;*/ .blogSearchContent {border:none; outline:none; background-color:#ffffff; width:216px; height:25px; padding-left:10px; display:inline-block; float:left;} + +/*课程大纲图标样式20151028Tim*/ +.syllabusIcon {background:url("../images/course/syllabus.png") 0px 0px no-repeat; width: 17px; height: 16px; display: inline-block;} +.syllabusSetting {background:url("../images/course/syllabus.png") 0px -16px no-repeat; width: 20px; height: 16px; display: inline-block;} + +.syllabusSettingIcon {background:url(../images/course/syllabus_setting.png) 0px 0px no-repeat; width:20px; height:20px;} +.syllabusSettingIcon:hover {cursor: pointer} + +.pic_files{display:block; background:url(../images/public_icon.png) 0px -578px no-repeat; width:20px; height:15px;}