Split views in different tabs - asp.net-core-mvc

I have a page where I want the data to be showed in multiple tabs (and the data may only be loaded when clicked on the tab):
View
#model project.Models.AdminModels.Module
#{
ViewBag.Title = "Module";
}
<h2>#ViewBag.Title: #Model.Name</h2>
<div class="ui secondary pointing menu">
<a class="item" asp-controller="Module" asp-action="Details" asp-route-id="#Model.ID">
Details
</a>
<a class="item" asp-controller="Module" asp-action="Menus" asp-route-id="#Model.ID">
Menus
</a>
</a>
<a class="item" asp-controller="Module" asp-action="Menus" asp-route-id="#Model.ID">
Other tabs
</a>
</div>
<div class="ui segment" id="content">
</div>
Is their a way that I can load the data in the content div, without reloading and redefining the whole page?

Related

How can I display vue.js data in blade

I am doing a small project with vue.js and laravel. I have a list of products, when I click on a specific product on "Quick view" button I want to show all data about that product in a modal but the data is not showing in the modal.
Can you help me please. Here is my code:
#extends('app')
#section('content')
<div id ="crud" class="row">
<div class="col-xs-12">
<h1 class="page-header">Lista de Articulo</h1>
</div>
<div class="wrap-icon right-section col-md-12" data-toggle="modal" data-target="#list" >
<div class="wrap-icon-section wishlist">
<a href="#" class="link-direction">
<i class="fa fa-heart" aria-hidden="true"></i>
<div class="left-info">
<span class="index">0 item</span>
<br>
<span class="title">Wishlist</span>
</div>
</a>
</div>
</div>
<div class="row">
<div v-for="keep in keeps" class="col-md-4" style="width:25%;" #mouseover="showByIndex = keep" #mouseout="showByIndex = null">
<div class="container">
<img :src="keep.foto" style="width:100%; max-width:150px;">
<button class="btn" v-show="showByIndex === keep" v-on:click.prevent="showKeep(keep)">Quick view</button>
</div>
<h3>
<b> #{{keep.nombre}}</b>
</h3>
<p> #{{keep.descripcion}}</p>
I fixed it. The error was because I called the modal file outside the div. Thanks to everybody.
you can't send data directly from vue in blade structure, you need to write a component for that.
https://v3.vuejs.org/examples/modal.html#modal-component

Semantic-ui integration with Laravel 5.7

