I try to show different status depending on a field gallerypicture.status with thymeleaf
<tr th:each="image: ${galleryPictures}" class=".col-sm-7">
<td th:switch="${image.status}">
<p th:case="'neverReviewed'">
<div class="img-container" style="max-width: 50px" data-toggle="tooltip" data-placement="top" th:title="#{root.client.mitarbeiter.detectionTable.neverReviewed}">
<img th:src="#{/img/Check_blue_icon.png}" style="width: 50%; height: 50%; object-fit: contain;">
</div>
</p>
<p th:case="'partiallyReviewed'">
<div class="img-container" style="max-width: 50px" data-toggle="tooltip" data-placement="top" th:title="#{root.client.mitarbeiter.detectionTable.partiallyReviewed}">
<img th:src="#{/img/Check_orange_icon.png}" style="width: 50%; height: 50%; object-fit: contain;">
</div>
</p>
<p th:case="'fullyReviewed'">
<div class="img-container" style="max-width: 50px" data-toggle="tooltip" data-placement="top" th:title="#{root.client.mitarbeiter.detectionTable.fullyReviewed}">
<img th:src="#{/img/Check_green_icon.png}" style="width: 50%; height: 50%; object-fit: contain;">
</div>
</p>
<p th:case="'*'">
<div class="img-container" style="max-width: 50px" data-toggle="tooltip" data-placement="top" th:title="#{root.client.mitarbeiter.detectionTable.neverReviewed}">
<img th:src="#{/img/Check_blue_icon.png}" style="width: 50%; height: 50%; object-fit: contain;">
</div>
</p>
</td>
with galleryPicture.status defined as an enum as follows:
public enum GalleryImage_DetectionStatus {
neverReviewed,
partiallyReviewed,
fullyReviewed;
}
But thymeleaf applies all 3 cases at once. What is wrong with my code?
The default case '*' should be in the end. Please see here thymeleaf tutorial Then it will catch only non-specific cases.
for matching enum with switch case:
th:case="${T(yourpackage.GalleryImage_DetectionStatus).neverReviewed}"
Related
I made a product slider using Html Css JS and I want the scrollby left and right goes smoth instead of going directly.
Here is my website it works fine on the first slider but the second slider and third that have this issue
Html
<!-- Container for the layout of the full carousel -->
<div class="container2 cover2">
<div class=" scrolling-wrapper scrollmenu-SLIDER2 scroll-images2">
<div class="card2">
<a href=" https://ma.santemagasin.com/produit/hemoconfort/">
<div class="card-img2">
<img src=" https://ma.santemagasin.com/wp-content/uploads/2022/10/hemo-confort-compr.webp">
<h5 class="Product-Disc"> مكمل طبيعي لراحة البواسير
علاج مضمون من المصدر للبواسير الداخلية
حل نهائي للنزيف والالم</h5>
<p class="Product-Prix"> 249د.م.
</p>
<span class="Stars">★★★★★</span>
</div>
</a>
</div>
<div class="card2">
<a href="https://ma.santemagasin.com/produit/iron-hair/">
<div class="card-img2">
<img src="https://ma.santemagasin.com/wp-content/uploads/2022/09/iron-300x300.webp">
<h5 class="Product-Disc">
مكمل طبيعي خاص بالرجال
sante magasinمن
حل لتساقط الشعر
ملء فراغات اللحية
60 كبسولة نباتية
</h5>
<p class="Product-Prix">249 د.م.</p>
<span class="Stars">★★★★★</span>
</div>
</a>
</div>
<div class="card2">
<a href="https://ma.santemagasin.com/produit/vitex/">
<div class="card-img2">
<img src="https://ma.santemagasin.com/wp-content/uploads/2022/09/vtx-300x300.webp">
<h5 class="Product-Disc">
مكمل طبيعي من كف مريم
للنساء ٬ الدورة الشهرية
الحمل ٬ 60 كبسولة نباتية
صنع مغربي٬ 300 ملغرام
</h5>
<p class="Product-Prix">249 د.م.</p>
<span class="Stars">★★★★★</span>
</div>
</a>
</div>
<div class="card2">
<a href="https://ma.santemagasin.com/produit/perfecto/">
<div class="card-img2">
<img src="https://ma.santemagasin.com/wp-content/uploads/2022/09/prfrcto-300x300.webp">
<h5 class="Product-Disc">
مكمل طبيعي
لزيادة المناطق الأنثوية
بدون أضرار جانبية
مستخلصات طبيعية
60 كبسولة٬ 300 ملغرام
</h5>
<p class="Product-Prix">249 د.م.</p>
<span class="Stars">★★★★★</span>
</div>
</a>
</div>
<div class="card2">
<a href="https://ma.santemagasin.com/produit/hair-lit/">
<div class="card-img2">
<img src="https://ma.santemagasin.com/wp-content/uploads/2022/09/hair-lit-300x300.webp">
<h5 class="Product-Disc">
للنساء الشعر والاضافر
تركيبة مطورة ٬ مكمل طبيعي
60 كبسولة نباتية
</h5>
<p class="Product-Prix">249 د.م.</p>
<span class="Stars">★★★★★</span>
</div>
</a>
</div>
<div class="card2">
<a href="https://ma.santemagasin.com/produit/strong-carti/">
<div class="card-img2">
<img src="https://ma.santemagasin.com/wp-content/uploads/2022/09/strong-300x300.webp">
<h5 class="Product-Disc">
مكمل طبيعي من
sante magasin
حل للسياتيك والروماتيزم
60 كبسولة نباتية
</h5>
<p class="Product-Prix">249 د.م.</p>
<span class="Stars">★★★★★</span>
</div>
</a>
</div>
<div class="card2">
<a href="https://ma.santemagasin.com/produit/pure-skin/">
<div class="card-img2">
<img src="https://ma.santemagasin.com/wp-content/uploads/2022/09/pure-skin-300x300.webp">
<h5 class="Product-Disc">
مكمل طبيعي
من sante magasin
بشرة صافية خالية
من الشوائب والبثور
60 كبسولة نباتية
</h5>
<p class="Product-Prix">249 د.م.</p>
<span class="Stars">★★★★★</span>
</div>
</a>
</div>
<div class="card2">
<a href="https://ma.santemagasin.com/produit/maca/">
<div class="card-img2">
<img src="https://ma.santemagasin.com/wp-content/uploads/2022/09/maca-300x300.webp">
<h5 class="Product-Disc">
مكمل طبيعي
من sante magasin
كبسولات جذور الماكا
الطبيعية - العضوية
محفز الطاقة والقوة
</h5>
<p class="Product-Prix">249 د.م.</p>
<span class="Stars">★★★★★</span>
</div>
</a>
</div>
<div class="card2">
<a href="https://ma.santemagasin.com/produit/collagen-complex/">
<div class="card-img2">
<img src="https://ma.santemagasin.com/wp-content/uploads/2021/11/collagine-300x300.webp">
<h5 class="Product-Disc">
مكمل طبيعي
من sante magasin
كولاجين بحري
تركيبة طبيعية
60 كبسولة نباتية
</h5>
<p class="Product-Prix">199 د.م.</p>
<span class="Stars">★★★★★</span>
</div>
</a>
</div>
<div class="card2">
<a href="https://ma.santemagasin.com/produit/control-cholesterol/">
<div class="card-img2">
<img src="https://ma.santemagasin.com/wp-content/uploads/2022/09/bio-cholesto-300x300.webp">
<h5 class="Product-Disc">
مكمل طبيعي
من sante magasin
كوليسترول متوازن
محاربة الدهون الثلاثية
60 كبسولة نباتية
</h5>
<p class="Product-Prix">249 د.م.</p>
<span class="Stars">★★★★★</span>
</div>
</a>
</div>
<div class="card2">
<a href="https://ma.santemagasin.com/produit/bio-oral-complement-alimentaire/">
<div class="card-img2">
<img src="https://ma.santemagasin.com/wp-content/uploads/2022/09/bio-oral-300x300.webp">
<h5 class="Product-Disc">
مكمل لصحة الفم
حل طبيعي من المصدر
الرائحة الكريهة٫ اللثة
60 كبسولة نباتية
</h5>
<p class="Product-Prix">249 د.م.</p>
<span class="Stars">★★★★★</span>
</div>
</a>
</div>
<div class="card2">
<a href="https://ma.santemagasin.com/produit/ibs-active-complement-alimentaire/">
<div class="card-img2">
<img src="https://ma.santemagasin.com/wp-content/uploads/2022/09/ibs-300x300.webp">
<h5 class="Product-Disc">
مستخلصات طبيعية
300 ملغرام - 60 كبسولة
راحة الجهاز الهضمي
</h5>
<p class="Product-Prix">249 د.م.</p>
<span class="Stars">★★★★★</span>
</div>
</a>
</div>
<div class="card2">
<a href="https://ma.santemagasin.com/produit/saw-palmetto/">
<div class="card-img2">
<img src="https://ma.santemagasin.com/wp-content/uploads/2022/09/palmetto-300x300.webp">
<h5 class="Product-Disc">
مكمل طبيعي
من sante magasin
للرجال - صحة البروستاتا
مستخلصات طبيعية
60 كبسولة نباتية
</h5>
<p class="Product-Prix">249 د.م.</p>
<span class="Stars">★★★★★</span>
</div>
</a>
</div>
<div class="card2">
<a href="https://ma.santemagasin.com/produit/zen-stress/">
<div class="card-img2">
<img src="https://ma.santemagasin.com/wp-content/uploads/2022/09/zen-strees-300x300.webp">
<h5 class="Product-Disc">
مكمل طبيعي مغربي
من sante magasin
نوم مريح - حل للتوتر العصبي
60 كبسولة نباتية
</h5>
<p class="Product-Prix">249 د.م.</p>
<span class="Stars">★★★★★</span>
</div>
</a>
</div>
</div>
</div>
<div class="cover2">
<button class="left" onclick="leftScroll2()">❮</button>
<button class="right" onclick="rightScroll2()">❯</button>
</div>
CSS
.cover2 {
padding: 0px 30px;
position: relative;
}
.left {
position: absolute;
right: -20px;
top:-170PX;
background-color: transparent !important;
color: #006f07 !important;
font-size: 20px;
font-weight: bold;
border-color: grey;
border-radius: 20%;
}
.right:hover {
background-color: #006F07 !important;
color: white !important;
}
.left:hover {
background-color: #006F07 !important;
color: white !important;
}
.right {
position: absolute;
left: -20px;
top:-170PX;
background-color: transparent !important;
color: #006f07 !important;
font-size: 20px;
font-weight: bold;
border-color: grey;
border-radius: 20%;
margin-left :-10px;
}
.scrollmenu-SLIDER2 {
width: 100%;
height: auto;
display: flex;
flex-wrap: nowrap;
overflow-x: auto;
overflow-y: hidden;
}
.container2 {
display: flex;
overflow-x: auto;
}
.card2 {
padding: 10px;
margin: 10px;
border-radius: 20px;
line-height: 1.2;
background-color: white;
text-align: center;
}
.card2 img{
border-radius: 10px;
}
.Product-Prix{
text-decoration:none;
color : #006f07;
font-size: 20;
font-weight: bold;
margin:5px !important;
}
.Product-Disc{
color: #789FD6;
font-size: 15px;
display: -webkit-box;
max-width: 200px;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
text-align: center;
padding-top: 5px;
margin: auto;
width: 100%;
}
.scroll-images {
width: 100%;
height: auto;
display: flex;
flex-wrap: nowrap;
overflow-x: auto;
overflow-y: hidden;
scroll-behavior: smooth;
-webkit-overflow-scrolling: touch;
}
.Stars{
display: flex;
justify-content: center;
color: orange;
letter-spacing: 0.5px;
font-size: 20px;
}
.card-img2 {
width: 09rem;
}
::-webkit-scrollbar {
display: NONE;
}
#media only screen and (max-width: 800px) {
.card-img2 {
width: 07rem;
}
.card-img3 {
width: 10rem;
}
.left , .right {
display:none;
}
.cover2{
padding: 0px 5px;
position: relative;
}
JS
<script>
function leftScroll2() {
const left = document.querySelector(".scroll-images2");
left.scrollBy(2000, 0) ;
}
function rightScroll2() {
const right = document.querySelector(".scroll-images2");
right.scrollBy(-2000, 0) ;
}
</script>
I tried give different classes for every element than the first slider but the same problem still stop the slider from going smoothly
I have an Issue with the Bootstrap Carousel.
I want to have the fixed effect but in Firefox it's giving jumps.
HTML
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<div class="carousel-item-content" style="background:url('http://www.kia.ca/content/2018-soul/gallery/gallery-img-3.jpg')">
</div>
</div>
<div class="carousel-item">
<div class="carousel-item-content" style="background:url('http://carimages.silovendes.com/imgAutos/11/1056445-0.jpg')">
</div>
</div>
<div class="carousel-item">
<div class="carousel-item-content" style="background:url('https://kia.com.gt/images/modelos/rio/img/exterior-old//thumb/5.jpg')">
</div>
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
CSS
.carousel-item {
width: 100%;
height: 100vh;
}
.carousel-item .carousel-item-content {
width: 100%;
height: 100%;
-webkit-background-size: cover !important;
-moz-background-size: cover !important;
-o-background-size: cover !important;
background-size: cover !important;
background-position: center center !important;
background-repeat: no-repeat !important;
overflow: hidden !important;
background-attachment: fixed !important;
}
You can try it hier:
https://codepen.io/TamZam/pen/ZvQvox
Any ideas why it happens?
Thanks!
Below is the code :
I want to select the radio button which is present within the span class. Could you please help in identifying a successful xpath ?
<div id="quicklinkbox" class="col-md-2" data-position="left" data-intro="You can directly download payslip PDFs for the last 3 or 6 months. (India payslip only)" data-step="4">
<div style="background-color: transparent; margin-top: 28px;">
<div id="panel-title" ng-click="changeExpand(expand);" style="position: relative; left: 24px; cursor: pointer; font-weight: 500;">Quick Download</div>
<div id="panel-title" class="panel-body" style="text-align: left; font-weight: lighter; padding: 5px 0px 0px 50px; font-weight: 400">
<span style="margin-left: -16px;">Payslips for</span>
<form class="ng-pristine ng-valid">
<div class="form-group">
<div class="radio">
<span same-heightcol="" style="font-size: 16px;">
<input class="ng-pristine ng-valid" type="radio" ng-model="payslipselectedopt" style="cursor: pointer;" value="3" name="payslipradio"/>
<span style="font-size: 16px; position: relative; top: -5px;">Last 3 months</span>
</span>
</div>
<div class="radio">
<span style="font-size: 16px;">
<input class="ng-pristine ng-valid" type="radio" ng-model="payslipselectedopt" value="6" name="payslipradio" style="cursor: pointer;"/>
<span style="font-size: 16px; position: relative; top: -5px;"> Last 6 months</span>
</span>
</div>
<img style="margin-bottom: -12px; margin-left: -16px; cursor: pointer;" ng-click="downloadbulkpayslip()" src="appResources/images/Download-button.png"/>
</div>
</form>
</div>
</div>
</div>
</div>
You can use:
//span/input[#name='payslipradio' and #value='6']
Explanation:
//span -> Will search in all HTML al span tag
/input -> Will searth inside the span tag previous selected a input tag
[#name='payslipradio' and #value='6'] -> Will search in the previous selected tags one that the name attr is equals to 'pslpradio' and value attr equals to '6'
//*span[input#class='ng-pristine ng-valid' and #type='radio']))
Below is some HTML code, in which I need to find the element with the content win8 (last element, <div class="desc">win8</div>).
<div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable ui-resizable" style="display: block; z-index: 5002; outline: 0px none; position: absolute; height: auto; width: 800px; top: 7px; left: 537px;" tabindex="-1" role="dialog" aria-labelledby="ui-dialog-title-1">
<div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">
<div class="multi-wizard instance-wizard ui-dialog-content ui-widget-content" style="width: auto; min-height: 0px; height: 518px;">
<div class="progress">
<form novalidate="novalidate">
<div class="steps">
<div class="step setup loaded" wizard-step-id="setup" style="display: none;">
<div class="step select-iso loaded" wizard-step-id="select-iso" style="display: block;">
<div class="wizard-step-conditional select-template" style="display: block;">
<div class="main-desc">
<div class="template-select content tab-view ui-tabs ui-widget ui-widget-content ui-corner-all">
<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
<input type="hidden" value="XenServer" name="hypervisor" wizard-field="hypervisor">
<div id="instance-wizard-featured-templates" class="ui-tabs-panel ui-widget-content ui-corner-bottom">
<div class="select-container">
<div class="select **even**">
<input type="radio" name="templateid" wizard-field="template" value="b0c24832-6fdf-11e4-a45f-b6eb114441ae">
<div class="select-desc">
</div>
<div class="select **odd**">
<input type="radio" name="templateid" wizard-field="template" value="7720cdb2-b81a-4839-94cd-b56b660e3324">
<div class="select-desc">
<div class="name">win8</div>
<div class="desc">win8</div>
</div>
</div>
I tried the following XPath:
.//*[#id='instance-wizard-featured-templates']/div/div[2]/input
The issue is the screen has 2 elements, even and odd. Each time it loads it swaps the values. So the XPath selects the wrong element.
Is there a way to exactly select win8?
Assuming you always want to get the element with the class named 'desc', the correct XPath is looks like this:
//div[#class="desc" and text()="win8"]
This selects all <div> elements having the class 'desc' and 'win8' as text.
Help me to find the xpath of an element, I want to find the with the #class="tipN button greenB" in the second [2] which has #class="middleNav"
<div id="rightSide">
<div class="topNav">
<style type="text/css">
<div class="resp">
<div class="titleArea">
<div class="wrapper">
<div class="pageTitle">
<div class="middleNav" data-bind="visible: showAllButtons" style="display: none;">
<a id="saveformtop" class="tipN button greenB" data-bind="click: SaveForm, visible: showGridButtons" original-title="Save Staff data" href="#" style="margin: 5px; display: none;" novalidate="novalidate">
<a class="tipN button greenB" original-title="Save Staff data" href="#" style="margin: 5px;" data-bind="click: SaveRestrictions, visible: showRestriction">
<a id="cancelbtntop" class="tipN button redB" original-title="Cancel all edits" data-bind="click:CancelForm, visible: showGridButtons" style="margin: 5px; display: none;">
<a class="tipN button redB" original-title="Cancel all edits" data-bind="click: CancelRestriction, visible: showRestriction" style="margin: 5px;">
<div class="clear"> </div>
</div>
<div class="middleNav" data-bind="visible: !showAllButtons()" style="">
<a id="cancelbtntop" class="tipN button redB" original-title="Cancel all edits" data-bind="click:CancelForm, visible: showGridButtons" style="margin: 5px; display: none;">
<img class="icon" src="../../content/css/images/icons/light/arrowLeft.png" alt="">
<span>Back</span>
</a>
<a class="tipN button greenB" original-title="Save Staff data" href="#" style="margin: 5px;" data-bind="click: SaveRestrictions, visible: showRestriction">
<img class="icon" src="../../content/css/images/icons/light/check.png" alt="">
<span>Save</span>
</a>
<a class="tipN button redB" original-title="Cancel all edits" data-bind="click: CancelRestriction, visible: showRestriction" style="margin: 5px;">
<div class="clear"> </div>
</div>
</div>
</div>
<div class="clear"> </div>
<div class="line"> </div>
<div>
</div>
<div id="footer">
<style>
<div id="leftsidehide" style="display: none;">
</div>
I'm not sure to fully understand your question. But here is what I would do from what understood :
//*[contains(#class, 'middleNav')][2]/*[contains(#class, 'tipN button greenB')]
Hope I understood you correctly:
(//div[#class="middleNav"])[2]/a[#class="tipN button greenB"]
Try with following if it works for you:
//div[#class='middleNav']//a[#class='tipN button greenB']