president
parent
545e5c5941
commit
45e12c4bef
@ -1,35 +1,27 @@
|
|||||||
class NotificationcommentsController < ApplicationController
|
class NotificationcommentsController < ApplicationController
|
||||||
default_search_scope :contestnotifications
|
# default_search_scope :contestnotifications
|
||||||
model_object Contestnotifications
|
# model_object Contestnotifications
|
||||||
before_filter :find_model_object
|
# before_filter :authorize
|
||||||
before_filter :find_contest_from_association
|
|
||||||
before_filter :authorize
|
|
||||||
|
|
||||||
def create
|
def create
|
||||||
#raise Unauthorized unless @contestnotifications.notificationcommentable?
|
#raise Unauthorized unless @contestnotifications.notificationcommentable?
|
||||||
|
@contest = Contest.find(params[:contest_id])
|
||||||
|
@contestnotification = Contestnotification.find(params[:contestnotification_id])
|
||||||
|
|
||||||
@notificationcomment = Notificationcomment.new
|
@notificaioncomment = Notificationcomment.new
|
||||||
@notificationcomment.safe_attributes = params[:notificationcomment]
|
@notificaioncomment.safe_attributes = params[:notificaioncomment]
|
||||||
@notificationcomment.author = User.current
|
@notificaioncomment.author = User.current
|
||||||
if @contestnotifications.notificationcomments << @notificationcomment
|
if @contestnotification.notificationcomments << @notificaioncomment
|
||||||
flash[:notice] = l(:label_comment_added)
|
flash[:notice] = l(:label_comment_added)
|
||||||
end
|
end
|
||||||
|
|
||||||
redirect_to contest_contestnotification_path(@contestnotifications)
|
#redirect_to contest_contestnotification_notificationcomment_path(@contest, @contestnotification, @notificaioncomment)
|
||||||
|
redirect_to contest_contestnotification_path(@contest, @contestnotification)
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@contestnotifications.notificationcomments.find(params[:notificationcomment_id]).destroy
|
@contestnotifications.notificaioncomments.find(params[:notificaioncomment_id]).destroy
|
||||||
redirect_to contest_contestnotification_path(@contestnotifications)
|
redirect_to contest_contestnotification_path(@contestnotifications)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def find_model_object
|
|
||||||
super
|
|
||||||
@contestnotifications = @object
|
|
||||||
@notificationcomment = nil
|
|
||||||
@contestnotifications
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in new issue