Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New button appears even when it is not supposed to be displayed #777

Open
Tal-Shavit opened this issue Jan 16, 2025 · 1 comment
Open

New button appears even when it is not supposed to be displayed #777

Tal-Shavit opened this issue Jan 16, 2025 · 1 comment

Comments

@Tal-Shavit
Copy link

Describe the bug
The 'New' button appears in the UI even when it is not specified to be displayed, such as when the configuration does not include :new. For example, when configuring all fields with only: [:index, :show] or using except: [:new], the "New" button is still displayed.

To Reproduce
Steps to reproduce the behavior:

  1. Configure fields with only: [:index, :show] or use except: [:new].
  2. Visit index page.
  3. See that the "New" button is still shown despite the configuration.

Expected behavior
The "New" button should not be displayed.

Please complete the following information:
OS: MacOS
Browser Checked on Chrome, Safari, Firefox
Elixir Version 1.17.2
Backpex Version 0.9.1

@clifinger
Copy link

clifinger commented Jan 17, 2025

You can add also ->

# in your live resource

@impl Backpex.LiveResource
def can?(_assigns, :new, _item) do
  false
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants