Merge branch 'dev_tieba' of https://git.trustie.net/jacknudt/trustieforge into dev_tieba

This commit is contained in:
daiao 2016-12-28 16:38:30 +08:00
commit 506d7ae82c
20 changed files with 608 additions and 278 deletions

View File

@ -96,36 +96,74 @@ class ForumsController < ApplicationController
end
def index
@offset, @limit = api_offset_and_limit({:limit => 10})
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 # index.html.erb
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
@ -151,24 +189,23 @@ class ForumsController < ApplicationController
@order_str = "reorder_time=desc"
end
@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']
@memos = @forum.topics.
# reorder("#{Memo.table_name}.sticky DESC").
includes(:last_reply).
@memos = @forum.topics.includes(:last_reply).
limit(@topic_pages.per_page).
offset(@topic_pages.offset).
reorder(order).
preload(:author, {:last_reply => :author}).
all
@memos
@my_topic_count = Memo.where("forum_id = #{@forum.id} and 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_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]
# 推荐贴吧
@forums = Forum.where("id !=?", @forum.id).reorder("topic_count desc,updated_at desc").first(3)
respond_to do |format|
format.js
format.html {
render :layout => 'base_forums'
render :layout => 'base_new_forum'
}# show.html.erb
format.json { render json: @forum }
end
@ -178,9 +215,9 @@ class ForumsController < ApplicationController
# GET /forums/new.json
def new
@forum = Forum.new
respond_to do |format|
format.html # new.html.erb
format.js
format.json { render json: @forum }
end
end
@ -200,18 +237,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|

View File

@ -29,30 +29,23 @@ class MemosController < ApplicationController
def new
@memo = Memo.new
@memo.forum_id = @forum.id
@my_forums_count = Forum.where(:creator_id => User.current.id).count
@my_memos_count = Memo.where(:author_id => User.current.id).count
@forums = Forum.reorder("topic_count desc,updated_at desc")
respond_to do |format|
format.html {
render action: :new ,layout: 'base'
}
format.js
format.html {render layout: 'base_new_forum'}
format.json { render json: @memo }
end
end
def create
if params[:quote].nil?
@quote = ""
else
@quote = params[:quote]
end
#unless params[:quote].nil?
# @quote = params[:quote][:quote]
#end
@memo = Memo.new(params[:memo])
@memo.forum_id = params[:forum_id]
@memo.author_id = User.current.id
@ -78,7 +71,6 @@ class MemosController < ApplicationController
asset.save
end
end
#end
format.js
format.html { redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}" }
format.json { render json: @memo, status: :created, location: @memo }
@ -87,8 +79,6 @@ class MemosController < ApplicationController
format.js
format.html { redirect_to( forum_path(Forum.find(params[:forum_id]),:errors=>@memo.errors.full_messages[0])) }
format.json { render json: @memo.errors, status: :unprocessable_entity }
#end
end
end
end
@ -148,7 +138,7 @@ class MemosController < ApplicationController
respond_to do |format|
format.js
format.html {render :layout=> 'base_forums'}#:layout=> 'base_forums',
format.html {render :layout => 'base_new_forum'}
format.json { render json: @memo }
format.xml { render xml: @memo }
end

View File

@ -37,6 +37,16 @@ module ApplicationHelper
# super
# 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
contest.contest_members.select{|cm| cm.roles.to_s.include?("ContestManager")}

View File

@ -47,7 +47,8 @@
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->
<%#= button_tag "文件浏览", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'AnnexBtn fl mt3' %>
<a href="javascript:void(0);" onclick="_file.click();" class="AnnexBtn fl mr15">上传附件</a>
<%= button_tag "上传附件", :id => "upload_attachments", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'sub_btn' %>
<!--<a href="javascript:void(0);" onclick="_file.click();" class="AnnexBtn fl mr15">上传附件</a>-->
<%= file_field_tag 'attachments[dummy][file]',
:id => '_file',
:class => 'file_selector',

View File

@ -0,0 +1,16 @@
<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_forums_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_memos_count %></a></div>
<div class="homepageImageText">发帖</div>
</div>
</div>
<div class="cl"></div>
</div>

View File

@ -0,0 +1,34 @@
<div style="width:460px;">
<div class="sy_popup_top">
<h3 class="fl">欢迎加入项目</h3>
<a href="javascript:void(0);" class="sy_icons_close fr" onclick="hideModal()"></a>
<div class="cl"></div>
</div>
<div class="muban_popup_con mt15" >
<%= form_tag({:controller => 'forums', :action => 'create'}, :method => 'post', :id => "forum_new") do |f| %>
<ul class="newuploadbox">
<li class="mb10 clear">
<label class=" fl">贴吧名称&nbsp;&nbsp;:&nbsp;</label>
<!--<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">贴吧描述&nbsp;&nbsp;:&nbsp;</label>
<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">
<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>
<script>
function forums_commit(){
$("#forum_new").submit();
hideModal()
}
</script>

View File

@ -0,0 +1,15 @@
<% @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 %>
</div>

View File

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

View File

@ -1,5 +1,68 @@
<%= javascript_include_tag 'new_user' %>
<%= stylesheet_link_tag 'css/common','css/public'%>
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
<% end %>
<div class="postRightContainer mr10">
<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 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 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">
<div class="wenba-rightbar">
<div class="wenba-rightbar-top clearfix">
<h3 class="fl ml10">问吧</h3>
<%= link_to "新建贴吧", new_forum_path, :class => "btn-blue btn fr mt5 mr5", :remote => true %>
</div>
<%= render :partial => "forums/right_bar" %>
<a href="javascript:void(0);" class="wenba-rightbar-more linkBlue2">点击展开更多</a>
</div>
</div>
<script>
function add_class(id){
if($("#"+id).hasClass("sortArrowActiveD")){
@ -7,7 +70,7 @@
$("#"+id).addClass("sortArrowActiveU");
$.ajax({
type: 'GET',
url: '<%= forums_path %>' + '.js?' + id + '=asc&page='+<%= @forums_pages.page%>
url: '<%= forums_path %>' + '.js?' + id + '=asc&page='+<%= @topic_pages.page%>
});
}else if($("#"+id).hasClass("sortArrowActiveU")){
@ -15,14 +78,14 @@
$("#"+id).addClass("sortArrowActiveD");
$.ajax({
type: 'GET',
url: '<%= forums_path %>' + '.js?' + id + '=desc&page='+<%= @forums_pages.page%>
url: '<%= forums_path %>' + '.js?' + id + '=desc&page='+<%= @topic_pages.page%>
});
}else{
$("#"+id).addClass("sortArrowActiveD");
$.ajax({
type: 'GET',
url: '<%= forums_path %>' + '.js?' + id + '=desc&page='+<%= @forums_pages.page%>
url: '<%= forums_path %>' + '.js?' + id + '=desc&page='+<%= @topic_pages.page%>
});
}
@ -49,128 +112,60 @@
$("#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();
}
})
<% if @errors %>
$('#create_memo_div').slideToggle();$('#create_memo_btn').slideToggle();
$("#error").html('<%= @errors.html_safe %>').show();
<% end %>
});
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();
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(){
$('#error').hide();
$('#new_forum_div').slideToggle();
$('#create_btn').parent().slideToggle();
clear_form();
}
function clear_form(){
$("#forum_name").val('');
$("#forum_desc").val('');
$('#create_memo_div').slideToggle();
$('#create_memo_btn').slideToggle();
$('#memo_subject').val('');
memo_content.html('')
$('#error').html('').hide();
}
</script>
<div class="homepageContentContainer mb10">
<div class="homepageContent">
<div class="postContainer">
<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>
<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="cl"></div>
</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,13 +1,12 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
<%= javascript_include_tag 'new_user' %>
<% end %>
<div class="postRightContainer">
<div class="postRightContainer mr10">
<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),:remote=>true) do |f| %>
<%= labelled_form_for(@memo, :url => forum_memos_path(@forum), :remote => true) do |f| %>
<div>
<textarea type="text" name="memo[subject]" id="memo_subject" maxlength="50" onblur="check_memo_name();" onfocus="$('#error').hide();" onmouseover="this.style.borderColor='#d9d9d9'" class="postDetailInput" placeholder="输入帖子标题" ></textarea>
<script>
@ -29,30 +28,35 @@
</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>
<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_memo_path(:forum_id => @forum), :class => "c_white db creatPostIcon bBlue" %>
<!--<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="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>
<%= render :partial => "forums/my_count_message" %>
<div class="homepageLeft-new" id="forum_right_bar">
<div class="wenba-rightbar">
<div class="wenba-rightbar-top clearfix">
<h3 class="fl ml10">推荐问吧</h3>
</div>
<%= render :partial => "forums/right_bar" %>
</div>
</div>
<script>
function add_class(id){

View File

@ -0,0 +1,58 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title><%= h html_title %></title>
<meta name="description" content="<%= Redmine::Info.app_name %>" />
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= 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 'css/common','css/structure','css/public','css/forum','css/popup' ,:media => 'all'%>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>
</head>
<!--add by huang-->
<body onload="prettyPrint();">
<div class="navContainer mb10"> <%= render :partial => User.current.logged? ? 'layouts/logined_header' : 'layouts/unlogin_header' %></div>
<div class="cl"></div>
<div id="Container">
<%= render_flash_messages %>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>
</div>
<div class="cl"></div>
<%= render :partial => 'layouts/footer' %>
<div class="cl"></div>
<% if hidden_unproject_infos %>
<%= render :partial => 'layouts/new_feedback' %>
<% end %>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>
<div id="ajax-modal" style="display:none;"></div>
<%= call_hook :view_layouts_base_body_bottom %>
</body>
<!-- MathJax的配置 -->
<script type="text/javascript" src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<!-- 配置 在生成的公式图片上去掉Math定义的右键菜单$$ $$ \( \) \[ \] 中的公式给予显示-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
showMathMenu: false,
showMathMenuMSIE: false,
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
<%= javascript_include_tag('jquery-1.8.3-ui-1.9.2-ujs-2.0.3', 'application', 'jquery.colorbox-min') %>
</html>

View File

@ -1,3 +1,89 @@
<%= error_messages_for 'bid' %>
<p><%= f.text_field :content, :required => true, :size => 60, :style => "width:150px;" %></p>
<p><%= hidden_field_tag 'subject'||=@memo.subject %>
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
<% end %>
<div class="wenba-tiwenbox fl mr10 mb10">
<%= labelled_form_for(@memo, :url => forum_memos_path(@forum)) do |f| %>
<div class="wenba-tiwen-con">
<ul >
<li class="mb10">
<input type="text" name="memo[subject]" id="memo_subject" maxlength="50" onblur="check_memo_name();" onfocus="$('#error').hide();" onmouseover="this.style.borderColor='#d9d9d9'" class="wenba-tiwen-input" placeholder="请输入标题">
<!--<input type="text" placeholder="请输入标题" class="wenba-tiwen-input">-->
<script>
var textarea1 = document.getElementById('memo_subject');
autoTextarea(textarea1);
</script>
</li>
<li class="mb10">
<%= kindeditor_tag 'memo[content]','', :height => 300, :editor_id => 'memo_content' %>
<!--<textarea placeholder="请输入描述详情" class="wenba-tiwen-textarea"></textarea>-->
</li>
<li class="clear mb10">
<%= render :partial => 'forums/file_form', :locals => {:container => @memo} %>
<!--<button class="sub_btn fl" name="button" type="button">上传附件</button>-->
<!--<p class="fl ml5 mt3 c_grey">(未选择文件) 您可以上传小于<span class="c_red">50MB</span>的文件</p>-->
</li>
</ul>
<ul class="wenba-tagbox clearfix">
<h3 class="mb5">请选择分类</h3>
<% @forums.each do |forum| %>
<li><a href="javascript:void(0);" class="wenba-tiwen-tag wenba-tiwen-tag-active"><%= forum.name %></a></li>
<% end %>
</ul>
<div class="clear ">
<%= link_to "取消", forum_path(@forum), :class => "btn fr" %>
<a href="javascript:void(0);" class="btn btn-blue fr mr5" onclick="memo_commit();">确定</a>
</div>
</div>
<% end %>
</div>
<script>
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;
}
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 memo_commit(){
memo_content.sync();
$("#new_memo").submit();
}
</script>

