diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1c233ed6b..a6554075f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -563,7 +563,7 @@ class ApplicationController < ActionController::Base uri = URI.parse(back_url) # do not redirect user to another host or to the login or register page if (uri.relative? || (uri.host == request.host)) && !uri.path.match(%r{/(login|account/register)}) - back_url = back_url.gsub(%r{\/users\/(\d+)},"/users/"+default.id.to_s) + back_url = back_url.gsub(%r{\/users\/(\d+)},"/users/"+default.id.to_s) if default.is_a?(:User) redirect_to(back_url) return end diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 809f78ddc..784066378 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -96,11 +96,14 @@ class WelcomeController < ApplicationController @projects = Project.all_public.active render :layout => false, :content_type => 'text/plain' end - + def course - @course_page = FirstPage.find_by_page_type('course') - @school_id = params[:school_id] || User.current.user_extensions.school.try(:id) || 117 - @logoLink ||= logolink() + redirect_to signin_path + return + # + # @course_page = FirstPage.find_by_page_type('course') + # @school_id = params[:school_id] || User.current.user_extensions.school.try(:id) || 117 + # @logoLink ||= logolink() end def logolink() @@ -140,8 +143,11 @@ class WelcomeController < ApplicationController def contest - @contest_page = FirstPage.find_by_page_type('contest') - @contest_notifications = Contestnotification.order("created_at desc").limit(5) + redirect_to signin_path + return + + # @contest_page = FirstPage.find_by_page_type('contest') + # @contest_notifications = Contestnotification.order("created_at desc").limit(5) end def search @@ -181,28 +187,28 @@ class WelcomeController < ApplicationController private # 判断网站的入口,是课程 course 则跳过index去渲染 course 方法 def entry_select - url = request.original_url.gsub('/','') - if url.include?(Setting.url_course.gsub('/','')) - if @first_page.show_course == 1 - course - render :course - else - render_404 - end - - return 0 - elsif url.include?(Setting.url_contest.gsub('/','')) - if @first_page.show_contest == 1 - contest - render :contest - else - render_404 - end - - return 0 - elsif url.include?(Setting.url_user.gsub('/','')) - #redirect_to(:controller => "users", :action => "index") - end + # url = request.original_url.gsub('/','') + # if url.include?(Setting.url_course.gsub('/','')) + # if @first_page.show_course == 1 + # course + # render :course + # else + # render_404 + # end + # + # return 0 + # elsif url.include?(Setting.url_contest.gsub('/','')) + # if @first_page.show_contest == 1 + # contest + # render :contest + # else + # render_404 + # end + # + # return 0 + # elsif url.include?(Setting.url_user.gsub('/','')) + # #redirect_to(:controller => "users", :action => "index") + # end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 7f93345b4..7b83bb1c2 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2254,6 +2254,21 @@ module ApplicationHelper technical_title end + def get_user_roll user + technical_title = "" + case user.user_extensions.identity.to_s + when "0" + technical_title = get_technical_title user + when "1" + technical_title = l(:label_account_identity_student) + when "2" + technical_title = l(:label_account_identity_enterprise) + when "3" + technical_title = l(:label_account_identity_developer) + end + technical_title + end + def ie8? request.env["HTTP_USER_AGENT"] =~ /MSIE 8.0/ diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 6f775e7a2..c44b1aeee 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -202,24 +202,24 @@ class JournalsForMessage < ActiveRecord::Base # 用户留言消息通知 def act_as_user_feedback_message # 主留言 - receivers = [] - if self.reply_id == 0 - if self.user_id != self.jour_id # 过滤自己给自己的留言消息 - receivers << self.jour - end - else # 留言回复 - reply_to = User.find(self.reply_id) - if self.user_id != self.reply_id # 添加我回复的那个人 - receivers << reply_to - end - if self.user_id != self.parent.jour_id && self.reply_id != self.parent.jour_id # 给东家发信息,如果回复的对象是东家则不发 - receivers << self.parent.jour - end - end if self.jour_type == 'Principal' - receivers.each do |r| - self.user_feedback_messages << UserFeedbackMessage.new(:user_id => r.id, :journals_for_message_id => self.id, :journals_for_message_type => "Principal", :viewed => false) + receivers = [] + if self.reply_id == 0 + if self.user_id != self.jour_id # 过滤自己给自己的留言消息 + receivers << self.jour end + else # 留言回复 + reply_to = User.find(self.reply_id) + if self.user_id != self.reply_id # 添加我回复的那个人 + receivers << reply_to + end + if self.user_id != self.parent.jour_id && self.reply_id != self.parent.jour_id # 给东家发信息,如果回复的对象是东家则不发 + receivers << self.parent.jour + end + end + receivers.each do |r| + self.user_feedback_messages << UserFeedbackMessage.new(:user_id => r.id, :journals_for_message_id => self.id, :journals_for_message_type => "Principal", :viewed => false) + end end end diff --git a/app/views/courses/_history.html.erb b/app/views/courses/_history.html.erb index 70e943e99..864509546 100644 --- a/app/views/courses/_history.html.erb +++ b/app/views/courses/_history.html.erb @@ -5,7 +5,7 @@
<%= link_to image_tag(url_to_avatar(journal.user),:width => '46',:height => '46'), user_path(journal.user) %>
-
+
diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index ace881194..18953d22d 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -56,7 +56,7 @@ <%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %> " id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词进行搜索"/> - + <% end %>