问吧 base框架

This commit is contained in:
huang 2016-12-27 16:09:09 +08:00
parent 30d0cfc2af
commit 465b3e7b52
7 changed files with 53 additions and 12 deletions

View File

@ -153,24 +153,22 @@ class ForumsController < ApplicationController
@order_str = "reorder_time=desc" @order_str = "reorder_time=desc"
end end
@memo = Memo.new(:forum => @forum) @memo = Memo.new(:forum => @forum)
@topic_count = @forum.topics.count @topic_count = Memo.count
@topic_pages = Paginator.new @topic_count, per_page_option, params['page'] @topic_pages = Paginator.new @topic_count, per_page_option, params['page']
@memos = @forum.topics. @memos = Memo.includes(:last_reply).
# reorder("#{Memo.table_name}.sticky DESC").
includes(:last_reply).
limit(@topic_pages.per_page). limit(@topic_pages.per_page).
offset(@topic_pages.offset). offset(@topic_pages.offset).
reorder(order). reorder(order).
preload(:author, {:last_reply => :author}). preload(:author, {:last_reply => :author}).
all all
@memos @memos
@my_topic_count = Memo.where("forum_id = #{@forum.id} and author_id = #{User.current.id} and parent_id is null").count @my_topic_count = Memo.where("author_id = #{User.current.id} and parent_id is null").count
@my_replies_count = Memo.where("forum_id = #{@forum.id} and author_id = #{User.current.id} and parent_id is not null").count @my_replies_count = Memo.where("author_id = #{User.current.id} and parent_id is not null").count
@errors = params[:errors] @errors = params[:errors]
respond_to do |format| respond_to do |format|
format.js format.js
format.html { format.html {
render :layout => 'base_forums' render :layout => 'base_new_forum'
}# show.html.erb }# show.html.erb
format.json { render json: @forum } format.json { render json: @forum }
end end
@ -180,9 +178,9 @@ class ForumsController < ApplicationController
# GET /forums/new.json # GET /forums/new.json
def new def new
@forum = Forum.new @forum = Forum.new
respond_to do |format| respond_to do |format|
format.html # new.html.erb format.html # new.html.erb
format.js
format.json { render json: @forum } format.json { render json: @forum }
end end
end end

View File

@ -37,6 +37,16 @@ module ApplicationHelper
# super # super
# end # end
# 公共分页
def paginator_list objs, objs_count, limit, is_remote
@is_remote = is_remote
@objs_count = objs.count
@obj_pages = Paginator.new @objs_count, limit, params['page'] || 1
@offset ||= @obj_pages.offset
@objs = paginateHelper @attachments,25
end
# 获取竞赛的管理人员 # 获取竞赛的管理人员
def contest_managers contest def contest_managers contest
contest.contest_members.select{|cm| cm.roles.to_s.include?("ContestManager")} contest.contest_members.select{|cm| cm.roles.to_s.include?("ContestManager")}

View File

@ -0,0 +1,23 @@
<div id="muban_popup_box" style="width:475px;">
<div class="muban_popup_top">
<h3 class="fl">新建贴吧</h3>
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
<div class="cl"></div>
</div>
<div class="muban_popup_con mt15" >
<ul class="newuploadbox">
<li class="mb10 clear">
<label class=" fl">贴吧名称&nbsp;&nbsp;:&nbsp;</label>
<input type="text" placeholder="请输入新建贴吧名称最多20个字符" class="issues_calendar_input fl " style="width:320px;">
</li>
<li class=" clear">
<label class=" fl">贴吧描述&nbsp;&nbsp;:&nbsp;</label>
<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 >
</div>
</div>
</div>

View File

@ -0,0 +1,5 @@
var htmlvalue = "<%= escape_javascript(render :partial => 'forums/new') %>";
pop_box_new(htmlvalue,460,190);

View File

@ -1,10 +1,9 @@
<%= content_for(:header_tags) do %> <%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %> <%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
<%= javascript_include_tag 'new_user' %>
<% end %> <% end %>
<div class="postRightContainer"> <div class="postRightContainer mr10">
<div id="create_memo_div" style="display: none"> <div id="create_memo_div" style="display: none">
<div id="error" class="red fl mb10" style="display: none">error</div> <div id="error" class="red fl mb10" style="display: none">error</div>
<%= labelled_form_for(@memo, :url => forum_memos_path(@forum),:remote=>true) do |f| %> <%= labelled_form_for(@memo, :url => forum_memos_path(@forum),:remote=>true) do |f| %>
@ -35,7 +34,10 @@
<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="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"><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="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 class="cl"></div>
</div> </div>
<div id="topics_list"> <div id="topics_list">
@ -53,6 +55,8 @@
<!--</div>--> <!--</div>-->
<!--<div class="cl"></div>--> <!--<div class="cl"></div>-->
</div> </div>
<div class="homepageLeft-new">
<%= render :partial => "forums/right_bar" %>
</div> </div>
<script> <script>
function add_class(id){ function add_class(id){

View File

@ -11,7 +11,7 @@
<%= heads_for_theme %> <%= heads_for_theme %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','application','prettify', :media => 'all' %> <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','application','prettify', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= stylesheet_link_tag 'css/common','css/structure','css/public','css/forum' ,:media => 'all'%> <%= stylesheet_link_tag 'css/common','css/structure','css/public','css/forum','css/popup' ,:media => 'all'%>
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags --> <!-- page specific tags -->
<%= yield :header_tags -%> <%= yield :header_tags -%>

View File

@ -304,6 +304,7 @@ a:hover.qx_btn{color:#64bdd9;}
/*.navHomepageProfile ul li ul {display:none;} /*.navHomepageProfile ul li ul {display:none;}
.navHomepageProfile ul li:hover ul {display:block;}*/ .navHomepageProfile ul li:hover ul {display:block;}*/
.homepageLeft {width:240px; float:left; margin-right:10px; margin-bottom:10px;} .homepageLeft {width:240px; float:left; margin-right:10px; margin-bottom:10px;}
.homepageLeft-new {width:240px; float:left; margin-bottom:10px;}
.homepageRight {width:750px; float:left; margin-top:10px; margin-bottom:10px;} .homepageRight {width:750px; float:left; margin-top:10px; margin-bottom:10px;}
.homepagePortraitContainer {width:208px; border:1px solid #dddddd; background-color:#ffffff; margin-top:10px; padding:15px;} .homepagePortraitContainer {width:208px; border:1px solid #dddddd; background-color:#ffffff; margin-top:10px; padding:15px;}
.homepagePortraitImage {width:78px; height:78px; position:relative; border:1px solid #cbcbcb; padding: 2px;} .homepagePortraitImage {width:78px; height:78px; position:relative; border:1px solid #cbcbcb; padding: 2px;}