Custom Modal in Create/Edit forms - admin-on-rest

I want to create a custom modal instead of the 'Element is created' at the bottom of the screen. How should I create a custom modal which says 'Element is created' and if it is a failure, mention the error.

You can supply another label using the translations or you can create a custom Admin Layout (use the layout prop) and replace the current Notification component.

Related

Show bootstrap modal on server side validation

I have a ASP.Net Core MVC web application. I have a standard razor view which has a list of items with a delete button. What I want to do is if they user deletes an item from the grid go to the server calling an action which validates the item selected. IF invalid I want to return to the view and show a bootstrap modal explaining why the delete cannot be carried out. I call the delete routine using Controller / Action tag helpers and pass the unique Id to a controller event.
So basically if my delete validation fails show a modal dialog with a message. Any help please?
I ended up sorting this myself. Basically I set a viewbag property and give it a value of show. Then in my script section of my view I set the modal property to that viewbag.

Send action from custom View in NSToolbarItem

I created a Custom View as a Toolbar Item. Creating an action from the Toolbar item now doesn't work (it's not fired). Any ideas?
The action of an NSToolbarItem is only used if you leave the default view in place. Setting a custom view will mean that you need to setup any target/action/callbacks with that custom view instead: e.g. if you set a custom button or segmented control, you should set the target and action on that.

Open Dialog or Modal if AUTH_ERROR (401)

I would like to open a Dialog or Modal if I get a status 401 in AUTH_ERROR. What is the best way to implement this.
Thanks!
You'll have to take the custom app route:
Follow the documentation to bootstrap your custom app.
Add a saga which should take the latest (takeLatest in redux-saga) FETCH_ERROR action. This action has an error property. The saga should then dispatch (put in redux-saga) a custom action which will be used by a reducer you'll add.
This reducer should contain the data required for the modal: at least a boolean determining whether to show it or not.
Finally, update your custom app by adding it a custom redux connected component which will check if it has to show your modal.

Attach or embed node add form with a view

I am using Drupal 7.54. I want to attach or embed a node add form to a view so that when a user submits the form, the view below the form will be updated in realtime via ajax. The form will be shown above the view. My view block name is Statuses Stream.
I tried Form block module and putting the form in the header section of my view using views ui, but after submit, it was redirecting to the node created page.
Then I tried Advanced Form Block module. I created a form using AFB module. The form name is Statuses. It is submitting the form with ajax, but it is not updating the view in the realtime. I have to refresh the page manually to show the created node below the form.
I am open to any solution programmatically or through a module.
Note: For those who know, I am trying to mimic the statuses module. It does exactly what I am looking for. The problem began when I came to know that it is not an entity. So now I am trying to make the same functionality with Content type.
You could use something like Views Refresh to manually update the view below instead of refreshing the page.

How to add custom button to sidebar?

In my case I'm using server-side session (not authClient with token in cookies/local storage). So instead of using default LogoutButton I want to place custom button which will do simple "POST /logout" action. There are some examples in docs how to place custom buttons on resource pages, but nothing about sidebar. Any advices/examples?
A custom Sidebar is a custom Menu:
https://marmelab.com/admin-on-rest/AdminResource.html#menu ?

Resources