View File

@ -0,0 +1,33 @@
<div class="wenba-tiwenbox">
<div class="wenba-tiwen-con" >
<ul>
<li class="mb10 ">
<input type="text" placeholder="请输入标题" class="wenba-tiwen-input ">
</li>
<li class="mb10">
<textarea placeholder=" 请输入描述详情" class="wenba-tiwen-textarea"></textarea>
</li>
<li class="clear mb10">
<button class="sub_btn fl " name="button" type="button">上传附件</button>
<p class="fl ml5 mt3 c_grey">(未选择文件) 您可以上传小于<span class="c_red">50MB</span>的文件</p>
</li>
</ul>
<ul class="wenba-tagbox clearfix">
<h3 class="mb5">请选择分类(<span class="c_red">1</span>个)</h3>
<li><a href="javascript:void(0);" class="wenba-tiwen-tag wenba-tiwen-tag-active">新手讨论吧</a></li>
<li><a href="javascript:void(0);" class="wenba-tiwen-tag">网站建议吧</a></li>
<li><a href="javascript:void(0);" class="wenba-tiwen-tag">技术动态吧</a></li>
<li><a href="javascript:void(0);" class="wenba-tiwen-tag">教程共享吧</a></li>
<li><a href="javascript:void(0);" class="wenba-tiwen-tag">创业吧</a></li>
<li><a href="javascript:void(0);" class="wenba-tiwen-tag">互联网新闻</a></li>
<li><a href="javascript:void(0);" class="wenba-tiwen-tag">开源创新吧</a></li>
<li><a href="javascript:void(0);" class="wenba-tiwen-tag">网站新闻吧</a></li>
<li><a href="javascript:void(0);" class="wenba-tiwen-tag">技术知识交流</a></li>
<li><a href="javascript:void(0);" class="wenba-tiwen-tag">假日问候吧</a></li>
</ul>
<div class="clear ">
<button class=" btn btn-blue fr ">确定</button >
<button class=" btn fr mr5">取消</button >
</div>
</div>
</div>

