♻️ Migra #[builder_fn] a #[builder_impl]
Sustituye las ~400 anotaciones `#[builder_fn]` método a método por un único `#[builder_impl]` por `impl`/`trait`, en 74 ficheros de pagetop y sus extensiones (admin, bootsier, menu, user).
This commit is contained in:
parent
c34dc02357
commit
1be3d88888
74 changed files with 104 additions and 394 deletions
|
|
@ -43,22 +43,20 @@ impl Component for AdminPasswordForm {
|
|||
}
|
||||
}
|
||||
|
||||
#[builder_impl]
|
||||
impl AdminPasswordForm {
|
||||
// **< AdminPasswordForm BUILDER >**************************************************************
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_user_id(mut self, user_id: i32) -> Self {
|
||||
self.user_id = user_id;
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_error(mut self, error: impl Into<Option<Lc>>) -> Self {
|
||||
self.error = error.into();
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_waypoint(mut self, waypoint: impl Into<Waypoint>) -> Self {
|
||||
self.waypoint = waypoint.into();
|
||||
self
|
||||
|
|
|
|||
|
|
@ -98,52 +98,45 @@ impl Component for RoleForm {
|
|||
}
|
||||
}
|
||||
|
||||
#[builder_impl]
|
||||
impl RoleForm {
|
||||
// **< RoleForm BUILDER >***********************************************************************
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_mode(mut self, mode: RoleFormMode) -> Self {
|
||||
self.mode = mode;
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_error(mut self, error: impl Into<Option<Lc>>) -> Self {
|
||||
self.error = error.into();
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_role_id(mut self, role_id: impl Into<Option<i32>>) -> Self {
|
||||
self.role_id = role_id.into();
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_waypoint(mut self, waypoint: impl Into<Waypoint>) -> Self {
|
||||
self.waypoint = waypoint.into();
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_machine_name(mut self, machine_name: impl Into<String>) -> Self {
|
||||
self.machine_name = machine_name.into();
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_label(mut self, label: impl Into<String>) -> Self {
|
||||
self.label = label.into();
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_description(mut self, description: impl Into<String>) -> Self {
|
||||
self.description = description.into();
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_weight(mut self, weight: i32) -> Self {
|
||||
self.weight = weight;
|
||||
self
|
||||
|
|
|
|||
|
|
@ -61,28 +61,25 @@ impl Component for RolePermissionsForm {
|
|||
}
|
||||
}
|
||||
|
||||
#[builder_impl]
|
||||
impl RolePermissionsForm {
|
||||
// **< RolePermissionsForm BUILDER >************************************************************
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_role_id(mut self, role_id: i32) -> Self {
|
||||
self.role_id = role_id;
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_error(mut self, error: impl Into<Option<Lc>>) -> Self {
|
||||
self.error = error.into();
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_groups(mut self, groups: PermissionGroups) -> Self {
|
||||
self.groups = groups;
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_waypoint(mut self, waypoint: impl Into<Waypoint>) -> Self {
|
||||
self.waypoint = waypoint.into();
|
||||
self
|
||||
|
|
|
|||
|
|
@ -128,52 +128,45 @@ impl Component for RoleTable {
|
|||
}
|
||||
}
|
||||
|
||||
#[builder_impl]
|
||||
impl RoleTable {
|
||||
// **< RoleTable BUILDER >**********************************************************************
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_prop(mut self, op: PropsOp) -> Self {
|
||||
self.props.alter_prop(op);
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_items(mut self, items: Vec<RoleListItem>) -> Self {
|
||||
self.items = items;
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_message(mut self, message: impl Into<Option<Lc>>) -> Self {
|
||||
self.message = message.into();
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_sort(mut self, sort: RoleSortField) -> Self {
|
||||
self.sort = sort;
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_dir(mut self, dir: SortDir) -> Self {
|
||||
self.dir = dir;
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_page(mut self, page: u64) -> Self {
|
||||
self.page = page;
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_per_page(mut self, per_page: u64) -> Self {
|
||||
self.per_page = per_page;
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_total(mut self, total: u64) -> Self {
|
||||
self.total = total;
|
||||
self
|
||||
|
|
|
|||
|
|
@ -121,76 +121,65 @@ impl Component for UserForm {
|
|||
}
|
||||
}
|
||||
|
||||
#[builder_impl]
|
||||
impl UserForm {
|
||||
// **< UserForm BUILDER >***********************************************************************
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_mode(mut self, mode: UserFormMode) -> Self {
|
||||
self.mode = mode;
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_error(mut self, error: impl Into<Option<Lc>>) -> Self {
|
||||
self.error = error.into();
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_user_id(mut self, user_id: impl Into<Option<i32>>) -> Self {
|
||||
self.user_id = user_id.into();
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_waypoint(mut self, waypoint: impl Into<Waypoint>) -> Self {
|
||||
self.waypoint = waypoint.into();
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_username(mut self, username: impl Into<String>) -> Self {
|
||||
self.username = username.into();
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_email(mut self, email: impl Into<String>) -> Self {
|
||||
self.email = email.into();
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_display_name(mut self, display_name: impl Into<String>) -> Self {
|
||||
self.display_name = display_name.into();
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_language(mut self, language: impl Into<String>) -> Self {
|
||||
self.language = language.into();
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_timezone(mut self, timezone: impl Into<String>) -> Self {
|
||||
self.timezone = timezone.into();
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_roles(mut self, roles: Vec<(i32, String, bool)>) -> Self {
|
||||
self.roles = roles;
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_allow_admin_field(mut self, allow_admin_field: bool) -> Self {
|
||||
self.allow_admin_field = allow_admin_field;
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_is_admin(mut self, is_admin: bool) -> Self {
|
||||
self.is_admin = is_admin;
|
||||
self
|
||||
|
|
|
|||
|
|
@ -43,28 +43,25 @@ impl Component for UserRolesForm {
|
|||
}
|
||||
}
|
||||
|
||||
#[builder_impl]
|
||||
impl UserRolesForm {
|
||||
// **< UserRolesForm BUILDER >******************************************************************
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_user_id(mut self, user_id: i32) -> Self {
|
||||
self.user_id = user_id;
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_error(mut self, error: impl Into<Option<Lc>>) -> Self {
|
||||
self.error = error.into();
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_roles(mut self, roles: Vec<(i32, String, bool)>) -> Self {
|
||||
self.roles = roles;
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_waypoint(mut self, waypoint: impl Into<Waypoint>) -> Self {
|
||||
self.waypoint = waypoint.into();
|
||||
self
|
||||
|
|
|
|||
|
|
@ -100,52 +100,45 @@ impl Component for UserTable {
|
|||
}
|
||||
}
|
||||
|
||||
#[builder_impl]
|
||||
impl UserTable {
|
||||
// **< UserTable BUILDER >**********************************************************************
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_prop(mut self, op: PropsOp) -> Self {
|
||||
self.props.alter_prop(op);
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_items(mut self, items: Vec<UserListItem>) -> Self {
|
||||
self.items = items;
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_sort(mut self, sort: UserSortField) -> Self {
|
||||
self.sort = sort;
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_dir(mut self, dir: SortDir) -> Self {
|
||||
self.dir = dir;
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_query(mut self, query: impl Into<Option<String>>) -> Self {
|
||||
self.query = query.into();
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_page(mut self, page: u64) -> Self {
|
||||
self.page = page;
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_per_page(mut self, per_page: u64) -> Self {
|
||||
self.per_page = per_page;
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_total(mut self, total: u64) -> Self {
|
||||
self.total = total;
|
||||
self
|
||||
|
|
|
|||
|
|
@ -97,14 +97,13 @@ fn links(allow_registration: bool) -> Html {
|
|||
})
|
||||
}
|
||||
|
||||
#[builder_impl]
|
||||
impl LoginForm {
|
||||
#[builder_fn]
|
||||
pub fn with_error(mut self, error: impl Into<Option<Lc>>) -> Self {
|
||||
self.error = error.into();
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
pub fn with_waypoint(mut self, waypoint: impl Into<Waypoint>) -> Self {
|
||||
self.waypoint = waypoint.into();
|
||||
self
|
||||
|
|
|
|||
|
|
@ -48,18 +48,17 @@ impl Component for PasswordConfirm {
|
|||
}
|
||||
}
|
||||
|
||||
#[builder_impl]
|
||||
impl PasswordConfirm {
|
||||
// **< PasswordConfirm BUILDER >********************************************************************
|
||||
|
||||
/// Establece la etiqueta del campo de contraseña (por defecto, "field-password").
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_password_label(mut self, label: Lc) -> Self {
|
||||
self.password_label = label;
|
||||
self
|
||||
}
|
||||
|
||||
/// Establece la etiqueta del campo de confirmación (por defecto, "field-confirm-password").
|
||||
#[builder_fn]
|
||||
pub(crate) fn with_confirm_label(mut self, label: Lc) -> Self {
|
||||
self.confirm_label = label;
|
||||
self
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ impl Component for PasswordResetConfirmForm {
|
|||
}
|
||||
}
|
||||
|
||||
#[builder_impl]
|
||||
impl PasswordResetConfirmForm {
|
||||
#[builder_fn]
|
||||
pub fn with_error(mut self, error: impl Into<Option<Lc>>) -> Self {
|
||||
self.error = error.into();
|
||||
self
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ fn back_to_login() -> Html {
|
|||
})
|
||||
}
|
||||
|
||||
#[builder_impl]
|
||||
impl PasswordResetForm {
|
||||
#[builder_fn]
|
||||
pub fn with_error(mut self, error: impl Into<Option<Lc>>) -> Self {
|
||||
self.error = error.into();
|
||||
self
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@ impl Component for RegisterForm {
|
|||
}
|
||||
}
|
||||
|
||||
#[builder_impl]
|
||||
impl RegisterForm {
|
||||
#[builder_fn]
|
||||
pub fn with_error(mut self, error: impl Into<Option<Lc>>) -> Self {
|
||||
self.error = error.into();
|
||||
self
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue