Skip to content

Commit

Permalink
First commit of Registry 5.x default theme (CFM-174)
Browse files Browse the repository at this point in the history
  • Loading branch information
arlen committed Jun 23, 2022
1 parent c19a9ac commit c3c8b08
Show file tree
Hide file tree
Showing 54 changed files with 1,627 additions and 313 deletions.
3 changes: 3 additions & 0 deletions app/resources/locales/en_US/field.po
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ msgstr "Required"
msgid "room"
msgstr "Room"

msgid "search.placeholder"
msgstr "Search..."

msgid "sponsor"
msgstr "Sponsor"

Expand Down
14 changes: 13 additions & 1 deletion app/resources/locales/en_US/menu.po
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,25 @@
# Menu Messages

msgid "co.configuration"
msgstr "Configuration"
msgstr "Config"

msgid "co.connections"
msgstr "Connections"

msgid "co.lifecycle"
msgstr "Lifecycle"

msgid "co.operations"
msgstr "Operations"

msgid "co.groups"
msgstr "Groups"

msgid "co.people"
msgstr "People"

msgid "co.structure"
msgstr "Structure"

msgid "co.switch"
msgstr "Switch CO"
3 changes: 3 additions & 0 deletions app/resources/locales/en_US/operation.po
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ msgstr "Remove"
msgid "save"
msgstr "Save"

msgid "search"
msgstr "Search"

msgid "skip_to_content"
msgstr "Skip to main content"

Expand Down
68 changes: 9 additions & 59 deletions app/templates/element/javascript.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,71 +33,21 @@
$('.focusFirst').focus();

// DESKTOP MENU DRAWER BEHAVIOR
// Check the drawer half-closed cookie on first load and set the drawer state appropriately
if (Cookies.get("desktop-drawer-state") == "half-closed") {
$("#navigation-drawer").addClass("half-closed");
$("#main").addClass("drawer-half-closed");
}

// Hamburger menu-drawer toggle
$('#co-hamburger').click(function () {
if($(window).width() < 768) {
// Mobile mode
$("#navigation-drawer").removeClass("half-closed").toggle();
} else {
// Desktop mode
if ($("#navigation-drawer").hasClass("half-closed")) {
$("#navigation-drawer").removeClass("half-closed");
$("#main").removeClass("drawer-half-closed");
// set a cookie to hold drawer half-open state between requests
Cookies.set("desktop-drawer-state", "open");
} else {
$("#navigation-drawer").addClass("half-closed");
$("#main").addClass("drawer-half-closed");
// set a cookie to hold drawer half-open state between requests
Cookies.set("desktop-drawer-state", "half-closed");
}
}
});

