links_controller.rb revision 08464a6b0d787688a7a3d60e22c7dc9a62e30b71
72ae534f5aef6d2e5d3f2f51299aede5abf9687eJakub Hrozek# Controller for Links
72ae534f5aef6d2e5d3f2f51299aede5abf9687eJakub Hrozekclass LinksController < InheritedResources::Base
72ae534f5aef6d2e5d3f2f51299aede5abf9687eJakub Hrozek load_and_authorize_resource :except => [:index, :show]
72ae534f5aef6d2e5d3f2f51299aede5abf9687eJakub Hrozek @version.source = Ontology.find(params[:link][:source_id]).versions.current
72ae534f5aef6d2e5d3f2f51299aede5abf9687eJakub Hrozek @version.target = Ontology.find(params[:link][:target_id]).versions.current
72ae534f5aef6d2e5d3f2f51299aede5abf9687eJakub Hrozek @version.version_number = @version.version_number + 1
72ae534f5aef6d2e5d3f2f51299aede5abf9687eJakub Hrozek redirect_to edit_link_link_version_path(resource, @version)
72ae534f5aef6d2e5d3f2f51299aede5abf9687eJakub Hrozek @links = Link.where("ontology_id =#{onto} OR source_id = #{onto} OR target_id = #{onto}")
72ae534f5aef6d2e5d3f2f51299aede5abf9687eJakub Hrozek collection = Kaminari.paginate_array(Link.where("ontology_id =#{onto} OR source_id = #{onto} OR target_id = #{onto}").
72ae534f5aef6d2e5d3f2f51299aede5abf9687eJakub Hrozek select { |link| can?(:show, link.source.repository) && can?(:show, link.target.repository) }).page(params[:page])