]> _ Git - ccgm.git/commitdiff
Wait #5334 @2
authorstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 18 Jul 2022 16:47:10 +0000 (16:47 +0000)
committerstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 18 Jul 2022 16:47:10 +0000 (16:47 +0000)
framework/application/views/helpers/Teams.php
framework/application/views/scripts/templates/equipes.phtml
js/equipes.js [deleted file]
js/teams.js [new file with mode: 0644]
less/equipes.less [deleted file]
less/teams.less

index 86eae83cce5cddb1e28117b89ed7cb857884cd24..888445b0f098b58b500681d257338d581e19b537 100644 (file)
@@ -20,7 +20,11 @@ class CCGM_View_Helper_Teams extends CubeIT_View_Helper_Abstract {
 
         $res = '<div class="teams-list">';
         foreach ($teams as $team) {
-            $res .= '<span data-id="'. $team['id'] .'">'. $team['name'] .'</span>';
+            if (empty($team['members'])) {
+                continue; // Don't display empty teams
+            }
+
+            $res .= '<a href="#'. CubeIT_Text::str2URL($team['name']) .'">'. $team['name'] .'</a>';
         }
         $res .= '</div>'; // .teams-list
 
@@ -30,7 +34,7 @@ class CCGM_View_Helper_Teams extends CubeIT_View_Helper_Abstract {
                 continue;
             }
 
-            $res .= '<div class="teams-team" data-team-id="'. $team['id'] .'">';
+            $res .= '<div class="teams-team" data-team-slug="#'. CubeIT_Text::str2URL($team['name'])  .'">';
             if (!empty($team['photo'])) {
                 $res .= $this->imageCms($team['photo'], $team['name'], 770, null);
             }
index 6e0e9ff554f669211feff1d53ae9b0db38062776..1a4a56628f6a385fb3a5f396b9296f36aa1159db 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-$this->headScript()->addScriptAndStyle('equipes');
 $this->sidebar_nav_depth = 0; // Don't show individual staff sub-pages in the sidebar
 ?>
 
diff --git a/js/equipes.js b/js/equipes.js
deleted file mode 100644 (file)
index a3ff045..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-TO_LOAD_ONCE[TO_LOAD_ONCE.length] = 'load_equipes();';
-
-function load_equipes() {
-       $(".thumb").mouseenter(function() {
-               $(this).siblings(".big").show();
-       }).mouseleave(function() {
-               $(this).siblings(".big").hide();
-       });
-}
\ No newline at end of file
diff --git a/js/teams.js b/js/teams.js
new file mode 100644 (file)
index 0000000..f8f0081
--- /dev/null
@@ -0,0 +1,21 @@
+TO_LOAD_ONCE.push('load_teams();');
+
+function load_teams() {
+  show_team();
+  $(window).on('hashchange', show_team);
+}
+
+function reset_teams() {
+  $('.teams-team').hide();
+  $('.teams-list a').removeClass('active');
+}
+
+function show_team() {
+  let team = window.location.hash || $('.teams-list a').first().attr('href');
+
+  reset_teams();
+  $(`.teams-list a[href="${team}"]`).addClass('active');
+  $(`.teams-team[data-team-slug="${team}"]`).show();
+}
+
+
diff --git a/less/equipes.less b/less/equipes.less
deleted file mode 100644 (file)
index 6b3b087..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-@import "constants.less";
-
-
-#equipes{
-       .col{
-               width: 334px;
-               display:inline-block;
-               &:first-child{
-                       margin:0 100px 0 0;
-               }
-       }
-       .equipe{
-               h3{
-                       text-transform: none;
-                       font-size: 16px;
-                       font-weight: 500;
-                       margin:20px 0;
-               }
-               img{
-                       border:1px solid #c7c5c5;
-                       border-radius: 5px;
-                       display: block;
-               }
-               >img{
-                       margin: 30px 0;
-               }
-
-               .membre{
-                       margin: 15px 0;
-                       position:relative;
-                       .thumb{
-                               display:inline-block;
-                               width: 44px;
-                               margin:0 16px 0 0;
-                               background-color: #e7e7e7;
-                       }
-                       .big{
-                               display:none;
-                               position: absolute;
-                               top:-54px;
-                               left:52px;
-                               z-index: 2;
-                               background-color:#fff;
-                               padding:6px;
-                               box-shadow: 0 0 5px 2px rgba(0,0,0,0.3);
-                               border-radius:7px;
-                               img{
-                                       border:0;
-                               }
-                               &:after{
-                                       content:"";
-                                       width: 0; 
-                                       height: 0; 
-                                       position:absolute;
-                                       left:-10px;
-                                       top:62px;
-                                       border-top: 10px solid transparent;
-                                       border-bottom: 10px solid transparent; 
-                                       border-right:10px solid #fff; 
-                               }
-                       }
-                       .infos{
-                               display:inline-block;
-                               .role{
-                                       font-weight: 300;
-                                       font-style: italic;
-                                       font-size: 13px;
-                               }
-                       }
-               }
-       }
-}
\ No newline at end of file
index 99d59e2bc77eb7ab69d02a557a37777989251d84..7f581d0239fc0337edb692bdab9db8e21f7b89d6 100644 (file)
 
       &:hover, &.active {
         background-color: #57c1e6;
+        text-decoration: none;
       }
     }
   }
 
   &-team {
+    display: none; // Initially hidden, will be shown when user clicks the link or onload via URL hash
+
     > * + * {
       margin-top: 1.5em;
     }