Class: Tolk::LocalesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/tolk/locales_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#authenticate, #ensure_no_primary_locale

Instance Method Details

#allObject



26
27
28
# File 'app/controllers/tolk/locales_controller.rb', line 26

def all
  @phrases = @locale.phrases_with_translation(params[:page])
end

#createObject



35
36
37
38
# File 'app/controllers/tolk/locales_controller.rb', line 35

def create
  Tolk::Locale.create!(params[:tolk_locale])
  redirect_to :action => :index
end

#indexObject



6
7
8
# File 'app/controllers/tolk/locales_controller.rb', line 6

def index
  @locales = Tolk::Locale.secondary_locales.sort_by(&:language_name)
end

#showObject



10
11
12
13
14
15
16
17
18
# File 'app/controllers/tolk/locales_controller.rb', line 10

def show
  respond_to do |format|
    format.html do
      @phrases = @locale.phrases_without_translation(params[:page])
    end
    format.atom { @phrases = @locale.phrases_without_translation(params[:page], :per_page => 50) }
    format.yaml { render :text => @locale.to_hash.ya2yaml(:syck_compatible => true) }
  end
end

#updateObject



20
21
22
23
24
# File 'app/controllers/tolk/locales_controller.rb', line 20

def update
  @locale.translations_attributes = params[:translations]
  @locale.save
  redirect_to request.referrer
end

#updatedObject



30
31
32
33
# File 'app/controllers/tolk/locales_controller.rb', line 30

def updated
  @phrases = @locale.phrases_with_updated_translation(params[:page])
  render :all
end