Skip to content
Snippets Groups Projects
Commit 3ea9d72d authored by Dominik Baránek's avatar Dominik Baránek
Browse files

feat: previous selections delete

parent 1ea5683c
Branches
Tags
1 merge request!13feat: previous selections delete
...@@ -33,17 +33,25 @@ ...@@ -33,17 +33,25 @@
<div class="box-vcards-list__content u-pb-0 u-pt-0 u-pr-0 u-pl-10"> <div class="box-vcards-list__content u-pb-0 u-pt-0 u-pr-0 u-pl-10">
{% if attribute(idp.name, currentLanguage) is defined %}{{ attribute(idp.name, currentLanguage) }}{% elseif idp.name is iterable and idp.name is not empty %}idp.name|first{% else %}{{ '{campusmultiauth:undefined}'|trans }}{% endif %} {% if attribute(idp.name, currentLanguage) is defined %}{{ attribute(idp.name, currentLanguage) }}{% elseif idp.name is iterable and idp.name is not empty %}idp.name|first{% else %}{{ '{campusmultiauth:undefined}'|trans }}{% endif %}
</div> </div>
<div class="remove-option">
<span class="icon icon-times"></span>
</div>
</div> </div>
</button> </button>
</div> </div>
{% else %} {% else %}
<button class="list-group-item list-group-item-action d-flex align-items-center" type="submit"> <button class="list-group-item list-group-item-action d-flex align-items-center" type="submit" name="searchbox" value="{{ idp.entityid }}">
<span class="mb-0"> <div class="full-width">
<img src="{{ idp.img }}" class="img-searchbox" alt=""/> <span class="mb-0">
</span> <img src="{{ idp.img }}" class="img-searchbox" alt=""/>
<span class="margin-left-24"> </span>
{% if attribute(idp.name, currentLanguage) is defined %}{{ attribute(idp.name, currentLanguage) }}{% elseif idp.name is iterable and idp.name is not empty %}idp.name|first{% else %}{{ '{campusmultiauth:undefined}'|trans }}{% endif %} <span class="margin-left-24">
</span> {% if attribute(idp.name, currentLanguage) is defined %}{{ attribute(idp.name, currentLanguage) }}{% elseif idp.name is iterable and idp.name is not empty %}idp.name|first{% else %}{{ '{campusmultiauth:undefined}'|trans }}{% endif %}
</span>
<div class="remove-option">
<i class="fas fa-times"></i>
</div>
</div>
</button> </button>
{% endif %} {% endif %}
{% set counter = counter + 1 %} {% set counter = counter + 1 %}
......
<?php
use SimpleSAML\Module\campusmultiauth\Auth\Source\Campusidp;
use SimpleSAML\Logger;
$prevIdps = Campusidp::getCookie(Campusidp::COOKIE_PREVIOUS_IDPS) === null ?
[] :
json_decode(gzinflate(base64_decode(Campusidp::getCookie(Campusidp::COOKIE_PREVIOUS_IDPS))), true);
$entityid = $_POST['entityid'];
foreach ($prevIdps as $index => $idp) {
if ($idp['entityid'] === $entityid) {
unset($prevIdps[$index]);
}
}
Campusidp::setCookie(Campusidp::COOKIE_PREVIOUS_IDPS, base64_encode(gzdeflate(json_encode($prevIdps))));
...@@ -89,6 +89,11 @@ html, body { ...@@ -89,6 +89,11 @@ html, body {
margin: 24px; margin: 24px;
} }
.remove-option {
float: right;
margin-right: 10px;
}
.header-img { .header-img {
width: 170px; width: 170px;
margin: 0 auto 0 36px; margin: 0 auto 0 36px;
......
...@@ -117,6 +117,24 @@ document.addEventListener("DOMContentLoaded", function () { ...@@ -117,6 +117,24 @@ document.addEventListener("DOMContentLoaded", function () {
}); });
} }
document.querySelectorAll('.remove-option').forEach(function (element) {
element.addEventListener('click', function (e) {
e.stopPropagation();
let button = this.parentElement.parentElement;
$.ajax({
url: "./removeCookie.php",
type: "POST",
data: {
entityid: button.value
},
});
button.remove();
})
})
document.querySelectorAll('.idps-form-nojs-div').forEach(hideElement); document.querySelectorAll('.idps-form-nojs-div').forEach(hideElement);
document.querySelectorAll('.idps-form-div').forEach(showElement); document.querySelectorAll('.idps-form-div').forEach(showElement);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment