Cross Reference: categories_controller.rb
xref
: /
ontohub
/
app
/
controllers
/
categories_controller.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
2326cfd02158fb9217ef3bb4419142f144aa3c0b
Sascha Graef
class
CategoriesController
<
InheritedResources
::
Base
a60927fe2101305fea1eeb5312bd2f292d29c2a9
henning mueller
08a490bd597c5ab72fe9938a42961bfa918c468b
henning mueller
respond_to
:
json
17e3eda463c5fe407b4498c996c7fd0474e34e41
henning mueller
belongs_to
:
ontology
,
optional
:
true
2da24154575de5ed5b48287bfc860d372c600c89
Eugen Kuksa
before_filter
:
check_read_permissions
a60927fe2101305fea1eeb5312bd2f292d29c2a9
henning mueller
17e3eda463c5fe407b4498c996c7fd0474e34e41
henning mueller
load_and_authorize_resource
b64bf0b85fad81cd1ac021d2abddd2baecfb2a35
Eugen Kuksa
b64bf0b85fad81cd1ac021d2abddd2baecfb2a35
Eugen Kuksa
def
index
08a490bd597c5ab72fe9938a42961bfa918c468b
henning mueller
unless
params
[:
ontology_id
]
a60927fe2101305fea1eeb5312bd2f292d29c2a9
henning mueller
@
c_vertices
= []
3155e91f5c8bf06d16193eb75df63e78c8d7c062
henning mueller
if
vert
=
Category.first
a60927fe2101305fea1eeb5312bd2f292d29c2a9
henning mueller
@
c_vertices
=
vert.roots.first.children
28c312c686f25fd40963983fa3b725469eac682a
Sascha Graef
end
2326cfd02158fb9217ef3bb4419142f144aa3c0b
Sascha Graef
end
08a490bd597c5ab72fe9938a42961bfa918c468b
henning mueller
08a490bd597c5ab72fe9938a42961bfa918c468b
henning mueller
super
a60927fe2101305fea1eeb5312bd2f292d29c2a9
henning mueller
end
17e3eda463c5fe407b4498c996c7fd0474e34e41
henning mueller
a60927fe2101305fea1eeb5312bd2f292d29c2a9
henning mueller
def
show
a60927fe2101305fea1eeb5312bd2f292d29c2a9
henning mueller
@
category
=
Category.find
(
params
[:
id
])
a60927fe2101305fea1eeb5312bd2f292d29c2a9
henning mueller
@
ontologies
= @
category.related
_ontologies
b64bf0b85fad81cd1ac021d2abddd2baecfb2a35
Eugen Kuksa
end
b64bf0b85fad81cd1ac021d2abddd2baecfb2a35
Eugen Kuksa
2da24154575de5ed5b48287bfc860d372c600c89
Eugen Kuksa
protected
2da24154575de5ed5b48287bfc860d372c600c89
Eugen Kuksa
2da24154575de5ed5b48287bfc860d372c600c89
Eugen Kuksa
def
check_read_permissions
2da24154575de5ed5b48287bfc860d372c600c89
Eugen Kuksa
authorize
! :
show
,
parent.repository
if
parent.is
_a
?
Ontology
2da24154575de5ed5b48287bfc860d372c600c89
Eugen Kuksa
end
2da24154575de5ed5b48287bfc860d372c600c89
Eugen Kuksa
d1f0cb74e8bc61e9185488a431b86816cb1cc7ed
Sascha Graef
end