Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0] Webauth inline SVG button with fill #31190

Merged
merged 57 commits into from
Nov 12, 2020
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
63d694e
prepare for login webauth
N6REJ Oct 20, 2020
fe935a9
make frontend match backend
N6REJ Oct 21, 2020
0c1b8d0
make frontend match backend
N6REJ Oct 21, 2020
d9b22bb
changed button to primary
N6REJ Oct 21, 2020
c61e368
added support for svg
N6REJ Oct 23, 2020
356c400
Merge branch '4.0-dev' of https://github.com/joomla/joomla-cms into w…
N6REJ Oct 24, 2020
5f5d76b
Merge branch '4.0-dev' of https://github.com/joomla/joomla-cms into w…
N6REJ Oct 24, 2020
bba870e
use htmlhelper & sanity check
N6REJ Oct 25, 2020
07ea988
check for valid filetype
N6REJ Oct 25, 2020
8cc73f8
check for valid filetype
N6REJ Oct 25, 2020
2849f60
remove path check
N6REJ Oct 26, 2020
ce93f67
creates svg icon helper
N6REJ Oct 26, 2020
bd30c13
changed to global usage
N6REJ Oct 26, 2020
f080a0e
forgot $relative
N6REJ Oct 26, 2020
c4168ce
Update libraries/src/HTML/Helpers/Icons.php
N6REJ Oct 26, 2020
6707385
Update plugins/system/webauthn/src/PluginTraits/AdditionalLoginButton…
N6REJ Oct 26, 2020
d1eb03e
Update libraries/src/HTML/Helpers/Icons.php
N6REJ Oct 26, 2020
97d55bb
remove use file
N6REJ Oct 28, 2020
ba67198
remove use file
N6REJ Oct 28, 2020
e54e224
remove transform styling
N6REJ Oct 28, 2020
76607c9
Update libraries/src/HTML/Helpers/Icons.php
N6REJ Oct 29, 2020
b90703e
Merge branch '4.0-dev' of https://github.com/joomla/joomla-cms into w…
N6REJ Oct 29, 2020
2d7c737
relative was reversed
N6REJ Oct 30, 2020
168f212
Merge branch '4.0-dev' of https://github.com/joomla/joomla-cms into w…
N6REJ Oct 30, 2020
eadaf2e
removed empty line
N6REJ Oct 30, 2020
4a30863
working on exceptions
N6REJ Oct 30, 2020
abecdef
error checking done.
N6REJ Oct 30, 2020
69fe6ab
remove unused string
N6REJ Oct 30, 2020
3332b0d
Merge branch '4.0-dev' of https://github.com/joomla/joomla-cms into w…
N6REJ Oct 30, 2020
8ef4846
cleanup
N6REJ Oct 30, 2020
cc16540
better extension test per sharky
N6REJ Oct 30, 2020
d8d32b8
remove strpos per sharky
N6REJ Oct 30, 2020
af7d51e
pathcheck
N6REJ Oct 30, 2020
8ee2e7f
Update libraries/src/HTML/Helpers/Icons.php
N6REJ Oct 30, 2020
5366f42
Update libraries/src/HTML/Helpers/Icons.php
N6REJ Oct 31, 2020
be6b0ba
Update libraries/src/HTML/Helpers/Icons.php
N6REJ Oct 31, 2020
9d42ad0
added missing use Joomla\Filesystem\Path;
N6REJ Oct 31, 2020
595de2a
add global namespace
N6REJ Nov 1, 2020
291562c
Merge branch '4.0-dev' into webauth-frontend
N6REJ Nov 3, 2020
16b819b
Update libraries/src/HTML/Helpers/Icons.php
N6REJ Nov 3, 2020
efecbf3
various corrections from Brian Teeman
N6REJ Nov 3, 2020
b3086b5
Merge remote-tracking branch 'N6REJ/webauth-frontend' into webauth-fr…
N6REJ Nov 3, 2020
a70b9c1
phpcs fix
N6REJ Nov 3, 2020
8fb2324
color styling per sharky
N6REJ Nov 4, 2020
1d68038
Update templates/cassiopeia/scss/blocks/_icons.scss
N6REJ Nov 4, 2020
94255d6
spacer fix
N6REJ Nov 4, 2020
0dd245e
Merge remote-tracking branch 'N6REJ/webauth-frontend' into webauth-fr…
N6REJ Nov 4, 2020
e92b4b8
phpcs
N6REJ Nov 4, 2020
d9d03f4
fill fix
N6REJ Nov 5, 2020
6d624d4
rtl
N6REJ Nov 5, 2020
40e95be
rtl
N6REJ Nov 5, 2020
16fa923
change svg transparency to solid
N6REJ Nov 6, 2020
e9132e4
move some css out of language direction
N6REJ Nov 10, 2020
ff2c6de
Merge branch '4.0-dev' of https://github.com/joomla/joomla-cms into w…
N6REJ Nov 10, 2020
19aeaa5
add margin to atum
N6REJ Nov 11, 2020
abf1db8
changed scss
N6REJ Nov 11, 2020
8d228a7
changed to var(--xxx)
N6REJ Nov 11, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions administrator/modules/mod_login/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Filesystem\File;
N6REJ marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unused