View File

@ -1,35 +1,5 @@
<% @nav_dispaly_home_path_label = 1
@nav_dispaly_main_course_label = 1
@nav_dispaly_main_project_label = 1
@nav_dispaly_main_contest_label = 1 %>
<% @nav_dispaly_forum_label = 1%>
<!-- <h1>New memo</h1> -->
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
<% end %>
<div class="banner-big f16 fontGrey3 mb10">问吧 > 我要提问</div>
<%= render :partial => "memos/form" %>
<div class="top-content">
<table>
<tr>
<td class="info_font" style="width: 240px; color: #15bccf"><%= l(:label_projects_community)%></td>
<td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
<td rowspan="2" width="250px">
<div class="top-content-search">
</div>
</td>
</tr>
<tr>
<td style="padding-left: 8px"><%= link_to request.host()+"/forums", forums_path %></td>
<td><p class="top-content-list"><%=link_to l(:label_home),home_path %> > <%=link_to l(:label_forum), :controller => 'forums', :action => 'index' %> > <%=link_to @forum.name %></p></td>
</tr>
</table>
</div>
<h3><%=l(:label_memo_new)%></h3>
<div class="box tabular">
<div style="width:780px">
<%= render :partial => 'memos/topic_form' %>
</div>
</div>
<%= render :partial => "forums/my_count_message" %>

