axioms_controller.rb revision bb90b28cdc65a2e18bda6ae833d16fc0bd48a823
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa#
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa# Lists axioms of an ontology
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa#
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksaclass AxiomsController < InheritedResources::Base
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa belongs_to :ontology
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa actions :index
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa has_pagination
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa respond_to :html, only: %i(index)
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa before_filter :check_read_permissions
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa protected
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa def check_read_permissions
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa authorize! :show, parent.repository
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa end
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa def collection
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa @collection ||=
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa if display_all?
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa axioms =
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa if logically_translated?
a45d3d730a4a0428b96460e0484513fc4219662bEugen Kuksa parent.all_axioms
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa else
bb90b28cdc65a2e18bda6ae833d16fc0bd48a823Eugen Kuksa parent.translated_axioms
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa end
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa Kaminari.paginate_array(axioms).page(params[:page])
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa else
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa super
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa end
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa end
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa def logically_translated?
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa parent.contains_logic_translations?
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa end
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksa helper_method :logically_translated?
9682ce7cd0be309474550ba9d8fb97585d3facc3Eugen Kuksaend