Cross Reference: ontologies_controller.rb
xref
: /
ontohub
/
app
/
controllers
/
ontologies_controller.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
ontologies_controller.rb revision 8d0fb4fb93788e195e8fc2a48b243b3e53e6bd45
52
N/A
#
52
N/A
# Controller for ontologies
292
N/A
#
52
N/A
class
OntologiesController
<
InheritedResources
::
Base
52
N/A
292
N/A
respond_to
:
json
, :
xml
52
N/A
has_pagination
52
N/A
has_scope
:
search
52
N/A
52
N/A
load_and_authorize_resource
:
except
=> [:
index
, :
show
]
292
N/A
292
N/A
respond_to
:
json
292
N/A
292
N/A
def
index
52
N/A
super
do
|
format
|
52
N/A
format.html
do
52
N/A
@
search
=
params
[:
search
]
292
N/A
@
search
=
nil
if
@
search.blank
?
292
N/A
end
292
N/A
end
292
N/A
end
292
N/A
292
N/A
def
new
292
N/A
@
ontology_version
=
build_resource.versions.build
292
N/A
@
categories
=
Category.first.subtree.arrange.first.second
292
N/A
end
292
N/A
292
N/A
def
create
52
N/A
@
version
=
build_resource.versions.first
52
N/A
@
version.user
=
current_user
52
N/A
super
52
N/A
end
52
N/A
52
N/A
def
show
52
N/A
respond_to
do
|
format
|
52
N/A
format.html
do
52
N/A
redirect_to
ontology_entities_path
(
resource
, :
kind
=>
resource.entities.groups_by_kind.first.kind
)
52
N/A
end
52
N/A
format.json
do
52
N/A
respond_with
resource
292
N/A
end
52
N/A
end
52
N/A
end
6
N/A
6
N/A
protected
6
N/A
6
N/A
def
build_resource
6
N/A
return
@
ontology
if
@
ontology
15
N/A
6
N/A
type
=
(
params
[:
ontology
] || {})
.
delete
(:
type
)
6
N/A
clazz
=
type
==
'DistributedOntology'
?
DistributedOntology
:
SingleOntology
201
N/A
@
ontology
=
clazz.new
params
[:
ontology
]
6
N/A
end
15
N/A
302
N/A
end
6
N/A