Sha256: 72cee41162bafae522279f76a839b4142d414da680c2e34d7ad02cd80764a3a8

Contents?: true

Size: 705 Bytes

Versions: 29

Compression:

Stored size: 705 Bytes

Contents

module Hyrax
  class FeaturedWorksController < ApplicationController
    def create
      authorize! :create, FeaturedWork
      @featured_work = FeaturedWork.new(work_id: params[:id])

      respond_to do |format|
        if @featured_work.save
          format.json { render json: @featured_work, status: :created }
        else
          format.json { render json: @featured_work.errors, status: :unprocessable_entity }
        end
      end
    end

    def destroy
      authorize! :destroy, FeaturedWork
      @featured_work = FeaturedWork.find_by(work_id: params[:id])
      @featured_work&.destroy

      respond_to do |format|
        format.json { head :no_content }
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
hyrax-2.9.6 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.9.5 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.9.4 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.9.3 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.9.2 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.9.1 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.9.0 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.8.0 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.7.2 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.7.1 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.7.0 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.6.0 app/controllers/hyrax/featured_works_controller.rb
hyrax-3.0.0.pre.rc1 app/controllers/hyrax/featured_works_controller.rb
hyrax-3.0.0.pre.beta3 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.5.1 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.5.0 app/controllers/hyrax/featured_works_controller.rb
hyrax-3.0.0.pre.beta2 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.4.1 app/controllers/hyrax/featured_works_controller.rb
hyrax-3.0.0.pre.beta1 app/controllers/hyrax/featured_works_controller.rb
hyrax-2.4.0 app/controllers/hyrax/featured_works_controller.rb