浏览代码

user avatar fix topbar - refs #2681

Alex Aragón 6 年之前
父节点
当前提交
0879de0c61

+ 9 - 2
assets/css/scss/_topbar.scss

@@ -15,7 +15,7 @@
   transition: all 0.2s ease;
   width: calc(100% - #{$offscreen-size});
   z-index: 800;
-  box-shadow: 0px 8px 20px -10px rgba(0, 0, 0, 0.15);
+  box-shadow: 0 8px 20px -10px rgba(0, 0, 0, 0.15);
 
   @include to($breakpoint-md) {
     width: 100%;
@@ -76,6 +76,13 @@
             text-decoration: none;
           }
 
+          .rounded-circle{
+            margin-right: 10px;
+            width: 40px;
+            border: 2px solid #fff;
+            box-shadow: 0 5px 10px 0 rgba(43,43,43,0.2);
+          }
+
           @include to($breakpoint-md) {
             padding: 0 15px;
           }
@@ -154,7 +161,7 @@
             line-height: 1.5;
             min-height: auto;
             padding: 10px 15px;
-            color: $sidebar-link;
+            color: $header-link;
           }
         }
       }

+ 5 - 5
assets/css/scss/_variables.scss

@@ -46,13 +46,13 @@ $default-link         : rgb(0, 153, 255);
 // linear-gradient(120deg, #00a5e4, #4a71d0);
 
 $page-background      : #f2f8f9;
-$menu-background      : #4a71d0;
+$menu-background      : #FFFFFF;
 $menu-secondary       : #ff3c7e;
-$sidebar-link         : #54667A;
-$sidebar-bg           : #FFFFFF;
+$sidebar-link         : #FFFFFF;
+$sidebar-bg           : #4a71d0;
 $sidebar-focus        : rgba(0, 0, 0, 0.07);
-$header-link          : #FFFFFF;
-$header-hover         : #eddf0e;
+$header-link          : #54667a;
+$header-hover         : #ff3c7e;
 $breadcrumb-color     : #d2f1ff;
 $select-color         : #ced4da;
 // ---------------------------------------------------------

+ 3 - 0
src/CoreBundle/Resources/config/routing.yml

@@ -11,6 +11,9 @@ legacy_main:
     requirements:
         name: .+
 
+legacy_upload:
+    path: ../var/upload/
+
 # Controllers
 controllers:
     resource: '../src/CoreBundle/Controller/'

+ 19 - 7
src/ThemeBundle/Resources/views/Layout/topbar.html.twig

@@ -105,8 +105,6 @@
             <!-- END NAVBAR LEFT -->
             <!-- NAVBAR RIGHT -->
 
-
-
             {% if app.user is not null and is_granted('IS_AUTHENTICATED_FULLY') %}
             <ul class="nav-right">
 
@@ -131,12 +129,26 @@
 
                 <li class="dropdown">
                     <a href="" class="dropdown-toggle" data-toggle="dropdown">
+
+                        {% set avatar %}
+                            {% if app.user.pictureUri is null %}
+                                <img
+                                    class="rounded-circle"
+                                    src="{{ url('legacy_public') ~ app.user.avatarOrAnonymous(32) }}"
+                                    alt="{{ app.user.firstname }} {{ app.user.lastname }}"
+                                >
+                            {% else %}
+                                <img
+                                    class="rounded-circle"
+                                    src="{{ url('legacy_upload') ~ app.user.getPictureLegacy() }}"
+                                    alt="{{ app.user.firstname }} {{ app.user.lastname }}"
+                                >
+                            {% endif %}
+                        {% endset %}
+
+                        {{ avatar }}
+
                         <span class="profile-text">{{ app.user.firstname }} {{ app.user.lastname }}</span>
-                        <img
-                            class="rounded-circle"
-                            src="{{ url('legacy_public') ~ app.user.avatarOrAnonymous(32) }}"
-                            alt="{{ app.user.firstname }} {{ app.user.lastname }}"
-                        >
                     </a>
                     <ul class="dropdown-menu">
                         <li>