Trestle.resource(:<%= plural_name %>, model: <%= model %>, scope: Auth) do menu do group :configuration, priority: :last do item :<%= plural_name %>, icon: "fa fa-users" end end table do column :avatar, header: false do |administrator| avatar_for(administrator) end column :email, link: true column :otp_module, header: 'OTP' <%- unless devise? -%> column :first_name column :last_name <%- end -%> actions do |a| a.delete unless a.instance == current_user end end form do |administrator| sidebar do render 'qr_code' if administrator.persisted? end text_field :email <%- unless devise? -%> row do col(sm: 6) { text_field :first_name } col(sm: 6) { text_field :last_name } end <%- end -%> row do col(sm: 6) { password_field :password } col(sm: 6) { password_field :password_confirmation } end check_box :otp_module, label: 'Enable OTP' end <%- if devise? -%> update_instance do |instance, attrs| if attrs[:password].blank? attrs.delete(:password) attrs.delete(:password_confirmation) if attrs[:password_confirmation].blank? end instance.assign_attributes(attrs) end after_action on: :update do if Devise.sign_in_after_reset_password && instance == current_user login!(instance) end end <%- end -%> end