View File

View File

@ -16,7 +16,7 @@
}
}
</script>
<div class="postRightContainer">
<div class="postRightContainer mr10">
<div class="postThemeContainer">
<div class="postDetailPortrait">
<%= link_to image_tag(url_to_avatar(@memo.author),:width=>50,:height => 50,:alt=>'贴吧图像' ),user_path(@memo.author) %>
@ -96,6 +96,54 @@
</div>
</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>
<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(){
$("#activity_description_<%= @memo.id %> p,#activity_description__<%= @memo.id %> span,#activity_description_<%= @memo.id %> em").each(function(){

View File

@ -0,0 +1,29 @@
/*问吧新增20161223*/
.wenba-rightbar{ border: 1px solid #ddd;background-color:#fff; width: 238px;}
.wenba-h3-top{ font-size: 14px; color: #666; }
.wenba-rightbar-top{ height: 40px; line-height: 40px; border-bottom:1px solid #ddd; }
.wenba-rightbar-li{ padding:10px 0; border-bottom:1px solid #ddd; color: #666;}
.wenba-rightbar-title{ font-size: 14px; width: 140px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
.right-line{ border-right:1px solid #ddd;}
.wenba-rightbar-ul{ width: 45px; text-align: center;}
.wenba-rightbar-more{ padding:10px 0 ; text-align: center; display: block;}
.wenba-tiwenbox{border: 1px solid #ddd;background-color:#fff; width: 718px; padding:15px;}
.wenba-tiwen-con{ width: 100%; }
input.wenba-tiwen-input{ width:705px; height: 30px; line-height: 30px; padding:0 5px;}
textarea.wenba-tiwen-textarea{ padding:5px;width:705px; height: 150px;}
a.wenba-tiwen-tag{background-color: #E4EFF6;border-bottom: 1px solid #B1D3EB; border-right: 1px solid #B1D3EB;-webkit-text-size-adjust: none; color: #3E6D8E; font-size:12px;line-height: 2.4; padding: 5px 10px;text-decoration: none; white-space: nowrap;}
a:hover.wenba-tiwen-tag,a.wenba-tiwen-tag-active{ background: #3b94d6; color: #fff;border-bottom: 1px solid #2e76ab; border-right: 1px solid #2e76ab;}
.wenba-tagbox li{ float: left; margin:0 5px 5px 0;}
.wenba-tagbox h3{ font-weight: normal; color: #333;}
/*按钮*/
.btn{display: inline-block;border:none; padding:0 10px;color: #333;background: #e1e1e1; text-align:center;font-size: 12px; height: 30px;line-height: 30px;-webkit-border-radius: 3px;-moz-border-radius: 3px; -o-border-radius: 3px; border-radius: 3px; }
.btn:hover{background: #c3c3c3; color: #333;}
.btn-green{background: #60b25e; color: #fff;}
.btn-green:hover{background: #51a74f; color: #fff;}
.btn-blue{background: #3b94d6; color: #fff;}
.btn-blue:hover{background: #2788d0; color: #fff;}
/*大提交按钮*/
.btn-big-blue{display: block; width: 240px; height: 60px; line-height: 60px; text-align: center; color: white; font-weight: bold; background: #3b94d6;font-size: 14px;}
.btn-big-blue:hover{display: block; width: 240px; height: 60px; line-height: 60px; text-align: center; color: white; font-weight: bold; background: #2788d0;font-size: 14px;}
.banner-big {width:968px; background-color: #ffffff; padding:10px 15px; border:1px solid #dddddd;}

View File

@ -406,7 +406,7 @@ a.st_down{ display: block; width:8px; float:left; height:13px; background:url(/i
.likeNum{color: #7f7f7f}
/*创建贴吧样式*/
.postContainer {width:968px; border:1px solid #dddddd; padding:15px; background-color:#ffffff;}
.postContainer {width:718px; border:1px solid #dddddd; padding:15px; background-color:#ffffff;}
.postBanner {height:30px; width:970px; border-bottom:1px solid #efefef;}
.postSort {width:40px; float:left; margin-top:5px; padding-left:5px;}
a.sortArrowDown {background:url(../images/post_image_list.png) 0px 0px no-repeat; width:7px; height:9px; float:left; margin-left:5px; margin-top:5px;}
@ -431,6 +431,7 @@ a.sortArrowActiveU {background:url(../images/post_image_list.png) -17px -20px no
.postDetailContainer {padding:15px; border:1px solid #dddddd; background-color:#ffffff;}
.postlabel {background-color:#edf1f2; color:#888888; padding:2px 5px; float:left; margin-bottom:5px;}
.postRightContainer {width:718px; border:1px solid #dddddd; padding:15px; background-color:#ffffff; float:left; margin-bottom:10px;}
.forumRightContainer {width:718px; border:1px solid #dddddd; background-color:#ffffff; float:left; margin-bottom:10px;}
.postDetailBanner {height:30px; width:720px; border-bottom:1px solid #efefef;}
.postDetailRow {width:720px; border-bottom:1px solid #efefef; padding:15px 0;}
.postDetailPortrait {width:50px; height:50px; float:left; margin-right:15px;}

View File

@ -304,6 +304,7 @@ a:hover.qx_btn{color:#64bdd9;}
/*.navHomepageProfile ul li ul {display:none;}
.navHomepageProfile ul li:hover ul {display:block;}*/
.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;}
.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;}