This commit is contained in:
wanglinchun 2014-06-05 11:19:59 +08:00
parent 8b78929190
commit 982bf17ebc
3 changed files with 5 additions and 5 deletions

View File

@ -1,10 +1,10 @@
class Contestnotification < ActiveRecord::Base
attr_accessible :author_id, :comments_count, :contest_id, :description, :summary, :title
attr_accessible :author_id, :notificationcomments_count, :contest_id, :description, :summary, :title
include Redmine::SafeAttributes
belongs_to :contest
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
has_many :comments, :as => :commented, :dependent => :delete_all, :order => "created_at"
has_many :notificationcomments, :as => :notificationcommented, :dependent => :delete_all, :order => "created_at"
# fq
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy

View File

@ -5,7 +5,7 @@ class Notificationcomments < ActiveRecord::Base
belongs_to :notificationcommented, :polymorphic => true, :counter_cache => true
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
validates_presence_of :notificationcommented, :author, :comments
validates_presence_of :notificationcommented, :author, :notificationcomments
safe_attributes 'notificationcomments'
end

View File

@ -70,12 +70,12 @@
<!--add comment-->
<% if @contestnotifications.notificationcommentable? %>
<p>
<%= toggle_link l(:label_comment_add), "add_notificationcomment_form", :focus => "comment_comments" %>
<%= toggle_link l(:label_comment_add), "add_notificationcomment_form", :focus => "notificationcomment_notificationcomments" %>
</p>
<%= form_tag({:controller => 'notificationcomments', :action => 'create', :id => @contestnotifications}, :id => "add_notificationcomment_form", :style => "display:none;") do %>
<div class="box">
<%= text_area 'notificationcomment', 'notificationcomments', :cols => 80, :rows => 15, :class => 'wiki-edit' %>
<%= wikitoolbar_for 'comment_comments' %>
<%= wikitoolbar_for 'notificationcomment_notificationcomments' %>
</div>
<p>
<%= submit_tag l(:button_add) %>