Skip to content

Commit

Permalink
First cleanup of COmanage Match UI/UX (CO-1662)
Browse files Browse the repository at this point in the history
  • Loading branch information
arlen committed Oct 1, 2018
1 parent ecee7a1 commit ad15300
Show file tree
Hide file tree
Showing 34 changed files with 3,711 additions and 422 deletions.
540 changes: 245 additions & 295 deletions app/composer.lock

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions app/src/Locale/en_US/default.po
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
msgid "match.meta.lang"
msgstr "en"

msgid "match.meta.logo"
msgstr "COmanage Logo"

msgid "match.meta.match"
msgstr "COmanage Match"

Expand Down Expand Up @@ -333,6 +336,9 @@ msgstr "Assign This Reference ID"
msgid "match.op.save"
msgstr "Save"

msgid "match.op.skip_to_content"
msgstr "Skip to main content"

### Results
msgid "match.rs.build"
msgstr "Matchgrid schema successfully applied"
Expand Down
23 changes: 18 additions & 5 deletions app/src/Template/Element/Flash/default.ctp
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
<?php
$class = 'message';
if (!empty($params['class'])) {
$class = 'message';
if (!empty($params['class'])) {
$class .= ' ' . $params['class'];
}
if (!isset($params['escape']) || $params['escape'] !== false) {
}
if (!isset($params['escape']) || $params['escape'] !== false) {
$message = h($message);
}
}
?>
<?php /*
<div class="<?= h($class) ?>" onclick="this.classList.add('hidden');"><?= $message ?></div>
*/ ?>

<?php
if(!empty($message)) {
// Strip tags then escape quotes before handing Flash message to noty.js
$filteredMessage = filter_var(filter_var($message,FILTER_SANITIZE_STRING,FILTER_FLAG_NO_ENCODE_QUOTES),FILTER_SANITIZE_MAGIC_QUOTES);
// Replace all newlines with html breaks
$filteredMessage = str_replace(array("\r", "\n"), '<br/>', $filteredMessage);
print "<script>generateFlash('" . $filteredMessage . "', '" . $class . "');</script>";
}
?>

18 changes: 16 additions & 2 deletions app/src/Template/Element/Flash/error.ctp
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
<?php
if (!isset($params['escape']) || $params['escape'] !== false) {
if (!isset($params['escape']) || $params['escape'] !== false) {
$message = h($message);
}
}
?>
<?php /*
<div class="message error" onclick="this.classList.add('hidden');"><?= $message ?></div>
*/ ?>


<?php
if(!empty($message)) {
// Strip tags then escape quotes before handing Flash message to noty.js
$filteredMessage = filter_var(filter_var($message,FILTER_SANITIZE_STRING,FILTER_FLAG_NO_ENCODE_QUOTES),FILTER_SANITIZE_MAGIC_QUOTES);
// Replace all newlines with html breaks
$filteredMessage = str_replace(array("\r", "\n"), '<br/>', $filteredMessage);
print "<script>generateFlash('" . $filteredMessage . "', 'error');</script>";
}
?>

12 changes: 12 additions & 0 deletions app/src/Template/Element/Flash/success.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,16 @@ if (!isset($params['escape']) || $params['escape'] !== false) {
$message = h($message);
}
?>
<?php /*
<div class="message success" onclick="this.classList.add('hidden')"><?= $message ?></div>
*/ ?>

