diff --git a/pagetop-megamenu/src/component/item.rs b/pagetop-megamenu/src/component/item.rs index 95de934f..7a4a5236 100644 --- a/pagetop-megamenu/src/component/item.rs +++ b/pagetop-megamenu/src/component/item.rs @@ -81,35 +81,35 @@ impl ComponentTrait for MegaItem { impl MegaItem { pub fn label(label: L10n) -> Self { MegaItem { - item_type: MegaItemType::Label(OneComponent::new_with(label)), + item_type: MegaItemType::Label(Label::with(label)), ..Default::default() } } pub fn link(label: L10n, path: MegaItemPath) -> Self { MegaItem { - item_type: MegaItemType::Link(OneComponent::new_with(label), path), + item_type: MegaItemType::Link(Label::with(label), path), ..Default::default() } } pub fn link_blank(label: L10n, path: MegaItemPath) -> Self { MegaItem { - item_type: MegaItemType::LinkBlank(OneComponent::new_with(label), path), + item_type: MegaItemType::LinkBlank(Label::with(label), path), ..Default::default() } } pub fn html(content: Html) -> Self { MegaItem { - item_type: MegaItemType::Html(OneComponent::new_with(content)), + item_type: MegaItemType::Html(Content::with(content)), ..Default::default() } } pub fn submenu(label: L10n, menu: MegaMenu) -> Self { MegaItem { - item_type: MegaItemType::Submenu(OneComponent::new_with(label), menu), + item_type: MegaItemType::Submenu(Label::with(label), menu), ..Default::default() } } diff --git a/pagetop/src/core/action/all.rs b/pagetop/src/core/action/all.rs index 6273c2e7..4be2afe0 100644 --- a/pagetop/src/core/action/all.rs +++ b/pagetop/src/core/action/all.rs @@ -14,7 +14,7 @@ pub fn add_action(action: Action) { if let Some(list) = actions.get_mut(&action_handle) { list.add(action); } else { - actions.insert(action_handle, ActionsList::new_with(action)); + actions.insert(action_handle, ActionsList::with(action)); } } diff --git a/pagetop/src/core/action/list.rs b/pagetop/src/core/action/list.rs index 99ea1887..3449e103 100644 --- a/pagetop/src/core/action/list.rs +++ b/pagetop/src/core/action/list.rs @@ -18,7 +18,7 @@ impl ActionsList { ActionsList(Arc::new(RwLock::new(Vec::new()))) } - pub fn new_with(action: Action) -> Self { + pub fn with(action: Action) -> Self { let mut list = ActionsList::new(); list.add(action); list diff --git a/pagetop/src/core/component/one.rs b/pagetop/src/core/component/one.rs index 60ff23ef..f0d31ef5 100644 --- a/pagetop/src/core/component/one.rs +++ b/pagetop/src/core/component/one.rs @@ -11,7 +11,7 @@ impl OneComponent { OneComponent::::default() } - pub fn new_with(component: T) -> Self { + pub fn with(component: T) -> Self { OneComponent(Some(Arc::new(RwLock::new(component)))) } diff --git a/pagetop/src/core/component/pack.rs b/pagetop/src/core/component/pack.rs index 16831171..0e95dd2c 100644 --- a/pagetop/src/core/component/pack.rs +++ b/pagetop/src/core/component/pack.rs @@ -47,7 +47,7 @@ impl PackComponents { PackComponents::default() } - pub fn new_with(cref: ComponentRef) -> Self { + pub fn with(cref: ComponentRef) -> Self { let mut pack = PackComponents::new(); pack.alter(PackOp::Add, cref); pack diff --git a/pagetop/src/core/theme/regions.rs b/pagetop/src/core/theme/regions.rs index ba40d975..0e1d7460 100644 --- a/pagetop/src/core/theme/regions.rs +++ b/pagetop/src/core/theme/regions.rs @@ -19,7 +19,7 @@ impl ComponentsRegions { ComponentsRegions::default() } - pub fn new_with(region: &'static str, cref: ComponentRef) -> Self { + pub fn with(region: &'static str, cref: ComponentRef) -> Self { let mut regions = ComponentsRegions::new(); regions.add_in(region, cref); regions @@ -29,7 +29,7 @@ impl ComponentsRegions { if let Some(region) = self.0.get_mut(region) { region.alter(PackOp::Add, cref); } else { - self.0.insert(region, PackComponents::new_with(cref)); + self.0.insert(region, PackComponents::with(cref)); } } @@ -58,7 +58,7 @@ pub fn add_component_in(region: Region, cref: ComponentRef) { if let Some(hm) = regions.get_mut(&theme.handle()) { hm.add_in(region, cref); } else { - regions.insert(theme.handle(), ComponentsRegions::new_with(region, cref)); + regions.insert(theme.handle(), ComponentsRegions::with(region, cref)); } } }