mammoth-guitar-49791
01/24/2024, 5:54 PMloud-jewelry-99127
01/24/2024, 5:57 PMlemon-wall-20836
01/24/2024, 6:47 PMmammoth-guitar-49791
01/24/2024, 6:57 PMruby
field :link, as: :text, as_html: true do |model, *args|
link_to model.music_id, "https://www.el-recodo.com/music?id=#{model.music_id}", target: "_blank", rel: "noopener"
end
mammoth-guitar-49791
01/24/2024, 7:49 PMruby
# frozen_string_literal: true
class Avo::Actions::ExportCsv < Avo::BaseAction
self.name = "Export CSV"
self.may_download_file = true
def handle(models:, resource:, fields:, **)
columns = models.first.class.columns_hash.keys
# Uncomment below to use the user-selected fields
# columns = get_columns_from_fields(fields)
return error "No record selected" if models.blank?
file = CSV.generate(headers: true) do |csv|
csv << columns
models.each do |record|
csv << columns.map do |attr|
record.send(attr)
end
end
end
download file, "#{resource.plural_name}.csv"
end
def get_columns_from_fields(fields)
fields.select { |key, value| value }.keys
end
end
https://cdn.discordapp.com/attachments/1039573545828753438/1199803273486540840/image.png?ex=65c3dedf&is=65b169df&hm=a5622f565301f7833cfaa15166424e738a9d9aab7bf71d0b95b97eb7b01bb6a0&mammoth-guitar-49791
01/24/2024, 8:19 PMgentle-leather-98350
01/24/2024, 8:19 PMmammoth-guitar-49791
01/25/2024, 9:37 AMruby
# frozen_string_literal: true
class Avo::Resources::User < Avo::BaseResource
self.includes = [:user_preference]
self.search = {
query: -> { query.search(params[:q]) }
}
self.title = :email
def fields
field :id, as: :id, only_on: :show
field :admin, as: :boolean
field :avatar, as: :file, is_image: true, as_avatar: :rounded
field :email, as: :text, readonly: true
field :webauthn_id, as: :text, only_on: :show
field :action_auth_sessions, as: :has_many
field :action_auth_webauthn_credentials, as: :has_many
field :playlists, as: :has_many
field :tandas, as: :has_many
field :first_name, as: :text
field :last_name, as: :text do
resource.user_preference.last_name
end
field :verified, as: :boolean, readonly: true
field :user_setting, as: :has_one, hide_on: :index
field :user_preference, as: :has_one, hide_on: :index
field :subscription, as: :has_one, hide_on: :index
end
end
lemon-wall-20836
01/25/2024, 9:47 AMmammoth-guitar-49791
01/25/2024, 9:47 AMlemon-wall-20836
01/25/2024, 9:49 AMminiature-optician-85831
02/03/2024, 6:44 PMminiature-optician-85831
02/06/2024, 3:54 PMminiature-optician-85831
02/06/2024, 3:55 PMminiature-optician-85831
02/06/2024, 3:55 PMpurple-park-97233
02/13/2024, 6:51 PMdef versions
self.class.where(original_version_id: original_version_id).reorder(superseded_at: :asc)
end
I'd love a field that I could add for versions
and all the records would show in a table view.miniature-optician-85831
02/14/2024, 7:46 PMable-engine-47078
02/16/2024, 3:55 PMminiature-optician-85831
02/19/2024, 6:25 PMpurple-park-97233
02/25/2024, 7:25 PMstale-greece-65998
03/04/2024, 10:54 AMminiature-optician-85831
03/20/2024, 12:28 PMstale-greece-65998
03/20/2024, 12:35 PMminiature-optician-85831
03/20/2024, 1:08 PMstale-greece-65998
03/20/2024, 1:45 PMstale-greece-65998
03/26/2024, 7:41 AMminiature-optician-85831
03/26/2024, 9:30 PMminiature-optician-85831
04/04/2024, 8:54 AMminiature-optician-85831
04/08/2024, 9:14 AMminiature-optician-85831
04/09/2024, 3:26 PM