Sha256: a31bc1574551bf311a228c744305801138587d455d61d53938ce030dc3b723f3

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

module Lit
  class LocalizationsController < ::Lit::ApplicationController
    before_filter :find_localization_key
    before_filter :find_localization

    def edit
      @localization.translated_value = @localization.get_value
      respond_to :js
    end

    def update
      if @localization.update_attributes(clear_params)
        Lit.init.cache.refresh_key @localization.full_key
      end
      @localization.reload
      respond_to :js
    end

    def previous_versions
      @versions = @localization.versions.order('created_at DESC')
      respond_to :js
    end

    private
      def find_localization_key
        @localization_key = Lit::LocalizationKey.find(params[:localization_key_id])
      end

      def find_localization
        @localization = @localization_key.localizations.find(params[:id])
      end

      def clear_params
        if defined?(::ActionController::StrongParameters)
          params.require(:localization).permit(:translated_value, :locale_id)
        else
          params[:localization]
        end
      end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lit-0.2.0 app/controllers/lit/localizations_controller.rb
lit-0.1.0 app/controllers/lit/localizations_controller.rb