完成问吧idex页面及新家贴吧
This commit is contained in:
parent
fe20c45c26
commit
c3aa69029e
|
@ -96,38 +96,74 @@ class ForumsController < ApplicationController
|
|||
end
|
||||
|
||||
def index
|
||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||
@forums = Memo.all
|
||||
|
||||
order = ""
|
||||
@order_str = ""
|
||||
if(params[:reorder_complex])
|
||||
@type="reorder_complex"
|
||||
@str=params[:reorder_complex]
|
||||
@forums_all = Forum.reorder("topic_count #{params[:reorder_complex]},updated_at #{params[:reorder_complex]}")
|
||||
order = " last_replies_memos.created_at #{params[:reorder_complex]}, #{Memo.table_name}.created_at #{params[:reorder_complex]}"
|
||||
@order_str = "reorder_complex="+params[:reorder_complex]
|
||||
elsif(params[:reorder_popu])
|
||||
@type="reorder_popu"
|
||||
@str=params[:reorder_popu]
|
||||
@forums_all = Forum.reorder("topic_count #{params[:reorder_popu]}")
|
||||
order = "replies_count #{params[:reorder_popu]}"
|
||||
@order_str = "reorder_popu="+params[:reorder_popu]
|
||||
elsif(params[:reorder_time])
|
||||
@type="reorder_time"
|
||||
@str=params[:reorder_time]
|
||||
@forums_all = Forum.reorder("updated_at #{params[:reorder_time]}")
|
||||
order = "#{Memo.table_name}.updated_at #{params[:reorder_time]}"
|
||||
@order_str = "reorder_time="+params[:reorder_time]
|
||||
else
|
||||
params[:reorder_complex] = "desc"
|
||||
@type="reorder_complex"
|
||||
@str=params[:reorder_complex]
|
||||
@forums_all = Forum.reorder("topic_count desc,updated_at desc")
|
||||
order = "#{Memo.table_name}.updated_at desc"
|
||||
@order_str = "reorder_time=desc"
|
||||
end
|
||||
@forums_count = @forums_all.count
|
||||
@forums_pages = Paginator.new @forums_count, @limit, params['page']
|
||||
|
||||
@offset ||= @forums_pages.offset
|
||||
@forums = @forums_all.offset(@offset).limit(@limit).all
|
||||
#@forums = Forum.all
|
||||
@memo = Memo.new(:forum => @forum)
|
||||
@topic_count = Memo.count
|
||||
@topic_pages = Paginator.new @topic_count, per_page_option, params['page']
|
||||
@memos = Memo.includes(:last_reply).
|
||||
limit(@topic_pages.per_page).
|
||||
offset(@topic_pages.offset).
|
||||
reorder(order).
|
||||
preload(:author, {:last_reply => :author}).
|
||||
all
|
||||
@forums = Forum.includes(:memos).preload(:topics)
|
||||
@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
|
||||
@errors = params[:errors]
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_new_forum'}
|
||||
format.js
|
||||
format.json { render json: @forums }
|
||||
format.html {
|
||||
render :layout => 'base_new_forum'
|
||||
}# show.html.erb
|
||||
format.json { render json: @forum }
|
||||
end
|
||||
|
||||
# @offset, @limit = api_offset_and_limit({:limit => 10})
|
||||
# @forums = Memo.all
|
||||
#
|
||||
# if(params[:reorder_complex])
|
||||
# @type="reorder_complex"
|
||||
# @str=params[:reorder_complex]
|
||||
# @forums_all = Forum.reorder("topic_count #{params[:reorder_complex]},updated_at #{params[:reorder_complex]}")
|
||||
# elsif(params[:reorder_popu])
|
||||
# @type="reorder_popu"
|
||||
# @str=params[:reorder_popu]
|
||||
# @forums_all = Forum.reorder("topic_count #{params[:reorder_popu]}")
|
||||
# elsif(params[:reorder_time])
|
||||
# @type="reorder_time"
|
||||
# @str=params[:reorder_time]
|
||||
# @forums_all = Forum.reorder("updated_at #{params[:reorder_time]}")
|
||||
# else
|
||||
# params[:reorder_complex] = "desc"
|
||||
# @type="reorder_complex"
|
||||
# @str=params[:reorder_complex]
|
||||
# @forums_all = Forum.reorder("topic_count desc,updated_at desc")
|
||||
# end
|
||||
# @forums_count = @forums_all.count
|
||||
# @forums_pages = Paginator.new @forums_count, @limit, params['page']
|
||||
#
|
||||
# @offset ||= @forums_pages.offset
|
||||
# @forums = @forums_all.offset(@offset).limit(@limit).all
|
||||
# #@forums = Forum.all
|
||||
# respond_to do |format|
|
||||
# format.html{render :layout => 'base_new_forum'}
|
||||
# format.js
|
||||
# format.json { render json: @forums }
|
||||
# end
|
||||
end
|
||||
|
||||
# GET /forums/1
|
||||
|
@ -161,7 +197,7 @@ class ForumsController < ApplicationController
|
|||
reorder(order).
|
||||
preload(:author, {:last_reply => :author}).
|
||||
all
|
||||
@memos
|
||||
@forums = Forum.includes(:memos).preload(:topics)
|
||||
@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
|
||||
@errors = params[:errors]
|
||||
|
@ -200,18 +236,17 @@ class ForumsController < ApplicationController
|
|||
# Author lizanle
|
||||
# Description after save后需要进行资源记录的更新
|
||||
# owner_type = 2 对应的是 forum
|
||||
@save_flag=true
|
||||
@save_flag = true
|
||||
if params[:asset_id]
|
||||
ids = params[:asset_id].split(',')
|
||||
update_kindeditor_assets_owner ids ,@forum.id,OwnerTypeHelper::FORUM
|
||||
update_kindeditor_assets_owner ids, @forum.id, OwnerTypeHelper::FORUM
|
||||
end
|
||||
#end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.js{ redirect_to forums_path, notice: l(:label_forum_create_succ)}
|
||||
format.html { redirect_to @forum, notice: l(:label_forum_create_succ) }
|
||||
format.json { render json: @forum, status: :created, location: @forum }
|
||||
end
|
||||
|
||||
else
|
||||
@save_flag=false
|
||||
respond_to do |format|
|
||||
|
|
|
@ -5,21 +5,30 @@
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="muban_popup_con mt15" >
|
||||
<%= labelled_form_for(@memo, :url => forum_memos_path(@forum),:remote=>true) do |f| %>
|
||||
<%= form_tag({:controller => 'forums', :action => 'create'}, :method => 'post', :id => "forum_new") do |f| %>
|
||||
<ul class="newuploadbox">
|
||||
<li class="mb10 clear">
|
||||
<label class=" fl">贴吧名称 : </label>
|
||||
<input type="text" placeholder="请输入新建贴吧名称,最多20个字符" class="issues_calendar_input fl " style="width:320px;">
|
||||
<!--<input maxlength="80" class="postCreateInput" onfocus="hideError();" onblur="check_forum_name();" placeholder="输入贴吧名称" >-->
|
||||
<input type="text" name="forum[name]" id="forum_name" placeholder="请输入贴吧名称,最多20个字符" class="issues_calendar_input fl " style="width:320px;">
|
||||
</li>
|
||||
<li class=" clear">
|
||||
<label class=" fl">贴吧描述 : </label>
|
||||
<textarea class="mr15 mb10 fl newupload_textarea " placeholder=" 请输入新建贴吧描述,最多250个字符" style="width:320px; height:100px;"></textarea>
|
||||
<textarea type="text" name="forum[description]" id="forum_desc" maxlength="5000" class="mr15 mb10 fl newupload_textarea" style="width:320px; height:100px;" placeholder="请输入新建贴吧描述,最多250个字符"></textarea>
|
||||
<!--<textarea class="mr15 mb10 fl newupload_textarea " placeholder=" 请输入新建贴吧描述,最多250个字符" style="width:320px; height:100px;"></textarea>-->
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clear mr45">
|
||||
<button class=" btn fr">取消</button >
|
||||
<button class=" btn btn-blue fr mr5">确定</button >
|
||||
<a href="javascript:void(0);" class="btn fr" onclick="hideModal()" >取消</a>
|
||||
<a href="javascript:void(0);" class="btn btn-blue fr mr5" onclick="forums_commit();">确定</a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function forums_commit(){
|
||||
$("#forum_new").submit();
|
||||
hideModal()
|
||||
}
|
||||
</script>
|
|
@ -1,41 +1,21 @@
|
|||
<div class="wenba-rightbar">
|
||||
<div class="wenba-rightbar-top clearfix">
|
||||
<h3 class="fl ml10">问吧</h3>
|
||||
<a href="javascript:void(0);" class="btn-blue btn fr mt5 mr5">新建贴吧</a>
|
||||
</div>
|
||||
<div class="wenba-rightbar-li clearfix">
|
||||
<h4 class="fl wenba-rightbar-title mt5 ml5"><a href="javascript:void(0);">新手讨论吧</a></h4>
|
||||
<ul class=" fl right-line wenba-rightbar-ul" >
|
||||
<li><a href="javascript:void(0);" class="linkGrey5">798</a></li>
|
||||
<li>回答</li>
|
||||
</ul>
|
||||
<ul class=" fl wenba-rightbar-ul" >
|
||||
<li><a href="javascript:void(0);" class="linkGrey5">79888</a></li>
|
||||
<li>帖子</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="wenba-rightbar-li clearfix">
|
||||
<h4 class="fl wenba-rightbar-title mt5 ml5"><a href="javascript:void(0);">新手讨论吧新手讨论吧新手讨论吧</a></h4>
|
||||
<ul class=" fl right-line wenba-rightbar-ul" >
|
||||
<li><a href="javascript:void(0);" class="linkGrey5">798</a></li>
|
||||
<li>回答</li>
|
||||
</ul>
|
||||
<ul class=" fl wenba-rightbar-ul" >
|
||||
<li><a href="javascript:void(0);" class="linkGrey5">79888</a></li>
|
||||
<li>帖子</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="wenba-rightbar-li clearfix">
|
||||
<h4 class="fl wenba-rightbar-title mt5 ml5"><a href="javascript:void(0);">新手讨论吧</a></h4>
|
||||
<ul class=" fl right-line wenba-rightbar-ul" >
|
||||
<li><a href="javascript:void(0);" class="linkGrey5">798</a></li>
|
||||
<li>回答</li>
|
||||
</ul>
|
||||
<ul class=" fl wenba-rightbar-ul" >
|
||||
<li><a href="javascript:void(0);" class="linkGrey5">79888</a></li>
|
||||
<li>帖子</li>
|
||||
</ul>
|
||||
<%= link_to "新建贴吧", new_forum_path, :class => "btn-blue btn fr mt5 mr5", :remote => true %>
|
||||
</div>
|
||||
<% @forums.each do |forum| %>
|
||||
<div class="wenba-rightbar-li clearfix">
|
||||
<h4 class="fl wenba-rightbar-title mt5 ml5"><%= link_to forum.name, forum_path(forum), :class => "" %></h4>
|
||||
<ul class=" fl right-line wenba-rightbar-ul" >
|
||||
<li><%= link_to forum.topic_count, forum_path(forum), :class => "linkGrey5" %></li>
|
||||
<li>回答</li>
|
||||
</ul>
|
||||
<ul class=" fl wenba-rightbar-ul" >
|
||||
<li><%= link_to forum.memo_count, forum_path(forum), :class => "linkGrey5" %></li>
|
||||
<li>帖子</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
<a href="javascript:void(0);" class="wenba-rightbar-more linkBlue2">点击展开更多</a>
|
||||
|
||||
</div>
|
|
@ -1,7 +1,5 @@
|
|||
<%if @save_flag%>
|
||||
//$('#new_forum_div').slideToggle();$('#create_btn').parent().slideToggle();
|
||||
//$('#reorder_time').click();
|
||||
window.location.href= "<%= host_with_protocol %>"+"/forums/" + "<%= @forum.id%>"
|
||||
$("#forum_right_bar").html('<%= escape_javascript( render :partial => 'forums/right_bar') %>');
|
||||
<%else%>
|
||||
$("#error").html("<%= @forum.errors.full_messages[0]%>").show();
|
||||
<%end %>
|
||||
|
|
|
@ -1,179 +1,164 @@
|
|||
<%= javascript_include_tag 'new_user' %>
|
||||
<%= stylesheet_link_tag 'css/common','css/public'%>
|
||||
<script>
|
||||
function add_class(id){
|
||||
if($("#"+id).hasClass("sortArrowActiveD")){
|
||||
$("#"+id).removeClass("sortArrowActiveD");
|
||||
$("#"+id).addClass("sortArrowActiveU");
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '<%= forums_path %>' + '.js?' + id + '=asc&page='+<%= @forums_pages.page%>
|
||||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
|
||||
<% end %>
|
||||
|
||||
});
|
||||
}else if($("#"+id).hasClass("sortArrowActiveU")){
|
||||
$("#"+id).removeClass("sortArrowActiveU");
|
||||
$("#"+id).addClass("sortArrowActiveD");
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '<%= forums_path %>' + '.js?' + id + '=desc&page='+<%= @forums_pages.page%>
|
||||
|
||||
});
|
||||
}else{
|
||||
$("#"+id).addClass("sortArrowActiveD");
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '<%= forums_path %>' + '.js?' + id + '=desc&page='+<%= @forums_pages.page%>
|
||||
<div class="postRightContainer mr10">
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
$(function() {
|
||||
$("#complex").click(function(){
|
||||
$("#reorder_popu").removeClass("sortArrowActiveU");
|
||||
$("#reorder_popu").removeClass("sortArrowActiveD");
|
||||
$("#reorder_time").removeClass("sortArrowActiveD");
|
||||
$("#reorder_time").removeClass("sortArrowActiveU");
|
||||
add_class("reorder_complex");
|
||||
});
|
||||
$("#popu").click(function () {
|
||||
$("#reorder_complex").removeClass("sortArrowActiveD");
|
||||
$("#reorder_complex").removeClass("sortArrowActiveU");
|
||||
$("#reorder_time").removeClass("sortArrowActiveD");
|
||||
$("#reorder_time").removeClass("sortArrowActiveU");
|
||||
add_class("reorder_popu");
|
||||
});
|
||||
$("#time").click(function () {
|
||||
$("#reorder_complex").removeClass("sortArrowActiveD");
|
||||
$("#reorder_complex").removeClass("sortArrowActiveU");
|
||||
$("#reorder_popu").removeClass("sortArrowActiveU");
|
||||
$("#reorder_popu").removeClass("sortArrowActiveD");
|
||||
add_class("reorder_time");
|
||||
});
|
||||
$('#forum_name').keypress( function(e)
|
||||
{
|
||||
var n = 0;
|
||||
var str = this.value;
|
||||
for (i = 0; i < str.length; i++) {
|
||||
var leg = str.charCodeAt(i);//ASCII码
|
||||
if (leg > 255) {//大于255的都是中文
|
||||
n += 2;//如果是中文就是2个字节
|
||||
} else {
|
||||
n += 1;//英文,不多说了
|
||||
}
|
||||
}
|
||||
if(n >= 160 && e.keyCode != 8)
|
||||
if(document.all)
|
||||
{
|
||||
e.returnValue = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.preventDefault();
|
||||
}
|
||||
})
|
||||
});
|
||||
function check_and_submit(doc){
|
||||
$("#error").html('').hide();
|
||||
check_forum_name();
|
||||
if( $("textarea[name='forum[name]']").val().trim() == "" && $("textarea[name='forum[description]']").val().trim() != "" ){
|
||||
$("#error").html("名称不能为空").show();
|
||||
return;
|
||||
} else if( $("textarea[name='forum[description]']").val().trim() == "" && $("textarea[name='forum[name]']").val().trim() != "" ){
|
||||
$("#error").html("描述不能为空").show();
|
||||
return;
|
||||
}else if($("textarea[name='forum[description]']").val().trim() == "" && $("textarea[name='forum[name]']").val().trim() == ""){
|
||||
$("#error").html("名称和描述不能为空").show();
|
||||
return;
|
||||
}
|
||||
else{
|
||||
doc.parent().parent().submit();
|
||||
}
|
||||
}
|
||||
var check_pass = true;
|
||||
function check_forum_name(){
|
||||
check_pass = true;
|
||||
name = $("textarea[name='forum[name]']").val().trim();
|
||||
if( name != ""){
|
||||
$.get(
|
||||
'<%= check_forum_name_forums_path %>',
|
||||
{"forum_name":encodeURIComponent(name)},
|
||||
function(data){
|
||||
if( data == 'true'){
|
||||
$("#error").html("贴吧名称已经存在").show();
|
||||
check_pass = false;
|
||||
}
|
||||
}
|
||||
);
|
||||
}else{
|
||||
check_pass = false;
|
||||
}
|
||||
if(check_pass == false){
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
function hideError(){
|
||||
$("#error").html("").hide();
|
||||
}
|
||||
|
||||
function create_cancle(){
|
||||
$('#error').hide();
|
||||
$('#new_forum_div').slideToggle();
|
||||
$('#create_btn').parent().slideToggle();
|
||||
clear_form();
|
||||
}
|
||||
function clear_form(){
|
||||
$("#forum_name").val('');
|
||||
$("#forum_desc").val('');
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="homepageContentContainer mb10">
|
||||
<div class="homepageContent">
|
||||
<div class="forumRightContainer mr10">
|
||||
<div id="new_forum_div" class="mb5" style="display: none">
|
||||
<div class="red fl mb10" id="error" style="display: none">error</div>
|
||||
<%= form_tag({:controller => 'forums',:action=>'create',:format=>'js'},:method => 'post',:remote=>'true') do |f| %>
|
||||
<div>
|
||||
<textarea type="text" name="forum[name]" id="forum_name" maxlength="80" class="postCreateInput" onfocus="hideError();" onblur="check_forum_name();" placeholder="输入贴吧名称" ></textarea>
|
||||
<script>
|
||||
var textarea = document.getElementById('forum_name');
|
||||
autoTextarea(textarea);
|
||||
</script>
|
||||
</div>
|
||||
<div class="mt15">
|
||||
<textarea type="text" name="forum[description]" id="forum_desc" maxlength="5000" class="postCreateInput" placeholder="输入贴吧描述"></textarea>
|
||||
<script>
|
||||
var textarea1 = document.getElementById('forum_desc');
|
||||
autoTextarea(textarea1);
|
||||
</script>
|
||||
</div>
|
||||
<div class="mt10">
|
||||
<div class="fr"><a href="javascript:void(0);" class="submit_btn" onclick="check_and_submit($(this));">确定</a></div>
|
||||
<div class="fr"><a href="javascript:void(0);" class="linkGrey2 mr10" onclick="create_cancle();">取消</a><span class="mr10 fontGrey">或</span></div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="postBanner" id="postBanner">
|
||||
<%= render :partial => 'post_banner' ,:locals => {:order_type=>@type,:order_str=>@str}%>
|
||||
<!--<div class="postSort" id="complex"><a href="javascript:void(0);" class="linkGrey2 fl">综合</a><a href="javascript:void(0);" id="reorder_complex" 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" ></a></div>-->
|
||||
<!--<div class="postSort" id="time"><a href="javascript:void(0);" class="linkGrey2 fl">时间</a><a href="javascript:void(0)" id="reorder_time" ></a></div>-->
|
||||
<!--<div class="creatPost"><a href="javascript:void(0);" id="create_btn" class="c_white db creatPostIcon bBlue" onclick="$('#error').hide();$('#new_forum_div').slideToggle();$(this).parent().slideToggle();">新建贴吧</a></div>-->
|
||||
<!--<div class="cl"></div>-->
|
||||
<div class="postDetailBanner">
|
||||
<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>
|
||||
|
||||
</div>
|
||||
<div id="forum_list">
|
||||
<%= render :partial => 'forum_list',:locals => {:forums=>@forums}%>
|
||||
</div>
|
||||
<ul class="wlist fr" id="pages" style="margin-top: 10px;">
|
||||
<%= pagination_links_full @forums_pages, @forums_count ,:per_page_links => true,:remote =>true,:flag=>true%>
|
||||
</ul>
|
||||
<div class="postSort" id="complex"><a href="javascript:void(0);" class="linkGrey2 fl">综合</a><a href="javascript:void(0);" id="reorder_complex" class=""></a><!--<a href="javascript:void(0);" class="sortArrowActiveD"></a>--></div>
|
||||
|
||||
<div class="creatPost" id="create_memo_btn">
|
||||
<%= link_to "发布新帖", new_forum_path(@forums), :class => "c_white db creatPostIcon bBlue", :remote => true %>
|
||||
<!--<a href="javascript:void(0);" class="c_white db creatPostIcon bBlue" onclick="$('#error').hide();$('#create_memo_div').slideToggle();$(this).parent().slideToggle();">发布新帖</a>-->
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="homepageLeft">
|
||||
<%= render :partial => "forums/right_bar" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="topics_list">
|
||||
<%= render :partial => 'show_topics',:locals => {:memos=>@memos}%>
|
||||
</div>
|
||||
|
||||
<!--<div class="pageRoll">-->
|
||||
<!--<div class="pageCell"><a href="javascript:void(0);" class="linkBlue">上一页</a></div>-->
|
||||
<!--<div class="pageCell pageCellActive"><a href="javascript:void(0);" class="c_white">1</a></div>-->
|
||||
<!--<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">2</a></div>-->
|
||||
<!--<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">3</a></div>-->
|
||||
<!--<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">...</a></div>-->
|
||||
<!--<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">14</a></div>-->
|
||||
<!--<div class="pageCell"><a href="javascript:void(0);" class="linkBlue">下一页</a></div>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="cl"></div>-->
|
||||
</div>
|
||||
|
||||
<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="mt8 fl">
|
||||
<div class="f16 fontGrey2">我在贴吧</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>
|
||||
<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>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<div class="homepageLeft-new" id="forum_right_bar">
|
||||
<%= render :partial => "forums/right_bar" %>
|
||||
</div>
|
||||
<script>
|
||||
function add_class(id){
|
||||
if($("#"+id).hasClass("sortArrowActiveD")){
|
||||
$("#"+id).removeClass("sortArrowActiveD");
|
||||
$("#"+id).addClass("sortArrowActiveU");
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '<%= forums_path %>' + '.js?' + id + '=asc&page='+<%= @topic_pages.page%>
|
||||
|
||||
});
|
||||
}else if($("#"+id).hasClass("sortArrowActiveU")){
|
||||
$("#"+id).removeClass("sortArrowActiveU");
|
||||
$("#"+id).addClass("sortArrowActiveD");
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '<%= forums_path %>' + '.js?' + id + '=desc&page='+<%= @topic_pages.page%>
|
||||
|
||||
});
|
||||
}else{
|
||||
$("#"+id).addClass("sortArrowActiveD");
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '<%= forums_path %>' + '.js?' + id + '=desc&page='+<%= @topic_pages.page%>
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
$(function() {
|
||||
$("#complex").click(function(){
|
||||
$("#reorder_popu").removeClass("sortArrowActiveU");
|
||||
$("#reorder_popu").removeClass("sortArrowActiveD");
|
||||
$("#reorder_time").removeClass("sortArrowActiveD");
|
||||
$("#reorder_time").removeClass("sortArrowActiveU");
|
||||
add_class("reorder_complex");
|
||||
});
|
||||
$("#popu").click(function () {
|
||||
$("#reorder_complex").removeClass("sortArrowActiveD");
|
||||
$("#reorder_complex").removeClass("sortArrowActiveU");
|
||||
$("#reorder_time").removeClass("sortArrowActiveD");
|
||||
$("#reorder_time").removeClass("sortArrowActiveU");
|
||||
add_class("reorder_popu");
|
||||
});
|
||||
$("#time").click(function () {
|
||||
$("#reorder_complex").removeClass("sortArrowActiveD");
|
||||
$("#reorder_complex").removeClass("sortArrowActiveU");
|
||||
$("#reorder_popu").removeClass("sortArrowActiveU");
|
||||
$("#reorder_popu").removeClass("sortArrowActiveD");
|
||||
add_class("reorder_time");
|
||||
});
|
||||
<% if @errors %>
|
||||
$('#create_memo_div').slideToggle();$('#create_memo_btn').slideToggle();
|
||||
$("#error").html('<%= @errors.html_safe %>').show();
|
||||
<% end %>
|
||||
});
|
||||
|
||||
var first_click = true;
|
||||
// function check_and_submit(){
|
||||
// if(!check_memo_name()){
|
||||
// return;
|
||||
// }
|
||||
// if($("textarea[name='memo[subject]']").val().trim() != "" && !memo_content.isEmpty() && first_click){
|
||||
// first_click = false;
|
||||
// memo_content.sync();
|
||||
// $.ajax({
|
||||
// url:'/forums/'+'<%#= @forum.id.to_s%>'+'/memos',
|
||||
// type:'post',
|
||||
// data:$("#new_memo").serialize(),
|
||||
// success:function(data){
|
||||
//
|
||||
// },
|
||||
// error:function(){
|
||||
// alert('请检查当前网络连接')
|
||||
// }
|
||||
// });
|
||||
// //$("#new_memo").submit();
|
||||
// }else if($("textarea[name='memo[subject]']").val().trim() == "" && memo_content.isEmpty()){
|
||||
// $("#error").html("主题和内容不能为空").show();
|
||||
// }
|
||||
// else if($("textarea[name='memo[subject]']").val().trim() == "" && !memo_content.isEmpty() ){
|
||||
// $("#error").html("主题不能为空").show();
|
||||
// }else if($("textarea[name='memo[subject]']").val().trim() != "" && memo_content.isEmpty()){
|
||||
// $("#error").html("内容不能为空").show();
|
||||
// }
|
||||
// }
|
||||
|
||||
function check_memo_name(){
|
||||
if($("#memo_subject").val().trim().length > 50){
|
||||
$("#error").html("主题 过长(最长为 50 个字符)").show();
|
||||
return false;
|
||||
}
|
||||
if(memo_content.html().length > 20000){
|
||||
$("#error").html("内容 过长(最长为 20000 个字符)").show();
|
||||
$("html,body").animate({scrollTop:$("#error").offset().top},1000)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function create_cancle(){
|
||||
$('#create_memo_div').slideToggle();
|
||||
$('#create_memo_btn').slideToggle();
|
||||
$('#memo_subject').val('');
|
||||
memo_content.html('')
|
||||
$('#error').html('').hide();
|
||||
}
|
||||
</script>
|
|
@ -28,6 +28,9 @@
|
|||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="postDetailBanner">
|
||||
<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>
|
||||
|
@ -55,7 +58,25 @@
|
|||
<!--</div>-->
|
||||
<!--<div class="cl"></div>-->
|
||||
</div>
|
||||
<div class="homepageLeft-new">
|
||||
|
||||
<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="mt8 fl">
|
||||
<div class="f16 fontGrey2">我在贴吧</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>
|
||||
<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>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<div class="homepageLeft-new" id="forum_right_bar">
|
||||
<%= render :partial => "forums/right_bar" %>
|
||||
</div>
|
||||
<script>
|
||||
|
|
Loading…
Reference in New Issue