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} %> -

+
+ <%= render :partial => 'layouts/user_brief_introduction', :locals => {:user => @user} %> +
@@ -349,6 +349,7 @@ $(function(){ $('#user_hide_course').hide(); $('#user_hide_project').hide(); + autoUrl("user_brief_introduction_show"); }); $("#courseMenu").mouseenter(function(){ diff --git a/app/views/org_subfields/create.js.erb b/app/views/org_subfields/create.js.erb index 952ed7b2c..a65f53719 100644 --- a/app/views/org_subfields/create.js.erb +++ b/app/views/org_subfields/create.js.erb @@ -4,6 +4,8 @@ $("#sub_field_left_lists").html(""); $("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); $("#org_custom_admin").html("<%= escape_javascript(render :partial => 'organizations/org_custom_admin') %>"); + //默认选中第一个 + $("input[name='field_type']").get(0).checked=true; <% end %> $("#subfield_name").val(""); $("#sub_dir").val(""); \ No newline at end of file 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 diff --git a/app/views/users/edit_brief_introduction.js.erb b/app/views/users/edit_brief_introduction.js.erb index c64482715..eeaec4e6d 100644 --- a/app/views/users/edit_brief_introduction.js.erb +++ b/app/views/users/edit_brief_introduction.js.erb @@ -1,3 +1,4 @@ $("#user_brief_introduction_show").html("<%= escape_javascript render(:partial => "layouts/user_brief_introduction", :locals => {:user => @user}) %>"); $("#user_brief_introduction_show").show(); -$("#user_brief_introduction_edit").hide(); \ No newline at end of file +$("#user_brief_introduction_edit").hide(); +autoUrl("user_brief_introduction_show");