Class: Spree::Api::V3::Admin::TranslationsController

Inherits:
ResourceController show all
Defined in:
app/controllers/spree/api/v3/admin/translations_controller.rb

Overview

Read-only translation matrix for any parent in the Spree.translatable_resources registry. Mounted via the :translatable route concern; the parent class is inferred from whichever <segment>_id route param matches a registered translatable resource. One controller serves every model.

Writes go through the batch endpoint (+POST /admin/translations/batch+) — a single atomic surface that also handles multi-record saves (an option type plus all its option values). There is no per-resource write here.

Defined Under Namespace

Classes: ParentLookup

Constant Summary

Constants included from ScopedAuthorization

ScopedAuthorization::READ_ACTIONS

Constants inherited from BaseController

BaseController::RATE_LIMIT_RESPONSE

Constants included from Idempotent

Idempotent::IDEMPOTENCY_HEADER, Idempotent::IDEMPOTENCY_TTL, Idempotent::MAX_KEY_LENGTH, Idempotent::MUTATING_METHODS

Constants included from ErrorHandler

ErrorHandler::ERROR_CODES

Constants included from JwtAuthentication

JwtAuthentication::JWT_AUDIENCE_ADMIN, JwtAuthentication::JWT_AUDIENCE_STORE, JwtAuthentication::JWT_ISSUER, JwtAuthentication::USER_TYPE_ADMIN, JwtAuthentication::USER_TYPE_CUSTOMER

Instance Method Summary collapse

Methods inherited from ResourceController

#create, #destroy, #show, #update

Methods included from Spree::Api::V3::ApiKeyAuthentication

#authenticate_api_key!, #authenticate_secret_key!

Methods included from JwtAuthentication

#authenticate_user, #require_authentication!

Instance Method Details

#indexObject

GET /api/v3/admin//<parent_id>/translations Returns the matrix + discovery fields, with nested translatable children (e.g. an option type's values) so an editor fetches the whole tree in one read.



26
27
28
# File 'app/controllers/spree/api/v3/admin/translations_controller.rb', line 26

def index
  render json: { data: serialize_translations(@parent) }
end