From d667e6359c93562d56392a1476e17118bfcb76ed Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 7 Sep 2015 11:12:04 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/schema.rb | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index ec38d5c1d..3b5b88ee7 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 => 20150906083453) do +ActiveRecord::Schema.define(:version => 20150906091045) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -476,13 +476,6 @@ ActiveRecord::Schema.define(:version => 20150906083453) do add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" - create_table "discuss_demos", :force => true do |t| - t.string "title" - t.text "body" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - create_table "documents", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.integer "category_id", :default => 0, :null => false @@ -913,6 +906,7 @@ ActiveRecord::Schema.define(:version => 20150906083453) do t.datetime "created_on" t.integer "comments_count", :default => 0, :null => false t.integer "course_id" + t.datetime "updated_on" end add_index "news", ["author_id"], :name => "index_news_on_author_id" @@ -1421,6 +1415,7 @@ ActiveRecord::Schema.define(:version => 20150906083453) do t.integer "container_id" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.integer "user_id" end create_table "user_extensions", :force => true do |t| From aa0c0dab8366fa8493cad57abc6efde8e2247c6c Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 7 Sep 2015 15:01:08 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E2=80=9C=E6=88=91?= =?UTF-8?q?=E7=9A=84=E5=8A=A8=E6=80=81=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 6 ++- app/models/course_activity.rb | 1 + app/views/users/show.html.erb | 1 + ...07064144_add_user_id_to_user_activities.rb | 5 +++ .../20150907064547_update_user_activities.rb | 40 +++++++++++++++++++ db/schema.rb | 2 +- 6 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20150907064144_add_user_id_to_user_activities.rb create mode 100644 db/migrate/20150907064547_update_user_activities.rb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 859f19f19..d7cf29387 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -800,11 +800,13 @@ class UsersController < ApplicationController @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Issue'").order('created_at desc').limit(10).offset(@page * 10) when "project_message" @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('created_at desc').limit(10).offset(@page * 10) + when "current_user" + @user_activities = UserActivity.where("user_id = #{User.current.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('created_at desc').limit(10).offset(@page * 10) 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}").order('created_at desc').limit(10).offset(@page * 10) + @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})").order('created_at desc').limit(10).offset(@page * 10) 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}").order('created_at desc').limit(10).offset(@page * 10) + @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})").order('created_at desc').limit(10).offset(@page * 10) end # @user_activities = paginateHelper @user_activities,500 @type = params[:type] diff --git a/app/models/course_activity.rb b/app/models/course_activity.rb index 284687870..103796a72 100644 --- a/app/models/course_activity.rb +++ b/app/models/course_activity.rb @@ -19,6 +19,7 @@ class CourseActivity < ActiveRecord::Base user_activity.act_type = self.course_act_type user_activity.container_type = "Course" user_activity.container_id = self.course_id + user_activity.user_id = self.user_id user_activity.save end end diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 92f3f4a1a..13f2518e1 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -29,6 +29,7 @@
    • 更多
    • +
    • <%= link_to "我的动态", {:controller => "users", :action => "show", :type => "current_user"}, :class =>"homepagePostTypeAll postTypeGrey"%>
    • <%= link_to "全部动态", {:controller => "users", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%>
  • diff --git a/db/migrate/20150907064144_add_user_id_to_user_activities.rb b/db/migrate/20150907064144_add_user_id_to_user_activities.rb new file mode 100644 index 000000000..a038f4dab --- /dev/null +++ b/db/migrate/20150907064144_add_user_id_to_user_activities.rb @@ -0,0 +1,5 @@ +class AddUserIdToUserActivities < ActiveRecord::Migration + def change + add_column :user_activities, :user_id, :int + end +end diff --git a/db/migrate/20150907064547_update_user_activities.rb b/db/migrate/20150907064547_update_user_activities.rb new file mode 100644 index 000000000..b4c56c009 --- /dev/null +++ b/db/migrate/20150907064547_update_user_activities.rb @@ -0,0 +1,40 @@ +class UpdateUserActivities < ActiveRecord::Migration + def up + count = UserActivity.all.count / 30 + 2 + transaction do + for i in 1 ... count do i + UserActivity.page(i).per(30).each do |activity| + if activity.container_type.to_s == 'Project' + forge_activity = ForgeActivity.where("forge_act_type = '#{activity.act_type.to_s}' and forge_act_id = #{activity.act_id}").first + if forge_activity + activity.user_id = forge_activity.user_id + else + activity.user_id = 0 + end + + elsif activity.container_type.to_s == 'Course' + course_activity = CourseActivity.where("course_act_type = '#{activity.act_type.to_s}' and course_act_id = #{activity.act_id}").first + if course_activity + activity.user_id = course_activity.user_id + else + activity.user_id = 0 + end + end + activity.save + end + end + end + end + + def down + count = UserActivity.all.count / 30 + 2 + transaction do + for i in 1 ... count do i + UserActivity.page(i).per(30).each do |activity| + activity.user_id = nil + activity.save + end + end + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 3b5b88ee7..db0b57ae8 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 => 20150906091045) do +ActiveRecord::Schema.define(:version => 20150907064547) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false From a159af813959d9b3b7ca9d04264bdf6d7e817572 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 7 Sep 2015 15:20:18 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E9=A1=B9=E7=9B=AE--=E9=82=80=E8=AF=B7--?= =?UTF-8?q?=E5=8F=91=E9=80=81=E9=82=AE=E4=BB=B6=E9=82=80=E8=AF=B7=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=AF=B9=E8=BE=93=E5=85=A5=E7=9A=84=E9=82=AE=E7=AE=B1?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E5=88=A4=E6=96=AD=EF=BC=8C=E5=90=8C=E6=97=B6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8F=90=E7=A4=BA=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../projects/invite_members_by_mail.html.erb | 18 +++++++++++++----- public/stylesheets/public.css | 2 ++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/app/views/projects/invite_members_by_mail.html.erb b/app/views/projects/invite_members_by_mail.html.erb index 4c6ee47d8..8c951a485 100644 --- a/app/views/projects/invite_members_by_mail.html.erb +++ b/app/views/projects/invite_members_by_mail.html.erb @@ -24,16 +24,24 @@ if(email == "") { $("#valid_email").text("<%= l(:label_input_email_blank)%>"); + return false; } - else if (filter.test(email)) { - $("#valid_email").html(""); - return true; + else if(!filter.test(email)) + { + $("#valid_email").text("<%= l(:label_email_format_error)%>"); + return false; + } + else if(email.split('@')[0].length >= 20) + { + $("#valid_email").text("邮箱名过长,最长为20个字符"); + return false; } else { - $("#valid_email").text("<%= l(:label_email_format_error)%>"); + $("#valid_email").text(""); + return true; } - return false; + } function senderEmail(obj) diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 4cc859721..2288c4994 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -418,6 +418,8 @@ div.flash.notice { background-color: #dfffdf; border-color: #9fcf9f; color: #005f00; + word-wrap: break-word; + word-break: break-all } div.flash.warning, .conflict { From 61281af4971073013ad1f59cc025170e61e5b2a6 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 7 Sep 2015 15:30:11 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=9A=84=E6=9C=80=E8=BF=91=E7=99=BB=E5=BD=95=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=88=97=E8=A1=A8=E7=9A=84=E7=99=BB=E5=BD=95=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E7=B2=BE=E7=A1=AE=E5=88=B0=E5=88=86=E7=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admin/latest_login_users.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/latest_login_users.html.erb b/app/views/admin/latest_login_users.html.erb index 89514726a..c438dcebd 100644 --- a/app/views/admin/latest_login_users.html.erb +++ b/app/views/admin/latest_login_users.html.erb @@ -54,7 +54,7 @@ <%=@count %> - <%=format_date(user.last_login_on) %> + <%=format_time(user.last_login_on) %> <%=user.id %> From 6bcaf01fe26f537fbb4088d13f9f3618d3ac133e Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Mon, 7 Sep 2015 16:01:19 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=BC=B9=E5=87=BA?= =?UTF-8?q?=E6=A1=86=E6=A0=B7=E5=BC=8F=E4=B8=8D=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_resource_share_for_project_popup.html.erb | 6 +++--- app/views/users/_resource_share_popup.html.erb | 6 +++--- public/stylesheets/new_user.css | 4 ++-- public/stylesheets/public_new.css | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/views/users/_resource_share_for_project_popup.html.erb b/app/views/users/_resource_share_for_project_popup.html.erb index 482569297..40bbd5e7c 100644 --- a/app/views/users/_resource_share_for_project_popup.html.erb +++ b/app/views/users/_resource_share_for_project_popup.html.erb @@ -30,11 +30,11 @@
    <% if !projects.empty? %> <% projects.each do |project| %> -
      -
    • +
        +
      • -
      • <%= project.name%>
      • +
      • <%= project.name%>
      <% end %>
    diff --git a/app/views/users/_resource_share_popup.html.erb b/app/views/users/_resource_share_popup.html.erb index 219402cbf..ed2ed44a6 100644 --- a/app/views/users/_resource_share_popup.html.erb +++ b/app/views/users/_resource_share_popup.html.erb @@ -30,11 +30,11 @@
    <% if !courses.empty? %> <% courses.each do |course| %> -
      -
    • +
        +
      • -
      • <%= course.name%>
      • +
      • <%= truncate(course.name,:lendght=>25) + '['+course.time.to_s+course.term + ']'%>
      <% end %>
    diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index f8000f674..539e9ce54 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -410,9 +410,9 @@ a.uploadIcon {background:url(images/resource_icon_list.png) 8px -60px no-repeat; .searchResourcePopup {border:none; outline:none; background-color:#ffffff; width:184px; height:25px; padding-left:10px; display:inline-block; float:left;} .searchIconPopup{width:31px; height:25px; background-color:#ffffff; background:url(images/resource_icon_list.png) -40px -18px no-repeat; display:inline-block; float:left;} .searchIconPopup:hover {cursor: pointer} -.courseSend {width:260px; height:15px; line-height:15px; margin-bottom:10px;} +.courseSend {width:390px; height:15px; line-height:15px; margin-bottom:10px;display:block;white-space:nowrap;} .courseSendCheckbox {padding:0px; margin:0px; width:12px; height:12px; margin-right:10px; display:inline-block; margin-top:2px;} -.sendCourseName {font-size:12px; color:#5f6060;} +.sendCourseName {font-size:12px; color:#5f6060;display:inline-block} .courseSendSubmit {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#269ac9; margin-right:25px; float:left;cursor: pointer;} .courseSendSubmit:hover {background-color:#297fb8;} .courseSendCancel {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#c1c1c1; float:left} diff --git a/public/stylesheets/public_new.css b/public/stylesheets/public_new.css index ec7ec26a1..15650bc65 100644 --- a/public/stylesheets/public_new.css +++ b/public/stylesheets/public_new.css @@ -572,7 +572,7 @@ a.uploadIcon {background:url(images/resource_icon_list.png) 8px -60px no-repeat; .searchIconPopup{width:31px; height:25px; background-color:#ffffff; background:url(images/resource_icon_list.png) -40px -18px no-repeat; display:inline-block; float:left;} .courseSend {width:260px; height:15px; line-height:15px; margin-bottom:10px;} .courseSendCheckbox {padding:0px; margin:0px; width:12px; height:12px; margin-right:10px; display:inline-block; margin-top:2px;} -.sendCourseName {font-size:12px; color:#5f6060;} +.sendCourseName {font-size:12px; color:#5f6060;display:inline-block} .courseSendSubmit {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#64bdd9; margin-right:25px; float:left;} .courseSendCancel {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#c1c1c1; float:left} a.sendSourceText {font-size:14px; color:#ffffff;} From 32b2d4f8740c6371a85c800101ec6965d6916108 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 7 Sep 2015 17:38:31 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E7=82=B9=E5=87=BB=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E5=9B=BE=E7=89=87=E5=8D=B3=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=A4=A7=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_project_issue.html.erb | 16 +++++++- public/stylesheets/new_user.css | 53 +++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index 3a6eac49d..8b9acb36e 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -130,4 +130,18 @@ <% end %> - \ No newline at end of file + + \ No newline at end of file diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index f8000f674..33a3d8413 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -1001,3 +1001,56 @@ a:hover.tijiao{ background:#0f99a9;} .about_project{ overflow:hidden;display:none;} .project_r_h{ width:670px; height:40px; background:#eaeaea; margin-bottom:10px;} .project_r_h02{ width:920px; height:40px; background:#eaeaea; margin-bottom:10px;} + +/* colorbox +*******************************************************************************/ +/* + Colorbox Core Style: + The following CSS is consistent between example themes and should not be altered. +*/ +#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;} +#cboxWrapper {max-width:none;} +#cboxOverlay{position:fixed; width:100%; height:100%;} +#cboxMiddleLeft, #cboxBottomLeft{clear:left;} +#cboxContent{position:relative;} +#cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;} +#cboxTitle{margin:0;} +#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;} +#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;} +.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;} +.cboxIframe{width:100%; height:100%; display:block; border:0; padding:0; margin:0;} +#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;} + +/* + User Style: + Change the following styles to modify the appearance of Colorbox. They are + ordered & tabbed in a way that represents the nesting of the generated HTML. +*/ +#cboxOverlay{background:#fff;} +#colorbox{outline:0;} +#cboxTopLeft{width:25px; height:25px; background:url(../images/colorbox/border1.png) no-repeat 0 0;} +#cboxTopCenter{height:25px; background:url(../images/colorbox/border1.png) repeat-x 0 -50px;} +#cboxTopRight{width:25px; height:25px; background:url(../images/colorbox/border1.png) no-repeat -25px 0;} +#cboxBottomLeft{width:25px; height:25px; background:url(../images/colorbox/border1.png) no-repeat 0 -25px;} +#cboxBottomCenter{height:25px; background:url(../images/colorbox/border1.png) repeat-x 0 -75px;} +#cboxBottomRight{width:25px; height:25px; background:url(../images/colorbox/border1.png) no-repeat -25px -25px;} +#cboxMiddleLeft{width:25px; background:url(../images/colorbox/border2.png) repeat-y 0 0;} +#cboxMiddleRight{width:25px; background:url(../images/colorbox/border2.png) repeat-y -25px 0;} +#cboxContent{background:#fff; overflow:hidden;} +.cboxIframe{background:#fff;} +#cboxError{padding:50px; border:1px solid #ccc;} +#cboxLoadedContent{margin-bottom:20px;} +#cboxTitle{position:absolute; bottom:0px; left:0; text-align:center; width:100%; color:#999;} +#cboxCurrent{position:absolute; bottom:0px; left:100px; color:#999;} +#cboxLoadingOverlay{background:#fff url(../images/colorbox/loading.gif) no-repeat 5px 5px;} + +/* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */ +#cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; } + +/* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */ +#cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;} + +#cboxSlideshow{position:absolute; bottom:0px; right:42px; color:#444;} +#cboxPrevious{position:absolute; bottom:0px; left:0; color:#444;} +#cboxNext{position:absolute; bottom:0px; left:63px; color:#444;} +#cboxClose{position:absolute; bottom:0; right:0; display:block; color:#444;} \ No newline at end of file