app/controllers/itsf/backend/resource/base_controller.rb in itsf_backend-4.2.3 vs app/controllers/itsf/backend/resource/base_controller.rb in itsf_backend-5.0.0.pre
- old
+ new
@@ -1,36 +1,43 @@
-require 'ransack' if Itsf::Backend.features?(:ransack)
-require 'kaminari' if Itsf::Backend.features?(:kaminari)
-
module Itsf::Backend
class Resource::BaseController < Configuration.resource_base_controller.constantize
- if Itsf::Backend.features?(:pundit)
- include Controller::RestActionsConcernWithPundit
- include Pundit
- prepend Controller::PunditNamespacedAuthorizeConcern
- include Controller::PunditAuthorizationFailureHandlingConcern
- helper_method :engine_policy
- else
- include Controller::RestActionsConcern
- end
- include Controller::ResourceUrlsConcern
- include Controller::ResourceInflectionsConcern
- prepend Controller::RansackConcern if Itsf::Backend.features?(:ransack)
- prepend Controller::PaginationConcern if Itsf::Backend.features?(:kaminari)
- include Controller::JsonApiConcern
+ # if Itsf::Backend.features?(:pundit)
+ # include Controller::RestActionsConcernWithPundit
+ # include Pundit
+ # prepend Controller::PunditNamespacedAuthorizeConcern
+ # include Controller::PunditAuthorizationFailureHandlingConcern
+ # helper_method :engine_policy
+ # else
+ # include Controller::RestActionsConcern
+ # end
+ # include Controller::ResourceUrlsConcern
+ # include Controller::ResourceInflectionsConcern
+ # prepend Controller::RansackConcern if Itsf::Backend.features?(:ransack)
+ # prepend Controller::PaginationConcern if Itsf::Backend.features?(:kaminari)
+ # include Controller::JsonApiConcern
include Controller::FeatureFlagsConcern
include Controller::ResourceLinksConcern
include Controller::CollectionLinksConcern
- include Controller::CurrentEngineConcern
+ # include Controller::CurrentEngineConcern
include Controller::BreadcrumbsConcern
helper Itsf::Backend::ApplicationHelper
helper Itsf::Backend::BootstrapHelper
- helper MultiClientHelper if Itsf::Backend.features?(:multi_client)
+ # helper MultiClientHelper if Itsf::Backend.features?(:multi_client)
- helper_method :resource_class
+ # helper_method :resource_class
+ include ResourcesController::Resources
+ include ResourcesController::ResourceInflections
+ include ResourcesController::RestResourceUrls
+ include ResourcesController::RestActions
+ include ResourcesController::LocationHistory
+ include ResourcesController::Kaminari if Itsf::Backend.features?(:kaminari)
+ include ResourcesController::WillPaginate if Itsf::Backend.features?(:will_paginate)
+
helper ResourceRenderer::ViewHelper
+ helper Rails::AddOns::TableHelper
+ helper Twitter::Bootstrap::Components::Rails::V3::ComponentsHelper
layout 'itsf/backend/base'
def self.resource_class
name.gsub('Controller', '').singularize.constantize
@@ -47,15 +54,19 @@
private
def after_create_location
return edit_resource_path(@resource) if params.has_key?(:commit_and_continue_with_edit) && @resource.persisted?
return new_resource_path if params.has_key?(:commit_and_continue_with_new) && @resource.persisted?
- @resource
+ resource_path(@resource)
end
def after_update_location
return edit_resource_path(@resource) if params.has_key?(:commit_and_continue_with_edit) && !@resource.changed?
return new_resource_path if params.has_key?(:commit_and_continue_with_new) && !@resource.changed?
- @resource
+ resource_path(@resource)
+ end
+
+ def after_destroy_location
+ collection_path
end
end
end