<?php
if(!empty($message)) {
// Strip tags then escape quotes before handing Flash message to noty.js
$filteredMessage = filter_var(filter_var($message,FILTER_SANITIZE_STRING,FILTER_FLAG_NO_ENCODE_QUOTES),FILTER_SANITIZE_MAGIC_QUOTES);
// Replace all newlines with html breaks
$filteredMessage = str_replace(array("\r", "\n"), '<br/>', $filteredMessage);
print "<script>generateFlash('" . $filteredMessage . "', 'success');</script>";
}
?>
2 changes: 0 additions & 2 deletions app/src/Template/Element/menuMain.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
// XXX we're using the same cookie as registry to determine collapsing of the menu,
// we should probably have our own cookie (note other cookies already use "match" prefix)
?>
XXX PLACEHOLDER BECAUSE<br />
MENU DOESNT ALIGN
<ul id="main-menu" class="metismenu">
<?php
if(!empty($vv_cur_mg)) {
Expand Down
1 change: 0 additions & 1 deletion app/src/Template/Element/menuUser.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/
?>
Hello, World
<?php if(!empty($vv_user)): ?>
<div id="user">
<a href="#" class="topMenu" id="user-links">
Expand Down
27 changes: 20 additions & 7 deletions app/src/Template/Layout/default.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,23 @@ if(isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'M
<?= $this->fetch('css') ?>
<?= $this->fetch('script') ?>
</head>

<body onload="js_onload_call_hooks()>

<?php
// cleanse the controller and action strings and insert them into the body classes
$controller_stripped = preg_replace('/[^a-zA-Z0-9\-_]/', '', $this->request->getParam('controller'));
$action_stripped = preg_replace('/[^a-zA-Z0-9\-_]/', '', $this->request->getParam('action'));
$bodyClasses = $controller_stripped . ' ' .$action_stripped;

// add further body classes as needed
if($this->Session->check('Auth.User') != NULL) {
$bodyClasses .= ' logged-in';
} else {
$bodyClasses .= ' logged-out';
}
?>
<body class="<?= $bodyClasses ?>" onload="js_onload_call_hooks()">
<div id="skip-to-content-box">
<!-- XXX shouldn't the text be localized, here and in Registry? -->
<a href="#content-start" id="skip-to-content">Skip to main content.</a>
<a href="#content-start" id="skip-to-content"><?= __('match.op.skip_to_content') ?></a>
</div>

<!-- Primary layout -->
Expand All @@ -96,7 +108,6 @@ if(isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'M
<header id="banner" class="mdl-layout__header mdl-layout__header--scroll">
<div class="mdl-layout__header-row">
<div id="collaborationTitle">
<!-- XXX fonts are different? -->
<?= __('match.meta.match'); ?>
</div>

Expand All @@ -107,8 +118,7 @@ if(isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'M
// XXX background needs to be on green (and primary gear should be green)
"COmanage-Logo-LG-onBlue.png",
array(
// XXX this should be localized (and in Registry also)
'alt' => 'COmanage Logo'
'alt' => __('match.meta.logo')
)
),'/',
array('escape' => false)
Expand Down Expand Up @@ -155,6 +165,9 @@ if(isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'M
'jquery/metisMenu/metisMenu.min.js',
'js-cookie/js.cookie-2.1.3.min.js',
'jquery/spin.min.js',
'jquery/noty/jquery.noty.js',
'jquery/noty/layouts/topCenter.js',
'jquery/noty/themes/comanage.js',
'comanage.js'
]) . "\n"; ?>

Expand Down
5 changes: 2 additions & 3 deletions app/src/Template/Matchgrids/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,15 @@ use \App\Lib\Enum\ReferenceIdEnum;
// Hide or show gadgets according to current state

var method = document.getElementById('referenceid-method').value;

if(method == '<?= ReferenceIdEnum::Sequence ?>') {
$("#referenceid-start").closest('li').show('fade');
} else {
$("#referenceid-start").closest('li').hide('fade');
$("#referenceid-start").closest('li').hide();
}
}

function js_local_onload() {
// XXX this doesn't run, probably because comanage.js doesn't load correctly?
fields_update_gadgets();
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion app/src/Template/Permissions/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use \App\Lib\Enum\PermissionEnum;
var perm = document.getElementById('permission').value;

if(perm == '<?= PermissionEnum::PlatformAdmin ?>') {
$("#matchgrid-id").closest('li').hide('fade');
$("#matchgrid-id").closest('li').hide();
} else {
$("#matchgrid-id").closest('li').show('fade');
}
Expand Down
6 changes: 5 additions & 1 deletion app/src/Template/Standard/add-edit-view.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ $modelsName = $this->name;
// $tablename = models
$tableName = \Cake\Utility\Inflector::tableize($this->name);
?>
<h1><?= $vv_title; ?></h1>
<div class="titleNavContainer">
<div class="pageTitle">
<h1><?= $vv_title; ?></h1>
</div>
</div>
<?php
if($action == 'add' || $action == 'edit') {
// By default, the form will POST to the current controller
Expand Down
Loading

0 comments on commit ad15300

Please sign in to comment.