socialforge/app/views/forums/show.html.erb

104 lines
5.5 KiB
Plaintext

<script>
function add_class(id){
if($("#"+id).hasClass("sortArrowActiveD")){
$("#"+id).removeClass("sortArrowActiveD");
$("#"+id).addClass("sortArrowActiveU");
$.ajax({
type: 'GET',
url: '<%= forums_path+"/"+@forum.id.to_s %>' + '.js?' + id + '=asc&page='+<%= @topic_pages.page%>
});
}else if($("#"+id).hasClass("sortArrowActiveU")){
$("#"+id).removeClass("sortArrowActiveU");
$("#"+id).addClass("sortArrowActiveD");
$.ajax({
type: 'GET',
url: '<%= forums_path+"/"+@forum.id.to_s %>' + '.js?' + id + '=desc&page='+<%= @topic_pages.page%>
});
}else{
$("#"+id).addClass("sortArrowActiveD");
$.ajax({
type: 'GET',
url: '<%= forums_path+"/"+@forum.id.to_s %>' + '.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");
});
});
function check_and_submit(){
if($("input[name='memo[subject]']").val().trim() != "" && $("input[name='memo[content]']").val().trim() != ""){
$("#new_memo").submit();
}else{
$("#error").html("主题和内容不能为空").show();
}
}
</script>
<div class="postRightContainer">
<div id="create_memo_div" style="display: none">
<div id="error" class="red fl mb10" style="display: none">error</div>
<%= labelled_form_for(@memo, :url => forum_memos_path(@forum)) do |f| %>
<div>
<input type="text" name="memo[subject]" onfocus="$('#error').hide();" onmouseover="this.style.borderColor='#d9d9d9'" class="postDetailInput" placeholder="输入帖子标题" />
</div>
<div class="mt15">
<input type="text" name="memo[content]" onfocus="$('#error').hide();" onmouseover="this.style.borderColor='#d9d9d9'" class="postDetailInput" placeholder="输入贴子内容" />
</div>
<div class="mt10">
<!--<a href="javascript:void(0);" class="AnnexBtn fl mt3">上传附件</a>-->
<%= render :partial => 'file_form', :locals => {:container => @memo} %>
<div class="fr">
<a href="javascript:void(0);" class="submit_btn" onclick="check_and_submit();">确定</a>
</div>
<div class="fr"><a href="javascript:void(0);" class="linkGrey2 mr10" onclick="$('#create_memo_div').slideToggle();$('#create_memo_btn').slideToggle();">取消</a><span class="mr10 fontGrey">或</span></div>
<div class="cl"></div>
</div>
<% end %>
</div>
<div class="postDetailBanner">
<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><!--<a href="javascript:void(0);" 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 class="postSort" id="time"><a href="javascript:void(0);" class="linkGrey2 fl">时间</a><a href="javascript:void(0);" id="reorder_time" class=""></a></div>
<div class="creatPost" id="create_memo_btn"><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 id="topics_list">
<%= render :partial => 'show_topics',:locals => {:memos=>@memos}%>
</div>
<div class="pagination" style="float: right"><%= pagination_links_full @topic_pages, @topic_count %></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>