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 068c4812bb4a75942b62c2124ca1875525b3ac5c
172
N/A
#
172
N/A
# Displays versions of a ontology
172
N/A
#
172
N/A
class
OntologyVersionsController
<
InheritedResources
::
Base
172
N/A
defaults
:
collection_name
=> :
versions
172
N/A
actions
:
index
, :
show
, :
new
, :
create
172
N/A
belongs_to
:
ontology
172
N/A
respond_to
:
json
, :
xml
172
N/A
172
N/A
before_filter
:
check_changeable
,
only
: [:
new
, :
create
]
172
N/A
172
N/A
def
show
172
N/A
mime
=
'
text
/
plain
'
172
N/A
mime
=
'
application
/
rdf
+xml'
if
resource.ontology.logic.name
==
'OWL'
172
N/A
send_file
resource.raw_file.current
_path
,
type
:
mime
172
N/A
rescue
Errno
::
ENOENT
,
NoMethodError
172
N/A
redirect_to
collection_path
,
flash
:
{
error
:
'The cake is a lie.'
}
172
N/A
end
172
N/A
172
N/A
def
new
172
N/A
build_resource.source
_uri
=
collection.latest.first.source
_uri
3573
N/A
end
172
N/A
172
N/A
def
create
172
N/A
build_resource.user
=
current_user
172
N/A
172
N/A
super
do
|
success
,
failure
|
172
N/A
success.html
{
redirect_to
collection_path
}
3573
N/A
end
172
N/A
end
172
N/A
172
N/A
protected
172
N/A
172
N/A
def
check_changeable
172
N/A
unless
parent.changeable
?
redirect_to
collection_path
,
flash
:
{
error
:
'There are pending ontology versions.'
}
end
end
end