Sha256: 0c1863c2700d23bb1e4f7cb48d9ae055accb4ab16c280114e1bd669d662a88ba

Contents?: true

Size: 1002 Bytes

Versions: 4

Compression:

Stored size: 1002 Bytes

Contents

module Workarea
  module Admin
    module Listrak
      class ConfigurationsController < Admin::ApplicationController
        def edit
          @configuration = ListrakConfigurationViewModel.new(
            Workarea::Listrak.configuration
          )
        end

        def update
          configuration = Workarea::Listrak.configuration
          if configuration.update_attributes(configuration_params)
            redirect_to admin.edit_listrak_configuration_path, flash: { success: t('workarea.admin.listrak_configuration.edit.flash_messages.updated') }
          else
            flash[:error] = t('workarea.admin.listrak_configuration.edit.flash_messages.save_error')
            @configuration = ListrakConfigurationViewModel.new(configuration)
            render :edit, status: :unprocessable_entity
          end
        end

        private

          def configuration_params
            params.permit(:default_list_id, external_event_ids: [])
          end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
workarea-listrak-5.0.4 app/controllers/workarea/admin/listrak/configurations_controller.rb
workarea-listrak-5.0.3 app/controllers/workarea/admin/listrak/configurations_controller.rb
workarea-listrak-5.0.2 app/controllers/workarea/admin/listrak/configurations_controller.rb
workarea-listrak-5.0.1 app/controllers/workarea/admin/listrak/configurations_controller.rb