Best practice for ion tags - ionic-framework

I am a bit confused about tag usage in the ionic framework. If you check their docs under CSS components, you'll see they use existing tags (particularly div) with a specific class choice to achieve formatting, just like you'd expect from something like bootstrap. Example:
<div class="bar bar-header bar-light">
<h1 class="title">bar-light</h1>
</div>
If you go by their code samples, however, you see that they use custom ion tags instead. Example:
<ion-header-bar class="bar-assertive">
<h1 class="title">Left Menu</h1>
</ion-header-bar>
The same practice of using custom ion tags is used in their guide as well as a pluralsight tutorial I found on ionic.
So what's going on here? If both approaches accomplish the same thing, which one is considered best practice?

Ionic Framework, as stated in their site, is:
Ionic is both a CSS framework and a Javascript UI library. Many
components need Javascript in order to produce magic, though often
components can easily be used without coding through framework
extensions such as our AngularIonic extensions.
Using CSS Components you're simply applying CSS styling to your HTML page.
When using the Ionic directives you're using a fully-featured JavaScript component and you have access to the APIs provided by the framework.
To better understand the difference you should dig into AngularJs directives.
Take the list for example. You could create a simple list using an HTML ul li:
<ul class="list">
<li class="item">
...
</li>
</ul>
but if you use the directive:
<ion-list>
<ion-item ng-repeat="item in items">
Hello, {{item}}!
</ion-item>
</ion-list>
you have access to the extended features provided by the framework (see the API at the bottom of the page).
I tend to use directives most of the times unless I know I don't want any kind of interaction with the interface.

Related

Is using <div class="col-sm-6"> or <b-col sm="6"> the same?

I just started looking into bootstrap-vue (and vue actually) and I noticed that <b-col sm="6"> translates into the classic <div class="col-sm-6"> so I wonder if there is any difference or advantages in using <b-col sm="6">.
Most web designers are confortable in using <div class="col-sm-6"> so why asking them to switch to the other notation?
There is no difference but only more convenient to use.
By setting sm="6" as a property, you can more easily change the value (dynamic) without needing a jquery but purely a js function within Vue. With this you make full use of Vue which is a lot easier to see.
:sm="getColSize"
Can be anything you want. With classes i find it more effort.
<b-col> (and the other layout helper components) are purely for convenience, as they require less typing (expecially for complex colums that have different width at different breakpoints).
They are written as Vue functional components (they keep no state information), so render fast.
You can be free to mix and match with regular html markup for layout, or not use them at all.

Integrate Htmls into GWT

We have a web application that its UI is based on GWT.
We are pretty satisfied from the technology, but we have one major problem: We get html files from our designer, and it takes a lot of time to integrate them into our GWT code.
Is there a quick way or rules to do that?
For instance, I would like to take the html, put it almost "as is" in a ui.xml file, and then start binding the components to UiBinder fields.
What is the quickest way to do that? What should I do with the CSS and JS files that I get?
I need some guidelines to make this conversion, so it will be quick & easy.
We have the same problem. It might be hard for a designer to get used to GWT widgets. But he'll have to forget about making HTML proof-of-concepts and using GWT directly.
We didn't overcame the difficulty. As a result, many GWT features are under-used (like CSSResources, or GWT-Bootstrap layout capabilities).
I would advise to have him learn the xml of GWT widget libraries.
You can also start by using GWT Designer. This way he can still do the design, learn the XML bit by bit, and you can still work on wiring the components.
Of course it is a slow process. People don't change old habits instantly.
Errai seems to fit your requirements.
Basically is uses regular HTML5 templates, binded to GWT logic.
"Create standard conform HTML5 templates or use existing HTML and CSS files to design your web and mobile applications."
http://errai.github.io/
Here is an example of a sign-in page:
<!DOCTYPE html>
<link rel=stylesheet href="css/TodoList.css">
<div data-field="main">
<h1>Get it done with Errai.</h1>
<div class=form>
<p class=error data-field=loginError>
Login failed. Please check that your email address and password were entered correctly.
</p>
<input type=text data-field=username placeholder="Email">
<input type=password data-field=password placeholder="Password">
<button data-field=loginButton>Sign In</button>
<p>New here? Sign up in seconds!</p>
</div>
</div>
source
(p.s. I've never used it, yet)

I want to make a accordion, and I want it to function like a site I found

It has to be able to run in Wordpress, and it also has to be able to house as many "sections" as I wish. It also has to be able to have multiple instances of the accordion with different information in each. The site that I got the idea from was http://www.steppenwolf.org/Plays-Events/.
I have next to no experience with javascript, but am proficient with HTML and CSS.
I am NOT asking you to make this for me, only help me in the building of such a thing.
I want to be able to use an unordered list to form the accordion:
<ul class="accordion-1">
<li class="accordion-item-1"></li>
<li class="accordion-item-2"></li>
<li class="accordion-item-3"></li>
<li class="accordion-item-4"></li>
</ul>
<ul class="accordion-2">
<li class="accordion-item-5"></li>
etc...
I would advise looking to see if there is already a plugin available. I did a quick search and found a jQueryUI one - http://wordpress.org/extend/plugins/jquery-ui-widgets/
This will allow you to use the Accordian plugin

How to get Facebook comments count in HTML5 without using a <div>?

The Facebook comments count can be done in three different ways: (without directly using JS)
<fb:comments-count href="http://example.com" />
<iframe src="http://www.facebook.com/plugins/comments.php?href=example.com" />
<div class="fb-comments-count" data-href="http://example.com">0</div>
The issue, however, is that doing something like this messes things up:
<p><div class="fb-comments-count" data-href="http://example.com">0</div> comments</p>
...because a <div> is firstly, not valid inside a <p> tag and secondly, looks wrong (though this could be fixed with CSS).
Basically, my question is: is there a way to do the above without using a <div> (a <span> for example), bearing in mind that I want to use the HTML5 method and (if possible!) want to avoid using javascript?
Clarification: I would like to avoid writing extra JS in the page simply because the MVC view currently looks nice and clean and I would prefer to keep it that way. Obviously, I'm still including the Facebook Connect library.
So, one solution would be to use a DIV instead of a P as the outer element.

Implement an if/else using TYPO3 templates syntax

Is there a way to to implement IF/ELSE using TYPO3 templates syntax?
Here is my template:
<div class="simi-prof-pic">
<div class="simi-botcurv">###ITEM_IMAGE###</div>
</div>
I would like it to work this way (written using PHP syntax):
<?php if(###ITEM_IMAGE###):?>
<div class="simi-prof-pic">
<div class="simi-botcurv">###ITEM_IMAGE###</div>
</div>
<?php else: ?>
NO IMAGE
<?php endif;?>
If you're implementing an extension you downloaded you're pretty much stuck with what you get and the templating engine you're describing is a simple search and replace mechanism which cannot be extended, cannot implement much presentation logic and will not interpret PHP.
If, however, you're writing your own module you can implement any of the alternative templating engines available for TYPO3, for example:
http://flow3.typo3.org/documentation/manuals/fluid/
http://typo3.org/extensions/repository/view/smarty/current/