Semantic-ui is integrated with my laravel app. All buttons are working but Menubar is not working i.e whatever code I copied from documentation it is showing like that only.
I have linked these files -
<link rel="stylesheet" type="text/css" href="{{asset('semantic/dist/semantic.min.css')}}">
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="{{asset('semantic/dist/semantic.min.js')}}"></script>
<div class="ui secondary menu">
<a class="active item"> Home </a>
<a class="item"> Messages </a>
<a class="item"> Friends </a>
<div class="right menu">
<div class="item">
<div class="ui icon input">
<input type="text" placeholder="Search...">
<i class="search link icon"></i>
</div>
</div>
<a class="ui item"> Logout </a>
</div>
By default Home is active but when i click or focus on another item i.e messages or Friends , it is not showing as active otherwise hovering effect is working fine.
As you see, only the first menu item is marked as active in your code, so why do you expect any other menu items to be marked as active when you click on them?
<a class="active item"> Home </a>
You should detect which menu item is active when you render the menu and set active class to the necessary item.
So, for example, when you are on "Home" page your menu should look like this:
<a class="active item"> Home </a>
<a class="item"> Messages </a>
<a class="item"> Friends </a>
But when your are on the "Friends" page your menu should look like this instead:
<a class="item"> Home </a>
<a class="item"> Messages </a>
<a class="active item"> Friends </a>
And everything else depends on your implementation (either it's PHP or other server-side language if you generate your menu or JavaScript if you toggle its state in the browser).

How to include tab contents in spring when using tabbed form

I am trying to create a registration page that is using a tabbed view.
It was working perfectly fine when I tried to include all the tab contents inside respective tabs in single page.
Later I wrote the contents of each tab to different jsp pages specifically for each tab and tried to include the jsp pages using
But now all the jsp pages' contents are being listed under a single tab. I mean each tab is displaying contents of other tabs too.
<div class="panel-body">
<div class="reg-panel">
<ul id="breadcrumbs-one" class="nav nav-tabs" role="tablist">
<li class="active"><a data-toggle="tab" href="#main">Basic
Details</a></li>
<li><a data-toggle="tab" href="#tab1">Grade Details</a></li>
<li><a data-toggle="tab" href="#tab2">Facilities</a></li>
<li><a data-toggle="tab" href="#tab3">Awards</a></li>
<li><a data-toggle="tab" href="#">Documents</a></li>
<li><a data-toggle="tab" href="#preview">Preview</a></li>
<li><a data-toggle="tab" href="#submit">Submit</a></li>
</ul>
<div class="tab-content">
<div id="main" class="tab-pane fade in active">
<jsp:include page="/WEB-INF/views/basic_details.jsp" />
</div>
<div id="tab1" class="tab-pane fade">
<jsp:include page="/WEB-INF/views/grade_details.jsp" />
</div>
<div id="tab2" class="tab-pane fade">
<jsp:include page="/WEB-INF/views/grade_details.jsp" />
</div>
....... and so and so ......
The problem here is that the contents of all the tabs basic details, grade details, awards and all such is being displayed under one tab itself.
Please help me resolve this. Which method should I actually have used? Is it better to use jstl or spring url instead?
First get the list in spring controller.
#RequestMapping(value = { "/registration" }, method = RequestMethod.GET)
public ModelAndView registration(ModelAndView model)
{
List<Registration> regList = regService.regList();
model.addObject("regList ", regList);
model.setViewName("registration");
setBreadCrumb(model);
return model;
}
Now the list is added using model.addObject("regList ", regList);
Use the regList in jsp using JSTL you can do
<c:if test="${regList.grade=="something"}">
show this
</c:if>
<c:if test="${regList.facilities=="something-else"}">
show that
</c:if>

How to fill my html with json object?

I am new in ajax.
I am trying to get value and want to fill in html code snippet.
I have html code and json object that has value.
Now I want to show the specific value in the different-different part of html code.
Here is my html code:-
<div>
<div class="borb clearfix">
<div class="profileholder fleft">
<img src="images/users/1.png" class="userpic">
<div class="icon state green"></div>
</div>
<div class="remainder">
<div class="padl10">
<div class="username">Anurag Shivpuri</div>
<div class="desig">Cheif Information Officer</div>
<div class="loc">Credit Operation | Pune</div>
</div>
</div>
</div>
<ul class="userdata">
<li>
<span class="lbl">Employee Code :</span>
<span> 2007</span>
</li>
<li>
<span class="lbl">Role_Designation :</span>
<span> Senior HR</span>
</li>
<li>
<span class="lbl">Department :</span>
<span> HR</span>
</li>
<li>
<span class="lbl">Sub_Department :</span>
<span> Talent Acquisition</span>
</li>
<li>
<span class="lbl">Official E-mail Id :</span>
<span> atul.gupta#bajajfinserve.co.in</span>
</li>
<li>
<span class="lbl">Mobile No :</span>
<span> 9844333932</span>
</li>
</ul>
<div class="footbar">
Reward
Incentive
Movement
Leaves
LnD
</div>
On success of ajax I am getting the value now I want to fill it in my html code.
Please help me.
You can use a library (like knockout) to do that, or you can use jQuery to create the elements:
$("<div>").append("some text").appendTo("body"); //creates a div, append some text and...
If you already have a success event in your ajax, you could grab an empty DOM element and set its content.
document.getElementById('placeholder').innerHTML = jsonData.myProperty;
You should use innerHTML in javascript.
Set some ID on the element you need to update:
<li>
<span class="lbl">Employee Code :</span>
<span id='employeeCode'> 2007</span>
</li>
Then update it with your json value:
document.getElementById('employeeCode').innerHTML= yourJsonObject.employeeCodeValue;

Gumby CSS framework parent anchor in dropdown on mobile

Using gumby CSS framework, when in mobile layout, the top level anchors with dropdowns are clickable. When clicked, the anchor loads a new page instead of showing the dropdowns. Has anyone encountered this problem and found a solution?
<div class="row navbar pretty" id="nav1">
<!-- Toggle for mobile navigation, targeting the <ul> -->
<a class="toggle" gumby-trigger="#nav1 > .row > ul" href="#"><i class="icon-menu"></i></a>
<h1 class="four columns logo">
<a href="#">
<img src="/img/gumby_mainlogo.png" gumby-retina />
</a>
</h1>
<ul class="eight columns">
<li>Features</li>
<li>
<!-- This link opens dropdown but also redirects to the href -->
Documentation
<div class="dropdown">
<ul>
<li>The Grid</li>
<li>UI Kit</li>
<li>Sass</li>
<li>JavaScript</li>
<li>Demo</li>
</ul>
</div>
</li>
<li>Customize</li>
</ul>
</div>
Your anchor was pointing to google.com instead of itself "#"
Also I would try and avoid opening a div inside of a list for your css to use, instead add aclass to your lists
should be:
<div class="row navbar pretty" id="nav1">
<!-- Toggle for mobile navigation, targeting the <ul> -->
<a class="toggle" gumby-trigger="#nav1 > .row > ul" href="#"><i class="icon-menu"></i></a>
<h1 class="four columns logo">
<a href="#">
<img src="/img/gumby_mainlogo.png" gumby-retina />
</a>
</h1>
<ul class="eight columns">
<li>Features</li>
<li>
<!-- This link opens dropdown but also redirects to the href -->
Documentation
<ul class="dropdown">
<li>The Grid</li>
<li>UI Kit</li>
<li>Sass</li>
<li>JavaScript</li>
<li>Demo</li>
</ul>
</li>
<li>Customize</li>
</ul>
</div>

Resources