Class: Weeler::SeoItemsController

Inherits:
ConfigurationController show all
Defined in:
app/controllers/weeler/seo_items_controller.rb

Instance Method Summary collapse

Instance Method Details

#editObject



9
10
11
# File 'app/controllers/weeler/seo_items_controller.rb', line 9

def edit
  @section = params[:id]
end

#indexObject



4
5
6
7
# File 'app/controllers/weeler/seo_items_controller.rb', line 4

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

#updateObject



13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/weeler/seo_items_controller.rb', line 13

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