Merge branch 'yuanke' into develop

Conflicts:
	app/controllers/org_subfields_controller.rb
This commit is contained in:
yuanke 2016-06-15 14:44:02 +08:00
commit b08f6e307a
10 changed files with 52 additions and 19 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

@ -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)

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

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

View File

@ -1,8 +1,10 @@
<% if user.user_extensions && user.user_extensions.brief_introduction && !user.user_extensions.brief_introduction.empty? %>
<%= user.user_extensions.brief_introduction %>&nbsp;
<% else%>
这位童鞋很懒,什么也没有留下~&nbsp;
<% end %>
<span>
<% if user.user_extensions && user.user_extensions.brief_introduction && !user.user_extensions.brief_introduction.empty? %>
<%= user.user_extensions.brief_introduction %>
<% else%>
这位童鞋很懒,什么也没有留下~
<% end %>
</span>
<% 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%>
<% end %>

View File

@ -139,9 +139,9 @@
<div>
<div class="homepageSignature break_word">
<p id="user_brief_introduction_show">
<%= render :partial => 'layouts/user_brief_introduction', :locals => {:user => @user} %>
</p>
<div id="user_brief_introduction_show">
<%= render :partial => 'layouts/user_brief_introduction', :locals => {:user => @user} %>
</div>
</div>
<textarea class="homepageSignatureTextarea none" placeholder="请编辑签名" id="user_brief_introduction_edit" onblur="edit_user_introduction('<%= edit_brief_introduction_user_path(@user.id)%>');"><%= @user.user_extensions.brief_introduction %></textarea>
</div>
@ -349,6 +349,7 @@
$(function(){
$('#user_hide_course').hide();
$('#user_hide_project').hide();
autoUrl("user_brief_introduction_show");
});
$("#courseMenu").mouseenter(function(){

View File

@ -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("");

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>

View File

@ -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();
$("#user_brief_introduction_edit").hide();
autoUrl("user_brief_introduction_show");