fragments in Thymeleaf - html

I have created this fragment html page in Thymeleaf
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<ul th:fragment="top-menu" class="nav navbar-nav mai-top-nav">
<li class="nav-item"><a class="nav-link nav-link-selected" href="pages-my-ppt.html">My PPT</a></li>
<li class="nav-item"><a class="nav-link" href="pages-all-ppt.html">All PPT</a></li>
<li class="nav-item"><a class="nav-link" href="pages-my-wallets.html">Wallets</a></li>
<li class="nav-item"><a class="nav-link" href="pages-purchases.html">Purchases</a></li>
<li class="nav-item"><a class="nav-link" href="pages-alarms.html">Alarms</a></li>
</ul>
</html>
I use this fragment in another template:
<ul th:replace="bonanza/common/top-menu :: top-menu" />
but I got this error message: No end tag (</ul>).

Just wrap your ul fragment with a <div> and add th:fragment notation to that div.
For example:
<div th:fragment="top-menu">
<ul class="nav navbar-nav mai-top-nav">
<li class="nav-item"><a class="nav-link nav-link-selected" href="pages-my-ppt.html">My PPT</a></li>
<li class="nav-item"><a class="nav-link" href="pages-all-ppt.html">All PPT</a></li>
<li class="nav-item"><a class="nav-link" href="pages-my-wallets.html">Wallets</a></li>
<li class="nav-item"><a class="nav-link" href="pages-purchases.html">Purchases</a></li>
<li class="nav-item"><a class="nav-link" href="pages-alarms.html">Alarms</a></li>
</ul>
</div>
and use a div at another template:
<div th:replace="bonanza/common/top-menu :: top-menu"></div>
or you can just add a closing tag to your ul(but i am not sure with this, above is better)
<ul th:replace="bonanza/common/top-menu :: top-menu"></ul>

Related

preventDefault() stops a tag from working

I'm trying to make my navbar links use the active class, so i can switch styles on click.
But when i put preventDefault() in my onclick event to stop the event to refresh the page, it stops working completely, the links won't work at all
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav navbar-style ml-auto">
<li class="nav-item">
<a class="nav-link" href="/">Acasa</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/about us">About us</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/apartments">Apartments</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/houses">Houses</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/location">Location</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/contact">Contact</a>
</li>
</ul>
</div>
and the jquery that i use:
$(".navbar-nav .nav-link").on("click", function (e) {
e.preventDefault();
$(".navbar-nav").find(".active").removeClass("active");
$(this).addClass("active");
});

how to redirect to another page with vue component template

I want to redirect template component. I go to another template component but I don't find the way
<template>
<div class="section-wrapper mg-t-20">
<label class="section-title">Gestion De Datos</label>
<!-- <p class="mg-b-20 mg-sm-b-40">Below is an example of a pill navigation in both light and dark.</p> -->
<div class="pd-10 bd">
<ul class="nav nav-pills flex-column flex-md-row" role="tablist">
<li class="nav-item"><a class="nav-link active" data-toggle="tab" href="#" role="tab">Reporte</a></li>
<li class="nav-item" >
<a class="nav-link" data-toggle="tab" href="REDIRECT TO ANOTHER VUE COMPONENT PAGE" role="tab">Agregar Cliente</a>
</li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#" role="tab">Asignar</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#" role="tab">Cambiar Estado</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#" role="tab">Importar</a></li>
<!-- <li class="nav-item"><a class="nav-link" data-toggle="tab" href="#" role="tab">Contact</a></li> -->
</ul>
</div><!-- pd-10 -->
</div><!-- section-Datos -->
</template>
Image of source code vue.js

nav-pills not working in my code (Bootstrap 4)

I'm trying to add nav-pills to tag but it's not working, why?
I really tried everything but nothing works!
<ul class="nav nav-pills flex-column">
<li class="nav-item">
<a class="nav-link" href="dashboard.php">Dashboard</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Add New Post</a>
</li>
</ul>
Pills require the active class.
<ul class="nav nav-pills flex-column">
<li class="nav-item">
<a class="nav-link active" href="">Dashboard</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Add New Post</a>
</li>
</ul>
https://www.codeply.com/go/xrln5uphko

Nav tabs' bottom border can't removed like given in official site

On the official page of agular for the nav tabs we have no bottom border for the selected tab
official page
But when I am using the same code , I get a border even on the selected nav-item
myTab example
Here is my HTML Code
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link active" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">tab 1</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">tab 2</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">tab 3</a>
</li>
</ul>`
And My CSS :
.nav-item .active
{
background-color: rgb(119, 218, 218) !important;
border-bottom: 0px;
color:rgb(168, 19, 168);
}
Could someone tell me to remove the border bottom from active nav-item ???
Edit: I previously made a mistake. Here's the correct code (notice the corresponding css file):
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css">
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link active" href="#">Active</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
So, it's important that you link the correct css file in your header. Once you do that, no additional custom css is required to make it work. Also, make sure that none of the other custom css you potentially have interferes with this code.
Remove the nav-tabs class and will work

How do I give external or local html doc link to bootstrap nav-pills?

I need to link my another webpage to my pictures nav menu.
Ex: if I click my pictures menu , it opens google.com.
Framework: bootstrap 4
div class="row row2">
<div class="col-md-12">
<ul class="nav nav-pills justify-content-center nav-justified" role="tablist">
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#">About me</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#">My pictures</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#">My music</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#">My files</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#">My videos</a>
</li>
</ul>
</div>
</div>
This will work :)
<div class="row row2">
<div class="col-md-12">
<ul class="nav nav-pills justify-content-center nav-justified" role="tablist">
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#">About me</a>
</li>
<li class="nav-item">
<a class="nav-link" target="_blank" href="http://google.com">My pictures</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#">My music</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#">My files</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#">My videos</a>
</li>
</ul>
</div>
</div>
This is the correct code for my question. i solve this with your help. thankyou
Html
<div class="row row2">
<div class="col-md-12">
<ul class="nav nav-pills justify-content-center nav-justified" role="tablist">
<li class="nav-item">
<a class="nav-link" href="about_me.html">About me</a>
</li>
<li class="nav-item">
<a class="nav-link" href="my_pictures.html">My pictures</a>
</li>
<li class="nav-item">
<a class="nav-link" href="my_music.html">My music</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="my_files.html">My files</a>
</li>
<li class="nav-item">
<a class="nav-link" href="my_videos.html">My videos</a>
</li>
</ul>
</div>
</div>
CSS
.active {
background-color: #39a0c9 !important;
color: #fff !important;
}