Merge branch 'dev_tieba' into develop

This commit is contained in:
huang 2016-12-30 17:30:29 +08:00
commit b5b988fb58
46 changed files with 1513 additions and 924 deletions

View File

@ -65,6 +65,17 @@ class ForumsController < ApplicationController
end end
end end
def forum_create_memo
@memo = Memo.new
@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.js
format.html {render layout: 'base_new_forum'}
end
end
def create_memo def create_memo
@memo = Memo.new(params[:memo]) @memo = Memo.new(params[:memo])
@memo.forum_id = @forum.id @memo.forum_id = @forum.id
@ -107,35 +118,41 @@ class ForumsController < ApplicationController
end end
def index def index
@offset, @limit = api_offset_and_limit({:limit => 10}) order = ""
@order_str = ""
if(params[:reorder_complex]) if(params[:reorder_complex])
@type="reorder_complex" order = " last_replies_memos.created_at #{params[:reorder_complex]}, #{Memo.table_name}.created_at #{params[:reorder_complex]}"
@str=params[:reorder_complex] @order_str = "reorder_complex="+params[:reorder_complex]
@forums_all = Forum.reorder("topic_count #{params[:reorder_complex]},updated_at #{params[:reorder_complex]}")
elsif(params[:reorder_popu]) elsif(params[:reorder_popu])
@type="reorder_popu" order = "replies_count #{params[:reorder_popu]}"
@str=params[:reorder_popu] @order_str = "reorder_popu="+params[:reorder_popu]
@forums_all = Forum.reorder("topic_count #{params[:reorder_popu]}")
elsif(params[:reorder_time]) elsif(params[:reorder_time])
@type="reorder_time" order = "#{Memo.table_name}.updated_at #{params[:reorder_time]}"
@str=params[:reorder_time] @order_str = "reorder_time="+params[:reorder_time]
@forums_all = Forum.reorder("updated_at #{params[:reorder_time]}")
else else
params[:reorder_complex] = "desc" order = "#{Memo.table_name}.updated_at desc"
@type="reorder_complex" @order_str = "reorder_time=desc"
@str=params[:reorder_complex]
@forums_all = Forum.reorder("topic_count desc,updated_at desc")
end end
@forums_count = @forums_all.count @memo = Memo.new(:forum => @forum)
@forums_pages = Paginator.new @forums_count, @limit, params['page'] @memos = Memo.where("parent_id is null")
@topic_count = @memos.count
@offset ||= @forums_pages.offset @topic_pages = Paginator.new @topic_count, per_page_option, params['page']
@forums = @forums_all.offset(@offset).limit(@limit).all @memos = @memos.includes(:last_reply).
#@forums = Forum.all limit(@topic_pages.per_page).
offset(@topic_pages.offset).
reorder(order).
preload(:author, {:last_reply => :author}).
all
@forums = Forum.reorder("topic_count desc,updated_at desc")
@my_forums_count = Forum.where(:creator_id => User.current.id).count
@my_memos_count = Memo.where(:author_id => User.current.id).count
@errors = params[:errors]
respond_to do |format| respond_to do |format|
format.html # index.html.erb
format.js format.js
format.json { render json: @forums } format.html {
render :layout => 'base_new_forum'
}# show.html.erb
format.json { render json: @forum }
end end
end end
@ -164,22 +181,21 @@ class ForumsController < ApplicationController
@memo = Memo.new(:forum => @forum) @memo = Memo.new(:forum => @forum)
@topic_count = @forum.topics.count @topic_count = @forum.topics.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 = @forum.topics.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 @my_topic_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is null").count
@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 = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is not null").count
@my_replies_count = Memo.where("forum_id = #{@forum.id} and author_id = #{User.current.id} and parent_id is not null").count
@errors = params[:errors] @errors = params[:errors]
# 推荐贴吧
@forums = Forum.where("id !=?", @forum.id).reorder("topic_count desc,updated_at desc").first(3)
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
@ -189,9 +205,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
@ -199,6 +215,10 @@ class ForumsController < ApplicationController
# GET /forums/1/edit # GET /forums/1/edit
def edit def edit
@forum = Forum.find(params[:id]) @forum = Forum.find(params[:id])
respond_to do |format|
format.html
format.js
end
end end
# POST /forums # POST /forums
@ -211,18 +231,17 @@ class ForumsController < ApplicationController
# Author lizanle # Author lizanle
# Description after save后需要进行资源记录的更新 # Description after save后需要进行资源记录的更新
# owner_type = 2 对应的是 forum # owner_type = 2 对应的是 forum
@save_flag=true @save_flag = true
if params[:asset_id] if params[:asset_id]
ids = params[:asset_id].split(',') 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
#end #end
respond_to do |format| 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.html { redirect_to @forum, notice: l(:label_forum_create_succ) }
format.json { render json: @forum, status: :created, location: @forum } format.json { render json: @forum, status: :created, location: @forum }
end end
else else
@save_flag=false @save_flag=false
respond_to do |format| respond_to do |format|
@ -238,15 +257,14 @@ class ForumsController < ApplicationController
# PUT /forums/1.json # PUT /forums/1.json
def update def update
@forum = Forum.find(params[:id]) @forum = Forum.find(params[:id])
respond_to do |format| respond_to do |format|
if @forum.update_attributes(params[:forum]) if @forum.update_attributes(params[:forum])
format.js {render :text=> true} format.js
format.html { redirect_to @forum, notice: l(:label_forum_update_succ) } format.html { redirect_to @forum, notice: l(:label_forum_update_succ) }
format.json { head :no_content } format.json { head :no_content }
else else
flash.now[:error] = "#{l :label_forum_update_fail}: #{@forum.errors.full_messages[0]}" flash.now[:error] = "#{l :label_forum_update_fail}: #{@forum.errors.full_messages[0]}"
format.js { render :text=> false} format.js
format.html { render action: "edit" } format.html { render action: "edit" }
format.json { render json: @forum.errors, status: :unprocessable_entity } format.json { render json: @forum.errors, status: :unprocessable_entity }
end end
@ -265,6 +283,19 @@ class ForumsController < ApplicationController
end end
end end
# 更新贴吧描述
def update_memo_description
@forum = Forum.find(params[:id])
if @forum.blank?
result = { :result => false }
else
forum_decription = params[:forum][:description]
@forum.update_attributes(:description => forum_decription )
result = { :result => true }
end
render :json => result
end
def search_forum def search_forum
# @forums = paginateHelper Forum.where("name LIKE '%#{params[:name]}%'") # @forums = paginateHelper Forum.where("name LIKE '%#{params[:name]}%'")
q = "%#{params[:name].strip}%" q = "%#{params[:name].strip}%"
@ -307,15 +338,24 @@ class ForumsController < ApplicationController
#检查forum的名字 #检查forum的名字
def check_forum_name def check_forum_name
forum_name_exist = true begin
if params[:forum_id] forum_name = params[:forum_name]
forum_name_exist = Forum.where("name = '#{params[:forum_name]}' and id != #{params[:forum_id]}").count >= 1 ? true : false result = Forum.find_by_name(forum_name).blank? ? {:result => true} : {:result => false}
else rescue Exception => e
forum_name_exist = Forum.where("name = '#{params[:forum_name]}' ").count >= 1 ? true : false puts e
end end
render :text => forum_name_exist render :json => result
# if params[:forum_id]
# forum_name_exist = Forum.where("name = '#{params[:forum_name]}' and id != #{params[:forum_id]}").count >= 1 ? true : false
# else
# forum_name_exist = Forum.where("name = '#{params[:forum_name]}' ").count >= 1 ? true : false
# end
# render :text => forum_name_exist
end end
#添加论坛tag #添加论坛tag
def add_forum_tag def add_forum_tag
@forum = Forum.find(params[:id]) @forum = Forum.find(params[:id])

