app/controllers/spotlight/pages_controller.rb in blacklight-spotlight-3.1.0 vs app/controllers/spotlight/pages_controller.rb in blacklight-spotlight-3.2.0
- old
+ new
@@ -1,13 +1,10 @@
# frozen_string_literal: true
module Spotlight
##
# Base CRUD controller for pages
- # rubocop:disable Metrics/ClassLength
- # Disableing class length because this is a base
- # controller that gives other controllers their behavior
class PagesController < Spotlight::ApplicationController
before_action :authenticate_user!, except: [:show]
before_action :load_locale_specific_page, only: %i[destroy edit show update]
load_and_authorize_resource :exhibit, class: Spotlight::Exhibit
load_and_authorize_resource through: :exhibit, instance_name: 'page', only: [:index]
@@ -30,11 +27,11 @@
# set up a model the inline "add a new page" form
@page = CanCan::ControllerResource.new(self).send(:build_resource)
respond_to do |format|
format.html
- format.json { render json: @pages.for_locale.published.to_json(methods: [:thumbnail_image_url]) }
+ format.json { render json: @pages.for_default_locale.published.to_json(methods: [:thumbnail_image_url]) }
end
end
# GET /pages/1
def show
@@ -206,7 +203,6 @@
else
raise ActiveRecord::RecordNotFound
end
end
end
- # rubocop:enable Metrics/ClassLength
end