Hi please need help how to render my multinode tree picker value (http://screencast.com/t/NTu1NqXsTmBz) to show it on its parent node named PORTFOLIO ..
i want the multinode picker value should be placed between the Portfolio and About section (http://screencast.com/t/F0Dnnv9a) but I don't know how yet i tried render it and still not work ..
here is the finish template : screencast.com/t/ar1zeZ43Pf6J
Node tree picker code:
#if (Model.Content.HasValue("mntp_pickContent"))
{
var bannerListValue = Model.Content.GetPropertyValue<string>("mntp_pickContent");
<div id="container" class="container-portfolio">
#foreach (var item in bannerListValue.Split(','))
{
var page = Umbraco.Content(item);
<div class="col-md-4 element branding">
<div class="portfolio-item flip ">
<div class="flip-content">
<div class="front">
<img width="360" height="249" src="#page.Url" class="attachment-project-thumb wp-post-image" alt="background4" />
</div>
<div class="back">
<div class="back-content">
<h4>#page.contentTitle</h4>
<div class="txt-project">
<p>#page.contentsubTitle</p>
</div>
<i class="fa fa-plus"></i> More
</div>
</div>
</div>
</div>
<!-- flip container -->
</div>
}
</div>
}
Parent Node Portfolio.cshtml
#{ if (Model.Content.HasValue("port_backImage"))
{
var bgport = Umbraco.TypedMedia(Model.Content.GetPropertyValue<string>("port_backImage"));
<section class="section-wrap section-portfolio" style="background-image: url(#bgport.Url)" id="portfolio">
<div class="container">
<div class="container-wrap row portfolio">
<div class="container-wrap-title col-md-6">
<h2>#Model.Content.GetPropertyValue("pageTitle")</h2>
<h6>#Model.Content.GetPropertyValue("subTitleText")</h6>
</div>
<div class="container-wrap-subnav col-md-6">
<ul class="subnavigation" id="filters">
<li class="active">show all</li>
#foreach (var portMenu in Model.Content.Children)
{
<li>#portMenu.Name</li>
}
</ul>
</div>
</div>
</div>
</section>
}
}
This all depends on the Templating Engine you are using.
If you are using MVC, then you need to add your MNTP logic to a partial view.
See the following link:
https://our.umbraco.org/documentation/Reference/Templating/Mvc/partial-views
If you are using WebForms, then you will need to add your logic to a Razor file OR alternatively a UserControl (.ascx) file. See the following links:
https://our.umbraco.org/documentation/reference/templating/macros/
https://our.umbraco.org/documentation/reference/templating/macros/Razor/
http://umbraco.com/help-and-support/video-tutorials/introduction-to-umbraco/developer-introduction/using-net-user-controls
Related
i am new to angular and typescript and i need to hide div section *ngIf="stu.notes != null" on save button click.
i can display the respective divs when clicked on the respective buttons, but i am not able to hide the other one.
Can anyone hep me out here.
Thanks in advance.
HTML File:
<nb-accordion-item-body>
<div class="row">
<div *ngIf="notes_area != null">
<h5> <span class="col-md-8" style="font-weight : bold; font-size : 16px;"
[innerHTML]="notes_area"></span>
</h5>
<br/>
</div>
<div class="col-md-3" *ngFor = "let stu of studentData">
<div *ngIf="stu.notes != null" >
<div class="row">
<div class="col-md-8">
<br/>
<h5 style="font-weight : bold;" > {{stu?.notes.slice(3,-4)}}
</h5>
<br/>
</div>
</div>
</div>
</div>
</div>
<br/>
<div class="row" *ngIf="addNote == true">
<div class="col-md-6">
<tinymce [(ngModel)] = "notes" ></tinymce>
</div>
<div class="col-md-6">
<button nbButton (click)="saveNotes()">Save</button>
</div>
</div>
</nb-accordion-item-body>
.ts File:
saveNotes() {
this.api.saveNotes(this.my_app_data[0].app_id,this.notes).subscribe(data => {
this.notes_area = data['data'];
console.log(this.app_id);
console.log('log',this.notes);
});
}
I have a express handlebar application with main.hbs as the layout file.
//main.hbs
<html>
<head></head>
<body>
{{> header}}
{{{body}}}
<script src='/js/jquery-2.2.4.min.js'></script>
<script src='/js/bootstrap.min.js'></script>
</body>
</html>
When i click a link let's say "settings" in dashboard page then it redirects to settings page where i have sidebar and main content page.
This page also uses main.hbs as layout.
//settings.hbs
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<li class="active">Account<span class="sr-only">(current)</span></li>
<li>Views</li>
<li>Users</li>
<li>Sites</li>
</ul>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<ol class="breadcrumb">
<li class="active">Settings</li>
</ol>
<div id="settingsContainer">
//Content should be rendered here just like the {{{body}}}
</div>
</div>
</div>
So how can i able to render the desired content inside the "settingsContainer".
As per my understanding in layout file {{{body}}} is used as a placeholder for where the main content should be rendered.
But this is a different page. Is there a way i can render the content based on the link clicked from sidebar.
Any help and pointer will be much appreciated!
i don't know much about handlebars but you can achieve the same with bootstrap tabs.
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<div class="tabbable">
<ul class="nav nav-sidebar">
<li class="active">Account<span class="sr-only">(current)</span></li>
<li class="">Views</li>
</ul>
</div>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<ol class="breadcrumb">
<li class="active">Settings</li>
</ol>
<hr>
<div id="settingsContainer">
<div class="tabbable">
<div class="tab-content">
<div class="tab-pane active" id="account">
//render partial for account
</div>
<div class="tab-pane" id="views">
//render partial for views
</div>
</div>
</div>
</div>
</div>
</div>
Hope this helps
I am making a website with node.js and I am new ,I want to learn a method if there is.I list cars using ul and when I click on a car name i want to show car's details. How can I do it.
html
<template name="vehicles">
<section id="vehicles" class="container">
<div class="row">
<div class="col-md-12">
<h2 class="title wow fadeInDown" data-wow-offset="200">Vehicle Models - <span class="subtitle">Our rental fleet at a glance</span></h2>
</div>
<!-- Vehicle nav start -->
<div class="col-md-3 vehicle-nav-row wow fadeInUp" data-wow-offset="100">
<div id="vehicle-nav-container">
<ul class="vehicle-nav">
{{#each showcarnames}}
<li class="active">{{aracmarka}}<span class="active"> </span></li>
{{/each}}
</ul>
</div>
<div class="vehicle-nav-control">
<a class="vehicle-nav-scroll" data-direction="up" href="#"><i class="fa fa-chevron-up"></i></a>
<a class="vehicle-nav-scroll" data-direction="down" href="#"><i class="fa fa-chevron-down"></i></a>
</div>
</div>
<!-- Vehicle nav end -->
<!-- Vehicle 1 data start -->
<div class="vehicle-data" id="vehicle-1">
<div class="col-md-6 wow fadeIn" data-wow-offset="100">
<div class="vehicle-img">
<img class="img-responsive" src="img/vehicle1.jpg" alt="Vehicle">
</div>
</div>
<div class="col-md-3 wow fadeInUp" data-wow-offset="200">
<div class="vehicle-price">$ 37.40 <span class="info">rent per day</span></div>
<table class="table vehicle-features">
<tr>
<td>Marka</td>
<td>{{carmark}}</td>
</tr>
<tr>
<td>Model</td>
<td>{{carmodel}}</td>
</tr>
</table>
<span class="glyphicon glyphicon-calendar"></span> Reserve now
</div>
</div>
js
Template.vehicles.helpers({
showcarnames: function() {
return cars.find();
}
});
I would approach this problem using Session. You could target the data using a click event:
Template.vehicles.events({
'click .vehicle-nav li': function(){
Session.set('selected-vehicle', this._id); // or however you id the docs in your app.
}
});
then create an event helper that gets the selected doc and returns it to the template.
Template.vehicles.helpers({
getSelectedVehicle: function() {
var selectedId = Session.get('selected-vehicle');
return cars.findOne(selectedId);
},
});
Session is a great and simple tool to manage user state, like what vehicle they have selected.
Finally, you would then need to get the values in your template somewhere
<!-- html-->
{{#if getSelectedVehicle}}
{{#with getSelectedVehicle}}
<!-- mark up, when using with you can access doc atts directly. -->
{{/with}}
{{else}}
<!-- tell the user to make a selection -->
{{/if}}
using with in this context can lead to more readable markup. But there are other ways to achieve the same result.
To recap, at a high level, You are targeting the users interactions with the UI, to set a global variable as a way to simplify managing state. Be sure to check out Session in the meteor docs, its very simple and powerful. (the above code is not tested, but hopefully conveys the idea)
I have some pages which don't always have content in the body and would like to then treat the zone as empty and have it hidden.
Normally I'd use
#if (Model.Content != null)
{
<section id="layout-content">
<div class="container">
<div class="row">
<div class="col-md-12">
#Zone(Model.Content)
</div>
</div>
</div>
</section>
}
Problem is that Content zone is never null on the Page, there's title and metadata. Even if I hide those with placement, it's still not null so it just displays empty tags.
<section id="layout-content">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="zone zone-content">
<article class="page content-item">
<header> </header>
</article>
</div>
</div>
</div>
</div>
</section>
Can I somehow check for empty body in my layout or would you suggest better approach?
Don't hide the top-level content zone from layout. Instead, override Content.cshtml and hide local zones from there.
I'm using bootstrap and attempting to use the panel component for rendering lookup items. It renders perfectly fine, but this was all hand coded.
<div class="row">
<div class="col-md-4">
<div class="panel panel-primary">
<div class="panel-heading">
Item Number 1
</div>
<div class="panel-body">Image Carousel Goes Here</div>
<div class="panel-footer">
<table>
<tr>
<td>Field</td>
<td>Value</td>
</tr>
<!-- etc. -->
</table>
</div>
</div>
</div>
<div class="col-md-4">
<div class="panel panel-primary">
<div class="panel-heading">
Item Number 1
</div>
<div class="panel-body">Image Carousel Goes Here</div>
<div class="panel-footer">
<table>
<tr>
<td>Field</td>
<td>Value</td>
</tr>
<!-- etc. -->
</table>
</div>
</div>
</div>
</div>
A JSFiddle is here.
I'm wondering how it'd be possible to do something like:
<div class="row">
#(foreach Item item in items)
{
#RenderItemView(item);
}
</div>
where I could dump all of the "div.col-md-4 ... slash div" code into another cshtml file and use it as a component and just pass the model to it?
I know that I could do this, but would prefer to make this a reusable component.
<div class="row">
#foreach(Item item in items)
{
// instead of using a component, setting the panel-heading off item.Number,
// panel-body by a foreach on item.ImageUrls, etc.
}
</div>
Basically, the subcomponent will be a partial view, I think, but what is the normal way of passing a model to it and it rendering at that spot (basically, like #RenderBody works on layout)
You could create a partial view which holds this content:
#model IEnumerable<ItemType>
<div class="row">
#foreach(var item in Model)
{
// instead of using a component, setting the panel-heading off item.Number,
// panel-body by a foreach on item.ImageUrls, etc.
}
</div>
Save the partial view in the Views/Shared folder, so that it's available everywhere. Then to use it:
#{Html.RenderPartial("YourPartialView", Model.Items);}