annoying bug with InheritedResources, engine and custom actions
This commit is contained in:
parent
486f86f366
commit
6096d18689
@ -2,7 +2,7 @@ module Admin
|
|||||||
class BaseController < InheritedResources::Base
|
class BaseController < InheritedResources::Base
|
||||||
|
|
||||||
include Locomotive::Routing::SiteDispatcher
|
include Locomotive::Routing::SiteDispatcher
|
||||||
|
|
||||||
layout 'admin/application'
|
layout 'admin/application'
|
||||||
|
|
||||||
before_filter :authenticate_admin!
|
before_filter :authenticate_admin!
|
||||||
|
1
doc/TODO
1
doc/TODO
@ -3,6 +3,7 @@ BOARD:
|
|||||||
- refactor slugify method (use parameterize + create a module)
|
- refactor slugify method (use parameterize + create a module)
|
||||||
- send email when new content added thru api
|
- send email when new content added thru api
|
||||||
- publish event when saving form in ajax (for instance, in order to update account name or site name)
|
- publish event when saving form in ajax (for instance, in order to update account name or site name)
|
||||||
|
- switch to list (theme assets / assets ?). delete all in once (with checkbox) or see details (updated_at, size, ...etc)
|
||||||
|
|
||||||
BACKLOG:
|
BACKLOG:
|
||||||
|
|
||||||
|
@ -11,9 +11,6 @@ require 'locomotive/inherited_resources'
|
|||||||
require 'locomotive/admin_responder'
|
require 'locomotive/admin_responder'
|
||||||
|
|
||||||
require 'redcloth'
|
require 'redcloth'
|
||||||
require 'inherited_resources'
|
|
||||||
require 'inherited_resources/responder'
|
|
||||||
require 'inherited_resources/actions' # required otherwise actions won't be included in Admin base controller
|
|
||||||
require 'mongo_session_store/mongoid'
|
require 'mongo_session_store/mongoid'
|
||||||
|
|
||||||
module Locomotive
|
module Locomotive
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
|
require 'inherited_resources'
|
||||||
|
require 'inherited_resources/actions'
|
||||||
|
require 'inherited_resources/responder'
|
||||||
|
|
||||||
module InheritedResources
|
module InheritedResources
|
||||||
# redirect to edit_resource_url instead of resource_url
|
# redirect to edit_resource_url instead of resource_url
|
||||||
module Actions
|
module Actions
|
||||||
|
|
||||||
def create(options={}, &block)
|
def create(options={}, &block)
|
||||||
object = build_resource
|
object = build_resource
|
||||||
|
|
||||||
@ -24,19 +28,19 @@ module InheritedResources
|
|||||||
respond_with_dual_blocks(object, options, &block)
|
respond_with_dual_blocks(object, options, &block)
|
||||||
end
|
end
|
||||||
alias :update! :update
|
alias :update! :update
|
||||||
|
|
||||||
# DELETE /resources/1
|
# DELETE /resources/1
|
||||||
def destroy(options={}, &block)
|
def destroy(options={}, &block)
|
||||||
object = resource
|
object = resource
|
||||||
options[:location] ||= collection_url rescue nil
|
options[:location] ||= collection_url rescue nil
|
||||||
|
|
||||||
destroy_resource(object)
|
destroy_resource(object)
|
||||||
|
|
||||||
options[:alert] = object.errors.full_messages.first # display the first error if present
|
options[:alert] = object.errors.full_messages.first # display the first error if present
|
||||||
|
|
||||||
respond_with_dual_blocks(object, options, &block)
|
respond_with_dual_blocks(object, options, &block)
|
||||||
end
|
end
|
||||||
alias :destroy! :destroy
|
alias :destroy! :destroy
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Reference in New Issue
Block a user