// Catch the edge-case of browser resize causing menu-drawer
// to remain hidden and vice versa.
$(window).resize(function() {
if($( window ).width() > 767) {
$("#navigation-drawer").show();
} else {
$("#navigation-drawer").hide();
}
$('#co-menu-collapse').click(function(){
$('#navigation-drawer').toggleClass('closed');
});

// Desktop half-closed drawer behavior & expandable menu items
$('#navigation-drawer a.menuTop').click(function () {
if (Cookies.get("desktop-drawer-state") == "half-closed") {
$("#navigation-drawer").toggleClass("half-closed");
}
$('#co-hamburger').click(function() {
$('#navigation-drawer').toggleClass('visible');
});
// END DESKTOP MENU DRAWER BEHAVIOR

// USER MENU BEHAVIORS
$("#global-search label").click(function () {
$("#global-search-box").toggle();
// GLOBAL SEARCH
$('#search-bar input').focus(function() {
$('#search-bar button').addClass('visible');
});

// Accordion - XXX Deprecated?
// $(".accordion").accordion();

// Click outside behaviors
// XXX Enable when / if needed (also enable popopvers below)
/*$(document).on('click', function (e) {
// Hide popovers on click outside but don't close current popover when interacting with content inside it
$('#content [data-bs-toggle="popover"]').each(function () {
if (!$(this).is(e.target) && $('.popover.show').has(e.target).length === 0) {
$(this).popover('hide');
}
});
});*/

// TOP SEARCH FILTER FORM

// TOP FILTER FORM
// Send only non-empty fields in the form
$("#top-filters-form").submit(function() {
$("#top-filters-form *").filter(':input').each(function () {
Expand Down
52 changes: 52 additions & 0 deletions app/templates/element/links.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php
/*
* COmanage Registry Custom Links
*
* Portions licensed to the University Corporation for Advanced Internet
* Development, Inc. ("UCAID") under one or more contributor license agreements.
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership.
*
* UCAID licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @link https://www.internet2.edu/comanage COmanage Project
* @package registry
* @since COmanage Registry v5.0.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/
?>
<?php /* if(isset($vv_NavLinks) || isset($vv_CoNavLinks)): */ ?>
<div class="custom-links">
<ul>
<!-- XXX Mockup some links for layout considerations (CFM-162) -->
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
<?php
// Emit dynamically configured (via Navigation Links) links

if(isset($vv_NavLinks)) {
foreach($vv_NavLinks as $l){
print '<li><a href="' . $l['NavigationLink']['url'] . '">' . filter_var($l['NavigationLink']['title'],FILTER_SANITIZE_SPECIAL_CHARS) . '</a>';
}
}

if(isset($vv_CoNavLinks)) {
foreach($vv_CoNavLinks as $l){
print '<li><a href="' . $l['CoNavigationLink']['url'] . '">' . filter_var($l['CoNavigationLink']['title'],FILTER_SANITIZE_SPECIAL_CHARS) . '</a>';
}
}
?>
</ul>
</div>
<?php /* endif; */ ?>
144 changes: 88 additions & 56 deletions app/templates/element/menuMain.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,60 +27,92 @@

// The following menu will only render if we have a user and CO (see default.ctp)
?>
<ul id="main-menu">
<?php
if(!empty($vv_cur_co)) {
// In Registry PE, there is no more Platform Administration menu, so there
// is no menu context without a current CO. (The Platform Administration
// menu is now part of the COmanage CO configuration.)

// When adding new items here, 'permission' corresponds to
// RegistryAuthComponent::getMenuPermissions. 'icon' is from
// https://fonts.google.com/icons?selected=Material+Icons

$menuItems = [
[
'permission' => 'people',
'controller' => 'people',
'action' => 'index',
'icon' => 'person',
'label' => __d('menu', 'co.people')
],
[
'permission' => 'groups',
'controller' => 'groups',
'action' => 'index',
'icon' => 'group',
'label' => __d('menu', 'co.groups')
],
[
'permission' => 'configuration',
'controller' => 'dashboards',
'action' => 'configuration',
'icon' => 'settings',
'label' => __d('menu', 'co.configuration')
]
];

foreach($menuItems as $m) {
if(!isset($m['permission']) || $vv_menu_permissions[ $m['permission'] ]) {
$linkContent = '<em class="material-icons" aria-hidden="true">' . $m['icon'] . '</em>'
. '<span class="menu-title">' . $m['label'] . '</span>';

print '<li>'
. $this->Html->link(
$linkContent,
['plugin' => null,
'controller' => $m['controller'],
'action' => $m['action'],
'?' => [
'co_id' => $vv_cur_co->id
]],
['escape' => false]
)
. '</li>';
<div id="navigation-drawer">
<nav id="navigation" aria-label="main menu">
<ul id="main-menu">
<?php
if(!empty($vv_cur_co)) {
// In Registry PE, there is no more Platform Administration menu, so there
// is no menu context without a current CO. (The Platform Administration
// menu is now part of the COmanage CO configuration.)

$menuItems = [
[
'permission' => 'people',
'controller' => 'people',
'action' => 'index',
'icon' => 'person',
'dropdown' => 'true',
'label' => __d('menu', 'co.people')
],
[
'permission' => 'groups',
'controller' => 'groups',
'action' => 'index',
'icon' => 'group',
'dropdown' => 'true',
'label' => __d('menu', 'co.structure')
],
[
'permission' => 'configuration',
'controller' => 'dashboards',
'action' => 'configuration',
'icon' => 'cached',
'dropdown' => 'true',
'label' => __d('menu', 'co.lifecycle')
],
[
'permission' => 'configuration',
'controller' => 'dashboards',
'action' => 'configuration',
'icon' => 'hub',
'dropdown' => 'true',
'label' => __d('menu', 'co.connections')
],
[
'permission' => 'configuration',
'controller' => 'dashboards',
'action' => 'configuration',
'icon' => 'play_circle_outline',
'dropdown' => 'true',
'label' => __d('menu', 'co.operations')
],
[
'permission' => 'configuration',
'controller' => 'dashboards',
'action' => 'configuration',
'icon' => 'settings',
'label' => __d('menu', 'co.configuration')
]
];

foreach($menuItems as $m) {
if(!isset($m['permission']) || $vv_menu_permissions[ $m['permission'] ]) {
$linkContent = '<em class="material-icons" aria-hidden="true">' . $m['icon'] . '</em>'
. '<span class="menu-title">' . $m['label'] . '</span>';

print '<li>';
print $this->Html->link(
$linkContent,
['plugin' => null,
'controller' => $m['controller'],
'action' => $m['action'],
'?' => [
'co_id' => $vv_cur_co->id
]],
['escape' => false, 'title' => $m['label']]
);
print '</li>';
}
}
}
}
}
?>
</ul>
?>
</ul>
</nav>
<button id="co-menu-collapse">
<em class="material-icons-outlined co-menu-collapse-icon">
expand_circle_down
</em>
<div class="co-menu-collapse-text">close</div>
</button>
</div>
6 changes: 3 additions & 3 deletions app/templates/element/menuTop.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
<?php if(!empty($vv_user)): ?>
<ul>
<li id="top-menu-user">
<a class="dropdown-toggle nospin" href="#" role="button" id="user-panel-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<button type="button" class="dropdown-toggle top-menu-button" id="user-panel-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="top-menu-link-text">
<?= $vv_user['username']; ?>
</span>
<em class="material-icons icon-adjust">person</em>
</a>
</button>
<!-- Account Dropdown -->
<div id="user-panel" class="dropdown-menu <?= (count($vv_available_cos) > 1) ? ' with-co-switcher' : ''; ?>" aria-labelledby="user-panel-toggle">
<div id="logout-in-panel">
Expand Down Expand Up @@ -74,7 +74,7 @@
'plugin' => false],
['escape' => false,
'id' => 'login',
'class' => '']);
'class' => 'btn btn-small']);
}
?>
<?php endif; ?>
Loading

0 comments on commit c3c8b08

Please sign in to comment.