https://avo.cool logo
Join Discord
Powered by
# avo-2
  • a

    adventurous-crayon-9274

    05/10/2023, 6:26 PM
    Hi everyone, I'm new here. Trying to customize trix editor and add additional header levels (h2 and h3). Has anyone done this?
    l
    • 2
    • 9
  • e

    early-knife-34520

    05/11/2023, 3:27 PM
    I have TestResource with
    field :records, as: :has_many
    . So, in TestResource
    :show
    I can see index of
    records
    . I also have RecordResource with custom standalone action. If i'm calling this action from TestResource
    :show
    , I can only get instance of RecordResource without any associations. But I want to access model instance of TestResource. Is it possible?
    l
    • 2
    • 18
  • m

    microscopic-dream-82397

    05/12/2023, 11:18 AM
    Hey guys. Is there a way to automatically apply the default filters when loading the index page?
  • w

    wide-art-99889

    05/12/2023, 1:57 PM
    I have a question about using
    bin/rails generate avo:eject
    . I read the code and the rake task accepts a symbol for a specific list of templates, or a string for pretty much any template. I ejected a specific template, but when I make changes to that template I don't see them on my local rails app. Is there another step I need to take to get my ejected template to take precedence?
    l
    • 2
    • 16
  • r

    rough-library-77794

    05/12/2023, 4:50 PM
    Hi Guys, Do you know why after upload a audio file works well, but some minutes later the audio is not available any more. Avo demo: https://main.avodemo.com/avo/resources/posts/55
  • r

    rough-library-77794

    05/12/2023, 4:56 PM
    For some reasons the S3 block the content
  • g

    green-london-56146

    05/12/2023, 4:57 PM
    I clicked play on the demo link and did hear the audio
  • g

    green-london-56146

    05/12/2023, 4:58 PM
    Copy code
    https://avodemo.s3.amazonaws.com/hua0j3dw469ob0ogj8yyn8cf5g1s?response-content-disposition=attachment%3B%20filename%3D%22even-track.mp3%22%3B%20filename%2A%3DUTF-8%27%27even-track.mp3&response-content-type=audio%2Fmpeg&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAQ2I55O4GW5456AGH%2F20230512%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230512T165808Z&X-Amz-Expires=300&X-Amz-SignedHeaders=host&X-Amz-Signature=25efbd19823963181e9c7a13a0d7bbc409dcdc629d38a48c6e4ea64f28ca3b11
  • g

    green-london-56146

    05/12/2023, 4:58 PM
    does this presign url work for you?
  • g

    green-london-56146

    05/12/2023, 5:00 PM
    possible the s3 link expires in Amz-Expires=300 seconds but refreshing the page would generate a new such link
  • g

    green-london-56146

    05/12/2023, 5:02 PM
    I havn't worked with active storage in a long time, but it appears to be configurable, if that is what causes the issue https://blog.saeloun.com/2021/09/14/rails-7-adds-expiring-urls-to-active-storage/
  • r

    rough-library-77794

    05/12/2023, 5:04 PM
    Yes, that URL works
  • r

    rough-library-77794

    05/12/2023, 5:04 PM
    Let me see, thanks @green-london-56146
  • r

    rough-library-77794

    05/12/2023, 6:04 PM
    @green-london-56146 The configuration
    config.active_storage.service_urls_expire_in = 1.hours or 10.hours
    in
    config/environments/development.rb
    file works well. But after that time the content(audio) will not be available for the user in the Avo admin, why this issue is not happening with image content in Avo demo? πŸ€”
  • g

    green-london-56146

    05/12/2023, 6:06 PM
    not sure maybe images get cached better at the browser level where the audio when you press play again or scrub to a different place need to make new network requests but that is me guessing
  • r

    rough-library-77794

    05/12/2023, 6:09 PM
    There is a option to use CDN url ? something like :external_image option ?
    l
    • 2
    • 13
  • f

    fancy-crowd-87619

    05/12/2023, 10:16 PM
    I have a resource called NonprofitRequest (users can request nonprofits missing from our system). In the admin, I'd like to have an action AcceptNonprofitRequest, which accepts a request by creating a Nonprofit with the requested values (name, location, website, etc). Ideally, in the AcceptNonprofitRequest action, the admin user will be able to modify the requested values before submitting though. Essentially, I'd like to be able to have the
    default
    value of the action fields use the values from the NonprofitRequest model. Like this:
    Copy code
    ruby
    class AcceptNonprofitRequest < Avo::BaseAction
      field :name, as: :text, default: ->(model) { model.name }
    end
    As far as I can tell the above is not possible. Anyone have any other ideas on how I can enable this behavior on an action? Maybe I need to use something besides actions for this?
    l
    • 2
    • 15
  • m

    microscopic-dream-82397

    05/15/2023, 11:20 AM
    Hey guys. Is there a way to automatically apply the default filters when loading the index page?
    l
    • 2
    • 3
  • b

    billowy-easter-81499

    05/16/2023, 2:17 PM
    Has anyone else had issues with Required Fields not working properly? Specifically, fields I am able to Save/Submit forms even if fields I mark as Required are left blank... (I will create a Github issue in the meantime)
  • c

    curved-father-82134

    05/17/2023, 3:31 PM
    @billowy-easter-81499 If you using Rails with AVO. you can add validation to the model side this is a much better approach instead of adding Required: true inside the AVO Resource. because any user can break your form validation from the Developer Tool.
  • l

    lemon-wall-20836

    05/17/2023, 3:34 PM
    that's correct. The
    required
    option is just a cosmethic one
  • l

    lemon-wall-20836

    05/17/2023, 3:34 PM
    it does not add the validation rule. I'm updating the docs as we speak
  • l

    lemon-wall-20836

    05/17/2023, 3:34 PM
    it was always like that
  • b

    billowy-easter-81499

    05/17/2023, 3:44 PM
    Got it thanks!
  • b

    billowy-easter-81499

    05/17/2023, 3:45 PM
    understood thanks πŸ‘
  • c

    creamy-ghost-62907

    05/21/2023, 10:06 PM
    I am having some difficulties with
    redirect_to
    in an action. Specifically, if I have an action like this:
    Copy code
    class SomeAction < Avo::BaseAction
      self.name    = "Some Action"
      self.visible = -> { view == :show }
    
      def handle(**args)
        models, = args.values_at(:models)
    
        unless models&.length == 1
          error("You must do the thing to exactly one thing at a time.")
          return
        end
    
        model_id = models.first.id
        target   = view_context.resources_some_model_path(model_id)
    
        redirect_to(main_app.something_path(target:, model_id:))
      end
    end
    The redirect is happening behind the scenes (I.E. entirely within the context of the Ajax request), entirely within the context of the Ajax request.
    something_path
    is a route that doesn't render a view, but instead redirects the user to a different site. I'm wondering if this is a corner-case involving Turbo? It doesn't happen with a route generated by Avo...
  • c

    creamy-ghost-62907

    05/21/2023, 10:07 PM
    Aha! Yes. If I make the target action render something instead of redirecting, then things behave fine. So the issue here is an interaction with Turbo. Is there a graceful solution to this?
    l
    • 2
    • 2
  • w

    wide-art-99889

    05/23/2023, 4:36 PM
    Good morning! I am having an unusual problem with a tailwind class in an overridden component. I recently created a couple of custom Avo components in my project, and in one of the component html.erb files I am using a tailwind class
    lg:max-h-[500px]
    to constrain the height of an element. This works fine in my local development environment, but when I deploy to a heroku app the height constraint is not applied (I can see the tailwind class in the markup). I have tried the following steps to get it to work: 1. I added
    ./app/components/**/*.rb
    and
    ./app/components/**/*.html.erb
    to the
    content
    section of my
    tailwind.config.js
    file. 2. I added a
    safelist
    section to the same file with an entry for
    lg:max-h-[500px]
    Neither of these steps appears to fix the problem. Do I also need to run
    bin/rails avo:build-assets
    as part of my heroku deploy process to get this to work?
    l
    • 2
    • 123
  • c

    curved-father-82134

    05/23/2023, 4:46 PM
    Hey @channel @lemon-wall-20836, I'm having an issue while displaying two resource tools inside the parent resource. Basically, I want to retrieve the params of both has_many resources, namely 'collection_products' and 'collection_conditions,' in the controller. However, I'm only receiving the params of the first tool in the controller. Here is an example: `with_options show_on: [:edit, :new], hide_on: [:index, :show] do tool CollectionProducts tool CollectionProducts end So, the params of 'CollectionProducts' are available in the controller. But if I move 'CollectionProducts' from the top to the bottom, I receive the params of 'CollectionConditions' in the controller, which is not correct. It mean I'm only retrieving first resource tool params in the controller, either it's CollectionProducts or CollectionProducts. I want to have the params of both resource tools in the controller.
    l
    • 2
    • 3
  • c

    calm-gold-48525

    05/23/2023, 10:16 PM
    Hey, all. I'm evaluating Avo for a larger production application with a high volume of records. In this case, I would like to be able to show nested resources in the traditional rails nested resource routing: Ie. /avo/resources/companies/123/employees. Is this something I can do in Avo?
    l
    • 2
    • 72
1...585960...64Latest