Class: I18nDashboard::TranslationsController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

i18n_dashboard_authenticate, i18n_dashboard_conf

Instance Method Details

#createObject



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/i18n_dashboard/translations_controller.rb', line 12

def create

  Translation.create(params[:key], params[:value], params[:locale])
  respond_to do |format|
    format.js{
      @digest = I18nDashboard::Translation.digest_key(params[:key])
    }
    format.html{
      redirect_to i18n_dashboard_root_path, :notice => "Added translations"
    }
  end

end

#destroyObject



26
27
28
29
30
31
32
33
34
35
# File 'app/controllers/i18n_dashboard/translations_controller.rb', line 26

def destroy
  Translation.destroy(params[:id])
  respond_to do |format|
    format.js
    format.html{
      redirect_to i18n_dashboard_root_path, :notice => "Key deleted"
    }
  end

end

#indexObject



8
9
10
# File 'app/controllers/i18n_dashboard/translations_controller.rb', line 8

def index
   @translations = Translation.all(params[:query])
end