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
23 lines
620 B
Ruby
23 lines
620 B
Ruby
class Account::EntropiesController < ApplicationController
|
|
wrap_parameters :entropy, include: [ :auto_postpone_period_in_days ]
|
|
|
|
before_action :ensure_admin
|
|
|
|
def update
|
|
@account = Current.account
|
|
@account.entropy.update!(entropy_params)
|
|
|
|
respond_to do |format|
|
|
format.html { redirect_to account_settings_path, notice: "Account updated" }
|
|
format.json { render "account/settings/show", status: :ok }
|
|
end
|
|
rescue ActiveRecord::RecordInvalid
|
|
head :unprocessable_entity
|
|
end
|
|
|
|
private
|
|
def entropy_params
|
|
params.expect(entropy: [ :auto_postpone_period_in_days ])
|
|
end
|
|
end
|