How to add user defined icons in Ionic2? - ionic2

I am a newbie to Ionic 2 and I want to use my own icons/image slices (like those i place in drawable folders in native android). Like in the list view I want to add an icon along with some text. I can found such examples nowhere. Any help would highly be appreciated.

Following will be your Css file
.icon{
background-image: url("../assets/icons/ic_icon.png");
background-repeat:no-repeat;
}
Ionic 2 HTML code
<button ion-button color="secondary" clear>
<div class="icon">
<p>Icon</p>
</div>
</button>
This will work for you , in ionic 2, button tag is optional , it's there to add the tap effect

try icomoon service, which provides css files and fonts that easy include in project

Related

Generate PDF based on Particular Div id in Rails

Is there a way to generate pdf in rails based on div id.
Sample code:
<div id="pdf_download">
<h1>Hello Welcome to PDF
</div>
<div id="seconf_pdf">
<h2>Second PDF</h2>
</div>
Now i want to download only the div id "pdf_download" as pdf, Is it possible? Can anyone explain how to achieve it?
There seems to be a gem that does that - wicked_pdf. Internally it seems to depend on wkhtmltopdf, so you should be able to install this on your production environment.

gulp-uncss with height equalizer in Zurb Foundation

I'm trying to use gulp-uncss to remove unneeded CSS from a Zurb Foundation website.
Within the site I'm using Foundation's Equalizer to make two columns the same height. This works by adding a data- attribute to an element:
<div data-equalizer>
<div data-equalizer-watch>
<div>
<div data-equalizer-watch>
<div>
<div>
When the page loads Foundation determines the height of the two elements and injects an inline style to set the height of the elements to the greater of the two element heights. The result is:
<div data-equalizer>
<div data-equalizer-watch style="height: 256px;">
<div>
<div data-equalizer-watch style="height: 256px;">
<div>
<div>
When I add gulp-uncss to my gulpfile.js the Equalizer no longer works. The data- attributes are still present in the HTML file, but the inline styles are not added.
I've tried using the ignore option in gulp-uncss to ignore height but had no luck. The inline style is no longer added to HTML document.
Is there an option in gulp-uncss that will allow the equalizer to do it's job?
I was able to get gulp-uncss working using the ignore parameter in UnCSS.
Adding:
ignore: [/^meta.foundation/, /f-topbar-fixed/, /contain-to-grid/, /sticky/, /fixed/]
to uncss() kept all the necessary CSS. The most important of these is /^meta.foundation as this allows the Foundation JS to inject the styles. The remaining values /f-topbar-fixed, contain-to-grid, /sticky/ and /fixed/ are all specific to the Foundation JS modules I'm using. The above work for a .sticky topbar.
If you're using other JS modules you'll need to determine what classes are being injected and add those to the the ignore array.

Sitecore SPEAK UI configure ListControl to display icon and button

Is there a way in Sitecore SPEAK UI (7.5) to configure a ListControl (ViewMode set to DetailList) to contain a column with images, and another column containing buttons?
I've created a ListControl Parameters item beneath my PageSettings item and have added a few ColumnField items for the required columns - but cant find any other template types to add for different types of column data. I've also tried playing around with the Formatter and HTMLTemplate fields of the ColumnFields but am not sure how these are meant to be used.
Considering button means hyperlink. You can try adding the following in the HTMLTemplate:
For Image:
<img src="{{YourImageSourceField}}" ..../>
For Hyperlink:
{{YourLinkTextField}}
You can also consider reading Martina Welander Speak Series for some information on this kind of custom implementations.
I've also used the custom title property of the ListView by setting ViewMode to TileList. Then used Knockout to databind to a custom tile using standard cshtml, if this is any use?
<div class="sc-tile-default" data-bind="attr: {id: Id}">
<div style="min-height: 98px;">
<img width="112" data-bind="attr: {src: Path}" />
</div>
<div class="sc-iconList-item-title">
<span data-bind="text: Name"></span>
</div>
See this project
https://github.com/sobek1985/WallpaperManager

Is there a way to have (hack) turbolinks to only refresh a specific selector?

I would like to use turbolinks in a rails 4 application but not have it replace the entire <body> tag. Instead I would like to specify a tag/selector for turbolinks to refresh.
Something like...
<body>
<div class="turbolinks-refreshes-this">
Some content that is replaced whenever a link is clicked.
</div>
<div class="turblinks-does-not-refresh-this">
Some content that remains even if a link is clicked.
</div>
</body>
My guess is you would need to fork turbolinks to add this functionality but thought I'd throw it out there to see if anyone else has tried to do this.
Have you looked at pjax? It's very similar to Turbolinks (and gets a mention in the Turbolinks README) but lets you specify a target container. Here's a Railscast that shows how to use it in a Rails app.
Here's a (slightly modified) excerpt from the pjax README:
<h1>My Site</h1>
<div class="container" id="pjax-container">
Go to next page.
</div>
We want pjax to grab the url /page/2 then replace #pjax-container
with whatever it gets back. No styles or scripts will be reloaded and
even the h1 can stay the same - we just want to change the
#pjax-container element.
We do this by telling pjax to listen on a tags and use
#pjax-container as the target container:
$(document).pjax('a', '#pjax-container')
Now when someone in a pjax-compatible browser clicks "next page" the
content of #pjax-container will be replaced with the body of
/page/2.

Foundation 5: Dropdown content not working

I am trying content dropdown from Foundation 5: http://foundation.zurb.com/docs/components/dropdown.html, but it does not work as you can see on this fiddle: http://jsfiddle.net/AQGd9/2/. Basically, the content does not appear upon clicking the link when it should.
Has Content Dropdown
<ul id="drop2" class="f-dropdown content" data-dropdown-content>
<li>This is a link</li>
<li>This is another</li>
<li>Yet another</li>
</ul>
Thanks
You need to explicitly initialize foundation with this piece of code before the end of your body, like this:
<body>
...
<script>
$(document).foundation();
</script>
</body>
I have the same problem right now. The doc says that you need include the javascript required files, there are two ways to do it:
1) All Js (core + plugins): foundation.min.js
2) Only the core, and add the plugins on demand: foundation.js + foundation.dropdown.js (in this case).
So, launch foundation Js:
$(document).foundation();
Source: Foundation 5 Js Doc
This work for me.