parent should not always cast same case (in case of folder switching to project list or similar)
instead now calls via proxy and returns the resulting resource from that Note: Gemfile (althought changed previous commit) contains a github tag, which can cause some installation problems - may integrate into plugin (not elegant, but fixes issue), as dev plugin passes aspects of litmus that release doesn't Todo: Integrate permission model into functionality
This commit is contained in:
parent
9ae871be66
commit
4e044384ce
@ -49,6 +49,11 @@ module RedmineDmsf
|
|||||||
@__proxy.child(name)
|
@__proxy.child(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def parent
|
||||||
|
p = @__proxy.parent
|
||||||
|
return p.resource.nil? ? p : p.resource
|
||||||
|
end
|
||||||
|
|
||||||
#Override index_page from DAV4Rack::Resource
|
#Override index_page from DAV4Rack::Resource
|
||||||
def index_page
|
def index_page
|
||||||
return <<-PAGE
|
return <<-PAGE
|
||||||
|
|||||||
@ -15,9 +15,9 @@ module RedmineDmsf
|
|||||||
# Our already quite heavy usage of DB would just get silly every time we called
|
# Our already quite heavy usage of DB would just get silly every time we called
|
||||||
# this method.
|
# this method.
|
||||||
def children
|
def children
|
||||||
MethodNotAllowed unless collection?
|
|
||||||
return @children unless @children.nil?
|
return @children unless @children.nil?
|
||||||
@children = []
|
@children = []
|
||||||
|
return [] unless collection?
|
||||||
folder.subfolders.map do |p|
|
folder.subfolders.map do |p|
|
||||||
@children.push child(p.title, p)
|
@children.push child(p.title, p)
|
||||||
end
|
end
|
||||||
@ -42,6 +42,7 @@ module RedmineDmsf
|
|||||||
# Todo: Move folder data retrieval into folder function, and use folder method to determine existence
|
# Todo: Move folder data retrieval into folder function, and use folder method to determine existence
|
||||||
def folder
|
def folder
|
||||||
return @folder unless @folder == false
|
return @folder unless @folder == false
|
||||||
|
return nil if project.nil? || project.id.nil? #if the project doesnt exist, this entity can't exist
|
||||||
@folder = nil
|
@folder = nil
|
||||||
# Note: Folder is searched for as a generic search to prevent SQL queries being generated:
|
# Note: Folder is searched for as a generic search to prevent SQL queries being generated:
|
||||||
# if we were to look within parent, we'd have to go all the way up the chain as part of the
|
# if we were to look within parent, we'd have to go all the way up the chain as part of the
|
||||||
@ -71,6 +72,7 @@ module RedmineDmsf
|
|||||||
# Todo: Move file data retrieval into folder function, and use file method to determine existence
|
# Todo: Move file data retrieval into folder function, and use file method to determine existence
|
||||||
def file
|
def file
|
||||||
return @file unless @file == false
|
return @file unless @file == false
|
||||||
|
return nil if project.nil? || project.id.nil? #Again if entity project is nil, it cannot exist in context of this object
|
||||||
@file = nil
|
@file = nil
|
||||||
|
|
||||||
# Hunt for files parent path
|
# Hunt for files parent path
|
||||||
@ -165,6 +167,7 @@ module RedmineDmsf
|
|||||||
#
|
#
|
||||||
# Create a DmsfFolder at location requested, only if parent is a folder (or root)
|
# Create a DmsfFolder at location requested, only if parent is a folder (or root)
|
||||||
def make_collection
|
def make_collection
|
||||||
|
debugger
|
||||||
if (request.body.read.to_s == '')
|
if (request.body.read.to_s == '')
|
||||||
return MethodNotAllowed if exist? #If we already exist, why waste the time trying to save?
|
return MethodNotAllowed if exist? #If we already exist, why waste the time trying to save?
|
||||||
parent_folder = nil
|
parent_folder = nil
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user