pub struct EntityHandler<State, CreateForm, UpdateForm, Listing> {
pub navigation_group: String,
pub navigation_title: String,
/* private fields */
}Expand description
This is the main item for presenting your custom entity to the admin-ui. It requires a AdminCreateForm, AdminUpdateForm and AdminListing.
Fields§
Implementations§
Source§impl<S, C, U, L: AdminListing<S>> EntityHandler<S, C, U, L>
impl<S, C, U, L: AdminListing<S>> EntityHandler<S, C, U, L>
Sourcepub fn new(navigation_group: impl ToString) -> Self
pub fn new(navigation_group: impl ToString) -> Self
Examples found in repository?
examples/full-admin.rs (lines 88-93)
67 fn configure_state(&mut self, state: &mut S) -> quokka::Result<()> {
68 let admin: &mut AdminState<_> = state.provide_mut();
69
70 admin.super_admin_group = EXAMPLE_SUPER_USER_GROUP.to_string().into(); // This can be and usually should be set via the config
71 admin.add_auth_provider(TestAuthProvider);
72 admin.add_login_provider(TestLoginProvider);
73
74 admin.add_navigation(
75 AdminNavigationGroup::new("Example").add(
76 NavigationItem::new("example_page", "Example Page").link("/admin/example/page"),
77 ),
78 );
79
80 admin.add_sidebar_widget(AdminSidebarWidget::htmx("/example/admin/test_widget"));
81 admin.add_sidebar_widget(AdminSidebarWidget::htmx("/example/admin/time_widget")); // .hx_trigger("load, every 1s") // This widget should be refreshed, but as it spams the console I leave this comment here so you know that it is possible
82
83 admin.add_dashboard_widget(AdminDashboardWidget::htmx("/example/admin/test_widget"));
84 admin.add_dashboard_widget(AdminDashboardWidget::htmx("/example/admin/test_widget"));
85 admin.add_dashboard_widget(AdminDashboardWidget::htmx("/example/admin/test_widget"));
86 admin.add_dashboard_widget(AdminDashboardWidget::htmx("/example/admin/test_widget"));
87
88 admin.register_entity_handler(EntityHandler::<
89 S,
90 TestEntityCreateForm,
91 TestEntityUpdateForm,
92 TestEntityListing,
93 >::new("Example"));
94
95 Ok(())
96 }Trait Implementations§
Source§impl<State: Clone, CreateForm: Clone, UpdateForm: Clone, Listing: Clone> Clone for EntityHandler<State, CreateForm, UpdateForm, Listing>
impl<State: Clone, CreateForm: Clone, UpdateForm: Clone, Listing: Clone> Clone for EntityHandler<State, CreateForm, UpdateForm, Listing>
Source§fn clone(&self) -> EntityHandler<State, CreateForm, UpdateForm, Listing>
fn clone(&self) -> EntityHandler<State, CreateForm, UpdateForm, Listing>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<State, CreateForm, UpdateForm, Listing> Freeze for EntityHandler<State, CreateForm, UpdateForm, Listing>
impl<State, CreateForm, UpdateForm, Listing> RefUnwindSafe for EntityHandler<State, CreateForm, UpdateForm, Listing>where
State: RefUnwindSafe,
CreateForm: RefUnwindSafe,
UpdateForm: RefUnwindSafe,
Listing: RefUnwindSafe,
impl<State, CreateForm, UpdateForm, Listing> Send for EntityHandler<State, CreateForm, UpdateForm, Listing>
impl<State, CreateForm, UpdateForm, Listing> Sync for EntityHandler<State, CreateForm, UpdateForm, Listing>
impl<State, CreateForm, UpdateForm, Listing> Unpin for EntityHandler<State, CreateForm, UpdateForm, Listing>
impl<State, CreateForm, UpdateForm, Listing> UnsafeUnpin for EntityHandler<State, CreateForm, UpdateForm, Listing>
impl<State, CreateForm, UpdateForm, Listing> UnwindSafe for EntityHandler<State, CreateForm, UpdateForm, Listing>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more