View File

@ -1,6 +1,6 @@
class MemosController < ApplicationController class MemosController < ApplicationController
default_search_scope :memos default_search_scope :memos
before_filter :find_forum, :only => [:new, :create, :preview] before_filter :find_forum, :only => [:new, :create, :preview, :update]
before_filter :find_attachments, :only => [:preview] before_filter :find_attachments, :only => [:preview]
before_filter :find_memo, :except => [:new, :create, :preview] before_filter :find_memo, :except => [:new, :create, :preview]
before_filter :authenticate_user_edit, :only => [:edit, :update] before_filter :authenticate_user_edit, :only => [:edit, :update]
@ -29,32 +29,25 @@ class MemosController < ApplicationController
def new def new
@memo = Memo.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| respond_to do |format|
format.html { format.js
render action: :new ,layout: 'base' format.html {render layout: 'base_new_forum'}
}
format.json { render json: @memo } format.json { render json: @memo }
end end
end end
def create def create
if params[:quote].nil? if params[:quote].nil?
@quote = "" @quote = ""
else else
@quote = params[:quote] @quote = params[:quote]
end end
#unless params[:quote].nil?
# @quote = params[:quote][:quote]
#end
@memo = Memo.new(params[:memo]) @memo = Memo.new(params[:memo])
@memo.forum_id = params[:forum_id] @memo.forum_id = @forum.id
@memo.author_id = User.current.id @memo.author_id = User.current.id
if params[:memo][:parent_id] if params[:memo][:parent_id]
@ -78,24 +71,20 @@ class MemosController < ApplicationController
asset.save asset.save
end end
end end
#end format.js
format.js format.html { redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}" }
format.html { redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}" } format.json { render json: @memo, status: :created, location: @memo }
format.json { render json: @memo, status: :created, location: @memo }
else else
flash.now[:error] = "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" flash.now[:error] = "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}"
format.js format.js
format.html { redirect_to( forum_path(Forum.find(params[:forum_id]),:errors=>@memo.errors.full_messages[0])) } 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 } format.json { render json: @memo.errors, status: :unprocessable_entity }
#end
end end
end end
end end
REPLIES_PER_PAGE = 20 unless const_defined?(:REPLIES_PER_PAGE) REPLIES_PER_PAGE = 20 unless const_defined?(:REPLIES_PER_PAGE)
def show def show
# 更新贴吧帖子留言对应的memo_messages的viewed字段 # 更新贴吧帖子留言对应的memo_messages的viewed字段
unless @memo.children.blank? unless @memo.children.blank?
@memo.children.each do |child| @memo.children.each do |child|
@ -148,7 +137,7 @@ class MemosController < ApplicationController
respond_to do |format| respond_to do |format|
format.js format.js
format.html {render :layout=> 'base_forums'}#:layout=> 'base_forums', format.html {render :layout => 'base_new_forum'}
format.json { render json: @memo } format.json { render json: @memo }
format.xml { render xml: @memo } format.xml { render xml: @memo }
end end
@ -157,13 +146,16 @@ class MemosController < ApplicationController
def edit def edit
@my_topic_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is 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 @my_replies_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is not null").count
@forums = Forum.reorder("topic_count desc,updated_at desc")
@replying = false @replying = false
respond_to do |format| respond_to do |format|
format.html {render :layout=>'base_forums'} format.html {render :layout => 'base_new_forum'}
end end
end end
def update def update
# 注意,如果不需要
@flag = false @flag = false
respond_to do |format| respond_to do |format|
if( #@memo.update_column(:subject, params[:memo][:subject]) && if( #@memo.update_column(:subject, params[:memo][:subject]) &&
@ -173,10 +165,11 @@ class MemosController < ApplicationController
@memo.update_column(:subject,params[:memo][:subject]) && @memo.update_column(:subject,params[:memo][:subject]) &&
@memo.update_column(:updated_at,Time.now)) @memo.update_column(:updated_at,Time.now))
@memo.save_attachments(params[:attachments] || (params[:memo] && params[:memo][:uploads])) @memo.save_attachments(params[:attachments] || (params[:memo] && params[:memo][:uploads]))
@memo.forum_id = @forum.id
@flag = @memo.save @flag = @memo.save
# @memo.root.update_attribute(:updated_at, @memo.updated_at) # @memo.root.update_attribute(:updated_at, @memo.updated_at)
format.js format.js
format.html {redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}"} format.html {redirect_to back_memo_url, notice: "#{l :label_memo_update_succ}"}
else else
format.js format.js
format.html { render action: "edit" } format.html { render action: "edit" }
@ -207,7 +200,9 @@ class MemosController < ApplicationController
end end
def find_forum def find_forum
@forum = Forum.find(params[:forum_id]) forum_name = params[:forum_name].strip unless params[:forum_name].nil?
@forum = forum_name ? Forum.find_by_name(forum_name) : Forum.find(params[:forum_id])
# @forum = Forum.find(params[:forum_id])
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
render_404 render_404
nil nil

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")}
@ -227,6 +237,16 @@ module ApplicationHelper
xls_report.string xls_report.string
end end
# 用户资料是否完善
def user_data_complete user
user_extension = UserExtensions.where(:user_id => user.id).first
data = true
if user_extension.gender.nil? || user_extension.school_id.nil? || user.lastname.blank? || (user_extension.identity == 3 && user_extension.school_id.nil?)
data = false
end
return data
end
# 获取用户单位 # 获取用户单位
# 优先获取高校信息如果改信息不存在则获取occupation # 优先获取高校信息如果改信息不存在则获取occupation
def get_occupation_from_user user def get_occupation_from_user user

View File

