Set Max-width for Tags in Bootstrap Tags Input - twitter-bootstrap-3

The Tags in Bootstrap Tags Input is overflowing the container.
So I would like to set max-width for the Tag or is there any way to stop overflowing the Tags in Bootstrap Tags Input ?
For Reference please visit this web site.

Just Add An Bootstrap-Tagsinput Event:
$('#Id').on('itemAdded', function(obj) {
var tagsinputWidth = $('#Id').parent().find('.bootstrap-tagsinput').width();// Width of Bootstrap Tags Input.
var tagWidth = $('#Id').parent().find('.bootstrap-tagsinput span.tag').last().width();// To get the Width of individual Tag.
if(tagWidth > tagsinputWidth) {
//If Width of the Tag is more than the width of Container then we crop text of the Tag
var tagsText = obj.item.value;// To Get Tags Value
var res = tagsText.substr(0, 5); // Here I'm displaying only first 5 Characters.(You can give any number)
$('#Id').parent().find('.bootstrap-tagsinput span.tag').last().html(res+"..." +'<span data-role="remove"></span>');
}
});
But the Problem is, User can't see the total text of tag that he/she added. So we can place "Title" for the Tag
We need to customize in bootstrap-tagsinput.js at line Number 127.
var $tag = $('<span class="tag ' + htmlEncode(tagClass) + '" title="'+htmlEncode(itemText)+'">' + htmlEncode(itemText) + '<span data-role="remove"></span></span>');
So, Now the User Can visible the Text when he/she mouse-over on that particular Tag.

Related

SAPUI5: PDF in iframe blank content

I've retrieved my pdf from my odata service call. However when I insert to html content using iframe tag, it display a blank page.
I tried below code. When i hardcode url with drive.google, my app able to show the pdf page but when i remove the hard coded value, my html content not able to render the pdf page. Any inputs on this?
// var pdfURL = "https://drive.google.com/viewerng/viewer?
//url=https://assets.cdn.sap.com/sapcom/docs/2015/07/c06ac591-5b7c-0010-82c7-
//eda71af511fa.pdf?pid=explorer&efh=false&a=v&chrome=false&embedded=true";
var pdfURL = "https://assets.cdn.sap.com/sapcom/docs/2015/07/c06ac591-5b7c-
0010-82c7-eda71af511fa.pdf";
var oHtmlChange = new sap.ui.core.HTML({
content: "<iframe src=" + pdfURL + " width='800' height='800'></iframe>"
});
poFormPanel.addContent(oHtmlChange);
Try to set the following content property value:
...
content: "<embed src='https://drive.google.com/viewerng/viewer?embedded=true&url=https://assets.cdn.sap.com/sapcom/docs/2015/07/c06ac591-5b7c-0010-82c7-eda71af511fa.pdf' width='800' height='800'>"
...
Here is a working example.

Bootstrap keep accordion in the same height

I try to keep a Bootstrap accordion in the same height when the user click on another collapse pannel. The pannels should onclick wrap the space to get the accordion full hight and make the pannel content scrollable if the content getting too big. Here a fiddle!
var header = $('.panel-heading');
var test = $(window).height() - (header.length*$('.panel-heading').height());
$('.panel-body').height(test);
I've edited your CSS, HTML and JS.. I don't know how to do this with JQuery, so i've used normal javascript:
var header = document.getElementsByClassName('panel-heading');
var headingheights = header.length * (header[0].offsetHeight + 18);
var test = $(window).height() - headingheights;
$('.panel-body').height(test);
Note:
All Panelbodys must have the same padding, so ive wrapped your list in a own div with a margin of -15px (same effect as your solution)
I've added some comments inside the fiddle for you to explain... ;)
Take a look at this fiddle: https://jsfiddle.net/hhcpuequ/11/
I hope this is what you are searching for ;)

Bootstrap 3 Multiple Accordions on one page must assign data-parent values after the fact

