Class: Expat::TranslationsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/expat/translations_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



33
34
35
36
37
# File 'app/controllers/expat/translations_controller.rb', line 33

def create
  @translations[params[:key]] = params[:value]
  save_translations
  redirect_to locale_translations_path(@locale)
end

#destroyObject



39
40
41
42
43
# File 'app/controllers/expat/translations_controller.rb', line 39

def destroy
  @translations.delete params[:id]
  save_translations
  redirect_to locale_translations_path(@locale)
end

#editObject



20
21
22
# File 'app/controllers/expat/translations_controller.rb', line 20

def edit
  @translation = @translations[params[:id]]
end

#indexObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/expat/translations_controller.rb', line 7

def index
  @translations = append_missing_translations @locale, @translations
  @translations = @translations.sort do |first, second|
    if first[1].nil?
      -1
    elsif second[1].nil?
      1
    else
      0
    end
  end
end

#newObject



30
31
# File 'app/controllers/expat/translations_controller.rb', line 30

def new
end

#updateObject



24
25
26
27
28
# File 'app/controllers/expat/translations_controller.rb', line 24

def update
  @translations[params[:id]] = params[:value]
  save_translations
  redirect_to locale_translations_path(@locale)
end