Sha256: c30cdda2942ce65b6e49d1e41916818f129fcbb668c97aa87a20631f22b8634a

Contents?: true

Size: 975 Bytes

Versions: 23

Compression:

Stored size: 975 Bytes

Contents

module Locomotive
  class TranslationsController < BaseController

    account_required & within_site

    before_filter :load_translation, only: [:edit, :update]

    def index
      authorize ThemeAsset
      @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])
      respond_with @translation, location: translations_path(current_site, params[:_location])
    end

    private

    def load_translation
      @translation = current_site.translations.find(params[:id])
    end

    def translation_params
      params.require(:translation).permit(values: current_site.locales)
    end

    def service
      @service ||= Locomotive::TranslationService.new(current_site, current_locomotive_account)
    end

  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
locomotivecms-3.3.0.rc3 app/controllers/locomotive/translations_controller.rb
locomotivecms-3.3.0.rc2 app/controllers/locomotive/translations_controller.rb
locomotivecms-3.1.2 app/controllers/locomotive/translations_controller.rb
locomotivecms-3.2.1 app/controllers/locomotive/translations_controller.rb
locomotivecms-3.3.0.rc1 app/controllers/locomotive/translations_controller.rb
locomotivecms-3.2.0 app/controllers/locomotive/translations_controller.rb
locomotivecms-3.2.0.rc2 app/controllers/locomotive/translations_controller.rb
locomotivecms-3.2.0.rc1 app/controllers/locomotive/translations_controller.rb
locomotivecms-3.1.1 app/controllers/locomotive/translations_controller.rb
locomotivecms-3.1.0 app/controllers/locomotive/translations_controller.rb
locomotivecms-3.1.0.rc3 app/controllers/locomotive/translations_controller.rb
locomotivecms-3.1.0.rc2 app/controllers/locomotive/translations_controller.rb
locomotivecms-3.1.0.rc1 app/controllers/locomotive/translations_controller.rb
locomotivecms-3.0.1 app/controllers/locomotive/translations_controller.rb
locomotivecms-3.0.0 app/controllers/locomotive/translations_controller.rb
locomotivecms-3.0.0.rc7 app/controllers/locomotive/translations_controller.rb
locomotivecms-3.0.0.rc6 app/controllers/locomotive/translations_controller.rb
locomotivecms-3.0.0.rc5 app/controllers/locomotive/translations_controller.rb
locomotivecms-3.0.0.rc4 app/controllers/locomotive/translations_controller.rb
locomotivecms-3.0.0.rc3 app/controllers/locomotive/translations_controller.rb