修正发帖不填主题报错问题,修正发帖内容为空可成功发布bug、修改主页贴吧动态里回帖数字颜色、修改昵称字符为不超过25个
This commit is contained in:
parent
050a780b50
commit
2dd249a105
|
@ -51,7 +51,10 @@ class MemosController < ApplicationController
|
||||||
|
|
||||||
@memo_new = @memo.dup
|
@memo_new = @memo.dup
|
||||||
@memo = @memo.root # 取出楼主,防止输入帖子id让回复作为主贴显示
|
@memo = @memo.root # 取出楼主,防止输入帖子id让回复作为主贴显示
|
||||||
|
unless @memo.new_record?
|
||||||
@memo.update_column(:viewed_count, (@memo.viewed_count.to_i + 1))
|
@memo.update_column(:viewed_count, (@memo.viewed_count.to_i + 1))
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
page = params[:page]
|
page = params[:page]
|
||||||
if params[:r] && page.nil?
|
if params[:r] && page.nil?
|
||||||
|
@ -68,11 +71,15 @@ class MemosController < ApplicationController
|
||||||
limit(@reply_pages.per_page).
|
limit(@reply_pages.per_page).
|
||||||
offset(@reply_pages.offset).
|
offset(@reply_pages.offset).
|
||||||
all
|
all
|
||||||
|
if @memo.new_record?
|
||||||
|
format.html { redirect_to back_url, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" }
|
||||||
|
else
|
||||||
format.html { render action: :show }#, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" }
|
format.html { render action: :show }#, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" }
|
||||||
# format.html { redirect_to back_memo_or_forum_url}#, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" }
|
# format.html { redirect_to back_memo_or_forum_url}#, error: "#{l :label_memo_create_fail}: #{@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
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@ class Memo < ActiveRecord::Base
|
||||||
belongs_to :forum
|
belongs_to :forum
|
||||||
belongs_to :author, :class_name => "User", :foreign_key => 'author_id'
|
belongs_to :author, :class_name => "User", :foreign_key => 'author_id'
|
||||||
|
|
||||||
validates_presence_of :author_id, :forum_id, :subject
|
validates_presence_of :author_id, :forum_id, :subject,:content
|
||||||
# 若是主题帖,则内容可以是空
|
# 若是主题帖,则内容可以是空
|
||||||
validates :content, presence: true, if: Proc.new{|o| !o.parent_id.nil? }
|
#validates :content, presence: true, if: Proc.new{|o| !o.parent_id.nil? }
|
||||||
validates_length_of :subject, maximum: 50
|
validates_length_of :subject, maximum: 50
|
||||||
validates_length_of :content, maximum: 3072
|
validates_length_of :content, maximum: 3072
|
||||||
validate :cannot_reply_to_locked_topic, :on => :create
|
validate :cannot_reply_to_locked_topic, :on => :create
|
||||||
|
|
|
@ -164,7 +164,7 @@ class User < Principal
|
||||||
# Prevents unauthorized assignments
|
# Prevents unauthorized assignments
|
||||||
attr_protected :login, :admin, :password, :password_confirmation, :hashed_password
|
attr_protected :login, :admin, :password, :password_confirmation, :hashed_password
|
||||||
|
|
||||||
LOGIN_LENGTH_LIMIT = 60
|
LOGIN_LENGTH_LIMIT = 25
|
||||||
MAIL_LENGTH_LIMIT = 60
|
MAIL_LENGTH_LIMIT = 60
|
||||||
|
|
||||||
validates_presence_of :login, :firstname, :mail, :if => Proc.new { |user| !user.is_a?(AnonymousUser) }
|
validates_presence_of :login, :firstname, :mail, :if => Proc.new { |user| !user.is_a?(AnonymousUser) }
|
||||||
|
|
|
@ -449,7 +449,7 @@ a.attachments_list_color {
|
||||||
font-size: 9pt;
|
font-size: 9pt;
|
||||||
}
|
}
|
||||||
.memo_activity span a{
|
.memo_activity span a{
|
||||||
color: gray;
|
/*color: gray;*/
|
||||||
}
|
}
|
||||||
/*帖子的最后回复人*/
|
/*帖子的最后回复人*/
|
||||||
.memo_activity .memo_last_person{
|
.memo_activity .memo_last_person{
|
||||||
|
|
Loading…
Reference in New Issue