Sha256: 1f0dd241965335576855ce7edb92597367e95c9a4e535e7540ca8697098c4770

Contents?: true

Size: 735 Bytes

Versions: 26

Compression:

Stored size: 735 Bytes

Contents

# frozen_string_literal: true
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

26 entries across 26 versions & 1 rubygems

Version Path
hyrax-5.0.2 app/controllers/hyrax/featured_works_controller.rb
hyrax-5.0.1 app/controllers/hyrax/featured_works_controller.rb
hyrax-5.0.0 app/controllers/hyrax/featured_works_controller.rb
hyrax-5.0.0.rc3 app/controllers/hyrax/featured_works_controller.rb
hyrax-5.0.0.rc2 app/controllers/hyrax/featured_works_controller.rb
hyrax-5.0.0.rc1 app/controllers/hyrax/featured_works_controller.rb
hyrax-3.6.0 app/controllers/hyrax/featured_works_controller.rb
hyrax-4.0.0 app/controllers/hyrax/featured_works_controller.rb
hyrax-4.0.0.rc3 app/controllers/hyrax/featured_works_controller.rb
hyrax-4.0.0.rc2 app/controllers/hyrax/featured_works_controller.rb
hyrax-4.0.0.rc1 app/controllers/hyrax/featured_works_controller.rb
hyrax-3.5.0 app/controllers/hyrax/featured_works_controller.rb
hyrax-4.0.0.beta2 app/controllers/hyrax/featured_works_controller.rb
hyrax-3.4.2 app/controllers/hyrax/featured_works_controller.rb
hyrax-4.0.0.beta1 app/controllers/hyrax/featured_works_controller.rb
hyrax-3.4.1 app/controllers/hyrax/featured_works_controller.rb
hyrax-3.4.0 app/controllers/hyrax/featured_works_controller.rb
hyrax-3.3.0 app/controllers/hyrax/featured_works_controller.rb
hyrax-3.2.0 app/controllers/hyrax/featured_works_controller.rb
hyrax-3.1.0 app/controllers/hyrax/featured_works_controller.rb