@ -80,12 +80,12 @@ class User < Principal
#每日一报、一事一报、不报 #每日一报、一事一报、不报
MAIL_NOTIFICATION_OPTIONS = [ # MAIL_NOTIFICATION_OPTIONS = [
#['week', :label_user_mail_option_week], #['week', :label_user_mail_option_week],
# ['day', :label_user_mail_option_day], # ['day', :label_user_mail_option_day],
['all', :label_user_mail_option_all], # ['all', :label_user_mail_option_all],
['none', :label_user_mail_option_none] # ['none', :label_user_mail_option_none]
] # ]
has_many :homework_users has_many :homework_users
has_many :homework_attaches, :through => :homework_users has_many :homework_attaches, :through => :homework_users
@ -244,7 +244,7 @@ class User < Principal
validates_format_of :mail, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, :allow_blank => true validates_format_of :mail, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, :allow_blank => true
validates_length_of :mail, :maximum => MAIL_LENGTH_LIMIT, :allow_nil => true validates_length_of :mail, :maximum => MAIL_LENGTH_LIMIT, :allow_nil => true
validates_confirmation_of :password, :allow_nil => true validates_confirmation_of :password, :allow_nil => true
validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true # validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true
validate :validate_password_length validate :validate_password_length
# validates_email_realness_of :mail # validates_email_realness_of :mail
before_create :set_mail_notification before_create :set_mail_notification

View File

@ -0,0 +1,52 @@
<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" >
<%= labelled_form_for @forum, :html => {:id => "forum_new", :remote => true} do |f| %>
<%= render :partial => "forums/form", :locals => {:f => f} %>
<% end %>
</div>
</div>
<script>
function forums_commit(){
$("#forum_name_error_tips").hide();
$("#forum_description_error_tips").hide();
if ($("#forum_name").val().trim() == ""){
$("#forum_name_error_tips").html("贴吧名称不能为空").show();
}
else if($("#forum_desc").val().trim() == ""){
$("#forum_description_error_tips").html("贴吧描述不能为空").show();
}
else if($("#forum_desc").val().length > 5000){
$("#forum_description_error_tips").html("贴吧描述不能超过5000个字符").show();
}
else{
$.ajax({
url:'<%= check_forum_name_forums_path %>',
type:'get',
data:{
forum_name:$("#forum_name").val().trim()
},
success:function(data){
if(data.result == true){
alert("提交成功");
$("#forum_new").submit();
hideModal();
return true;
}else{
alert("提交失败");
$("#forum_name_error_tips").html("贴吧名称已存在").show();
return false;
}
},
error:function(){
alert('请检查当前网络连接')
}
});
}
}
</script>

View File

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

View File

@ -0,0 +1,70 @@
<ul class="newuploadbox">
<li class="mb10 clear">
<label class="fl" style="width: 90px;text-align: right;">贴吧名称&nbsp;&nbsp;:&nbsp;</label>
<!--<input maxlength="80" class="postCreateInput" onfocus="hideError();" onblur="check_forum_name();" placeholder="输入贴吧名称" >-->
<%= f.text_field :name, :label => "", :name => "forum[name]", :id => "forum_name", :onblur => "check_forum_name()", :class => "issues_calendar_input fl", :style => "width:320px;height:28px;", :placeholder => "请输入贴吧名称最多50个字符", :onfocus => "$('#forum_name_error_tips').hide();" %>
<!--<input type="text" name="forum[name]" id="forum_name" onfocus="$('#forum_name_error_tips').hide();" placeholder="请输入贴吧名称最多50个字符" class="issues_calendar_input fl" style="width:320px;height:28px;">-->
<div class="clear"></div>
<p class="c_red ml90" style="display: none" id="forum_name_error_tips"></p>
</li>
<li class=" clear">
<label class="fl" style="width: 90px;text-align: right;">贴吧描述&nbsp;&nbsp;:&nbsp;</label>
<%= f.text_area :description, :label => "", :maxlength => "5000", :name => "forum[description]", :id => "forum_desc", :class => "mr15 mb10 fl newupload_textarea", :style => "width:320px;height:100px;", :placeholder => "请输入新建贴吧描述最多5000个字符", :onfocus => "$('#forum_description_error_tips').hide();" %>
<div class="clear"></div>
<p class="c_red ml90" style="display: none" id="forum_description_error_tips"></p>
</li>
</ul>
<div class="clear mr45 mb10">
<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>
<script>
function check_forum_name(){
if ($("#forum_name").val().trim() == ""){
$("#forum_name_error_tips").html("贴吧名称不能为空").show();
}else if($("#forum_name").val().length > 50){
$("#forum_name_error_tips").html("贴吧名称不能超过50个字符").show();
}
}
function forums_commit(){
$("#forum_name_error_tips").hide();
$("#forum_description_error_tips").hide();
if ($("#forum_name").val().trim() == ""){
$("#forum_name_error_tips").html("贴吧名称不能为空").show();
}
else if($("#forum_name").val().length > 50){
$("#forum_name_error_tips").html("贴吧名称不能超过50个字符").show();
}
else if($("#forum_desc").val().trim() == ""){
$("#forum_description_error_tips").html("贴吧描述不能为空").show();
}
else if($("#forum_desc").val().length > 5000){
$("#forum_description_error_tips").html("贴吧描述不能超过5000个字符").show();
}
else{
$.ajax({
url:'<%= check_forum_name_forums_path %>',
type:'get',
data:{
forum_name:$("#forum_name").val().trim()
},
success:function(data){
if(data.result == true){
$("#forum_new").submit();
hideModal();
return true;
}else{
$("#forum_name_error_tips").html("贴吧名称已存在").show();
return false;
}
},
error:function(){
alert('请检查当前网络连接')
}
});
}
}
</script>

View File

@ -1,8 +1,10 @@
<% forum.reload.tag_list.each do |tag|%> <% forum.reload.tag_list.each do |tag|%>
<span class="postlabel mr10"> <span class="postlabel mr10">
<a title="双击可编辑" ondblclick="rename_tag($(this),'<%= tag %>',<%= forum.id%>,5);" style="cursor: pointer" class="fontGrey2 mr5"><%= tag %></a> <% if forum.creator.id == User.current.id %>
<%if forum.creator.id == User.current.id%> <a title="双击可编辑" ondblclick="rename_tag($(this),'<%= tag %>', <%= forum.id %>, 5);" style="cursor: pointer" class="fontGrey2 mr5"><%= tag %></a>
<a href="javascript:void(0);" class="fontGrey2" onclick="delete_forum_tag($(this));">×</a> <a href="javascript:void(0);" class="fontGrey2" onclick="delete_forum_tag($(this));">×</a>
<% else %>
<a href="javacript:void(0)" style="cursor: pointer" class="fontGrey2 mr5"><%= tag %></a>
<% end %> <% end %>
</span> </span>
<% end %> <% end %>

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="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_memos_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_forums_count %></a></div>
<div class="homepageImageText">发帖</div>
</div>
</div>
<div class="cl"></div>
</div>

View File

@ -0,0 +1,12 @@
<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" >
<%= labelled_form_for @forum, :html => {:id => "forum_new", :remote => false} do |f| %>
<%= render :partial => "form", :locals => {:f => f} %>
<% end %>
</div>
</div>

View File

@ -0,0 +1,14 @@
<% @forums.each_with_index do |forum, i| %>
<div class="wenba-rightbar-li clearfix <%= i > 9 ? 'none' : ''%> " id="forum_list_<%= forum.id %>">
<h4 class="fl wenba-rightbar-title mt5 ml10" style="border-bottom: 0px"><%= 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 %>

View File

