I would like to Display image on my page, I am struggling with evaluating a span tag which contains an HTTP URL.
<span sec:authentication="principal.image">
I have Updated the Authentication Object to have custom fields like image, firstName, lastName etc. So Basically below HTML
<div th:fragment="logout" class="logout" sec:authorize="isAuthenticated()">
<div class="container">
<div class="row">
<div class="span2 display-label">Name:</div>
<div class="span4 display-values">
<p>
<span sec:authentication="principal.firstName"></span>
<span sec:authentication="principal.lastName"></span>
</p>
</div>
</div>
<div class="row">
<div class="span2 display-label">Email:</div>
<div class="span4 display-values">
<p>
<span sec:authentication="name"></span>
</p>
</div>
</div>
<div class="row">
<div class="span2 display-label">Image:</div>
<div class="span4 display-values">
<span sec:authentication="principal.image"> </span>
</div>
</div>
<div>
<form action="#" th:action="#{/logout}" method="post">
<input type="submit" value="Logout"/>
</form>
</div>
</div>
</div>
Is printing
Name:
Abhishek
Email:
abhishek#gmail.com
Image:
https://scontent.xx.fbcdn.net/v/t1.0-0/p480x480/320426_10151045513476766_423049521_n.jpg?oh=766767548269c2483f0ad1e865d
As you can see I do have a valid URL I want to enclose this URL as <img src=""...>
I have tried
<img src = <span sec:authentication="principal.image"> </span></img>
<img th:src = <span sec:authentication="principal.image"> </span></th>
But none of these is working.
PS: I don't want to create a model attribute to store image URL and show it on page.
The syntax you have posted is not correct. Try using the authentication object with the following syntax:
<img th:if="${#authentication.principal.image}"
th:src="${#authentication.principal.image}"
alt="placeholder" />
Related
I have to implement pagination for a dynamically binded data for blogs on a page. On the click of the next button the next blog should come and so on.
Below is the code. It is done in asp.net mvc.
</div>
<div class="absolute cust-movetext">
<!-- <small class="text-xs font-semibold text-white">Pet Care</small> -->
#*<h1 class="text-6xl font-semibold text-white">Your Dog’s Best Life In Every Bite.fe In Every Bife In Every Bi</h1>*#
<h1 class="lg:text-4xl md:text-xl text-xl font-semibold text-white mb-2 ">#Model.BlogTitle.ToString()</h1>
<p class="text-sm font-semibold text-white ml-6px"> #Model.BloggerName</p>
</div>
</div>
</section>
<div id="wrapper">
<section>
<div id="pet_offline">
<div class="container mx-auto">
<div class="lg:pt-16 md:pt-8 pt-8 lg:px-12 md:px-12 px-4">
<div class="custp font-weightlow">
<p type="hidden" class="text-3d3d3d font-normal opac-84 lh-33px custp">
#Html.Hidden("BlogId")
#*#Html.Hidden(Model.BlogId)*#
#Html.Raw(Server.HtmlDecode(Model.BlogContent))
</p>
</div>
</div>
</div>
</div>
<div >
<button id="prebtn" class="btn">PREVIOUS</button>
<button id="nexbtn" class="btn" align="right">NEXT</button>
<img src="../content/images/bg-city.png" alt="city" class="w-full" />
</div>
</section>
</div>
Here is the code that has the data binded and I need to add pagination on this. How to do that?
I need it in one line, how to fix this?
Use the Bootstrap 5 grid system (ensure you are including the Bootstrap 5 css url)
Example:
<div class="container">
<div class="row">
<div class="col">
Column
</div>
<div class="col">
Column
</div>
<div class="col">
Column
</div>
</div>
</div>
https://getbootstrap.com/docs/5.0/layout/grid/
Your code would look, something like this:
<div class="d-none d-lg-block d-xl-block">
<div class="nav-item">
<div class="row">
<div class="col">
<form class="d-flex" action="search.php" method="get">
<input class="form-control me-2 px-3" type="search" placeholder="Search" name="search" aria-label="Search">
</form>
</div>
<div class="col">
<button class="btn btn-outline-success" data-bs-toggle="modal" data-bs-target="#loginmodal">Login</button>
<button class="btn btn-outline-success" data-bs-toggle="modal" data-bs-target="#signupmodal">Sign Up</button>
</div>
</div>
</div>
</div>
You could also put the signup button into a column on its own.
Add your buttons inside the form, or add d-flex to your nav-item class
Like this:
<div class="nav-item d-flex">
I have a View for my custom form.
In the view I have the following section:
<%-- area for showing Form's status or validation --%>
<div class="container roi">
<div class="Form__Status bg-pattern parallax-background">
<div class="Form__Status__Message <%: statusDisplay %>" data-f-form-statusmessage>
<div class="row">
<div class="col-md-12">
<h3>Vielen Dank!</h3>
<div class="row success-msg">
<div class="col-xs-3 center-block-xs col-sm-push-0 col-md-2">
<div class="square mb-1">
<div class="square-content circle bg-red">
<img class="icon-centered" src="/Static/img/icons/icon_check_white.svg" alt="">
</div>
</div>
</div>
<div class="col-xs-12 col-sm-9 col-md-10">
<p class="mt-1"> Übermittlung erfolgreich pp. </p>
<p class="mt-1" style="color:red;"> <%= message %> </p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
However when I test the form in my browser the success message looks like this:
<div class="container roi">
<div class="Form__Status bg-pattern parallax-background">
<div class="Form__Status__Message Form__Success__Message" data-f-form-statusmessage="">Übermittlung erfolgreich.</div>
</div>
</div>
How can I customize the success message?
Using language files you can edit the tag submitsuccess like this:
<?xml version="1.0" encoding="utf-8"?>
<languages>
<language name="English" id="en">
<episerver>
<forms>
<messages>
<formsubmission>
<submitsuccess>We got your form!</submitsuccess>
</formsubmission>
</messages>
</forms>
<episerver>
</language>
</languages>
I want to generate a list o products using thymeleaf and bootstrap so that I have three products on a row.
If it weren't for the rows, I would have done something like:
<div class="col-sm-4" th:each="product, : ${products}">
<div class="product">
<h3 th:text="${product.name}">Product name</h3>
<img th:src="${product.imagePath}" />
</div>
</div>
But I want to enclose each three products in a <div class="row"> and I just can't figure out how to do this. Has anyone else stumbled upon this problem ? How can I achieve the desired output without explicitly creating lists of three products in the controller ?
Desired output
<div class="row">
<div class="col-sm-4">
<div class="product">
<h3>Product 1 name</h3>
<img src="/path/to/image" />
</div>
</div>
<div class="col-sm-4">
<div class="product">
<h3>Product 2 name</h3>
<img src="/path/to/image" />
</div>
</div>
<div class="col-sm-4">
<div class="product">
<h3>Product 3 name</h3>
<img src="/path/to/image" />
</div>
</div>
</div>
<div class="row">
<div class="col-sm-4">
<div class="product">
<h3>Product 1 name</h3>
<img src="/path/to/image" />
</div>
</div>
<div class="col-sm-4">
<div class="product">
<h3>Product 2 name</h3>
<img src="/path/to/image" />
</div>
</div>
<div class="col-sm-4">
<div class="product">
<h3>Product 3 name</h3>
<img src="/path/to/image" />
</div>
</div>
</div>
I would include Apache Commons Collections 4.1 and use ListUtils to partition the list and iterate like this:
<th:block th:with="partitions=${T(org.apache.commons.collections4.ListUtils).partition(products, 3)}">
<div class="row" th:each="partition: ${partitions}">
<div class="col-sm-4" th:each="product: ${partition}">
<div class="product">
<h3 th:text="${product.name}">Product name</h3>
<img th:src="${product.imagePath}" />
</div>
</div>
</div>
</th:block>
I am having a issue with the styling for the iphone.
I have this form where it displays list of doctors base on a list of doctors from the db and it it generates the results correctly.
However, when the results are generated, you need to swipe from right to left to see the info.
How can I target only Iphone users so the information is within the frame of the iphone?
Here is the following form I used. Ignore the "##", I am using coldfusion and bootstrap.
$(function(){
$('##myModal').modal('show');
});
<div class="widthResults">
<nav class="hidden-xs visible-md visible-lg" ng-show="ShowResults"><uib-pagination boundary-links="true" max-size="maxPageNumbersToShow" ng-model="currentPage" total-items="resultsCount"> </uib-pagination></nav>
<nav class="visible-xs hidden-md hidden-lg" ng-show="ShowResults"><uib-pager ng-model="currentPage" total-items="resultsCount"> </uib-pager></nav>
<div class="container">
<div id="searchResults" ng-repeat="e in providers" ng-show="ShowResults">
<div class="row">
<hr />
<h4>{{e.FullName}}</h4>
</div>
<div class="row">
<div class="col-md-4 no-margin padding"><strong>Specialty: </strong>{{e.Specialty}}<br />
<span class="padding"><strong>Gender:</strong> {{e.Gender}}</span><br />
<strong>Language(s):</strong> {{e.Languages}}</div>
<div class="col-md-4 no-margin"><strong>Clinic: </strong> <i class="glyphicon glyphicon-map-marker"></i> {{e.Address1}}<br />
<span class="shiftAdd padding">{{e.Address2}} </span><br />
<strong>Phone:</strong> <i class="glyphicon glyphicon-earphone"></i> {{e.Phone | PhoneNumber}}</div>
</div>
</div>
</div>
<nav class="visible-xs hidden-md hidden-lg" ng-show="ShowResults">
<hr /><uib-pager ng-model="currentPage" total-items="resultsCount"> </uib-pager></nav>
</div>