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 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 include Redmine::SafeAttributes
belongs_to :contest belongs_to :contest
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' 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 # fq
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy 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 :notificationcommented, :polymorphic => true, :counter_cache => true
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' 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' safe_attributes 'notificationcomments'
end end

View File

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