问吧帖子权限控制
This commit is contained in:
parent
a7bf421df8
commit
fd291850ae
|
@ -208,8 +208,8 @@ class ForumsController < ApplicationController
|
|||
reorder(order).
|
||||
preload(:author, {:last_reply => :author}).
|
||||
all
|
||||
@my_topic_count = Memo.where("author_id = #{User.current.id} and parent_id is null").count
|
||||
@my_replies_count = Memo.where("author_id = #{User.current.id} and parent_id is not null").count
|
||||
@my_topic_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is null").count
|
||||
@my_replies_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is not null").count
|
||||
@errors = params[:errors]
|
||||
# 推荐贴吧
|
||||
@forums = Forum.where("id !=?", @forum.id).reorder("topic_count desc,updated_at desc").first(3)
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="postDetailBanner" style="padding-bottom: 10px">
|
||||
<div class="postSort" id="time"><a href="javascript:void(0);" class="linkGrey2 fl">时间</a><a href="javascript:void(0);" id="reorder_time" class="sortArrowActiveD"></a></div>
|
||||
<div class="postSort" id="popu"><a href="javascript:void(0);" class="linkGrey2 fl">人气</a><a href="javascript:void(0);" id="reorder_popu" class=""></a></div>
|
||||
|
|
|
@ -1 +1 @@
|
|||
$("#topics_list").html("<%= escape_javascript(render :partial => 'show_topics',:locals => {:memos=>@memos})%>")
|
||||
$("#topics_list").html("<%= escape_javascript(render :partial => 'show_topics',:locals => {:memos=>@memos}) %>")
|
||||
|
|
|
@ -1,16 +1,46 @@
|
|||
<div class="postDetailContainer mb10 fl" style="width: 208px;">
|
||||
<div class="fl mr10"><%= link_to image_tag(url_to_avatar(User.current), :width => 50, :height => 50,:alt=>'贴吧图像' ), user_path( User.current) %></div>
|
||||
<div class="fl">
|
||||
<div class="f16 fontGrey2 ml38">我在贴吧</div>
|
||||
<div class="homepageImageBlock" style="width: 68px !important;">
|
||||
<div><a href="javascript:void(0);" class="homepageImageNumber" style="cursor: default"><%= @my_replies_count %></a></div>
|
||||
<div class="homepageImageText">回答</div>
|
||||
<div class="homepageLeft-new">
|
||||
<div class="postDetailContainer">
|
||||
<div class="fl mr10 pr"> <%= link_to image_tag(url_to_avatar(@forum.creator),:width=>75,:height => 75,:alt=>'贴吧图像' ), user_path( @forum.creator) %>
|
||||
<!--<div class="homepageEditProfile"><a href="javascript:void(0);" class="homepageEditProfileIcon"></a></div>-->
|
||||
</div>
|
||||
<div class="homepageVerDiv"></div>
|
||||
<div class="homepageImageBlock" style="width: 68px !important;">
|
||||
<div><a href="javascript:void(0);" class="homepageImageNumber" style="cursor: default"><%= @my_topic_count %></a></div>
|
||||
<div class="homepageImageText">发帖</div>
|
||||
<div class="fl">
|
||||
<%= link_to @forum.name, forum_path(@forum), :class => "f16 fontBlue", :style => "word-break: break-all; word-wrap:break-word;white-space:pre-wrap;" %>
|
||||
<% user_name = @forum.creator.show_name.empty? ? @forum.creator.name : @forum.creator.show_name %>
|
||||
<div class="fontGrey2 mb8 mt10">吧主:<a href="<%= user_path(@forum.creator)%>" class="linkBlue"><%= user_name %></a></div>
|
||||
<div class="fontGrey3">回答:<a href="javascript:void(0);" class="linkOrange mr5" style="cursor: default"><%= @my_replies_count %></a> 帖子:<a href="javascript:void(0);" class="linkOrange" style="cursor: default"><%= @my_topic_count %></a></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="fontGrey2 mt10"><span id="forum_desc_span" style="word-break:normal; width:auto; display:block; white-space:pre-wrap;word-wrap : break-word ;overflow: hidden ;"><%= @forum.description.html_safe%></span>
|
||||
<%if @forum.creator.id == User.current.id%>
|
||||
<a href="javascript:void(0);" onclick="edit_desc();">
|
||||
<%= image_tag('signature_edit.png',{:width=>12,:height=>12}) %>
|
||||
</a>
|
||||
<%end%>
|
||||
</div>
|
||||
<div class="mt15">
|
||||
<div id="forum_tag_list">
|
||||
<%= render :partial => 'forums/forum_tag_list', :locals => {:forum => @forum} %>
|
||||
</div>
|
||||
<% if(@forum.creator.id == User.current.id)%>
|
||||
<a href="javascript:void(0)" class="yellowBtn f_l" onclick="$('#add_tag01').slideToggle();">+ 添加标签</a>
|
||||
<% end %>
|
||||
<span id="add_tag01" style="display:none; vertical-align: middle;" class="ml10 f_l">
|
||||
<input type="text" name="addTag" size="20" class="isTxt w90 f_l" maxlength="<%= Setting.tags_max_length %>" minlength="<%= Setting.tags_min_length%>" />
|
||||
<input type="button" class="submit f_l" onclick="addTag();" />
|
||||
</span></div>
|
||||
<div class="cl"></div>
|
||||
<% if @forum.creator.id == User.current.id %>
|
||||
<span class="postEdit">
|
||||
</span>
|
||||
<a href="<%= edit_forum_path(@forum) %>" class="linkGrey3">编辑贴吧</a>
|
||||
<a href="javascript:void(0);" data-method="delete" onclick="del_forum_confirm();" class="fr linkGrey3">删除贴吧</a>
|
||||
<a href="<%= forum_path(@forum) %>" data-method="delete" id="del_link" type="hidden"></a>
|
||||
<span class="postDelete"></span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<div class="f1">
|
||||
<%= link_to "<span class='btn-big-blue mt10'>我要提问</span>".html_safe, new_forum_memo_path(:forum_id => @forum) %>
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -100,52 +100,8 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="homepageLeft-new">
|
||||
<div class="postDetailContainer">
|
||||
<div class="fl mr10 pr"> <%= link_to image_tag(url_to_avatar(@forum.creator),:width=>75,:height => 75,:alt=>'贴吧图像' ),user_path( @forum.creator) %>
|
||||
<!--<div class="homepageEditProfile"><a href="javascript:void(0);" class="homepageEditProfileIcon"></a></div>-->
|
||||
</div>
|
||||
<div class="fl">
|
||||
<%= link_to @forum.name, forum_path(@forum), :class => "f16 fontBlue", :style => "word-break: break-all; word-wrap:break-word;white-space:pre-wrap;" %>
|
||||
<% user_name = @forum.creator.show_name.empty? ? @forum.creator.name : @forum.creator.show_name %>
|
||||
<div class="fontGrey2 mb8 mt10">吧主:<a href="<%= user_path(@forum.creator)%>" class="linkBlue"><%= user_name %></a></div>
|
||||
<div class="fontGrey3">回答:<a href="javascript:void(0);" class="linkOrange mr5" style="cursor: default"><%= @forum.memo_count %></a> 帖子:<a href="javascript:void(0);" class="linkOrange" style="cursor: default"><%=@forum.topic_count%></a></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="fontGrey2 mt10"><span id="forum_desc_span" style="word-break:normal; width:auto; display:block; white-space:pre-wrap;word-wrap : break-word ;overflow: hidden ;"><%= @forum.description.html_safe%></span>
|
||||
<%if @forum.creator.id == User.current.id%>
|
||||
<a href="javascript:void(0);" onclick="edit_desc();">
|
||||
<%= image_tag('signature_edit.png',{:width=>12,:height=>12})%>
|
||||
</a>
|
||||
<%end%>
|
||||
</div>
|
||||
<div class="mt15">
|
||||
<div id="forum_tag_list">
|
||||
<%= render :partial=>'forums/forum_tag_list',:locals=>{:forum=>@forum}%>
|
||||
</div>
|
||||
<% if(@forum.creator.id == User.current.id)%>
|
||||
<a href="javascript:void(0)" class="yellowBtn f_l" onclick="$('#add_tag01').slideToggle();">+ 添加标签</a>
|
||||
<% end %>
|
||||
<span id="add_tag01" style="display:none; vertical-align: middle;" class="ml10 f_l">
|
||||
<input type="text" name="addTag" size="20" class="isTxt w90 f_l" maxlength="<%=Setting.tags_max_length%>" minlength="<%= Setting.tags_min_length%>" />
|
||||
<input type="button" class="submit f_l" onclick="addTag();" />
|
||||
</span></div>
|
||||
<div class="cl"></div>
|
||||
<%if @forum.creator.id == User.current.id%>
|
||||
<span class="postEdit">
|
||||
</span>
|
||||
<a href="<%= edit_forum_path(@forum) %>" class="linkGrey3">编辑贴吧</a>
|
||||
<a href="javascript:void(0);" data-method="delete" onclick="del_forum_confirm();" class="fr linkGrey3">删除贴吧</a>
|
||||
<a href="<%= forum_path(@forum)%>" data-method="delete" id="del_link" type="hidden"></a>
|
||||
<span class="postDelete"></span>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= render :partial => "memos/my_count_message" %>
|
||||
|
||||
<div class="f1">
|
||||
<%= link_to "<span class='btn-big-blue mt10'>我要提问</span>".html_safe, new_forum_memo_path(:forum_id => @forum) %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
|
|
Loading…
Reference in New Issue