修改组织点击登录后可回复报500的BUG

This commit is contained in:
yuanke 2016-06-15 14:33:25 +08:00
parent 44c9265fee
commit 7b6e8fbc53
5 changed files with 29 additions and 4 deletions

View File

@ -916,4 +916,11 @@ class ApplicationController < ActionController::Base
call_hook(:controller_account_success_authentication_after, {:user => user })
end
def user_unlogged_check
if !User.current.logged?
render(:partial => 'organizations/unlogged_tip')
return false
end
true
end
end

View File

@ -57,6 +57,10 @@ class OrgSubfieldsController < ApplicationController
@org_subfield = OrgSubfield.find_by_sql("select distinct org_subfields.* from org_subfields,"+
"subfield_subdomain_dirs where org_subfields.id = subfield_subdomain_dirs.org_subfield_id and "+
" org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir_name]}'").first
if @org_subfield.nil?
render_404
return
end
if @org_subfield.field_type == 'Post'
@org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0
@org_activities = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page] || 1).per(10)

View File

@ -1,12 +1,12 @@
class PraiseTreadController < ApplicationController
accept_api_auth :tread_plus,:praise_plus
before_filter :require_login,:only => [:praise_plus,:tread_plus]
# before_filter :require_login,:only => [:praise_plus,:tread_plus]
before_filter :user_unlogged_check,:only => [:praise_plus,:tread_plus,:praise_minus]
def praise_plus
@obj = nil
@activity = false
if request.get?
@obj_id = params[:obj_id]
@obj_type = params[:obj_type]

View File

@ -0,0 +1,4 @@
//获取登录页面地址
var signinPath = '<%= signin_url_without_domain %>';
var htmlvalue = "</br><div style='width:550px;text-align:center'>您还没有登录,请登录后再执行此操作,谢谢!</div></br><div style='width:164px; margin:0 auto; text-align:center'><a href="+signinPath+" class='Blue-btn fl' target='_Blank' onclick=' hideModal()' >登录</a><a href='javascript:void(0);' class='Blue-btn fl' onclick='hideModal()'>关闭</a></div>";
pop_up_box(htmlvalue,580,30,50);

View File

@ -1,3 +1,13 @@
<div class="visitor-box fontGrey2">
<%= link_to "登录", signin_path, :class => "linkBlue", :target => "_blank" %>后可添加回复
</div>
<a href='javascript:void(0);' class='linkBlue' onclick='loginClick()'>登录</a>后可添加回复
<%#= link_to "登录", signin_path, :class => "linkBlue", :target => "_blank" %>
</div>
<script type="text/javascript">
function loginClick()
{
//获取登录页面地址
var signinPath = '<%= signin_url_without_domain %>';
var htmlvalue = "</br><div style='width:550px;text-align:center'>您还没有登录,请登录后再执行此操作,谢谢!</div></br><div style='width:164px; margin:0 auto; text-align:center'><a href="+signinPath+" class='Blue-btn fl' target='_Blank' onclick=' hideModal()' >登录</a><a href='javascript:void(0);' class='Blue-btn fl' onclick='hideModal()'>关闭</a></div>";
pop_up_box(htmlvalue,580,30,50);
}
</script>