I have an app where I'm using custom svg icons using Materials 'MatIconRegistry'.
The import works fine, but a strange thing is happening when I have multiple icons on a page. For some reason, any icons that following an initial icon end up bing the same as the first, even though they are clearly labeled as another icon.
When I comment out the initial icon, the next instance changes to the one being called by that instance, but then all the following icons then change to that icon.
What could be causing this?
Here is the code:
<mat-sidenav-container>
<mat-sidenav mode="side" opened="true" class="app-sidenav">
<div class="logo-wrapper">
<img
class="menu-logo"
alt="Avocado"
src="./assets/logo.png"
/>
</div>
<div>
<div class="menu-item">
<a
class="menu-button"
routerLink="/"
mat-button
routerLinkActive="active"
[routerLinkActiveOptions]="{ exact: true }"
>
<div>
<mat-icon svgIcon="dashboard"></mat-icon>
</div>
<div class="button-label">
Dashboard
</div>
</a>
</div>
<div class="menu-item">
<a
class="menu-button"
routerLink="/sessions"
mat-button
routerLinkActive="active"
>
<div>
<mat-icon svgIcon="sessions"></mat-icon>
</div>
<div class="button-label">
Sessions
</div>
</a>
</div>
<div class="menu-item">
<a
class="menu-button"
routerLink="/users"
mat-button
routerLinkActive="active"
>
<div>
<mat-icon svgIcon="users"></mat-icon>
</div>
<div class="button-label">
Users
</div>
</a>
</div>
</div>
</mat-sidenav>
<mat-toolbar class="app-toolbar">
<h2 class="page-title">{{pageTitle}}</h2>
</mat-toolbar>
<router-outlet></router-outlet>
</mat-sidenav-container>
Related
I have a search results screen showing 10 results (locations in the world) per page. If a result has an image available, the image will show, otherwise it shows the location on an OpenLayers map.
I'm just trying to upgrade this page using Bootstrap carousel to allow users to cycle between the map and the image (if available).
I got carousel working fine using 2 test images. However when I swap in the OL map, although the image/photo shows OK, when you cycle to the next item (the map), the map just shows a white screen / nothing shows.
Code is below. (FYI the map works fine when I pull it out of the carousel code.
Any ideas?
Happy to share the Ol.map code, although as mentioned it runs OK outside of carousel, so I assume it might be some sort of formatting/CSS issue.
<div class="carousel-inner">
<div class="carousel-item active">
<%= image_tag(#phototouse, class:"map img-responsive", style:"display:block;height: 100%;max-height:350px") %>
</div>
<div class="carousel-item">
<div id="<%= location.location_id %>" class="map" style="display:block;height: 100%;max-height:350px"></div>
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleControls<%= location.location_id %>" 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="#carouselExampleControls<%= location.location_id %>" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
Update:
I thought I had got this working by adding in the updateSize event (below) but weirdly the map only shows when I resize the window. If I don't touch the window, the map doesn't show and I get the following java error: 'map1.updateSize is not a function'.
Any ideas?
<div class="container-fluid normaltextblack" style="background-color: #F3F3F3;">
<div class="row" style="height:350px">
<div id="sidel" class="col-0 col-sm-0 col-md-0 col-lg-5 col-xl-5">
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block w-100" src="/assets/image1.jpg" alt="First slide" style="height:350px">
</div>
<div class="carousel-item">
<div id="testmap" class="map img-responsive" style="height:350px"></div>
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev" onclick="resizemap();">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next" onclick="resizemap();">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
</div>
<script>
function resizemap() {
setTimeout(function(){
var map1 = document.getElementById("testmap");
map1.updateSize();
}, 1000);
}
</script>
I'm working on making an FAQ page and have a bootstrap collapse with the categories of questions as the collapse titles and the questions as the body.
I'm using the same collapse for both the index and question display pages and I am passing a local variable local: { display: boolean } to differentiate.
I loop through the categories collection to make each table row
<% #categories.each_with_index do |category, index| %>
I have conditionals in the class and aria-expanded of the trigger element:
class='<%= "collapsed" if !display || category != #question.category %>'
aria-expanded='<%= category == #question.category %>'
And in the class of the target
class='collapse <%= "show" if display && category == #question.category %>'
The page loads with the correct row open but it doesn't close when triggered.
Everything is described in the Bootstrap documentation
To achieve what you need, you have to:
For buttons/headers:
set data-toggle="collapse"
if the content of the target has to be hidden, then set aria-expanded="false"
if the content of the target has to be displayed, then set aria-expanded="true"
For the targets:
set class="collapse" if the target has to be hidden
set class="collapse show" if the target has to be displayed
Here is an example
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<p>
<a class="btn btn-primary" data-toggle="collapse" href="#multiCollapseExample1" role="button" aria-expanded="false" aria-controls="multiCollapseExample1">Toggle first element</a>
<button class="btn btn-primary collapsed" type="button" data-toggle="collapse" data-target="#multiCollapseExample2" aria-expanded="false" aria-controls="multiCollapseExample2">Toggle second element</button>
</p>
<div class="row">
<div class="col">
<div class="collapse show multi-collapse" id="multiCollapseExample1">
<div class="card card-body">
First element content (displayed by the default)
</div>
</div>
</div>
<div class="col">
<div class="collapse multi-collapse" id="multiCollapseExample2">
<div class="card card-body">
Second element content
</div>
</div>
</div>
</div>
I just noticed the new angular dart components, so I was attemping to use them this way :
<material-expansionpanel-set>
<material-expansionpanel *ngFor="let place of places" name="{{place.name}}" showSaveCancel="false">
<div *deferredContent>{{place.name}}</div>
</material-expansionpanel>
</material-expansionpanel-set>
I was expecting the elements inside the div to be displayed automagically in a differed manner. It seams I don't get how it works : the statement inside the div is never displayed (naturally this is just a test, I'm planning to put an entire component inside the *deferredContent div.
This is the html I get.
<material-expansionpanel-set _ngcontent-toa-2="">
<!--template bindings={}--><material-expansionpanel _ngcontent-toa-2="" showsavecancel="false" _nghost-toa-10="">
<div _ngcontent-toa-10="" class="panel themeable open" role="group" aria-label="myplace" aria-expanded="true">
<!--template bindings={}--><header _ngcontent-toa-10="" buttondecorator="" role="button" class="" aria-label="Close myplace panel" tabindex="0" aria-disabled="false">
<div _ngcontent-toa-10="" class="panel-name">
<p _ngcontent-toa-10="" class="primary-text">myplace</p>
<!--template bindings={}-->
</div>
<div _ngcontent-toa-10="" class="panel-description">
</div>
<!--template bindings={}--><glyph _ngcontent-toa-10="" buttondecorator="" class="expand-button" role="button" _nghost-toa-11="" tabindex="0" aria-disabled="false"><i _ngcontent-toa-11="" aria-hidden="true" class="material-icons">expand_less</i></glyph>
</header>
<main _ngcontent-toa-10="" class="">
<div _ngcontent-toa-10="" class="content-wrapper">
<div _ngcontent-toa-10="" class="content">
<!--template bindings={}-->
</div>
<!--template bindings={}-->
</div>
<!--template bindings={}--><div _ngcontent-toa-10="" class="toolbelt">
</div>
<!--template bindings={}-->
</main>
</div>
</material-expansionpanel>
</material-expansionpanel-set>
If the idea is to implement DeferredContentAware and get notified when the component is visible, I'd be pretty deceived (since we could have done that manually by listening to open and close events)
material-expansionpanel should automatically fire events for *deferredContent.
Some simple questions:
Do you have DeferredContentDirective in your directives: const [ ...]?
What version of AngularDart are you using?
I have try to include a footer with a navbar inside a dialog page, however, the navbar gets bigger than the dialog window. I did try to just include the navbar without the data-role="footer" but is doing the same. Looks like the navbar inside the dialog doesn't inherent the css properties from the dialog parent. Here is the code.
<div id="addCourse" data-role="page" data-dialog="true" data-close-btn="none">
<div role="dialog">
<div data-role="header" role="banner">
<h1>Add course</h1>
</div>
<div class="ui-content">
<div class="ui-field-contain">
<label for="add-course">New course</label>
<input type="text" name="add-course" id="add-course" placeholder="Enter new course" value="">
</div>
</div>
<div data-role="navbar">
<ul>
<li>Cancel</li>
<li>Save</li>
</ul>
</div>
</div>
anybody with sugestions??
It looks like the borders on the navbar buttons are not considered when setting width. You can fix it with a little CSS
<div id="addCourse" data-role="page" data-dialog="true" data-close-btn="none">
<div data-role="header" role="banner">
<h1>Add course</h1>
</div>
<div role="main" class="ui-content">
<div class="ui-field-contain">
<label for="add-course">New course</label>
<input type="text" name="add-course" id="add-course" placeholder="Enter new course" value="" />
</div>
</div>
<div data-role="navbar">
<ul>
<li>Cancel</li>
<li>Save</li>
</ul>
</div>
</div>
.ui-dialog-contain .ui-navbar {
padding-right: 4px;
border-bottom-left-radius: 0.3125em;
border-bottom-right-radius: 0.3125em;
}
Working DEMO
I did found another way to work around this issue. I just added a overflow:hidden to the data-role="navbar"
<!-- Dialog Add Course Footer -->
<div data-role="navbar" style="overflow:hidden;">
<ul>
<li>Cancel</li>
<li>Save</li>
</ul>
</div>
<!-- End Dialog Add Course Footer -->
I am a JQM newbie and need to put a linked image in the collapsible content header so that when it is clicked the user will be able to access the associated href. I also need to be able to get the header to expand and collapse as needed. Here is my code so far
<h3><em><?=$agent_row['prefix'] . ' ' . $agent_row['first'] . ' ' . $agent_row['last'] . ' ' . $agent_row['suffix']?>
<a class="vcard" id="vcard" href="http://vcard.parascript.com/<?=$agent_row['first']?>_<?=$agent_row['last']?>.vcf"><img src="images/vcard.png" style="vertical-align:middle;width:30px;" /></a>
<a id="email" href="mailto:<?=$agent_row['email']?>"><img src="images/mail.png" style="vertical-align:middle;width:30px;" /></a>
<a id="mobilephone" href="tel://<?=$agent_row['cell']?>"><img src="images/mobile_phone.png" style="vertical-align:middle;width:30px;" /></a>
</em></h3>
I appreciate any suggestions provided.
Check out: http://jquerymobile.com/demos/1.2.0/docs/content/content-collapsible.html
Example: http://jsfiddle.net/Twisty/tJyeQ/
HTML
<html>
<body>
<div data-role="page" id="page1">
<div data-role="header">
<h1>page1</h1>
</div>
<div data-role="content">
<div data-role="collapsible">
<h3><em>First Last</em></h3>
<a class="vcard" id="vcard" href="http://vcard.parascript.com/first_last.vcf">
<img src="images/vcard.png" style="vertical-align:middle;width:30px;" />
</a>
<a id="email" href="mailto:f.last#example.com"><img src="images/mail.png" style="vertical-align:middle;width:30px;" />Email</a>
<a id="mobilephone" href="tel://4155551212"><img src="images/mobile_phone.png" style="vertical-align:middle;width:30px;" />Phone</a>
</div>
</div>
</div>
</body>
</html>
Here is a rough example using Layout Grids: http://jsfiddle.net/Twisty/tJyeQ/6/
HTML
<html>
<body>
<div data-role="page" id="page1">
<div data-role="header">
<h1>page1</h1>
</div>
<div data-role="content">
<div class="ui-grid-c ui-btn ui-bar-c ui-corner-all">
<div class="ui-block-a">
<span class="ui-btn-inner">
<span class="ui-icon ui-icon-plus ui-icon-shadow"> </span>
<span class="ui-btn-text">First Last</span>
</span>
</div>
<div class="ui-block-c">
<a class="vcard" id="vcard" href="http://vcard.parascript.com/first_last.vcf">
<img src="images/vcard.png" style="vertical-align:middle;width:30px;" />
vcard
</a>
</div>
<div class="ui-block-c">
<a id="email" href="mailto:f.last#example.com">
<img src="images/mail.png" style="vertical-align:middle;width:30px;" />
Email
</a>
</div>
<div class="ui-block-d">
<a id="mobilephone" href="tel://4155551212">
<img src="images/mobile_phone.png" style="vertical-align:middle;width:30px;" />
Phone
</a>
</div>
</div><!-- /grid-c -->
</div>
</div>
</body>
</html>
This allows you to set a unique focus or button for each image and you could have the Name Show/Hide other content like a collapsible block, with just a little extra code.