Module: Ixtlan::Controllers::ConfigurationsController

Defined in:
lib/ixtlan/controllers/configurations_controller.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
# File 'lib/ixtlan/controllers/configurations_controller.rb', line 5

def self.included(base)
  base.cache_headers :protected
end

Instance Method Details

#editObject

GET /configuration/edit



27
28
29
# File 'lib/ixtlan/controllers/configurations_controller.rb', line 27

def edit
  @configuration = CONFIGURATION.instance
end

#showObject

GET /configuration GET /configuration.xml



18
19
20
21
22
23
24
# File 'lib/ixtlan/controllers/configurations_controller.rb', line 18

def show
  @configuration = CONFIGURATION.instance
  respond_to do |format|
    format.html # show.html.erb
    format.xml  { render :xml => @configuration }
  end
end

#updateObject

PUT /configuration PUT /configuration.xml



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/ixtlan/controllers/configurations_controller.rb', line 33

def update
  @configuration = CONFIGURATION.instance
  @configuration.current_user = current_user

  locales = params[:configuration].delete(:locales)
  @configuration.update_children(locales, :locales)
  @configuration.attributes = params[:configuration]

  respond_to do |format|
    if @configuration.save() or not @configuration.dirty?
      flash[:notice] = 'Configuration was successfully updated.'
      format.html { redirect_to(configuration_url) }
      format.xml  { render :xml => @configuration }
    else
      format.html { render :action => "edit" }
      format.xml  { render :xml => @configuration.errors, :status => :unprocessable_entity }
    end
  end
end