Sha256: cc8c2f748a2fe04e1c2d8ff900544e6b3f5d73c3f6af990bfec56c8ccf37c22b

Contents?: true

Size: 751 Bytes

Versions: 2

Compression:

Stored size: 751 Bytes

Contents

module Weeler
  class SeoItemsController < ConfigurationController

    def index
      @translations_in_seo = I18n::Backend::Weeler::Translation.select("key").where("key LIKE ?", "seo.%").order("key")
      @groups = @translations_in_seo.map{ |t| t.key.split(".")[1] }.uniq{ |t| t}
    end

    def edit
      @section = params[:id]
    end

    def update
      params[:translations].each do |translation|
        id, value = translation.first, translation.last
        translation = I18n::Backend::Weeler::Translation.find(id)
        translation.value = value
        translation.save
      end
      Setting.i18n_updated_at = Time.now

      redirect_to({action: :edit, id: params[:id]}, {flash: {success: "Section updated."}})
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
weeler-2.1.0 app/controllers/weeler/seo_items_controller.rb
weeler-2.0.1 app/controllers/weeler/seo_items_controller.rb