Class: Shoppe::ProductCategoryLocalisationsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/shoppe/product_category_localisations_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject


19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/shoppe/product_category_localisations_controller.rb', line 19

def create
  if I18n.available_locales.include? safe_params[:locale].to_sym
    I18n.locale = safe_params[:locale].to_sym

    if @product_category.update(safe_params)
      I18n.locale = I18n.default_locale
      redirect_to [@product_category, :localisations], :flash => { :notice => t("shoppe.localisations.localisation_created") }
    else
      render :action => "edit"
    end
  else
    redirect_to [@product_category, :localisations]
  end
end

#destroyObject


46
47
48
49
# File 'app/controllers/shoppe/product_category_localisations_controller.rb', line 46

def destroy
  @localisation.destroy
  redirect_to [@product_category, :localisations], :notice =>  t('shoppe.localisations.localisation_destroyed')
end

#editObject


34
35
36
# File 'app/controllers/shoppe/product_category_localisations_controller.rb', line 34

def edit
  render :action => "form"
end

#indexObject


10
11
12
# File 'app/controllers/shoppe/product_category_localisations_controller.rb', line 10

def index
  @localisations = @product_category.translations
end

#newObject


14
15
16
17
# File 'app/controllers/shoppe/product_category_localisations_controller.rb', line 14

def new
  @localisation = @product_category.translations.new
  render :action => "form"
end

#updateObject


38
39
40
41
42
43
44
# File 'app/controllers/shoppe/product_category_localisations_controller.rb', line 38

def update
  if @localisation.update(safe_params)
    redirect_to [@product_category, :localisations], :notice => t('shoppe.localisations.localisation_updated')
  else
    render :action => "form"
  end
end