From 1c28edd5d478b44c82dcf206018d95fdf4148f49 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Fri, 6 Jun 2014 16:03:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=AB=9E=E8=B5=9B=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E7=9B=B8=E5=85=B3=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 18 +++++----- .../contestnotifications_controller.rb | 8 ++--- app/controllers/documents_controller.rb | 1 - .../issue_categories_controller.rb | 2 +- app/controllers/members_controller.rb | 2 +- app/controllers/versions_controller.rb | 2 +- app/views/contestnotifications/show.html.erb | 36 ------------------- 7 files changed, 16 insertions(+), 53 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 9eadda027..f05495d21 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -311,15 +311,15 @@ class ApplicationController < ActionController::Base render_404 end - def find_model_object_contest - model = self.class.model_object - if model - @object = model.find(params[:id]) - self.instance_variable_set('@' + controller_name.singularize, @object) if @object - end - rescue ActiveRecord::RecordNotFound - render_404 - end + # def find_model_object_contest + # model = self.class.model_object + # if model + # @object = model.find(params[:id]) + # self.instance_variable_set('@' + controller_name.singularize, @object) if @object + # end + # rescue ActiveRecord::RecordNotFound + # render_404 + # end def self.model_object(model) self.model_object = model diff --git a/app/controllers/contestnotifications_controller.rb b/app/controllers/contestnotifications_controller.rb index ecd509f2b..574ed389b 100644 --- a/app/controllers/contestnotifications_controller.rb +++ b/app/controllers/contestnotifications_controller.rb @@ -3,10 +3,10 @@ class ContestnotificationsController < ApplicationController # GET /contestnotifications.json layout 'base_newcontest' default_search_scope :contestnotifications - # model_object Contestnotifications - # before_filter :find_model_object_contest, :except => [:new, :create, :index] + model_object Contestnotification + before_filter :find_model_object, :except => [:new, :create, :index] before_filter :find_contest_from_association, :except => [:new, :create, :index] - # before_filter :find_contest_by_contest_id, :only => [:new, :create] + before_filter :find_contest_by_contest_id, :only => [:new, :create] before_filter :find_contest before_filter :find_author # before_filter :authorize, :except => [:index] @@ -71,7 +71,7 @@ class ContestnotificationsController < ApplicationController # format.html # show.html.erb # format.json { render json: @contestnotification } # end - @notificationcomments = @contestnotifications.notificationcomments + @notificationcomments = @contestnotification.notificationcomments @notificationcomments.reverse! if User.current.wants_notificationcomments_in_reverse_order? render :layout => 'base_newcontest' diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index 7e21242cc..51486f252 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -21,7 +21,6 @@ class DocumentsController < ApplicationController model_object Document before_filter :find_project_by_project_id, :only => [:index, :new, :create] before_filter :find_model_object, :except => [:index, :new, :create] - before_filter :find_model_object_contest, :except => [:index, :new, :create] before_filter :find_project_from_association, :except => [:index, :new, :create] before_filter :authorize , :except => [:index]#Added by young diff --git a/app/controllers/issue_categories_controller.rb b/app/controllers/issue_categories_controller.rb index f5ba71def..9803eb789 100644 --- a/app/controllers/issue_categories_controller.rb +++ b/app/controllers/issue_categories_controller.rb @@ -19,7 +19,7 @@ class IssueCategoriesController < ApplicationController menu_item :settings model_object IssueCategory before_filter :find_model_object, :except => [:index, :new, :create] - before_filter :find_model_object_contest, :except => [:index, :new, :create] + #before_filter :find_model_object_contest, :except => [:index, :new, :create] before_filter :find_project_from_association, :except => [:index, :new, :create] before_filter :find_project_by_project_id, :only => [:index, :new, :create] before_filter :authorize diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index 29c37c09b..751c2e556 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -17,7 +17,7 @@ class MembersController < ApplicationController model_object Member before_filter :find_model_object, :except => [:index, :create, :autocomplete] - before_filter :find_model_object_contest, :except => [:index, :create, :autocomplete] + #before_filter :find_model_object_contest, :except => [:index, :create, :autocomplete] before_filter :find_project_from_association, :except => [:index, :create, :autocomplete] before_filter :find_project_by_project_id, :only => [:index, :create, :autocomplete] before_filter :authorize diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb index 72cb5301f..0bbbd1bd6 100644 --- a/app/controllers/versions_controller.rb +++ b/app/controllers/versions_controller.rb @@ -20,7 +20,7 @@ class VersionsController < ApplicationController menu_item :roadmap model_object Version before_filter :find_model_object, :except => [:index, :new, :create, :close_completed] - before_filter :find_model_object_contest, :except => [:index, :new, :create] + #before_filter :find_model_object_contest, :except => [:index, :new, :create] before_filter :find_project_from_association, :except => [:index, :new, :create, :close_completed] before_filter :find_project_by_project_id, :only => [:index, :new, :create, :close_completed] before_filter :authorize diff --git a/app/views/contestnotifications/show.html.erb b/app/views/contestnotifications/show.html.erb index ead40aef7..85d81a61d 100644 --- a/app/views/contestnotifications/show.html.erb +++ b/app/views/contestnotifications/show.html.erb @@ -1,40 +1,4 @@ - - -
<%= watcher_link(@contestnotifications, User.current) %> <%= link_to(l(:button_edit),