Cross Reference: ontology_versions_controller.rb
xref
: /
ontohub
/
app
/
controllers
/
ontology_versions_controller.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
ontology_versions_controller.rb revision a1d2e5afa62b5129f8086d586c70b3f0bee2d998
1516
N/A
#
451
N/A
# Displays versions of a ontology
451
N/A
#
451
N/A
class
OntologyVersionsController
<
InheritedResources
::
Base
451
N/A
defaults
:
collection_name
=> :
versions
, :
finder
=> :
find_by_number
!
451
N/A
actions
:
index
, :
show
, :
new
, :
create
451
N/A
belongs_to
:
ontology
451
N/A
respond_to
:
json
, :
xml
451
N/A
451
N/A
before_filter
:
check_changeable
,
only
: [:
new
, :
create
]
451
N/A
451
N/A
# TODO Needs testing !!!
451
N/A
def
show
451
N/A
file
=
resource.raw
_file
451
N/A
451
N/A
send_file
file.current
_path
,
filename
:
file.identifier
451
N/A
rescue
Errno
::
ENOENT
,
NoMethodError
=> e
451
N/A
redirect_to
collection_path
,
flash
:
{
error
:
"The file was not found: #{
e.message
}"
}
451
N/A
end
451
N/A
451
N/A
def
new
1968
N/A
build_resource.source
_url
=
collection.latest.first.source
_url
1968
N/A
end
3158
N/A
1968
N/A
def
create
451
N/A
build_resource.user
=
current_user
451
N/A
451
N/A
super
do
|
success
,
failure
|
451
N/A
success.html
{
redirect_to
collection_path
}
451
N/A
end
451
N/A
end
451
N/A
451
N/A
protected
1431
N/A
451
N/A
def
check_changeable
451
N/A
unless
parent.changeable
?
2028
N/A
redirect_to
collection_path
,
flash
:
{
error
:
'There are pending ontology versions.'
}
3234
N/A
end
451
N/A
end
451
N/A
end
451
N/A