@ -5,6 +5,19 @@
$(function(){ $(function(){
showNormalImage('postDetailDes_<%= topic.id %>'); showNormalImage('postDetailDes_<%= topic.id %>');
autoUrl('postDetailDes_<%= topic.id %>'); autoUrl('postDetailDes_<%= topic.id %>');
if($("#intro_content_<%= topic.id %>").height() > 300) {
$("#intro_content_show_<%= topic.id %>").show();
}
$("#intro_content_show_<%= topic.id %>").click(function(){
$("#postDetailDes_<%= topic.id %>").toggleClass("maxh300");
$("#intro_content_show_<%= topic.id %>").hide();
$("#intro_content_hide_<%= topic.id %>").show();
});
$("#intro_content_hide_<%= topic.id %>").click(function(){
$("#postDetailDes_<%= topic.id %>").toggleClass("maxh300");
$("#intro_content_hide_<%= topic.id %>").hide();
$("#intro_content_show_<%= topic.id %>").show();
});
}); });
</script> </script>
<div class="postDetailRow"> <div class="postDetailRow">
@ -23,9 +36,14 @@
<a href="javascript:void(0);" class="linkGrey2 disablePostLikeIcon ml10" style="cursor: default" title="点赞人数" > <%= get_praise_num(topic)%></a> <a href="javascript:void(0);" class="linkGrey2 disablePostLikeIcon ml10" style="cursor: default" title="点赞人数" > <%= get_praise_num(topic)%></a>
</div> </div>
<div class="postDetailDes" id = "postDetailDes_<%= topic.id %>"><%= topic.content.html_safe%> <div class="postDetailDes maxh300" id = "postDetailDes_<%= topic.id %>">
<!--<a href="javascript:void(0);" class="linkBlue2 underline ml8">显示全部</a>--> <div id="intro_content_<%= topic.id %>">
<%= topic.content.html_safe%>
</div>
</div> </div>
<div id="intro_content_show_<%= topic.id %>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
<div id="intro_content_hide_<%= topic.id %>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
<div class="cl"></div>
<% author = topic.last_reply.try(:author)%> <% author = topic.last_reply.try(:author)%>
<% if author%> <% if author%>
<div class="postDetailCreater">最后回复:<a href="<%= user_path(author) %>" class="linkBlue2" target="_blank"><%= author.show_name%></a></div> <div class="postDetailCreater">最后回复:<a href="<%= user_path(author) %>" class="linkBlue2" target="_blank"><%= author.show_name%></a></div>
@ -36,10 +54,10 @@
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<% end %> <% end %>
<ul class="wlist" id="pages" style="float: right;margin-top: 10px;"> <ul class="pages" style="width: auto;display: table;margin-left: auto;margin-right: auto; padding-top: 10px">
<%= pagination_links_full @topic_pages, @topic_count ,:per_page_links => true, :remote => true, :flag => true %> <%= pagination_links_full @topic_pages, @topic_count ,:per_page_links => true, :remote => true, :flag => true, :is_new => true %>
</ul> </ul>
<% else %> <% else %>
<p class="nodata"><%= l(:label_no_data) %></p> <%= render :partial => "projects/no_data" %>
<% end %> <% end %>
</div> </div>

View File

@ -1,7 +1,5 @@
<%if @save_flag%> <%if @save_flag%>
//$('#new_forum_div').slideToggle();$('#create_btn').parent().slideToggle(); $("#forum_right_bar").html('<%= escape_javascript( render :partial => 'forums/right_bar') %>');
//$('#reorder_time').click();
window.location.href= "<%= host_with_protocol %>"+"/forums/" + "<%= @forum.id%>"
<%else%> <%else%>
$("#error").html("<%= @forum.errors.full_messages[0]%>").show(); $("#error").html("<%= @forum.errors.full_messages[0]%>").show();
<%end %> <%end %>

View File

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

View File

