president
wanglinchun 11 years ago
parent 7f5fa8b9b8
commit 545e5c5941

@ -6,12 +6,12 @@ class NotificationcommentsController < ApplicationController
before_filter :authorize before_filter :authorize
def create def create
raise Unauthorized unless @contestnotifications.notificationcommentable? #raise Unauthorized unless @contestnotifications.notificationcommentable?
@notificaioncomment = Notificaioncomment.new @notificationcomment = Notificationcomment.new
@notificaioncomment.safe_attributes = params[:notificaioncomment] @notificationcomment.safe_attributes = params[:notificationcomment]
@notificaioncomment.author = User.current @notificationcomment.author = User.current
if @contestnotifications.notificaioncomments << @notificaioncomment if @contestnotifications.notificationcomments << @notificationcomment
flash[:notice] = l(:label_comment_added) flash[:notice] = l(:label_comment_added)
end end
@ -19,7 +19,7 @@ class NotificationcommentsController < ApplicationController
end end
def destroy def destroy
@contestnotifications.notificaioncomments.find(params[:notificaioncomment_id]).destroy @contestnotifications.notificationcomments.find(params[:notificationcomment_id]).destroy
redirect_to contest_contestnotification_path(@contestnotifications) redirect_to contest_contestnotification_path(@contestnotifications)
end end
@ -28,7 +28,7 @@ class NotificationcommentsController < ApplicationController
def find_model_object def find_model_object
super super
@contestnotifications = @object @contestnotifications = @object
@notificaioncomment = nil @notificationcomment = nil
@contestnotifications @contestnotifications
end end

@ -29,10 +29,10 @@
<div style="margin:15px"> <div style="margin:15px">
<span class="font_description"> <%= textilizable(@contestnotification, :description) %> </span> <span class="font_description"> <%= textilizable(@contestnotification, :description) %> </span>
<br/> <br/>
<%#= link_to_attachments @contestnotification %>
<br/> <br/>
<!--add comment--> <!--add comment-->
<% if @contestnotification.notificationcommentable? %>
<p> <p>
<%= toggle_link l(:label_comment_add), "add_notificationcomment_form", :focus => "notificationcomment_notificationcomments" %> <%= toggle_link l(:label_comment_add), "add_notificationcomment_form", :focus => "notificationcomment_notificationcomments" %>
</p> </p>
@ -45,7 +45,7 @@
<%= submit_tag l(:button_add) %> <%= submit_tag l(:button_add) %>
</p> </p>
<% end %> <% end %>
<% end %>
<% html_title @contestnotification.title -%> <% html_title @contestnotification.title -%>
@ -57,7 +57,7 @@
<div class="line_heng"></div> <div class="line_heng"></div>
</div> </div>
<h3 class="notificationcomments"><%= l(:label_comment_plural) %></h3> <h3 class="notificationcomments"><%= l(:label_comment_plural) %></h3>
<% notificationcomments = @contestnotification.notificationcomments.reverse %> <% notificationcomments = @notificationcomments.reverse %>
<% notificationcomments.each do |notificationcomment| %> <% notificationcomments.each do |notificationcomment| %>
<% next if notificationcomment.new_record? %> <% next if notificationcomment.new_record? %>
<table width="660px" border="0" align="center"> <table width="660px" border="0" align="center">

Loading…
Cancel
Save