Due to some restrictions with a CMS I am developing for I cannot create the intended markup for a proper accordion with Bootstrap 3 on page load, however I can get it very close.
The issue I am having is that the initial
panel group id (accordion1), I cannot assign the proper data-parent="accordion1" to the data-toggle="collapse" element in the panel. I am attempting to rewrite the data-parent references to the proper accordion ID but it does not have an affect, it is like the collapse binding is already in place and I'm not sure how to get around it.
This is an example of my issue. (id's are the same on page load but I try to rewrite them with a script on dom-ready)
$(document).ready(function() {
$('.panel-group').each(function() {
var $t = $(this);
var id = "#" + $t.attr("id");
$t.find('[data-parent]').attr("data-parent", id);
});
});
This function fixes the markup as BS3 wants but the functionality is still broken.
http://plnkr.co/CTBekXVyzU0xjzlud2N1
I ended up figuring out that the error was my own. Multiple accordions is not an issue. Where I went wrong was in the markup. The error in my ways weas that the data-toggle="collapse" element's href="#collapse-0" for example was duplicated for both accordions. They must be unique. The CMS restriction still existed on the data-parent however. This caused me to redo my script (which does work now for multiple accordions)
$('.panel-group').each(function(){
//setup each panel group with individual id's appropriately
var $t = $(this);
var id = "#" + $t.attr('id');
var randomInt = $t.attr('id').split('_')[1]; //extract
$t.find('.panel').each(function(){
//set the proper collapsable targets for each
var $t = $(this);
var $dataParent = $t.find('[data-parent]');
var href = $dataParent.attr('href');
//set the collapse target
var $targetId = $dataParent.attr('href', injectRandom(href, randomInt));
var targetId = $targetId.attr('href').split('#')[1];
//set the random id's
$dataParent.attr('data-parent', id);
//set the collapse container
$dataParent.parents('.panel-heading:first').next().attr('id', targetId);
});
//open first pane
$t.find('[data-toggle]:first').trigger('click');
});
I will update the plunkr

Rally Cardboard render : Add item to card header

I want to add a value from a custom user attribute to the header of the cards in the default cardboard Kanban app. I added the following to the render function :
.....
var idDiv = document.createElement("div");
dojo.addClass(idDiv, "leftCardHeader");
header.appendChild(idDiv);
// MY NEW CODE
if(item.Domain && item.Domain.length > 0) {
var domainDiv = document.createElement("div");
domainDiv.appendChild(document.createTextNode(
" Domain: " + item.Domain));
header.appendChild(domainDiv);
}
// END MY NEW CODE
var ownerImg = document.createElement("img");
dojo.addClass(ownerImg, "cardOwner");
var ownerName = document.createElement("div");
dojo.addClass(ownerName, "cardOwnerName");
header.appendChild(ownerImg);
header.appendChild(ownerName);
....
This adds the text value to the card header but in doing so it pushes the owner name and image down a row in alignment. I have looked at the CSS but don't see any formating that is sting length dependent but I am still relatively new to this area. I tried changing the font size in the CSS but that didn't change anything adding the above code always pushes the owner name and owner image down a line.
Any help on what I might be doing wrong or if there is a cleaner way to dothis is appreciated.
You are appending a div, which is a block element- that is why you are getting the new line. You could either add a style of float:left to this element so it lines up next to the id or you could put the div in the card body instead- you may find it looks better there (especially on narrow width cards).

Galleriffic links

I have a Galleriffic slideshow on my page. Right now the "large" image links to the next image in the slideshow. How can I make it link to an external file instead?
First, you have to add a hidden div or span tag to your unordered list:
<li>
<a class="thumb" href="/imageurl/image.gif">imageititle</a>
<span id="project-path" style="display:none;">example_path</span>
</li>
Then, add this code to your galleriffic.js file. You are grabbing the path from the span element:
addImage: function(listItem, thumbExists, insert, position) {
var $li = ( typeof listItem === "string" ) ? $(listItem) : listItem;
var $aThumb = $li.find('a.thumb');
** var $path = $li.find('#project-path');
** var projectPath = $path.text();
var slideUrl = $aThumb.attr('href');
var title = $aThumb.attr('title');
var $caption = $li.find('.caption').remove();
var hash = $aThumb.attr('name');
Then, you add the value to the image variable:
var imageData = {
** projectPath:projectPath,
title:title,
slideUrl:slideUrl,
caption:$caption,
hash:hash,
gallery:this,
index:position
};
Now tell the gallery to change the link w/ new path on the full-size gallery images:
// Construct new hidden span for the image
var newSlide = this.$imageContainer
.append('<span class="image-wrapper current"><a class="advance-link" rel="history" href="/project/'+imageData.projectPath+'" title="'+imageData.title+'"> </a></span>')
.find('span.current').css('opacity', '0');
And comment out the gallery click action here, so that your user can just use the normal link wrapping the image:
newSlide.find('a')
.append(imageData.image)
//.click(function(e) {
//gallery.clickHandler(e, this);
//})
;
yep - at http://prestondentalgroup.com.au/downloads.html
The hyperlinks on the slide images allow viewer to open/save a PDF doc.
Works nicely (once I deciphered how to write example_path and to substitute /project/ with the URL of the PDF file (including subfolders).
So to link to readme.pdf from the site's images/downloads/ folder,
example_path becomes images/downloads/readme.pdf
and
/project/ becomes http:/prestondentalgroup.com.au/