Cross Reference: logics_controller.rb
xref
: /
ontohub
/
app
/
controllers
/
logics_controller.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
logics_controller.rb revision 343370afde088a3dd5e46b98833f01fdd0fb8c2b
5436
N/A
#
5436
N/A
# Controller for Logics
5436
N/A
#
5436
N/A
class
LogicsController
<
InheritedResources
::
Base
5436
N/A
actions
:
index
, :
show
5436
N/A
defaults
finder
: :
find_by_slug
!
5436
N/A
5436
N/A
has_pagination
5436
N/A
has_scope
:
search
5436
N/A
5436
N/A
respond_to
:
html
5436
N/A
respond_to
:
json
,
only
: %i
(
index
show
)
5436
N/A
respond_to
:
xml
, :
rdf
,
only
: %i
(
show
)
5436
N/A
5436
N/A
load_and_authorize_resource
:
except
=> [:
index
, :
show
]
5436
N/A
5436
N/A
def
index
5436
N/A
super
do
|
format
|
5436
N/A
format.html
do
5436
N/A
@
search
=
params
[:
search
]
5436
N/A
@
search
=
nil
if
@
search.blank
?
5436
N/A
end
5436
N/A
end
5436
N/A
end
5436
N/A
5436
N/A
def
show
5436
N/A
@
tab
=
params
[:
tab
].
try
(:
to_sym
)
5436
N/A
super
do
|
format
|
5436
N/A
format.html
do
5680
N/A
@
depth
=
params
[:
depth
] ?
params
[:
depth
].
to_i
:
3
5436
N/A
@
mappings_from
=
resource.mappings
_from
5436
N/A
@
mappings_to
=
resource.mappings
_to
5436
N/A
@
ontologies
=
resource.ontologies
5436
N/A
@
relation_list
||=
RelationList.new
[
resource
, :
supports
],
5436
N/A
:
model
=>
Support
,
5436
N/A
:
collection
=>
resource.supports
,
5436
N/A
:
association
=> :
language
,
5436
N/A
:
scope
=> [
Language
]
5436
N/A
end
5436
N/A
format.xml
do
5436
N/A
render
:
show
,
content_type
:
'
application
/
rdf
+xml'
5436
N/A
end
5436
N/A
format.rdf
do
5436
N/A
render
'
show.xml
'
,
content_type
:
'
application
/
rdf
+xml'
5436
N/A
end
5436
N/A
end
5436
N/A
end
5436
N/A
5436
N/A
protected
5436
N/A
def
collection
5436
N/A
if
all_logics
?
5436
N/A
super
5436
N/A
else
5436
N/A
logics
=
Logic.all.select
{|l| !
l.ontologies.empty
?}
5436
N/A
@
counter
=
logics.size
5436
N/A
collection
=
Kaminari.paginate
_array
(
logics
)
.
page
(
params
[:
page
])
5436
N/A
end
5436
N/A
end
5436
N/A
5436
N/A
def
authorize_parent
5436
N/A
#not needed
5436
N/A
end
5436
N/A
5436
N/A
helper_method
:
all_logics
?
5436
N/A
def
all_logics
?
5436
N/A
params
[:
all
].
present
?
5436
N/A
end
5436
N/A
end
5436
N/A