From bcaaa02bed3ffc08206b72032821b6180088ee8b Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 18 Jul 2014 10:01:54 +0800 Subject: [PATCH 01/14] =?UTF-8?q?=E5=8F=96=E6=B6=88=E5=B7=B2=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E8=AF=BE=E7=A8=8B=E5=9C=A8=E8=BD=AF=E4=BB=B6=E5=88=9B?= =?UTF-8?q?=E5=AE=A2=E5=88=97=E8=A1=A8=E7=9A=84=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/users_helper.rb | 20 +++++++++++++++++ app/views/users/_user_show.html.erb | 2 +- db/schema.rb | 33 ++++++++++++++++++++--------- 3 files changed, 44 insertions(+), 11 deletions(-) diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index e65fe174e..58935dd11 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -258,4 +258,24 @@ module UsersHelper end return result end + + #获取用户参与的公开的课程列表 + def user_public_course_list user + membership = user.coursememberships.all#@user.coursememberships.all(:conditions => Course.visible_condition(User.current)) + membership.sort! {|older, newer| newer.created_on <=> older.created_on } + memberships = [] + membership.collect { |e| + memberships.push(e) + } + ## 判断课程是否过期 [需封装] + memberships_doing = [] + memberships_done = [] + memberships.map { |e| + if course_endTime_timeout?(e.course) + memberships_done.push e + else + memberships_doing.push e + end + } + end end diff --git a/app/views/users/_user_show.html.erb b/app/views/users/_user_show.html.erb index 13f08f7ef..008905ef3 100644 --- a/app/views/users/_user_show.html.erb +++ b/app/views/users/_user_show.html.erb @@ -66,7 +66,7 @@ <%# unless user.memberships.empty? %> <%# cond = Project.visible_condition(User.current) + " AND projects.project_type = 1" %> <%# memberships = user.memberships.all(:conditions => cond) %> - <% user_courses = user.coursememberships.map(&:course) %> + <% user_courses = user_courses_list(user) %> <%= l(:label_x_course_contribute_to, :count => user_courses.count) %> <% for course in user_courses %> <%# if course.name != nil %> diff --git a/db/schema.rb b/db/schema.rb index ac5ca0644..4a14a02f2 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -809,18 +809,18 @@ ActiveRecord::Schema.define(:version => 20140716021558) do create_table "relative_memos", :force => true do |t| t.integer "osp_id" t.integer "parent_id" - t.string "subject", :null => false - t.text "content", :null => false + t.string "subject", :null => false + t.text "content", :limit => 16777215, :null => false t.integer "author_id" - t.integer "replies_count", :default => 0 + t.integer "replies_count", :default => 0 t.integer "last_reply_id" - t.boolean "lock", :default => false - t.boolean "sticky", :default => false - t.boolean "is_quote", :default => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "viewed_count_crawl", :default => 0 - t.integer "viewed_count_local", :default => 0 + t.boolean "lock", :default => false + t.boolean "sticky", :default => false + t.boolean "is_quote", :default => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "viewed_count_crawl", :default => 0 + t.integer "viewed_count_local", :default => 0 t.string "url" t.string "username" t.string "userhomeurl" @@ -844,6 +844,19 @@ ActiveRecord::Schema.define(:version => 20140716021558) do add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id" + create_table "rich_rich_files", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "rich_file_file_name" + t.string "rich_file_content_type" + t.integer "rich_file_file_size" + t.datetime "rich_file_updated_at" + t.string "owner_type" + t.integer "owner_id" + t.text "uri_cache" + t.string "simplified_type", :default => "file" + end + create_table "roles", :force => true do |t| t.string "name", :limit => 30, :default => "", :null => false t.integer "position", :default => 1 From 6f858795ef0c9778c19b6a640790a24e617e0708 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 18 Jul 2014 10:24:49 +0800 Subject: [PATCH 02/14] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=9C=AA=E9=80=89=E4=B8=ADwiki=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E5=8F=96=E6=B6=88=E5=B7=A6=E4=BE=A7=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E9=9B=86=E7=9A=84WIKI=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/_tools_expand.html.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/projects/_tools_expand.html.erb b/app/views/projects/_tools_expand.html.erb index aec1ad7a2..5ee70fa9d 100644 --- a/app/views/projects/_tools_expand.html.erb +++ b/app/views/projects/_tools_expand.html.erb @@ -6,7 +6,9 @@