This commit is contained in:
wanglinchun 2014-06-07 09:22:13 +08:00
parent 7f5fa8b9b8
commit 545e5c5941
2 changed files with 11 additions and 11 deletions

View File

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

View File

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