Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit01e01d5

Browse files
committed
Add support for adding profile picture
1 parent682b23e commit01e01d5

File tree

9 files changed

+28
-13
lines changed

9 files changed

+28
-13
lines changed

‎pgml-dashboard/src/components/navigation/navbar/web_app/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
usecrate::components::{StaticNav,StaticNavLink};
2+
usecrate::models::User;
23
usecrate::utils::config;
34
use pgml_components::component;
45
use sailfish::TemplateOnce;
@@ -9,14 +10,16 @@ pub struct WebApp {
910
pubstandalone_dashboard:bool,
1011
publinks:Vec<StaticNavLink>,
1112
pubaccount_management_nav:StaticNav,
13+
pubuser:User,
1214
}
1315

1416
implWebApp{
15-
pubfnnew(links:Vec<StaticNavLink>,account_management_nav:StaticNav) ->WebApp{
17+
pubfnnew(links:Vec<StaticNavLink>,account_management_nav:StaticNav,user:User) ->WebApp{
1618
WebApp{
1719
standalone_dashboard: config::standalone_dashboard(),
1820
links,
1921
account_management_nav,
22+
user,
2023
}
2124
}
2225
}

‎pgml-dashboard/src/components/navigation/navbar/web_app/template.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
<!-- Button to toggle collapsed menu for less than lg screens -->
2323
<buttonclass="navbar-toggler collapsed topnav-controlls"type="button"data-bs-toggle="collapse"data-bs-target="#navbarSupportedContent"aria-controls="navbarSupportedContent"aria-expanded="false"aria-label="Toggle navigation">
24-
<%+ ProfileIcon::new() %>
24+
<%+ ProfileIcon::new(user.profile_picture.clone()) %>
2525
</button>
2626
</div>
2727

@@ -63,7 +63,7 @@
6363
<liclass="d-none d-lg-flex nav-item align-items-center">
6464
<%+
6565
Dropdown::nav(account_management_nav.links.clone())
66-
.icon(ProfileIcon::new().into())
66+
.icon(ProfileIcon::new(user.profile_picture.clone()).into())
6767
.expandable()
6868
%>
6969
</li>

‎pgml-dashboard/src/components/profile_icon/mod.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ use sailfish::TemplateOnce;
33

44
#[derive(TemplateOnce,Default)]
55
#[template(path ="profile_icon/template.html")]
6-
pubstructProfileIcon;
6+
pubstructProfileIcon{
7+
pubprofile_picture:Option<String>,
8+
}
79

810
implProfileIcon{
9-
pubfnnew() ->ProfileIcon{
10-
ProfileIcon
11+
pubfnnew(profile_picture:Option<String>) ->ProfileIcon{
12+
ProfileIcon{ profile_picture}
1113
}
1214
}
1315

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
<% if let Some(profile_picture) = profile_picture { %>
2+
<imgsrc="<%- profile_picture %>"width="44"height="44"class="rounded-circle">
3+
<% } else { %>
4+
15
<svgclass="rounded-circle"width="44"height="44"viewBox="0 0 24 24"fill="none"xmlns="http://www.w3.org/2000/svg">
26
<pathd="M5 20V19C5 16.2386 7.23858 14 10 14H14C16.7614 14 19 16.2386 19 19V20M16 7C16 9.20914 14.2091 11 12 11C9.79086 11 8 9.20914 8 7C8 4.79086 9.79086 3 12 3C14.2091 3 16 4.79086 16 7Z"stroke="black"stroke-width="1.5"stroke-linecap="round"stroke-linejoin="round"/>
37
</svg>
8+
9+
<% } %>

‎pgml-dashboard/src/models.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -961,13 +961,15 @@ impl UploadedFile {
961961
pubstructUser{
962962
pubid:i64,
963963
pubemail:String,
964+
pubprofile_picture:Option<String>,
964965
}
965966

966967
implDefaultforUser{
967968
fndefault() ->User{
968969
User{
969970
id: -1,
970971
email:"".to_string(),
972+
profile_picture:None,
971973
}
972974
}
973975
}

‎pgml-dashboard/src/templates/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ pub struct WebAppBase<'a> {
127127
pubupper_left_nav:StaticNav,
128128
publower_left_nav:StaticNav,
129129
pubbody_components:Vec<Component>,
130+
pubuser: models::User,
130131
}
131132

132133
impl<'a>WebAppBase<'a>{
@@ -139,6 +140,7 @@ impl<'a> WebAppBase<'a> {
139140
account_management_nav: context.account_management_nav.clone(),
140141
upper_left_nav: context.upper_left_nav.clone(),
141142
lower_left_nav: context.lower_left_nav.clone(),
143+
user: context.user.clone(),
142144
..Default::default()
143145
}
144146
}

‎pgml-dashboard/static/css/scss/components/_icon.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,13 @@
110110
color:#{$neon-tint-100};
111111
}
112112

113-
svg {
113+
svg,img {
114114
border-color:#{$neon-tint-100};
115115
}
116116

117117
}
118118

119-
svg {
119+
svg,img {
120120
border:2pxsolid#{$gray-700};
121121
background-color:#{$gray-500};
122122
}

‎pgml-dashboard/templates/content/playground.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ <h3 class="h3">icons</h3>
1919
<%+ GithubIcon::new() %>
2020
</div>
2121
<divclass="mb-3">
22-
<%+ ProfileIcon %>
22+
<%+ ProfileIcon::new(None) %>
2323
</div>
2424

2525
<h3class="h3">Dropdowns</h3>
@@ -33,7 +33,7 @@ <h3 class="h3">Dropdowns</h3>
3333
StaticNavLink::new("Starts Active".into(), "#test".into()).active(true)
3434
]
3535
).collapsable()
36-
.icon(ProfileIcon::new().into()) %>
36+
.icon(ProfileIcon::new(None).into()) %>
3737
</div>
3838
<divclass="col-6"style="min-height: 400px;">
3939
<%+ Dropdown::nav(

‎pgml-dashboard/templates/layout/web_app_base.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@
2424
<main>
2525
<divclass="container-fluid p-0 min-vh-lg-100">
2626
<divclass="row gx-0 min-vh-lg-100 gy-0">
27-
<%+ WebAppNavbar::new(left_nav_links, account_management_nav) %>
27+
<%+ WebAppNavbar::new(left_nav_links, account_management_nav, user) %>
2828

2929
<divclass="d-flex">
30-
<%+ WebAppLeftNav::new(upper_left_nav, lower_left_nav, dropdown_nav) %>
30+
<%+ WebAppLeftNav::new(upper_left_nav, lower_left_nav, dropdown_nav) %>
3131

3232
<divclass="clear-from-under-navbar flex-grow-1 min-vw-0">
3333
<divclass="px-4 px-sm-5 py-3"style="position: absolute">
34-
<%- Breadcrumbs::render(breadcrumbs) %>
34+
<%- Breadcrumbs::render(breadcrumbs) %>
3535
</div>
3636

3737
<divclass="px-xs-2 px-md-5 overflow-hidden"style="padding-top: 57px;">

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp