Compare commits
2 commits
9afe75bc8f
...
f990311222
Author | SHA1 | Date | |
---|---|---|---|
f990311222 | |||
f97b0b6f1e |
7 changed files with 42 additions and 49 deletions
17
src/asset.rs
17
src/asset.rs
|
@ -52,15 +52,12 @@ pub trait AssetRoutes {
|
||||||
|
|
||||||
impl AssetRoutes for rocket::Rocket<Build> {
|
impl AssetRoutes for rocket::Rocket<Build> {
|
||||||
fn mount_assets(self) -> Self {
|
fn mount_assets(self) -> Self {
|
||||||
self.mount(
|
self.mount("/", routes![
|
||||||
"/",
|
crate::asset::htmx_script_route,
|
||||||
routes![
|
crate::asset::flowbite_css,
|
||||||
crate::asset::htmx_script_route,
|
crate::asset::flowbite_js,
|
||||||
crate::asset::flowbite_css,
|
crate::asset::material_css,
|
||||||
crate::asset::flowbite_js,
|
crate::asset::material_font
|
||||||
crate::asset::material_css,
|
])
|
||||||
crate::asset::material_font
|
|
||||||
],
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,7 @@ pub mod ui;
|
||||||
|
|
||||||
// Postgres
|
// Postgres
|
||||||
|
|
||||||
// TODO : Background Jobs
|
|
||||||
// TODO : Refactor caching
|
// TODO : Refactor caching
|
||||||
// TODO : mail
|
|
||||||
// TODO : scheduled jobs
|
|
||||||
|
|
||||||
// TODO : IDEA
|
// TODO : IDEA
|
||||||
// more efficient table join using WHERE ANY instead of multiple SELECTs
|
// more efficient table join using WHERE ANY instead of multiple SELECTs
|
||||||
|
|
|
@ -12,6 +12,7 @@ use crate::gen_random;
|
||||||
pub struct DataResponse {
|
pub struct DataResponse {
|
||||||
data: Vec<u8>,
|
data: Vec<u8>,
|
||||||
content_type: String,
|
content_type: String,
|
||||||
|
// TODO : Implement better cache control
|
||||||
cache_duration: Option<u64>,
|
cache_duration: Option<u64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ pub mod prelude {
|
||||||
Alignment, BottomNavigation, BottomNavigationTile, Classic, ClassicWidget, FetchToast,
|
Alignment, BottomNavigation, BottomNavigationTile, Classic, ClassicWidget, FetchToast,
|
||||||
NavBar, Position, Shell, Toast,
|
NavBar, Position, Shell, Toast,
|
||||||
};
|
};
|
||||||
pub use super::timeline::{ActivityLog, ActivityLogElement, Timeline, TimelineElement};
|
|
||||||
pub use super::{
|
pub use super::{
|
||||||
Accordion, Alert, Banner, Breadcrumb, Card, Carousel, CarouselMode, ColoredAlert,
|
Accordion, Alert, Banner, Breadcrumb, Card, Carousel, CarouselMode, ColoredAlert,
|
||||||
ColoredSpinner, CopyText, FetchAlert, FnKey, HelpIcon, HorizontalLine, IconStepper,
|
ColoredSpinner, CopyText, FetchAlert, FnKey, HelpIcon, HorizontalLine, IconStepper,
|
||||||
|
|
|
@ -26,16 +26,14 @@ pub fn Modal<T: UIWidget + 'static, E: UIWidget + 'static, F: FnOnce(String) ->
|
||||||
) -> (String, PreEscaped<String>) {
|
) -> (String, PreEscaped<String>) {
|
||||||
let id = uuid::Uuid::new_v4().to_string();
|
let id = uuid::Uuid::new_v4().to_string();
|
||||||
|
|
||||||
(
|
(format!("modal-{id}"), html! {
|
||||||
format!("modal-{id}"),
|
div id=(format!("modal-{id}")) tabindex="-1" aria-hidden="true" class="hidden overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 justify-center items-center w-full md:inset-0 h-[calc(100%-1rem)] max-h-full" {
|
||||||
html! {
|
div class="relative p-4 w-full max-w-2xl max-h-full" {
|
||||||
div id=(format!("modal-{id}")) tabindex="-1" aria-hidden="true" class="hidden overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 justify-center items-center w-full md:inset-0 h-[calc(100%-1rem)] max-h-full" {
|
|
||||||
div class="relative p-4 w-full max-w-2xl max-h-full" {
|
|
||||||
|
|
||||||
div class="relative bg-white rounded-lg shadow dark:bg-gray-700" {
|
div class="relative bg-white rounded-lg shadow dark:bg-gray-700" {
|
||||||
div class="flex items-center justify-between p-4 md:p-5 border-b rounded-t dark:border-gray-600" {
|
div class="flex items-center justify-between p-4 md:p-5 border-b rounded-t dark:border-gray-600" {
|
||||||
h3 class="text-xl font-semibold text-gray-900 dark:text-white" { (title) }
|
h3 class="text-xl font-semibold text-gray-900 dark:text-white" { (title) }
|
||||||
button type="button" class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white" data-modal-hide="default-modal" {
|
button type="button" class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white" data-modal-hide=(format!("modal-{id}")) {
|
||||||
svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14" {
|
svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14" {
|
||||||
path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6" {};
|
path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6" {};
|
||||||
};
|
};
|
||||||
|
@ -51,7 +49,15 @@ pub fn Modal<T: UIWidget + 'static, E: UIWidget + 'static, F: FnOnce(String) ->
|
||||||
(footer(format!("modal-{id}")))
|
(footer(format!("modal-{id}")))
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}};
|
|
||||||
},
|
div class="p-4 md:p-5 space-y-4" {
|
||||||
)
|
(body)
|
||||||
|
};
|
||||||
|
|
||||||
|
div class="flex items-center p-4 md:p-5 border-t border-gray-200 rounded-b dark:border-gray-600" {
|
||||||
|
(footer(format!("modal-{id}")))
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}};
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,13 +278,10 @@ pub fn BottomNavigationTile<T: UIWidget + 'static>(
|
||||||
) -> ClassicWidget<LinkWidget> {
|
) -> ClassicWidget<LinkWidget> {
|
||||||
Classic(
|
Classic(
|
||||||
"inline-flex flex-col items-center justify-center px-5 hover:bg-gray-50 dark:hover:bg-gray-800 group",
|
"inline-flex flex-col items-center justify-center px-5 hover:bg-gray-50 dark:hover:bg-gray-800 group",
|
||||||
Link(
|
Link(reference, html! {
|
||||||
reference,
|
(icon.map(|x| x.render()).unwrap_or_default());
|
||||||
html! {
|
span class="text-sm text-gray-500 dark:text-gray-400 group-hover:text-blue-600 dark:group-hover:text-blue-500" { (text) };
|
||||||
(icon.map(|x| x.render()).unwrap_or_default());
|
}),
|
||||||
span class="text-sm text-gray-500 dark:text-gray-400 group-hover:text-blue-600 dark:group-hover:text-blue-500" { (text) };
|
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -274,25 +274,21 @@ impl GridElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn span(mut self, value: GridElementValue) -> Self {
|
pub fn span(mut self, value: GridElementValue) -> Self {
|
||||||
self.1.push(format!(
|
self.1.push(format!("{}-span-{}", self.2, match value {
|
||||||
"{}-span-{}",
|
GridElementValue::_1 => "1",
|
||||||
self.2,
|
GridElementValue::_2 => "2",
|
||||||
match value {
|
GridElementValue::_3 => "3",
|
||||||
GridElementValue::_1 => "1",
|
GridElementValue::_4 => "4",
|
||||||
GridElementValue::_2 => "2",
|
GridElementValue::_5 => "5",
|
||||||
GridElementValue::_3 => "3",
|
GridElementValue::_6 => "6",
|
||||||
GridElementValue::_4 => "4",
|
GridElementValue::_7 => "7",
|
||||||
GridElementValue::_5 => "5",
|
GridElementValue::_8 => "8",
|
||||||
GridElementValue::_6 => "6",
|
GridElementValue::_9 => "9",
|
||||||
GridElementValue::_7 => "7",
|
GridElementValue::_10 => "10",
|
||||||
GridElementValue::_8 => "8",
|
GridElementValue::_11 => "11",
|
||||||
GridElementValue::_9 => "9",
|
GridElementValue::_12 => "12",
|
||||||
GridElementValue::_10 => "10",
|
GridElementValue::Auto => "full",
|
||||||
GridElementValue::_11 => "11",
|
}));
|
||||||
GridElementValue::_12 => "12",
|
|
||||||
GridElementValue::Auto => "full",
|
|
||||||
}
|
|
||||||
));
|
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue