diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index cbce67618..b1aae9b26 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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 diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb index 38f5879e5..734e8a719 100644 --- a/app/controllers/org_subfields_controller.rb +++ b/app/controllers/org_subfields_controller.rb @@ -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) diff --git a/app/controllers/praise_tread_controller.rb b/app/controllers/praise_tread_controller.rb index 0c665341a..b6eb54d2f 100644 --- a/app/controllers/praise_tread_controller.rb +++ b/app/controllers/praise_tread_controller.rb @@ -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] diff --git a/app/views/organizations/_unlogged_tip.js.erb b/app/views/organizations/_unlogged_tip.js.erb new file mode 100644 index 000000000..ac49fd422 --- /dev/null +++ b/app/views/organizations/_unlogged_tip.js.erb @@ -0,0 +1,4 @@ +//获取登录页面地址 +var signinPath = '<%= signin_url_without_domain %>'; +var htmlvalue = "
您还没有登录,请登录后再执行此操作,谢谢!

登录关闭
"; +pop_up_box(htmlvalue,580,30,50); \ No newline at end of file diff --git a/app/views/users/_show_unlogged.html.erb b/app/views/users/_show_unlogged.html.erb index 258ebe7af..cd59123b1 100644 --- a/app/views/users/_show_unlogged.html.erb +++ b/app/views/users/_show_unlogged.html.erb @@ -1,3 +1,13 @@
- <%= link_to "登录", signin_path, :class => "linkBlue", :target => "_blank" %>后可添加回复 -
\ No newline at end of file + 登录后可添加回复 + <%#= link_to "登录", signin_path, :class => "linkBlue", :target => "_blank" %> + + \ No newline at end of file