diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index a01d5c75f..d06344c0a 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -389,10 +389,6 @@ class ApplicationController < ActionController::Base render_404 end - def self.model_object(model) - self.model_object = model - end - # Find the issue whose id is the :id parameter # Raises a Unauthorized exception if the issue is not visible def find_issue diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 4043db08b..d04b5ed8d 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -18,8 +18,9 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class CommentsController < ApplicationController + self.model_object = News + default_search_scope :news - model_object News before_action :find_model_object before_action :find_project_from_association before_action :authorize diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index bd6c3f461..4e2c255d5 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -18,8 +18,9 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class DocumentsController < ApplicationController + self.model_object = Document + default_search_scope :documents - model_object Document before_action :find_project_by_project_id, :only => [:index, :new, :create] before_action :find_model_object, :except => [:index, :new, :create] before_action :find_project_from_association, :except => [:index, :new, :create] diff --git a/app/controllers/issue_categories_controller.rb b/app/controllers/issue_categories_controller.rb index 6148fe663..b184d0ac1 100644 --- a/app/controllers/issue_categories_controller.rb +++ b/app/controllers/issue_categories_controller.rb @@ -18,8 +18,9 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class IssueCategoriesController < ApplicationController + self.model_object = IssueCategory + menu_item :settings - model_object IssueCategory before_action :find_model_object, :except => [:index, :new, :create] before_action :find_project_from_association, :except => [:index, :new, :create] before_action :find_project_by_project_id, :only => [:index, :new, :create] diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index 3f7b376c6..db2a2be7b 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -18,7 +18,8 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class MembersController < ApplicationController - model_object Member + self.model_object = Member + before_action :find_model_object, :except => [:index, :new, :create, :autocomplete] before_action :find_project_from_association, :except => [:index, :new, :create, :autocomplete] before_action :find_project_by_project_id, :only => [:index, :new, :create, :autocomplete] diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index dd6bade24..57e0ff28d 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -18,8 +18,9 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class NewsController < ApplicationController + self.model_object = News + default_search_scope :news - model_object News before_action :find_model_object, :except => [:new, :create, :index] before_action :find_project_from_association, :except => [:new, :create, :index] before_action :find_project_by_project_id, :only => :create diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb index 328d3e56e..bdc909d25 100644 --- a/app/controllers/versions_controller.rb +++ b/app/controllers/versions_controller.rb @@ -18,8 +18,9 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class VersionsController < ApplicationController + self.model_object = Version + menu_item :roadmap - model_object Version before_action :find_model_object, :except => [:index, :new, :create, :close_completed] before_action :find_project_from_association, :except => [:index, :new, :create, :close_completed] before_action :find_project_by_project_id, :only => [:index, :new, :create, :close_completed]