From 3a21c4e2fa56b29930fbeb14bdd4dd69a7fcdf2a Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Sat, 29 Aug 2015 15:07:47 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E7=99=BB=E5=BD=95=E4=B9=8B=E5=90=8E?= =?UTF-8?q?=E8=B7=B3=E5=88=B0=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 698b0de48..1c233ed6b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -557,7 +557,7 @@ class ApplicationController < ActionController::Base end def redirect_back_or_default(default, options={}) - back_url = params[:back_url].to_s + back_url = '' #params[:back_url].to_s if back_url.present? begin uri = URI.parse(back_url) From 244d5165e27c945e30a4fad3f983e44bc7276d35 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Sat, 29 Aug 2015 15:25:58 +0800 Subject: [PATCH 02/13] =?UTF-8?q?=E7=99=BB=E5=BD=95=E4=B9=8B=E5=90=8E?= =?UTF-8?q?=E8=B7=B3=E5=88=B0=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/account_controller.rb | 14 +++++++------- app/controllers/my_controller.rb | 2 +- app/controllers/softapplications_controller.rb | 2 +- app/controllers/welcome_controller.rb | 5 +++-- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 5c64ad332..1e16d19be 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -27,7 +27,7 @@ class AccountController < ApplicationController if request.get? @login = params[:login] || true if User.current.logged? - redirect_to home_url + redirect_to user_path(User.current) else render :layout => 'login' end @@ -58,7 +58,7 @@ class AccountController < ApplicationController # Lets user choose a new password def lost_password - (redirect_to(home_url); return) unless Setting.lost_password? + (redirect_to(signin_path); return) unless Setting.lost_password? if params[:token] @token = Token.find_token("recovery", params[:token].to_s) if @token.nil? || @token.expired? @@ -110,7 +110,7 @@ class AccountController < ApplicationController # User self-registration def register - (redirect_to(home_url); return) unless Setting.self_registration? || session[:auth_source_registration] + (redirect_to(signin_path); return) unless Setting.self_registration? || session[:auth_source_registration] if request.get? session[:auth_source_registration] = nil @user = User.new(:language => current_language.to_s) @@ -187,11 +187,11 @@ class AccountController < ApplicationController # Token based account activation def activate - (redirect_to(home_url); return) unless Setting.self_registration? && params[:token].present? + (redirect_to(signin_path); return) unless Setting.self_registration? && params[:token].present? token = Token.find_token('register', params[:token].to_s) - (redirect_to(home_url); return) unless token and !token.expired? + (redirect_to(signin_path); return) unless token and !token.expired? user = token.user - (redirect_to(home_url); return) unless user.registered? + (redirect_to(signin_path); return) unless user.registered? user.activate if user.save token.destroy @@ -278,7 +278,7 @@ class AccountController < ApplicationController user = User.find_or_initialize_by_identity_url(identity_url) if user.new_record? # Self-registration off - (redirect_to(home_url); return) unless Setting.self_registration? + (redirect_to(signin_path); return) unless Setting.self_registration? # Create on the fly user.login = registration['nickname'] unless registration['nickname'].nil? diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 4124472e1..9728ddf11 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -174,7 +174,7 @@ class MyController < ApplicationController logout_user flash.now[:notice] = l(:notice_account_deleted) end - redirect_to home_url + redirect_to signin_path end end diff --git a/app/controllers/softapplications_controller.rb b/app/controllers/softapplications_controller.rb index e47cfc2ff..bedb2541f 100644 --- a/app/controllers/softapplications_controller.rb +++ b/app/controllers/softapplications_controller.rb @@ -207,7 +207,7 @@ class SoftapplicationsController < ApplicationController @softapplication.destroy respond_to do |format| - format.html { redirect_to home_url } + format.html { redirect_to signin_path } format.json { head :no_content } end end diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 6b14db9bb..809f78ddc 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -27,7 +27,8 @@ class WelcomeController < ApplicationController def index # 企业版定制: params[:project]为传过来的参数 - + redirect_to signin_path + return unless params[:organization].nil? @organization = Organization.find params[:organization] # @organization_projects = Project.joins(:project_status).joins("LEFT JOIN project_scores ON projects.id = project_scores.project_id").where("projects.organization_id = ?", @organization.id).order("score DESC").limit(10).all @@ -171,7 +172,7 @@ class WelcomeController < ApplicationController redirect_to users_search_url(:name => search_condition, :search_by => search_by, :role => :student) else #redirect_to home_path, :alert => l(:label_sumbit_empty) - (redirect_to home_url, :notice => l(:label_sumbit_empty);return) #if params[:name].blank? + (redirect_to signin_path, :notice => l(:label_sumbit_empty);return) #if params[:name].blank? end } end From 6d768100f8efaf101e86f80f7280c4a7e4d69294 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 29 Aug 2015 16:14:02 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E8=BE=93=E5=85=A5=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E4=B8=8D=E6=8F=90=E4=BA=A4=E8=A1=A8=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_logined_header.html.erb | 18 ++++++++--- app/views/layouts/_unlogin_header.html.erb | 36 +++++++++++++--------- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index 8dd0bd2bb..ab3a58369 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -33,12 +33,21 @@ $(function(){ $("#navHomepageSearchInput").keypress(function(e){ - if (e.keyCode == '13') { + var name = $.trim($('#navHomepageSearchInput').val()); + if (e.keyCode == '13' && name != "" && name.length != 0) { $('#type').val($('input[type=radio]:checked').val()); $(this).parent().submit(); } }) }); + + function search_in_header(){ + var name = $.trim($('#navHomepageSearchInput').val()); + if (name != "" && name.length != 0) { + $('#type').val($('input[type=radio]:checked').val()); + $(this).parent().submit(); + } + }