/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = $app->getDocument()->getWebAssetManager();
Expand Down Expand Up @@ -116,6 +117,8 @@ class="btn btn-secondary btn-block mt-4 <?php echo $button['class'] ?? '' ?>"
<?php echo HTMLHelper::_('image', $button['image'], Text::_($button['tooltip'] ?? ''), [
'class' => 'icon',
], true) ?>
<?php elseif (!empty($button['svg'])): ?>
<?php echo $button['svg']; ?>
<?php endif; ?>
<?php echo Text::_($button['label']) ?>
</button>
Expand Down
4 changes: 4 additions & 0 deletions administrator/templates/atum/scss/blocks/_login.scss
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
}
}

.plg_system_webauthn_login_button svg path {
fill: $white;
}

.form-group {
label {
span {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

24 changes: 24 additions & 0 deletions libraries/src/HTML/Helpers/Icons.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\Uri\Uri;

N6REJ marked this conversation as resolved.
Show resolved Hide resolved
/**
* Utility class for icons.
Expand Down Expand Up @@ -88,4 +89,27 @@ public static function button($button)

return $layout->render($button);
}

/**
* Writes a inline '<svg>' element
*
* @param string $file The relative or absolute PATH to use for the src attribute.
* @param boolean $relative Flag if the path to the file is relative to the /media folder (and searches in template).
N6REJ marked this conversation as resolved.
Show resolved Hide resolved
*
* @return string
*
* @since 4.0
*/
public static function svg(string $file, $relative = false)
{

if ($relative == true)
{
$file = HTMLHelper::_('image', $file, "", "", $relative, true);
N6REJ marked this conversation as resolved.
Show resolved Hide resolved
}

$file = substr($file, \strlen(Uri::root(true)));

return file_get_contents(JPATH_ROOT . $file);
}
}
3 changes: 2 additions & 1 deletion libraries/src/Helper/AuthenticationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ public static function getLoginButtons(string $formId): array
'tooltip' => '',
'icon' => '',
'image' => '',
'svg' => '',
'class' => '',
'id' => '',
'onclick' => '',
Expand All @@ -165,7 +166,7 @@ public static function getLoginButtons(string $formId): array
continue;
}

if (!in_array($key, ['label', 'tooltip', 'icon', 'image', 'class', 'id', 'onclick']))
if (!in_array($key, ['label', 'tooltip', 'icon', 'image', 'svg', 'class', 'id', 'onclick']))
{
unset($button[$key]);
}
Expand Down
4 changes: 3 additions & 1 deletion modules/mod_login/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
?>
<div class="mod-login__submit form-group">
<button type="button"
class="btn btn-secondary <?php echo $button['class'] ?? '' ?>"
class="btn btn-primary btn-block mt-4 <?php echo $button['class'] ?? '' ?>"
<?php foreach ($dataAttributeKeys as $key): ?>
<?php echo $key ?>="<?php echo $button[$key] ?>"
<?php endforeach; ?>
Expand All @@ -128,6 +128,8 @@ class="btn btn-secondary <?php echo $button['class'] ?? '' ?>"
<?php echo HTMLHelper::_('image', $button['image'], Text::_($button['tooltip'] ?? ''), [
'class' => 'icon',
], true) ?>
<?php elseif (!empty($button['svg'])): ?>
<?php echo $button['svg']; ?>
<?php endif; ?>
<?php echo Text::_($button['label']) ?>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Exception;
use Joomla\CMS\Factory;
use Joomla\CMS\Helper\AuthenticationHelper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\User\UserHelper;
Expand Down Expand Up @@ -152,7 +153,7 @@ public function onUserLoginButtons(string $form): array
'id' => $randomId,
'data-webauthn-form' => $form,
'data-webauthn-url' => $url,
'image' => 'plg_system_webauthn/webauthn-white.svg',
'svg' => HTMLHelper::_('icons.svg', "plg_system_webauthn/webauthn-black.svg", true),
N6REJ marked this conversation as resolved.
Show resolved Hide resolved
'class' => 'plg_system_webauthn_login_button',
],
];
Expand Down
4 changes: 4 additions & 0 deletions templates/cassiopeia/scss/blocks/_icons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@
min-width: 16px;
}
}

.plg_system_webauthn_login_button svg path {
fill: $white;
}
8 changes: 4 additions & 4 deletions templates/cassiopeia/scss/vendor/bootstrap/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
}

.btn-secondary {
color: $gray-800;
background-color: $white-offset;
color: $white-offset;
background-color: rgb(40, 73, 113);
border-color: $gray-400;

&:hover,
&:focus {
color: $gray-800;
background-color: $gray-100;
color: $white-offset;
background-color: #004e72;
N6REJ marked this conversation as resolved.
Show resolved Hide resolved
}
}