From 499aefbc1d8b590c12809895cb754a865d2392a0 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Fri, 3 Aug 2018 15:27:56 +0200 Subject: [PATCH] Improved site responsive --- assets/css/components/menuBar.css | 17 ++++++++++ assets/js/components/menuBar/authenticated.js | 31 +++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/assets/css/components/menuBar.css b/assets/css/components/menuBar.css index bf8094b9..a237fced 100644 --- a/assets/css/components/menuBar.css +++ b/assets/css/components/menuBar.css @@ -20,10 +20,27 @@ header .dropdown .fa-gear { vertical-align: middle; } +.main-header .alternate-latest-posts-button { + display: none; +} + @media (max-width: 360px) { .main-header[forActiveUser="true"] .navbar-brand { display: none; } + + .main-header .alternate-latest-posts-button { + display: block; + } + + .nav > li > a { + padding: 10px 10px; + } + + .navbar-custom-menu > .navbar-nav > li > .dropdown-menu { + width: 100%; + left: 0px; + } } @media (max-width: 767px) { diff --git a/assets/js/components/menuBar/authenticated.js b/assets/js/components/menuBar/authenticated.js index 7463f283..4877dd65 100644 --- a/assets/js/components/menuBar/authenticated.js +++ b/assets/js/components/menuBar/authenticated.js @@ -32,6 +32,9 @@ ComunicWeb.components.menuBar.authenticated = { //Add user name this.addUserName(navbarRightElemList); + //Alternate latest posts button + this.addAlternateLatestPostsButton(navbarRightElemList); + //Add friends list button this.addFriendListButton(navbarRightElemList); @@ -128,6 +131,34 @@ ComunicWeb.components.menuBar.authenticated = { return dropdownContent; }, + /** + * Add alternate latest posts button + * (if the screen is too small to display "Comunic") + * + * @param {HTMLElement} target The target for the ubutton + */ + addAlternateLatestPostsButton: function(target){ + //Create button + var button = createElem2({ + type: "li", + appendTo: target, + class: "alternate-latest-posts-button" + }); + + //Create link + var link = createElem("a", button); + createElem2({ + type: "i", + appendTo: link, + class: "fa fa-history" + }); + + //Makes link lives + link.addEventListener("click", function(){ + openPage("latest"); + }); + }, + /** * Add friendsList toggle button *