This commit is contained in:
nwb 2014-07-04 11:11:38 +08:00
commit ff8994fc9d
4 changed files with 15 additions and 8 deletions

View File

@ -51,7 +51,10 @@ class MemosController < ApplicationController
@memo_new = @memo.dup
@memo = @memo.root # 取出楼主防止输入帖子id让回复作为主贴显示
@memo.update_column(:viewed_count, (@memo.viewed_count.to_i + 1))
unless @memo.new_record?
@memo.update_column(:viewed_count, (@memo.viewed_count.to_i + 1))
end
page = params[:page]
if params[:r] && page.nil?
@ -68,10 +71,14 @@ class MemosController < ApplicationController
limit(@reply_pages.per_page).
offset(@reply_pages.offset).
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 { 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 }
end
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.json { render json: @memo.errors, status: :unprocessable_entity }
end
end
end

View File

@ -3,9 +3,9 @@ class Memo < ActiveRecord::Base
belongs_to :forum
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 :content, maximum: 3072
validate :cannot_reply_to_locked_topic, :on => :create

View File

@ -164,7 +164,7 @@ class User < Principal
# Prevents unauthorized assignments
attr_protected :login, :admin, :password, :password_confirmation, :hashed_password
LOGIN_LENGTH_LIMIT = 60
LOGIN_LENGTH_LIMIT = 25
MAIL_LENGTH_LIMIT = 60
validates_presence_of :login, :firstname, :mail, :if => Proc.new { |user| !user.is_a?(AnonymousUser) }

View File

@ -449,7 +449,7 @@ a.attachments_list_color {
font-size: 9pt;
}
.memo_activity span a{
color: gray;
/*color: gray;*/
}
/*帖子的最后回复人*/
.memo_activity .memo_last_person{