ontologies_controller.rb revision acb3db0ee20cd276e305da358a03b30666976db0
89a126810703c666309310d0f3189e9834d70b5bTimo Sirainen#
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# Controller for ontologies
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen#
16f816d3f3c32ae3351834253f52ddd0212bcbf3Timo Sirainenclass OntologiesController < InheritedResources::Base
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen respond_to :json, :xml
58be9d6bcc3800f5b3d76a064ee767fbe31a5a8aTimo Sirainen has_pagination
1098fc409a45e7603701dc94635927a673bee0c1Timo Sirainen has_scope :search
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen load_and_authorize_resource :except => [:index, :show]
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen respond_to :json
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen def index
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen super do |format|
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen format.html do
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen @search = params[:search]
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen @search = nil if @search.blank?
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen end
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen end
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen end
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen def show
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen show! { @grouped_kinds = resource.entities.grouped_by_kind }
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen end
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen def new
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen @ontology_version = build_resource.versions.build
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen end
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen def create
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen @version = build_resource.versions.first
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen @version.user = current_user
fd2f5fbc1f07aa93e2214a28cdf02437fb7d06c8Timo Sirainen super
ad850190d946d34966a56838cfdb216e021b5b5fTimo Sirainen end
ad850190d946d34966a56838cfdb216e021b5b5fTimo Sirainen
ad850190d946d34966a56838cfdb216e021b5b5fTimo Sirainenend
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen