From 4a9967674a5ffd761195d7fafb948cc2a69d7495 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Sat, 13 Aug 2016 14:29:33 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E5=BC=BA=E5=88=B6=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E8=B5=84=E6=96=99=EF=BC=8C=E5=9C=A8=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=8D=95=E4=BD=8D=E6=97=B6=E7=BB=99=E5=87=BA=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E9=80=9A=E7=9F=A5=202.=20=E5=8D=95=E4=BD=8D=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E7=94=B3=E8=AF=B7=E6=8F=90=E7=A4=BA=E4=B8=80=E7=9B=B4?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=203.=20=E7=94=B3=E8=AF=B7=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E7=9A=84=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E4=BA=BA=E5=A4=B4=E5=83=8F=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E5=88=B0=E7=94=B3=E8=AF=B7=E4=BA=BA=E4=B8=BB?= =?UTF-8?q?=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/account_controller.rb | 20 +- app/controllers/admin_controller.rb | 2 +- app/controllers/my_controller.rb | 15 +- app/views/layouts/_footer_show.html.erb | 43 +++ .../layouts/_logined_header_show.html.erb | 111 ++++++ app/views/layouts/new_base_user.html.erb | 2 +- app/views/layouts/new_base_user_show.html.erb | 335 ++++++++++++++++++ app/views/my/account.html.erb | 37 +- .../users/_user_message_applied.html.erb | 6 +- 9 files changed, 549 insertions(+), 22 deletions(-) create mode 100644 app/views/layouts/_footer_show.html.erb create mode 100644 app/views/layouts/_logined_header_show.html.erb create mode 100644 app/views/layouts/new_base_user_show.html.erb diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 8187055be..731a251f2 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -26,7 +26,13 @@ class AccountController < ApplicationController if request.get? @login = params[:login] || true if User.current.logged? - redirect_to user_path(User.current) + # 判断用户基本资料是否完善,不完善讲强制完善基本资料,完善进入主页 + user = UserExtensions.where(:user_id => User.current.id).first + if user.gender.nil? || user.school_id.nil? || User.current.lastname.nil? + redirect_to my_account_path(:tip => 1) + else + redirect_to user_path(User.current) + end else render :layout => 'login' end @@ -127,7 +133,7 @@ class AccountController < ApplicationController session[:auth_source_registration] = nil self.logged_user = @user flash[:notice] = l(:notice_account_activated) - redirect_to my_account_path + redirect_to my_account_path(:tip=>1) end else us = UsersService.new @@ -144,7 +150,7 @@ class AccountController < ApplicationController if !@user.new_record? self.logged_user = @user flash[:notice] = l(:notice_account_activated) - redirect_to my_account_url + redirect_to my_account_url(:tip=>1) else redirect_to signin_path end @@ -347,9 +353,15 @@ class AccountController < ApplicationController else #by young #redirect_back_or_default my_page_path - redirect_back_or_default User.current + # 基本资料不完善的用户,将强制用户完善基本资料。 + user = UserExtensions.where(:user_id => User.current.id).first + if user.gender.nil? || user.school_id.nil? || User.current.lastname.nil? + redirect_to my_account_path(:tip => 1) + else + redirect_back_or_default User.current #redirect_to my_account_url #redirect_to User.current + end end end end diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 82c827b48..62d55b01d 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -698,7 +698,7 @@ class AdminController < ApplicationController apply_school_ids = apply_schools.empty? ? "(-1)" : "(" + apply_schools.map{|sc| sc.school_id}.join(',') + ")" if !params[:search].nil? search = "%#{params[:search].to_s.strip.downcase}%" - @schools = School.where("id not in #{apply_school_ids} and #{School.table_name}.name like :p",:p=>search) + @schools = School.where("id not in #{apply_school_ids} and #{School.table_name}.name like :p", :p => search) #@schools = School.all else #@course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id}").select { |course| @user.allowed_to?(:as_teacher,course)} diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 05b93d302..3aefdfd1d 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -114,9 +114,15 @@ class MyController < ApplicationController applied_message.update_attribute(:viewed, true) end + # 基本资料不完善 @force为false, 完善 @force为true + @force = false + if params[:tip] + @force = true + end + @user = User.current - lg=@user.login + lg = @user.login @pref = @user.pref diskfile = disk_filename('User', @user.id) diskfile1 = diskfile + 'temp' @@ -178,7 +184,12 @@ class MyController < ApplicationController File.delete(diskfile1) if File.exist?(diskfile1) end - render :layout=>'new_base_user' + # 基本资料不完善,无法使用其他功能,完善着可继续使用 + if @force + render :layout => 'new_base_user_show' + else + render :layout => 'new_base_user' + end end # Destroys user's account diff --git a/app/views/layouts/_footer_show.html.erb b/app/views/layouts/_footer_show.html.erb new file mode 100644 index 000000000..bb29956d3 --- /dev/null +++ b/app/views/layouts/_footer_show.html.erb @@ -0,0 +1,43 @@ +
\ No newline at end of file diff --git a/app/views/layouts/_logined_header_show.html.erb b/app/views/layouts/_logined_header_show.html.erb new file mode 100644 index 000000000..a6721501e --- /dev/null +++ b/app/views/layouts/_logined_header_show.html.erb @@ -0,0 +1,111 @@ + + diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index 50e788e2f..b9d4652ad 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -103,7 +103,7 @@