Sha256: 7baae904607bae3b415bd3b64142eb03c75d62a2e353edf49d6a98a9c77195a1

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

Contents

class UnderConstructionEmailStorageController < ApplicationController
  def create
    @email = UnderConstructionEmailStorage.new(params[:under_construction_email_storage])

    respond_to do |format|
      if @email.valid?
        @email.save_to_file
        @notice = I18n.t('controllers.under_construction_email_storage.create.flash.success', default: "Your email added successfully")
        format.html { redirect_to under_construction_index_path,
          notice: I18n.t('controllers.under_construction_email_storage.create.flash.success',
                  default: "Your email added successfully"
          )}
        # TODO: UnderConstruction.config won't update if config file changes
        format.js { render template: "under_construction/#{UnderConstruction.config.theme}/create" }
      else
        @alert = @email.errors.full_messages[0]
        # TODO: UnderConstruction.config won't update if config file changes
        format.html { redirect_to under_construction_index_path, alert: @email.errors.full_messages }
        format.js { render template: "under_construction/#{UnderConstruction.config.theme}/create" }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
under_construction-0.2.2 app/controllers/under_construction_email_storage_controller.rb
under_construction-0.2.1 app/controllers/under_construction_email_storage_controller.rb
under_construction-0.1.4 app/controllers/under_construction_email_storage_controller.rb