You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
docuseal/app/controllers/account_logos_controller.rb

33 lines
719 B

# frozen_string_literal: true
class AccountLogosController < ApplicationController
before_action :load_account
authorize_resource :account
def update
file = params[:file]
return redirect_to settings_personalization_path, alert: I18n.t('file_is_missing') if file.blank?
@account.logo.attach(
io: file.open,
filename: file.original_filename,
content_type: file.content_type
)
redirect_to settings_personalization_path, notice: I18n.t('logo_has_been_uploaded')
end
def destroy
@account.logo.purge
redirect_to settings_personalization_path, notice: I18n.t('logo_has_been_uploaded')
end
private
def load_account
@account = current_account
end
end