2326cfd02158fb9217ef3bb4419142f144aa3c0bSascha Graefclass CategoriesController < InheritedResources::Base
a60927fe2101305fea1eeb5312bd2f292d29c2a9henning mueller
08a490bd597c5ab72fe9938a42961bfa918c468bhenning mueller respond_to :json
17e3eda463c5fe407b4498c996c7fd0474e34e41henning mueller belongs_to :ontology, optional: true
2da24154575de5ed5b48287bfc860d372c600c89Eugen Kuksa before_filter :check_read_permissions
a60927fe2101305fea1eeb5312bd2f292d29c2a9henning mueller
17e3eda463c5fe407b4498c996c7fd0474e34e41henning mueller load_and_authorize_resource
b64bf0b85fad81cd1ac021d2abddd2baecfb2a35Eugen Kuksa
b64bf0b85fad81cd1ac021d2abddd2baecfb2a35Eugen Kuksa def index
08a490bd597c5ab72fe9938a42961bfa918c468bhenning mueller unless params[:ontology_id]
a60927fe2101305fea1eeb5312bd2f292d29c2a9henning mueller @c_vertices = []
3155e91f5c8bf06d16193eb75df63e78c8d7c062henning mueller if vert = Category.first
a60927fe2101305fea1eeb5312bd2f292d29c2a9henning mueller @c_vertices = vert.roots.first.children
28c312c686f25fd40963983fa3b725469eac682aSascha Graef end
2326cfd02158fb9217ef3bb4419142f144aa3c0bSascha Graef end
08a490bd597c5ab72fe9938a42961bfa918c468bhenning mueller
08a490bd597c5ab72fe9938a42961bfa918c468bhenning mueller super
a60927fe2101305fea1eeb5312bd2f292d29c2a9henning mueller end
17e3eda463c5fe407b4498c996c7fd0474e34e41henning mueller
a60927fe2101305fea1eeb5312bd2f292d29c2a9henning mueller def show
a60927fe2101305fea1eeb5312bd2f292d29c2a9henning mueller @category = Category.find(params[:id])
a60927fe2101305fea1eeb5312bd2f292d29c2a9henning mueller @ontologies = @category.related_ontologies
b64bf0b85fad81cd1ac021d2abddd2baecfb2a35Eugen Kuksa end
b64bf0b85fad81cd1ac021d2abddd2baecfb2a35Eugen Kuksa
2da24154575de5ed5b48287bfc860d372c600c89Eugen Kuksa protected
2da24154575de5ed5b48287bfc860d372c600c89Eugen Kuksa
2da24154575de5ed5b48287bfc860d372c600c89Eugen Kuksa def check_read_permissions
2da24154575de5ed5b48287bfc860d372c600c89Eugen Kuksa authorize! :show, parent.repository if parent.is_a? Ontology
2da24154575de5ed5b48287bfc860d372c600c89Eugen Kuksa end
2da24154575de5ed5b48287bfc860d372c600c89Eugen Kuksa
d1f0cb74e8bc61e9185488a431b86816cb1cc7edSascha Graefend