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 040c1d8fca47a84f09d96ca3c21caa0a2ed91e05
98
N/A
#
606
N/A
# Displays versions of a ontology
98
N/A
#
98
N/A
class
OntologyVersionsController
<
InheritedResources
::
Base
98
N/A
defaults
:
collection_name
=> :
versions
98
N/A
actions
:
index
, :
show
, :
new
, :
create
98
N/A
belongs_to
:
ontology
98
N/A
98
N/A
before_filter
:
check_changeable
,
only
: [:
new
, :
create
]
98
N/A
98
N/A
def
show
98
N/A
o =
resource.ontology
98
N/A
98
N/A
path
=
resource.raw_file.current
_path
98
N/A
98
N/A
mime
=
o.logic.mimetype
98
N/A
mime
=
'
text
/
plain
'
if
mime.empty
?
98
N/A
98
N/A
name
=
o.name.to_slug.normalize.to
_s
98
N/A
name
=
File.basename
(
path
)
if
name.empty
?
98
N/A
98
N/A
ext
=
o.logic.extension
98
N/A
name
+=
".#{ext}"
unless
ext.empty
?
98
N/A
98
N/A
send_file
path
,
type
:
mime
,
filename
:
name
98
N/A
rescue
Errno
::
ENOENT
,
NoMethodError
98
N/A
redirect_to
collection_path
,
flash
:
{
error
:
'The cake is a lie.'
}
98
N/A
end
98
N/A
720
N/A
def
new
98
N/A
build_resource.source
_uri
=
collection.latest.first.source
_uri
98
N/A
end
98
N/A
493
N/A
def
create
98
N/A
build_resource.user
=
current_user
98
N/A
720
N/A
super
do
|
success
,
failure
|
98
N/A
success.html
{
redirect_to
collection_path
}
98
N/A
end
98
N/A
end
98
N/A
98
N/A
protected
98
N/A
156
N/A
def
check_changeable
493
N/A
unless
parent.changeable
?
493
N/A
redirect_to
collection_path
,
flash
:
{
error
:
'There are pending ontology versions.'
}
98
N/A
end
98
N/A
end
705
N/A
end
705
N/A