Sha256: dc6c11d2203ae0391fe650200863b71c14804d12f9a7da623cb6dc70a2993921
Contents?: true
Size: 1.31 KB
Versions: 11
Compression:
Stored size: 1.31 KB
Contents
module Locomotive class TranslationsController < BaseController account_required & within_site before_action :load_translation, only: [:edit, :update] helper_method :translation_nav_params def index authorize Translation @translations = service.all(params.slice(:page, :per_page, :q, :filter_by)) respond_with @translations end def edit authorize @translation respond_with @translation end def update authorize @translation service.update(@translation, translation_params[:values].to_h) respond_with @translation, location: translations_path(current_site, translation_nav_params) end def bulk_destroy authorize Translation, :destroy? service.bulk_destroy(params[:ids].split(',')) respond_with current_site, location: translations_path(current_site, translation_nav_params) end protected def load_translation @translation = current_site.translations.find(params[:id]) end def translation_params params.require(:translation).permit(values: current_site.locales) end def translation_nav_params params.permit(:filter_by, :q, :page, :per_page) end def service @service ||= Locomotive::TranslationService.new(current_site, current_locomotive_account) end end end
Version data entries
11 entries across 11 versions & 1 rubygems