@ -1,176 +1,159 @@
<%= javascript_include_tag 'new_user' %> <%= content_for(:header_tags) do %>
<%= stylesheet_link_tag 'css/common','css/public'%> <%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
<script> <% end %>
function add_class(id){ <div class="banner-big f16 fontGrey3 mb10">问吧</div>
if($("#"+id).hasClass("sortArrowActiveD")){
$("#"+id).removeClass("sortArrowActiveD");
$("#"+id).addClass("sortArrowActiveU");
$.ajax({
type: 'GET',
url: '<%= forums_path %>' + '.js?' + id + '=asc&page='+<%= @forums_pages.page%>
}); <div class="postRightContainer mr10">
}else if($("#"+id).hasClass("sortArrowActiveU")){ <div class="postDetailBanner" style="padding-bottom: 10px">
$("#"+id).removeClass("sortArrowActiveU"); <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>
$("#"+id).addClass("sortArrowActiveD"); <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>
$.ajax({ <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>
type: 'GET', <div class="creatPost" id="create_memo_btn">
url: '<%= forums_path %>' + '.js?' + id + '=desc&page='+<%= @forums_pages.page%> <%= link_to "发布新帖",new_forum_memo_path(:forum_id => Forum.first.id), :class => "c_white db creatPostIcon bBlue" %>
</div>
});
}else{
$("#"+id).addClass("sortArrowActiveD");
$.ajax({
type: 'GET',
url: '<%= forums_path %>' + '.js?' + id + '=desc&page='+<%= @forums_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");
});
$('#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="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 class="cl"></div>
</div> </div>
</div> <div id="forum_list">
<%= render :partial => 'show_topics',:locals => {:memos => @memos} %>
</div>
</div> </div>
<%= render :partial => "forums/my_count_message" %>
<div class="wenba-rightbar fr">
<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>
<div id="forums_right_list">
<%= render :partial => "forums/right_bar" %>
<% if @forums.count > 10 %>
<a href="javascript:void(0);" id="forum_more_id" class="wenba-rightbar-more linkBlue2" data-init="0" onclick="expand_forum('#forum_more_id', '#forums_right_list');">点击展开更多</a>
<% end %>
</div>
</div>
<script>
function expand_forum(btnid,container){
var target = $(container).children('.wenba-rightbar-li');
var btn = $(btnid);
if(btn.data('init')=='0'){
btn.data('init',1);
btn.html('点击收起');
target.show();
}else{
btn.data('init',0);
btn.html('点击展开更多');
target.hide();
for(var i = 0; i < 10; i++)
{
target.eq(i).show()
}
btn.parent().show();
}
}
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>

View File

@ -1,4 +1,4 @@
//$("#postBanner").html("<%#= render :partial => 'post_banner' ,:locals => {:order_type=>@type,:order_str=>@str }%>"); //$("#postBanner").html("<%#= render :partial => 'post_banner' ,:locals => {:order_type=>@type,:order_str=>@str }%>");
$("#forum_list").html("<%= escape_javascript(render :partial => 'forum_list',:locals => {:forums=>@forums}) %>"); $("#forum_list").html("<%= escape_javascript(render :partial => 'show_topics', :locals => {:memos => @memos}) %>");
//这里出现一个问题竟然是单双引号引起的。注意!! //这里出现一个问题竟然是单双引号引起的。注意!!
$("#pages").html('<%= pagination_links_full @forums_pages, @forums_count,:per_page_links => false,:remote =>true,:flag=>true%>'); $("#pages").html('<%= pagination_links_full @topic_pages, @topic_count ,:per_page_links => true, :remote => true, :flag => true, :is_new => true %>');

View File

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

View File

@ -1,59 +1,42 @@
<%= 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="banner-big f16 fontGrey3 mb10"><%= link_to "问吧", forums_path, :class => "c_blue" %> > <%= @forum.name %></div>
<div class="postRightContainer mr10">
<div class="postRightContainer"> <div class="postDetailBanner" style="padding-bottom: 10px">
<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| %>
<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>
var textarea1 = document.getElementById('memo_subject');
autoTextarea(textarea1);
</script>
</div>
<div class="mt15">
<%= kindeditor_tag 'memo[content]','',:height=>300,:editor_id=>'memo_content'%>
</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_cancle();">取消</a><span class="mr10 fontGrey">或</span></div>
<div class="cl"></div>
</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="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="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="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 class="cl"></div>
</div> </div>
<div id="topics_list"> <div id="topics_list">
<%= render :partial => 'show_topics',:locals => {:memos=>@memos}%> <%= render :partial => 'show_topics',:locals => {:memos => @memos}%>
</div>
</div>
<div class="fl">
<div id="my_count_message">
<%= render :partial => "memos/my_count_message" %>
</div> </div>
<!--<div class="pageRoll">--> <div class="homepageLeft-new" id="forum_right_bar">
<!--<div class="pageCell"><a href="javascript:void(0);" class="linkBlue">上一页</a></div>--> <div class="wenba-rightbar">
<!--<div class="pageCell pageCellActive"><a href="javascript:void(0);" class="c_white">1</a></div>--> <div class="wenba-rightbar-top clearfix">
<!--<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">2</a></div>--> <h3 class="fl ml10">推荐问吧</h3>
<!--<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">3</a></div>--> </div>
<!--<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">...</a></div>--> <%= render :partial => "forums/right_bar" %>
<!--<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">14</a></div>--> </div>
<!--<div class="pageCell"><a href="javascript:void(0);" class="linkBlue">下一页</a></div>--> </div>
<!--</div>-->
<!--<div class="cl"></div>-->
</div>
</div> </div>
<script> <script>
function add_class(id){ function add_class(id){
if($("#"+id).hasClass("sortArrowActiveD")){ if($("#"+id).hasClass("sortArrowActiveD")){

View File

@ -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}) %>")

View File

@ -0,0 +1 @@
$("#my_count_message").html('<%= escape_javascript( render :partial => 'memos/my_count_message') %>');

View File

@ -23,7 +23,7 @@
<% memo = Memo.where(:id => 1168).first %> <% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %> <% unless memo.nil? %>
<li class="navHomepageMenu fl mr30"> <li class="navHomepageMenu fl mr30">
<%= link_to "帮助中心", "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168", :class =>"c_white f16 db p10", :target => "_blank" %> <%= link_to "贴吧", forums_path, :class =>"c_white f16 db p10", :target => "_blank" %>
</li> </li>
<% end %> <% end %>
<% else %> <% else %>

View File

@ -219,7 +219,7 @@
</div> </div>
<div class="postDetailContainer mt10"> <div class="postDetailContainer mt10">
<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 mr10"><%= link_to image_tag(url_to_avatar(User.current),:width=>50,:height => 50,:alt=>'贴吧图像' ),user_path( User.current) %></div>
<div class="fl f16 fontGrey2">我在贴吧</div> <div class="fr f16 fontGrey2">我在贴吧</div>
<div class="cl"></div> <div class="cl"></div>
<div class="mt8"> <div class="mt8">
<div class="homepageImageBlock" style="width: 68px !important;"> <div class="homepageImageBlock" style="width: 68px !important;">

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

@ -101,10 +101,10 @@
<div class="cl"></div> <div class="cl"></div>
<div class="homepageContent"> <div class="homepageContent">
<div class="homepageLeft mt10" id="LSide"> <div class="homepageLeft mt10" id="LSide">
<div class="user_leftinfo mb10"> <div class="user_leftdata_background mb10">
<% if User.current.logged? && User.current == @user%> <% if User.current.logged? && User.current == @user%>
<div class="pr" style="width: 80px; margin:0 auto;"> <div class="pr" style="width: 80px; margin:0 auto;">
<%=link_to image_tag(url_to_avatar(@user),width:"74", height: "74", :id => 'nh_source_tx'), <%= link_to image_tag(url_to_avatar(@user),width:"74", height: "74", :id => 'nh_source_tx'),
my_clear_user_avatar_temp_path, :class => "user_leftinfo_img", :remote => true %> my_clear_user_avatar_temp_path, :class => "user_leftinfo_img", :remote => true %>
<div class="homepageEditProfile undis"> <div class="homepageEditProfile undis">
<%=link_to '', my_clear_user_avatar_temp_path, :class => 'homepageEditProfileIcon', :remote => true, :title => '点击编辑Logo' %> <%=link_to '', my_clear_user_avatar_temp_path, :class => 'homepageEditProfileIcon', :remote => true, :title => '点击编辑Logo' %>

View File

@ -37,7 +37,7 @@
(如果链接点击无效,请手动复制链接并粘贴到浏览器地址栏中,然后按“回车”打开页面即可) (如果链接点击无效,请手动复制链接并粘贴到浏览器地址栏中,然后按“回车”打开页面即可)
</span> </span>
</p> </p>
<div style="width: 100%; border-top: 1px solid #ddd; margin:30px 0;"></div> <div style="width: 100%; border-top: 1px solid #ddd; margin:10px 0;"></div>
<img src="https://www.trustie.net/images/wechat/trustie_QR.jpg" width="120" height="120" > <img src="https://www.trustie.net/images/wechat/trustie_QR.jpg" width="120" height="120" >
<p style=" color:#666;"> <p style=" color:#666;">
扫一扫,关注 Trustie 微信公众号,更方便获任务通知,作业等提醒<br/> 扫一扫,关注 Trustie 微信公众号,更方便获任务通知,作业等提醒<br/>

View File

@ -1,3 +1,111 @@
<%= error_messages_for 'bid' %> <%= content_for(:header_tags) do %>
<p><%= f.text_field :content, :required => true, :size => 60, :style => "width:150px;" %></p> <%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
<p><%= hidden_field_tag 'subject'||=@memo.subject %> <% end %>
<div class="wenba-tiwenbox fl mr10 mb10">
<div class="wenba-tiwen-con">
<ul >
<li class="mb10">
<%= f.text_field :subject, :no_label => true, :id => "memo_subject", :maxlength => "50", :style => "width:708px", :onblur => "check_memo_name();", :onfocus => "$('#memo_name_error_tips').hide();", :onmouseover => "this.style.borderColor='#d9d9d9'", :class => "wenba-tiwen-input", :placeholder => "请输入标题" %>
<p class="c_red" style="display: none" id="memo_name_error_tips"></p>
<script>
var textarea1 = document.getElementById('memo_subject');
autoTextarea(textarea1);
</script>
</li>
<li class="mb10">
<%= f.kindeditor :content, :editor_id => "memo_content", :height => 300, :no_label => true %>
</li>
<p class="c_red" style="display: none" id="memo_contents_error_tips"></p>
<li class="clear mb10">
<%= render :partial => 'forums/file_form', :locals => {:container => @memo} %>
</li>
</ul>
<ul class="wenba-tagbox clearfix">
<h3 class="mb5 c_red" id="memo_classify_tips">请选择分类</h3>
<% @forums.each do |forum| %>
<li class="hidden" style="max-width: 200px;"><a href="javascript:void(0)" class="wenba-tiwen-tag" name="<%= forum.name %>" id="forums_question_<%= forum.id %>" onclick="add_forum('forums_question_<%= forum.id %>')" ><%= forum.name %></a></li>
<% end %>
</ul>
<input type="text" style="display: none" id="forum_name" name="forum_name" value="">
<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>
</div>
<script>
$(document).ready(function(){
$("#forums_question_"+<%= params[:forum_id] %>).addClass("wenba-tiwen-tag-active");
});
function add_forum(id){
$("#memo_classify_tips").attr('style','color: #333;');
$('a').removeClass("wenba-tiwen-tag-active");
$("#"+id).addClass("wenba-tiwen-tag-active");
}
function check_memo_name(){
if($("#memo_subject").val().trim().length > 50){
$("#memo_name_error_tips").html("主题 过长(最长为 50 个字符)").show();
return false;
}
if(memo_content.html().length > 20000){
$("#memo_contents_error_tips").html("内容 过长(最长为 20000 个字符)").show();
$("html,body").animate({scrollTop:$("#memo_contents_error_tips").offset().top},1000);
return false;
}
if($("#memo_subject").val().trim() == ""){
$("#memo_name_error_tips").html("标题不能为空").show();
}
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()){
$("#memo_error_tips").html("主题和内容不能为空").show();
}
else if($("textarea[name='memo[subject]']").val().trim() == "" && !memo_content.isEmpty() ){
$("#memo_error_tips").html("主题不能为空").show();
}else if($("textarea[name='memo[subject]']").val().trim() != "" && memo_content.isEmpty()){
$("#memo_error_tips").html("内容不能为空").show();
}
}
var first_click = true;
function memo_commit(){
$("#memo_name_error_tips").hide();
$("#memo_contents_error_tips").hide();
var f_name = $('.wenba-tiwen-tag-active').attr('name');
$("#forum_name").attr('value',f_name);
if($("#memo_subject").val().trim() != "" && !memo_content.isEmpty() && first_click && $("#forum_name").attr('value') != ""){
// alert($("#forum_name").attr('name'));
memo_content.sync();
$("#new_memo").submit();
} else if($("#memo_subject").val().trim() == ""){
$("#memo_name_error_tips").html("标题不能为空").show();
}else if(memo_content.isEmpty()){
$("#memo_contents_error_tips").html("内容不能为空").show();
}else if ($("#forum_name").attr('value')== ""){
alert("请选择分类");
$("#memo_classify_tips").attr('style','color: #F00;');
}
}
</script>

View File

@ -0,0 +1,157 @@
<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" style="width: 120px;">
<% user_name = @forum.creator.show_name.empty? ? @forum.creator.name : @forum.creator.show_name %>
<div class="fl mb8 mt10">吧主:</div>
<a href="<%= user_path(@forum.creator)%>" target="_blank" class="linkBlue w80 fl mb8 mt10" style="overflow: hidden;white-space: nowrap;text-overflow:ellipsis; "><%= user_name %></a>
<div class="fontGrey3 fl">回答:<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="fl">
<%= link_to @forum.name, forum_path(@forum), :class => "f16 fontBlue", :style => "word-break: break-all; word-wrap:break-word;white-space:pre-wrap;" %>
</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 ;"><%= h @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>
<%= link_to "编辑贴吧", edit_forum_path(@forum), :class => "linkGrey3", :remote => true %>
<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>
<% unless params[:controller] == "forums" %>
<div class="f1">
<%= link_to "<span class='btn-big-blue mt10'>我要提问</span>".html_safe, new_forum_memo_path(:forum_id => @forum) %>
</div>
<% end %>
</div>
<script>
var desc;
function edit_desc(){
desc = $("#forum_desc_span").html();
$("#forum_desc_span").html("<textarea id='forum_desc_input' onblur='change_forum_desc();' style='width: 200px;height: 80px; max-width: 207px; max-height: 80px; border: 1px solid #d9d9d9;outline: none;margin: 0px 0px 12px 0px;'>" + desc + "</textarea>");
$("#forum_desc_input").focus();
}
function change_forum_desc(){
$.ajax({
url: '<%= update_memo_description_forum_path(@forum) %>',
type: 'post',
data:{"forum[description]":$("#forum_desc_input").val().trim()},
success:function(data){
if(data.result == true){
$("#forum_desc_input").hide();
$("#forum_desc_span").html($("#forum_desc_input").val().trim());
}else{
alert("保存失败");
$("#forum_desc_input").hide();
$("#forum_desc_span").html(desc);
}
}
});
}
function delete_forum_tag(doc){
tag_name = doc.parent().children().eq(0).html().trim();
$.ajax(
"<%= delete_forum_tag_forum_path(@forum)+ '.js?tag_name='%>"+tag_name,
{},
function(data){
alert(data == true)
if(data == true){
doc.parent().remove();
}else{
}
}
);
}
function addTag(){
if(<%=@forum.creator.id == User.current.id%>) {
if ($("input[name='addTag']").val().trim() != "" ) {
if($("input[name='addTag']").val().trim().length <= 120) {
$.get(
'<%= add_forum_tag_forum_path(@forum)%>' + "?tag_str=" + $("input[name='addTag']").val(),
{}
);
$("input[name='addTag']").val('');
}else{
alert("标签名字长度不能超过120个字符");
}
}
}
}
var tagNameHtml; //当前双击的链接的父节点的html
var tagName; //标签的值
var parentCssBorder; //当前双击的链接的父节点
var ele; //当前双击的链接
var taggableId; //标签的id
var taggableType; //被标签的类型
//这里renameTag有两种情况一种是改变某个资源的tag名称。如果其他资源也有这个tag。则新增一个改变后的tag名
//第二种是改变某个tag名称。其他所有的资源如果拥有这个tag。那么对应的tag名也要改掉。
//目前这两种依据 的来源就是 是否 传了参数 id。如果有id。就指定了资源id就是第一种情况。如果没有id。就是第二种情况
function rename_tag(domEle,name,id,type){
if(domEle.children().get(0) != undefined ){ //已经是编辑框的情况下不要动
return;
}
tagNameHtml = domEle.parent().html();
tagName = name;
parentCssBorder = domEle.parent().css("border");
ele = domEle;
taggableId = id;
taggableType = type;
width = parseInt(domEle.css('width').replace('px','')) >=100 ? parseInt(domEle.css('width').replace('px','')) : 100;
domEle.html('<input name="" id="renameTagName" maxlength="<%=Setting.tags_max_length%>" minlength="<%= Setting.tags_min_length%>" style="width:'+width+'px;" value="'+name+'"/>');
domEle.parent().css("border","1px solid #ffffff");
$("#renameTagName").focus();
}
$("#renameTagName").live('blur',function(){
if($("#renameTagName")[0] != undefined ){//存在renameTagName,则处于编辑状态
if($("#renameTagName").val().trim() == tagName){ //如果值一样,则恢复原来的状态
ele.parent().css("border","");
ele.parent().html(tagNameHtml);
}else{ //否则就要更新tag名称了
if(confirm("是否将标签改为 "+ $("#renameTagName").val().trim())){
$.post(
'<%= update_tag_name_path %>',
{"taggableId": taggableId, "taggableType": taggableType, "tagName": tagName, "renameName": $("#renameTagName").val().trim()}
)
}else{
ele.parent().css("border","");
ele.parent().html(tagNameHtml);
}
}
}
});
function del_forum_confirm(){
if(confirm('您确定要删除么?')){
$("#del_link").click();
}
}
</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

@ -21,7 +21,7 @@
<%#= link_to image_tag("/images/praise_tread/praise_true.png",weight:"22px", height:"22px",:title => l(:label_issue_praise)), <%#= link_to image_tag("/images/praise_tread/praise_true.png",weight:"22px", height:"22px",:title => l(:label_issue_praise)),
:controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class,:horizontal => horizontal %> :controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class,:horizontal => horizontal %>
<a href="<%= praise_tread_praise_plus_path({:obj_id=>obj.id,:obj_type=>obj.class,:horizontal => horizontal })%>" data-remote="true" class="linkGrey2 postLikeIcon mr30" title="<%= l(:label_issue_praise)%>" > <%= get_praise_num(obj)%></a> <a href="<%= praise_tread_praise_plus_path({:obj_id=>obj.id,:obj_type=>obj.class,:horizontal => horizontal })%>" data-remote="true" class="<%= params[:controller] == 'memos' ? 'linkGrey2 postLikeIcon': 'linkGrey2 postLikeIcon mr30' %>" title="<%= l(:label_issue_praise)%>" > <%= get_praise_num(obj)%></a>
<!--<%# else %>--> <!--<%# else %>-->
<!--<%#= link_to image_tag("/images/praise_tread/praise_true.png",weight:"22px", height:"22px",:title => l(:label_issue_praise)),--> <!--<%#= link_to image_tag("/images/praise_tread/praise_true.png",weight:"22px", height:"22px",:title => l(:label_issue_praise)),-->

View File

@ -39,33 +39,19 @@
} }
} }
</script> </script>
<div class="homepageRightBanner mt15"> <div class="banner-big f16 fontGrey3 mb10">
<div class="NewsBannerName">编辑帖子</div> <%= link_to "问吧", forums_path, :class => "c_blue" %> > <%= link_to @forum.name, forum_path(@forum), :class => "c_blue" %> >
<%= @memo.subject %>
</div> </div>
<div class="postRightContainer" style="margin-top: 15px">
<%= labelled_form_for(@memo, :url => forum_memo_path(@memo.forum_id, @memo),:html=>{:id=>'edit_memo'}) do |f| %>
<div id="error" style="color:red ;display: none">
</div> <%= labelled_form_for(@memo, :url => forum_memo_path(@memo.forum_id, @memo),:html=>{:id => 'new_memo'}) do |f| %>
<div> <%= render :partial => "memos/form", :locals => {:f => f} %>
<textarea type="text" id="memo_subject" name="memo[subject]" maxlength="50" class="postDetailInput" placeholder="对应帖子标题" ><%= @memo.subject%></textarea> <% end %>
<script>
var ta = document.getElementById('memo_subject') <div class="fl">
autoTextarea(ta) <%= render :partial => "memos/my_count_message" %>
</script>
</div>
<div class="mt15">
<%= kindeditor_tag 'memo[content]',@memo.content,:height=>300,:editor_id=>'memo_content'%>
</div>
<div class="mt10">
<!--<a href="javascript:void(0);" class="AnnexBtn fl mt3">对应附件名称</a>-->
<%= render :partial => 'forums/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="<%= forum_memo_path(@memo.forum,@memo)%>" class="linkGrey2 mr10">取消</a><span class="mr10 fontGrey">或</span></div>
<div class="cl"></div>
</div>
<% end %>
</div> </div>
<script> <script>
$(function(){ $(function(){
limitStrsize('memo_subject',50); limitStrsize('memo_subject',50);

View File

@ -1,35 +1,6 @@
<% @nav_dispaly_home_path_label = 1 <div class="banner-big f16 fontGrey3 mb10"><%= link_to "问吧", forums_path, :class => "c_blue" %> > <%= link_to @forum.name, forum_path(@forum), :class => "c_blue" %> > 我要提问</div>
@nav_dispaly_main_course_label = 1 <%= labelled_form_for(@memo, :url => forum_memos_path(@forum)) do |f| %>
@nav_dispaly_main_project_label = 1 <%= render :partial => "memos/form", :locals => {:f => f} %>
@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 %> <% end %>
<%= render :partial => "forums/my_count_message" %>
<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>

View File

View File

@ -3,6 +3,10 @@
<%= javascript_include_tag 'forum' %> <%= javascript_include_tag 'forum' %>
<% end %> <% end %>
<div class="banner-big f16 fontGrey3 mb10">
<%= link_to "问吧", forums_path, :class => "c_blue" %> > <%= link_to @forum.name, forum_path(@forum), :class => "c_blue" %> > <%=h @memo.subject %>
</div>
<script> <script>
$(function() { $(function() {
sd_create_editor_from_data(<%= @memo.id%>,null,"100%", "<%=@memo.class.to_s%>"); sd_create_editor_from_data(<%= @memo.id%>,null,"100%", "<%=@memo.class.to_s%>");
@ -16,7 +20,7 @@
} }
} }
</script> </script>
<div class="postRightContainer"> <div class="postRightContainer mr10">
<div class="postThemeContainer"> <div class="postThemeContainer">
<div class="postDetailPortrait"> <div class="postDetailPortrait">
<%= link_to image_tag(url_to_avatar(@memo.author),:width=>50,:height => 50,:alt=>'贴吧图像' ),user_path(@memo.author) %> <%= link_to image_tag(url_to_avatar(@memo.author),:width=>50,:height => 50,:alt=>'贴吧图像' ),user_path(@memo.author) %>
@ -96,6 +100,12 @@
</div> </div>
</div> </div>
</div> </div>
<div class="fl">
<%= render :partial => "memos/my_count_message" %>
</div>
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
$("#activity_description_<%= @memo.id %> p,#activity_description__<%= @memo.id %> span,#activity_description_<%= @memo.id %> em").each(function(){ $("#activity_description_<%= @memo.id %> p,#activity_description__<%= @memo.id %> span,#activity_description_<%= @memo.id %> em").each(function(){

File diff suppressed because it is too large Load Diff

View File

@ -42,13 +42,13 @@
</div> </div>
</fieldset> </fieldset>
<fieldset class="box"> <!-- <fieldset class="box">
<legend><%=l(:field_mail_notification)%></legend> <legend><%#= l(:field_mail_notification)%></legend>
<%= render :partial => 'users/mail_notifications' %> <%#= render :partial => 'users/mail_notifications' %>
</fieldset> </fieldset> -->
<fieldset class="box tabular"> <fieldset class="box tabular">
<legend><%=l(:label_preferences)%></legend> <legend><%= l(:label_preferences) %></legend>
<%= render :partial => 'users/preferences' %> <%= render :partial => 'users/preferences' %>
</fieldset> </fieldset>
</div> </div>

View File

@ -1,5 +1,5 @@
<div class="homepagePostReplyPublisher"> <div class="homepagePostReplyPublisher">
<%= link_to comment.creator_user.show_name, user_url_in_org(comment.creator_user), :class => "newsBlue mr10 f14" %> <%= link_to comment.creator_user.show_name, user_path(comment.creator_user), :class => "newsBlue mr10 f14" %>
<%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %> <%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %>
</div> </div>
<% if !comment.parent.nil? && !comment.parent.parent.nil? %> <% if !comment.parent.nil? && !comment.parent.parent.nil? %>

View File

@ -74,7 +74,7 @@
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id => user_activity_id, :content => activity.description} %> <%= render :partial => "users/intro_content", :locals => {:user_activity_id => user_activity_id, :content => activity.description} %>
<div id="intro_content_show_<%= user_activity_id %>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div> <div id="intro_content_show_<%= user_activity_id %>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
<div id="intro_content_hide_<%= user_activity_id %>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div> <div id="intro_content_hide_<%= user_activity_id %>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
<div class="cl"></div> <div class="cl"></div>

View File

@ -58,7 +58,8 @@
<%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "assigned"},:remote=>'true', :method => :put, :id=>"issue_query_assign_form_#{activity.id}", :class => 'query_form') do %> <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "assigned"},
:remote=>'true', :method => :put, :id => "issue_query_assign_form_#{activity.id}", :class => 'query_form') do %>
<li> <li>
<p class="label03">&nbsp;指派&nbsp;&nbsp;:&nbsp;</p> <p class="label03">&nbsp;指派&nbsp;&nbsp;:&nbsp;</p>
<span class="pro_info_p" style="width:130px;"> <span class="pro_info_p" style="width:130px;">

View File

@ -1758,6 +1758,7 @@ zh:
label_borad_org_subfield: 资源栏目讨论区 label_borad_org_subfield: 资源栏目讨论区
view_borad_course: 课程讨论 view_borad_course: 课程讨论
label_memo_create_succ: 发布成功 label_memo_create_succ: 发布成功
label_memo_update_succ: 更新成功
label_memo_create_fail: 发布失败 label_memo_create_fail: 发布失败
label_forum_create_succ: 贴吧新建成功 label_forum_create_succ: 贴吧新建成功
label_forum_create_fail: 贴吧新建失败 label_forum_create_fail: 贴吧新建失败

View File

@ -458,6 +458,7 @@ RedmineApp::Application.routes.draw do
post 'create_memo' post 'create_memo'
post 'create_feedback' post 'create_feedback'
post 'mail_feedback' post 'mail_feedback'
post 'update_memo_description'
match 'search_memo', :via => [:get, :post] match 'search_memo', :via => [:get, :post]
match 'delete_forum_tag',:via =>[:get] match 'delete_forum_tag',:via =>[:get]
match 'add_forum_tag',:via=>[:get] match 'add_forum_tag',:via=>[:get]

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -365,6 +365,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
.lh23{line-height: 23px;} .lh23{line-height: 23px;}
/*该高度会写入配置文件*/ /*该高度会写入配置文件*/
.maxh360 {max-height: 810px;} .maxh360 {max-height: 810px;}
.maxh300 { max-height: 300px; }
.lh18 { line-height: 18px;} .lh18 { line-height: 18px;}
/* Font & background Color */ /* Font & background Color */

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: 145px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
.right-line{ border-right:1px solid #ddd;}
.wenba-rightbar-ul{ width: 40px; 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;width: 200px;}
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: 55px; line-height: 55px; text-align: center; color: white; font-weight: bold; background: #3b94d6;font-size: 14px;}
.btn-big-blue:hover{display: block; width: 240px; height: 55px; line-height: 55px; 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} .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;} .postBanner {height:30px; width:970px; border-bottom:1px solid #efefef;}
.postSort {width:40px; float:left; margin-top:5px; padding-left:5px;} .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;} 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;} .postDetailContainer {padding:15px; border:1px solid #dddddd; background-color:#ffffff;}
.postlabel {background-color:#edf1f2; color:#888888; padding:2px 5px; float:left; margin-bottom:5px;} .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;} .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;} .postDetailBanner {height:30px; width:720px; border-bottom:1px solid #efefef;}
.postDetailRow {width:720px; border-bottom:1px solid #efefef; padding:15px 0;} .postDetailRow {width:720px; border-bottom:1px solid #efefef; padding:15px 0;}
.postDetailPortrait {width:50px; height:50px; float:left; margin-right:15px;} .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 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; 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;}

View File

@ -87,6 +87,7 @@ a:hover.pro_new_topbtn_left{background-image: linear-gradient(#ededed, #dddddd);
/* 个人主页左侧信息 */ /* 个人主页左侧信息 */
.user_leftinfo{ width:238px;border:1px solid #e5e5e5; background:#fff url(/images/user/user_bg_info.jpg) 0 0 no-repeat; position:relative; } .user_leftinfo{ width:238px;border:1px solid #e5e5e5; background:#fff url(/images/user/user_bg_info.jpg) 0 0 no-repeat; position:relative; }
.user_leftdata_background{ width:238px;border:1px solid #e5e5e5; background:#fff url(/images/user/user_bg_info2.jpg) 0 0 no-repeat; position:relative; }
a.user_leftinfo_img { display:block; width:80px; height:80px; margin:15px auto;} a.user_leftinfo_img { display:block; width:80px; height:80px; margin:15px auto;}
.user_leftinfo_img img{ width:74px; height:74px;-webkit-border-radius:50px;-moz-border-radius:50px;-o-border-radius:50px;border-radius:50px; border:3px solid #dcdcdc; } .user_leftinfo_img img{ width:74px; height:74px;-webkit-border-radius:50px;-moz-border-radius:50px;-o-border-radius:50px;border-radius:50px; border:3px solid #dcdcdc; }
.user_leftinfo_female{ display:block; width:20px; height:20px;background:url(/images/user/icons_user_leftnav.png) 5px -378px no-repeat; position:absolute; top:80px; left:160px;} .user_leftinfo_female{ display:block; width:20px; height:20px;background:url(/images/user/icons_user_leftnav.png) 5px -378px no-repeat; position:absolute; top:80px; left:160px;}