jquery plupload inside an accordion. The latter does not auto height - jquery-ui-accordion

i am using a plupload plugin inside an accordion. I first create the the plupload and then I create the accordion.
The plupload creates well... but the accordion height is not resized so that the whole plupload is seen sinside it. The height is about 50 px instead and the vertical scroll appears.
This is the JavaScript code:
function createUploader()
{
$("#uploader").pluploadQueue("destroy");
$("#uploader").pluploadQueue({
// General settings
runtimes: 'gears,flash,silverlight,browserplus,html5',
url: '/upload.php',
max_file_size: '10mb',
chunk_size: '1mb',
unique_names: true,
// Resize images on clientside if we can
resize: {width: 320, height: 240, quality: 90},
// Specify what files to browse for
filters: [
{title: "Archivos de imagen", extensions: "jpg,gif,png"},
{title: "Archivos comprimidos", extensions: "zip,rar"},
{title: "Documentos", extensions: "doc,docx,xls,xlsx,ppt,pdf,pptx,csv,txt"}
],
// Flash settings
flash_swf_url: '/js/plupload/plupload.flash.swf',
// Silverlight settings
silverlight_xap_url: '/js/plupload/plupload.silverlight.xap'
});
}
function creaDialogoAdjuntos()
{
createUploader();
$('#acordeon_adjuntos').accordion();
}
$(function() {
creaDialogoAdjuntos();
}
And this is the HTML:
<div id="acordeon_adjuntos">
<h3>Nuevo Adjunto</h3>
<div>
<form id="attach" action="{{ path('_renombra_archivos') }}">
<div id="uploader">
<p>Su navegador no tiene soporte Flash, Silverlight, Gears, BrowserPlus o HTML5.</p>
</div>
<input type="hidden" id="adjComId" name="compromiso" />
</form>
</div>
<h4>Adjuntos</h4>
<div>
<table id="adjuntos_compromisos"><tr><td></td></tr></table>
<div id="adjuntos_paginacion"></div>
</div>
</div>
Any help to solve this will be appreciated.
Thanks
Jaime

Related

How to use if else with AngularJS

I am trying to use if else with angular to filter the images from the controller. I am trying to show the image with my list if it exists and if not it show the placeholder image.I am new to angular can someone please guide.
I have tried some online solutions to use with it like
<div *ngIf="{{item.icon}}; else templateName">
<img ng-src = "{{item.icon}}" />
</div>
<ng-template #templateName>
<img ng-src = "{{item.placeholderImage}}" />
</ng-template>
I have created this component which I am trying to call in my index file. I am also not able to display the dates which was working before I transferred it in the component. I think there is something wrong with the commas.
{{date | date:"EEE MMM dd yyyy"}}
module('cListApp').
component('itemsList', {
template:<ul>
<li class="list-body-container" ng-repeat="item in $ctrl.items">
<div class="profileImage">
</div>
<div class="list-body-left">
<div class="li-title"><h2>{{item.name}}</h2><h4>Title3</h4></div>
<div class="li-body"><p>{{item.snippet}}</p></div>
<div class="li-date">
<div id="calendar">
<div id="c-top">
<span id="l1"></span>
<span id="l2"></span>
</div>
<div id="c-mark"></div>
</div>
{{date | date:"EEE MMM dd yyyy"}}
</div>
</div>
<div class="list-body-right">
</div>
</li>
</ul>,
controller: function cListController() {
this.items = [
{
name: 'Nexus S',
snippet: 'Fast just got faster with Nexus S.',
icon: 'https://picsum.photos/100/100/?image=491'
}, {
name: 'Motorola XOOM™ with Wi-Fi',
snippet: 'The Next, Next Generation tablet.'
},
],
this.placeholderImage = 'https://picsum.photos/100/100/?blur',
this.date = new Date();
}
});```
Instead of using ng-if, simply use an expression:
COMPLICATED
<div>
<img ng-if="item.icon" ng-src = "{{item.icon}}" />
<img ng-if="!item.icon" ng-src = "{{$ctrl.placeholderImage}}" />
</div>
Simpler
<img ng-src = "{{item.icon || $ctrl.placeholderImage}}" />
For more information, see
MDN JavaScript Reference - Logical Operators
Your code is in angularJS and in angularJS there is no such thing as ng-else that is in angular. To make this work you can use ng-if or ng-show of angularJS.
<div>
<img ng-if="item.icon" ng-src = "{{item.icon}}" />
<img ng-if="!item.icon" ng-src = "{{item.placeholderImage}}" />
</div>
What it will do is if icon is present first image will be shown with item.icon as image URL and if not condition in second img tag will be true and second one will be shown with placeholder image
I have got this working via below expression.
<img ng-src = "{{item.icon || item.placeholderImage}}" />
However, I have to make few changes to the controller from where it shows the data
controller: function cListController() {
this.items = [
{
name: 'Nexus S',
snippet: 'Fast just got faster with Nexus S.',
icon: 'https://picsum.photos/100/100/?image=491'
}, {
name: 'Motorola XOOM™ with Wi-Fi',
snippet: 'The Next, Next Generation tablet.'
},
],
this.placeholderImage = 'https://picsum.photos/100/100/?blur',
this.date = new Date();
}
Instead it's outside of first array I have to put the placeholder image inside the array
{
name: 'Nexus S',
snippet: 'Fast just got faster with Nexus S.',
icon: 'https://picsum.photos/100/100/?image=491'
},
{
name: 'Motorola XOOM™ with Wi-Fi',
snippet: 'The Next, Next Generation tablet.',
placeholderImage = 'https://picsum.photos/100/100/?blur',
},

Missing pagination dropdown icon using Angular ui grid

I am developing a table with pagination using Angular ui-grid. But somehow I am missing the drop arrow from the pagination dropdown as you can see in the following picture.
When I click it, it opens like dropdown, but I need the down arrow to indicate that its a dropdown.
I am using following css libraries
<link rel="stylesheet" ng-href="libs/bootstrap/3.3.6/css/paper.bootstrap.min.css">
<link rel="stylesheet" type="text/css" title="Style" href="libs/angular/ui-grid/3.0.7/ui-grid.min.css">
I config gridOptions as following
paginationPageSizes: [10, 20, 50],
paginationPageSize: 10,
data: 'historyData',
enableCellSelection: true,
enableFiltering: true,
enableHorizontalScrollbar: 1,
treeRowHeaderAlwaysVisible: false,
showTreeRowHeader: true,
enableGridMenu: true,
exporterMenuCsv: false,
exporterMenuPdf: false,
Below is my html code
<div class="container">
<div id="gridDiv"
style="-webkit-animation: slideInRight 0.3s; -moz-animation: slideInRight 0.3s; animation: slideInRight 0.3s;">
<div id="historyGrid" ui-grid="gridOptions" ui-grid-edit
ui-grid-cellnav ui-grid-move-columns ui-grid-resize-columns
ui-grid-save-state ui-grid-pagination ui-grid-pinning
ui-grid-grouping ui-grid-exporter class="grid"></div>
<div class="watermark" ng-show="!historyData.length">No upload
history available</div>
<div>
<p>
<img ng-src="{{contextRoot+'pics/addScanIcon.svg'}}"
alt="addScanIcon"
style="width: 25px; height: 25px; cursor: pointer" /> <span>
Click the icon for a specific policy to upload additional documents
to policy.</span>
</p>
</div>
</div>
It's working when I add below css
.ui-grid-pager-row-count-picker select {
-webkit-appearance: menulist;
}
Or Just add background arrow image
.ui-grid-pager-row-count-picker select {
background-image: url("../pics/select_arrow.png");
}

How to load image and text of that image paralelly into a div using angularjs

Actually,I'm able to load 3 images(open,new&save icons) into a div using angularjs.Now,I'm trying to place the related text of those images into the same div just below those 3 images.
Like,"open" text should be written just below "open" image.Simialrly,for the remaining images too.How can I achieve this?
Can anyone please help me out regarding this issue ...
My js code:
angular.module('Sample', []).controller('Home', function($scope) {
$scope.imageSources = [];
$scope.imageSources.push('images/open.png');
$scope.imageSources.push('images/new.jpg');
$scope.imageSources.push('images/save.png');
});
My html code:
<div style="margin-top: 15px;">
<img width=40 height=50 style="margin-left: 12px;"
ng-repeat="imageSource in imageSources track by $index"
ng-src="{{imageSource}}"> </img>
</div>
This will work but is not the right way to do it.
I leave the styling up to you.
View:
<div style="margin-top: 15px;" ng-repeat="imageSource in imageSources">
<img width=40 height=50 style="margin-left: 12px;" ng-src="{{imageSource}}" />
<br>
<span style="margin-left: 12px;">{{getFilenameFromPath(imageSource)}}</span>
</div>
Controller:
$scope.imageSources = [];
$scope.imageSources.push('images/open.png');
$scope.imageSources.push('images/new.jpg');
$scope.imageSources.push('images/save.png');
$scope.getFilenameFromPath = function(filename) {
return filename.split("/")[1].split(".")[0];
}
Here is a jsfiddle.
The right way as it has been mentioned in the contents, is to have a collection of object and each objects should have a name and a src property. In your case you should do:
$scope.imageSources = [];
$scope.imageSources.push({
name:"open",
src: "images/open.png"
});
$scope.imageSources.push({
name:"new",
src: "images/new.png"
});
$scope.imageSources.push({
name:"save",
src: "images/save.png"
});
So you will end up with this collection:
[
{
"name": "open",
"src": "images/open.png"
},
{
"name": "new",
"src": "images/new.png"
},
{
"name": "save",
"src": "images/save.png"
}
]
Here is an jsfiddle.

Highchart.js and AngularJS after navigation some chart does not load

I am currently facing a problem. I have a HTML page which contains multiple div to load highcharts. Same page have all the jquery script.
I am using angularJS to route the page. Index page, Chart1Page and Chart2Page. When i am loading chart1page 1st time all charts load but if i come back from chart2page to chart1page some charts does not load. Below code is one of the chart which not load. If i replace with some other chart like pie the result is same. Do i need to check the sequence?
<script>
function freecapacity() {
$(function () {
// Set up the chart
var chart = new Highcharts.Chart({
chart: {
renderTo: 'freecapacity',
type: 'column',
margin: 75
},
title: {
text: 'Free Capacity'
},
subtitle: {
text: ''
},
plotOptions: {
column: {
depth: 25
}
},
xAxis: {
categories: ['A', 'B', 'C', 'S', 'D', 'DD', 'PD']
},
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6]
}]
});
});
}
freecapacity();
</script>
<html>
<div class="row">
<h5 class="form-control" style="background-color:#D2D7D3"><label>Hub and GSA Information</label></h5>
<div class="col-xs-12 col-sm-8 col-md-6 col-lg-6 small">
<div class="form-control" style="height: 350px;" id="freecapacity"></div>
</div>
<div class="col-xs-12 col-sm-8 col-md-6 col-lg-6 small">
<div class="form-control" style="height: 350px;" id="gsanomination"></div>
</div>
</div>
</html
I recommend you use the Angularjs directive for Highcharts: https://github.com/pablojim/highcharts-ng
Than set up the Highchart object in the view controller instead of using script tags in the html file.

Loading google maps on a angularjs site changes the font of the entire website

Could anyone give me a hint on probable causes on why the font of my website changes when one of the navbar items is selected?
This is the website: http://sideta.tk/ (the fourth navbar item "Valgyklos" changes the font)
Here is the partial html code:
<div ng-controller="valgyklosCtrl" class="container">
<div class="row" style="height: 40px"></div>
<div class="row">
<div class="col-md-5">
<ui-gmap-google-map center='map.center' zoom='map.zoom'>
<ui-gmap-marker coords="marker.coords" idkey="marker.id"></ui-gmap-marker>
</ui-gmap-google-map>
<!--<google-map center='map.center' zoom='map.zoom'></google-map>-->
<h3 class="text-center">NT Valdos</h3>
<p>Valgykla esanti NT Valdos teritorijoje.</p>
</div>
<div class="col-md-2"></div>
<div class="col-md-5">
<ui-gmap-google-map center='map2.center' zoom='map2.zoom'>
<ui-gmap-marker coords="marker2.coords" idkey="marker2.id"></ui-gmap-marker>
</ui-gmap-google-map>
<h2 class="text-center">Energetikos Remontas</h2>
<p>Valgykla Esanti Energetikos Remonto teritorijoje.</p>
</div>
</div>
</div>
and here is the controller:
sidetaApp.controller('valgyklosCtrl', function($scope) {
$scope.map = { center: { latitude: 54.902522, longitude: 23.996512 }, zoom: 14 };
$scope.marker = { coords: { latitude: 54.902522, longitude: 23.996512 }, id: 0 };
$scope.map2 = { center: { latitude: 54.908702, longitude: 23.992693 }, zoom: 14 };
$scope.marker2 = { coords: { latitude: 54.903763, longitude: 23.997539 }, id: 1 }
});
I think is it that on initial load you are loading Roboto with only the 300 font weight. See your network/css in dev tools.
css?family=Roboto:300
fonts.googleapis.com
When you go to the page with the map on, the API is loading all the font weight of the Roboto font
css?family=Roboto:300,400,500,700
fonts.googleapis.com
And if you look at your css you are using different font weights other that 300
h1, h2, h3, h4, h5, h6 {
font-family: inherit;
**font-weight: 500;**
line-height: 1.1;
color: inherit;
}
So when the full Roboto font set is loaded in, the correct font weights are applied to the styles.
Looks like you need to use in the full range of font weights at the start, or alter your css to use the 300 weight.
Update:
See Google Maps v3 - prevent API from loading Roboto font to stop the google map api loading in Roboto font

Resources