增加竞赛删除评论的功能
This commit is contained in:
parent
209c1aeaab
commit
9cb026ed39
|
@ -1,4 +1,7 @@
|
||||||
class NotificationcommentsController < ApplicationController
|
class NotificationcommentsController < ApplicationController
|
||||||
|
def show
|
||||||
|
|
||||||
|
end
|
||||||
# default_search_scope :contestnotifications
|
# default_search_scope :contestnotifications
|
||||||
# model_object Contestnotifications
|
# model_object Contestnotifications
|
||||||
# before_filter :authorize
|
# before_filter :authorize
|
||||||
|
@ -20,8 +23,14 @@ class NotificationcommentsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@contestnotifications.notificaioncomments.find(params[:notificaioncomment_id]).destroy
|
@contest = Contest.find(params[:contest_id])
|
||||||
redirect_to contest_contestnotification_path(@contestnotifications)
|
@contestnotification = Contestnotification.find(params[:contestnotification_id])
|
||||||
|
notificaioncomments = Notificationcomment.find(params[:id])
|
||||||
|
notificaioncomments.destroy if notificaioncomments
|
||||||
|
#@contestnotifications = notificaioncomments.Contestnotification
|
||||||
|
#@contest = @contestnotifications.contest
|
||||||
|
#@contestnotifications.notificaioncomments.find(params[:notificaioncomment_id]).destroy
|
||||||
|
redirect_to contest_contestnotification_path(@contest,@contestnotification)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ class Notificationcomment < ActiveRecord::Base
|
||||||
include Redmine::SafeAttributes
|
include Redmine::SafeAttributes
|
||||||
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'
|
||||||
|
belongs_to :Contestnotification
|
||||||
|
|
||||||
validates_presence_of :notificationcommented, :author, :notificationcomments
|
validates_presence_of :notificationcommented, :author, :notificationcomments
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,21 @@
|
||||||
<td>
|
<td>
|
||||||
<table width="580px" border="0">
|
<table width="580px" border="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" valign="top"><strong><%= link_to_user(notificationcomment.author) if notificationcomment.respond_to?(:author) %> </strong><span class="font_lighter"><%= l(:label_project_newadd) %></span><%= l(:label_comment_plural) %></td>
|
<td colspan="2" valign="top">
|
||||||
|
<strong>
|
||||||
|
<%= link_to_user(notificationcomment.author) if notificationcomment.respond_to?(:author) %>
|
||||||
|
</strong>
|
||||||
|
<span class="font_lighter">
|
||||||
|
<%= l(:label_project_newadd) %>
|
||||||
|
</span>
|
||||||
|
<%= l(:label_comment_plural) %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<% if notificationcomment.author==User.current|| User.current.admin? %>
|
||||||
|
<%= link_to(l(:label_bid_respond_delete), contest_contestnotification_notificationcomment_path(@contest, @contestnotification,notificationcomment),
|
||||||
|
:method => :delete,:confirm => l(:text_are_you_sure), :title => l(:button_delete)) %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" width="580px" >
|
<td colspan="2" width="580px" >
|
||||||
|
|
|
@ -83,6 +83,10 @@ RedmineApp::Application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#resources :notificationcomments do
|
||||||
|
#
|
||||||
|
#end
|
||||||
|
|
||||||
#resources :contestnotifications, :only => [:index, :show, :edit, :update, :destroy]
|
#resources :contestnotifications, :only => [:index, :show, :edit, :update, :destroy]
|
||||||
# match '/contestnotifications/:id/notificationcomments', :to => 'notificationcomments#create', :via => :post
|
# match '/contestnotifications/:id/notificationcomments', :to => 'notificationcomments#create', :via => :post
|
||||||
# match '/contestnotifications/:id/notificationcomments/:notificationcomment_id', :to => 'notificationcomments#destroy', :via => :delete
|
# match '/contestnotifications/:id/notificationcomments/:notificationcomment_id', :to => 'notificationcomments#destroy', :via => :delete
|
||||||
|
@ -91,7 +95,9 @@ RedmineApp::Application.routes.draw do
|
||||||
resources :contests, only: [:index] do
|
resources :contests, only: [:index] do
|
||||||
resources :contestnotifications do
|
resources :contestnotifications do
|
||||||
# get 'preview', on: :collection
|
# get 'preview', on: :collection
|
||||||
resources :notificationcomments
|
resources :notificationcomments do
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
collection do
|
collection do
|
||||||
|
|
Loading…
Reference in New Issue