Cross Reference: repository_directories_controller.rb
xref
: /
ontohub
/
app
/
controllers
/
repository_directories_controller.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
repository_directories_controller.rb revision f62238647d38b53bfd4f1a2fabc77e26cbf3a1e4
class
RepositoryDirectoriesController
<
InheritedResources
::
Base
defaults
resource_class
:
RepositoryDirectory
actions
:
new
, :
create
helper_method
:
repository
before_filter
:
check_write_permissions
,
only
: [:
new
, :
create
]
before_filter
:
check_read_permissions
def
new
resource
end
def
create
if
resource.valid
?
resource.save
flash
[:
success
] =
"Successfully created the subdirectory."
redirect_to
fancy_repository_path
(
repository
,
path
:
resource.target
_path
)
else
render
:
new
end
end
protected
def
resource
@
repository_directory
||=
RepositoryDirectory.new
(
params.merge
(
user
:
current_user
)
)
end
def
repository
@
repository
||=
resource.repository
end
def
check_read_permissions
authorize
! :
show
,
repository
end
def
check_write_permissions
authorize
! :
write
,
repository
end
end