Sha256: 6bc6c5e621127b177547514f982c8d8bf5f0bbc4c9c0af9ccab6c35a59ab1e1d

Contents?: true

Size: 1.44 KB

Versions: 5

Compression:

Stored size: 1.44 KB

Contents

module Ixtlan
  module Controllers
    module ConfigurationsController

      private

      CONFIGURATION = Object.full_const_get(::Ixtlan::Models::CONFIGURATION)
      LOCALE = Object.full_const_get(::Ixtlan::Models::LOCALE)

      public

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

      # GET /configuration/edit
      def edit
        @configuration = CONFIGURATION.instance
      end

      # PUT /configuration
      # PUT /configuration.xml
      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
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ixtlan-0.4.0.pre4 lib/ixtlan/controllers/configurations_controller.rb
ixtlan-0.4.0.pre3 lib/ixtlan/controllers/configurations_controller.rb
ixtlan-0.4.0.pre2 lib/ixtlan/controllers/configurations_controller.rb
ixtlan-0.4.0.pre lib/ixtlan/controllers/configurations_controller.rb
ixtlan-0.3.0 lib/ixtlan/controllers/configurations_controller.rb