Class: Manage::LocalesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/manage/locales_controller.rb

Instance Method Summary collapse

Instance Method Details

#editObject



8
9
10
11
12
# File 'app/controllers/manage/locales_controller.rb', line 8

def edit
  @text = Sunrise::YmlLocale.new(@locale).get_data
  
  respond_with @text
end

#updateObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/manage/locales_controller.rb', line 14

def update    
  yml = Sunrise::YmlLocale.new(@locale)
  
  respond_to do |format|
    if !params[:text].blank? && yml.set_data(params[:text])
      I18n.reload!
      
      flash[:notice] = I18n.t('flash.locale.updated')
      
      format.html { redirect_to manage_locales_path }
      format.xml { head :ok }
    else
      flash.now[:error] = I18n.t('flash.locale.update_error')
    	
      format.html { render :action => "edit" }
      format.xml { render :xml => 'error', :status => :unprocessable_entity }
    end
  end 
end