From 5652a60c6885b0b59aa8873cfd396a5c19ec2eb5 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Mon, 19 Oct 2015 09:55:19 +0800 Subject: [PATCH 1/2] =?UTF-8?q?js=E5=87=BD=E6=95=B0=E8=8A=82=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/my/account.html.erb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index b439adaac..4a2fe446d 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -557,6 +557,17 @@ // }); //查询学校 $("input[name='province']").on('input', function (e) { + throttle(shcool_search_fn,window,e); + }); + + function throttle(method,context,e){ + clearTimeout(method.tId); + method.tId=setTimeout(function(){ + method.call(context,e); + },500); + } + + function shcool_search_fn(e){ $("input[name='occupation']").val(''); //一旦有输入就清空id。 if($(e.target).val().trim() == lastSearchCondition && $(e.target).val().trim() != ''){ return; @@ -592,7 +603,7 @@ } } }); - }); + } $(document.body).click(function(e){ if($(e.target).attr("id") != 'search_school_result_list' && $(e.target).attr("id") != 'province') { From cf0fd2022d8c85954227e6a83367d80755afb703 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Mon, 19 Oct 2015 14:58:44 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E5=8A=A8=E6=80=81=20=20=20=E9=A1=B9=E7=9B=AE=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E5=8A=A8=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 4 +-- app/views/users/_project_create.html.erb | 31 +++++++++++++++-------- app/views/users/_user_activities.html.erb | 10 +++++++- 3 files changed, 31 insertions(+), 14 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 90fdbe837..d25dd6fd2 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -881,8 +881,8 @@ class UsersController < ApplicationController @page = params[:page] ? params[:page].to_i + 1 : 0 user_project_ids = @user.projects.visible.empty? ? "(-1)" : "(" + @user.projects.visible.map{|project| project.id}.join(",") + ")" user_course_ids = @user.courses.visible.empty? ? "(-1)" : "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")" - course_types = "('Message','News','HomeworkCommon','Poll')" - project_types = "('Message','Issue')" + course_types = "('Message','News','HomeworkCommon','Poll','Course')" + project_types = "('Message','Issue','ProjectCreateInfo')" principal_types = "JournalsForMessage" if params[:type].present? case params[:type] diff --git a/app/views/users/_project_create.html.erb b/app/views/users/_project_create.html.erb index d07cb4a2d..8e3b5a5dc 100644 --- a/app/views/users/_project_create.html.erb +++ b/app/views/users/_project_create.html.erb @@ -1,18 +1,27 @@ +<% project = Project.find(activity.act_id) %> +<% user = User.find(project.user_id)%>