8c2318e267
* Add JSON response format to entropy endpoints Add account settings JSON endpoint returning account info including auto_postpone_period. Add auto_postpone_period to board JSON responses. Add JSON update support to both account and board entropy controllers. * Add auto_postpone_period to all board response examples in API docs * Use auto_postpone_period_in_days in JSON responses and API docs * Use valid period values in permission tests
32 lines
676 B
Ruby
32 lines
676 B
Ruby
class Account::SettingsController < ApplicationController
|
|
wrap_parameters :account, include: %i[ name ]
|
|
|
|
before_action :ensure_admin, only: :update
|
|
before_action :set_account
|
|
|
|
def show
|
|
respond_to do |format|
|
|
format.html { @users = @account.users.active.alphabetically.includes(:identity) }
|
|
format.json
|
|
end
|
|
end
|
|
|
|
def update
|
|
@account.update!(account_params)
|
|
|
|
respond_to do |format|
|
|
format.html { redirect_to account_settings_path }
|
|
format.json { head :no_content }
|
|
end
|
|
end
|
|
|
|
private
|
|
def set_account
|
|
@account = Current.account
|
|
end
|
|
|
|
def account_params
|
|
params.expect account: %i[ name ]
|
|
end
|
|
end
|