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 1b24a6730..734e8a719 100644 --- a/app/controllers/org_subfields_controller.rb +++ b/app/controllers/org_subfields_controller.rb @@ -14,9 +14,10 @@ class OrgSubfieldsController < ApplicationController SubfieldSubdomainDir.create(:org_subfield_id => @subfield.id, :name => params[:sub_dir].downcase) end end - @subfield.update_attributes(:field_type => params[:field_type]) + #默认类型为帖子 + @subfield.update_attributes(:field_type => params[:field_type]||"Post") # admin配置的类型 - update_status_by_type(@subfield, params[:field_type]) + update_status_by_type(@subfield, params[:field_type]||"Post") else @res = false end @@ -56,7 +57,11 @@ 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.try(:field_type) == 'Post' + 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) #redirect_to organization_path(@organization, :org_subfield_id => @org_subfield.id) 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/forums/create.js.erb b/app/views/forums/create.js.erb index be99d724a..aae5122e4 100644 --- a/app/views/forums/create.js.erb +++ b/app/views/forums/create.js.erb @@ -1,6 +1,7 @@ <%if @save_flag%> -$('#new_forum_div').slideToggle();$('#create_btn').parent().slideToggle(); -$('#reorder_time').click(); +//$('#new_forum_div').slideToggle();$('#create_btn').parent().slideToggle(); +//$('#reorder_time').click(); + window.location.href= "http://"+"<%= Setting.host_name%>"+"/forums/" + "<%= @forum.id%>" <%else%> $("#error").html("<%= @forum.errors.full_messages[0]%>").show(); <%end %> \ No newline at end of file diff --git a/app/views/layouts/_user_brief_introduction.html.erb b/app/views/layouts/_user_brief_introduction.html.erb index 3b0500fed..4b2645129 100644 --- a/app/views/layouts/_user_brief_introduction.html.erb +++ b/app/views/layouts/_user_brief_introduction.html.erb @@ -1,8 +1,10 @@ -<% if user.user_extensions && user.user_extensions.brief_introduction && !user.user_extensions.brief_introduction.empty? %> - <%= user.user_extensions.brief_introduction %> -<% else%> - 这位童鞋很懒,什么也没有留下~ -<% end %> + + <% if user.user_extensions && user.user_extensions.brief_introduction && !user.user_extensions.brief_introduction.empty? %> + <%= user.user_extensions.brief_introduction %> + <% else%> + 这位童鞋很懒,什么也没有留下~ + <% end %> + <% if User.current == user%> <%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);", :onclick => "show_edit_user_introduction();"%> -<% end%> \ No newline at end of file +<% end %> diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index e43aa499f..d67b2d3f3 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -139,9 +139,9 @@
- <%= render :partial => 'layouts/user_brief_introduction', :locals => {:user => @user} %> -
+