JavaScript for Line of Business Applications
596.1K views | +0 today
Follow
JavaScript for Line of Business Applications
Keeping track of current JavaScript Frameworks that help design your clientside Business Logic Layers.
Curated by Jan Hesse
Beam to my Inbox:
Your new post is loading...
Your new post is loading...

Popular Tags - Filter using the Funnel

Current selected tag: 'Templating'. Clear
Scoop.it!

Conventional HTML in ASP.NET MVC: Client-side templates

Conventional HTML in ASP.NET MVC: Client-side templates | JavaScript for Line of Business Applications | Scoop.it

In our last post, we brought everything together to build composable blocks of tags driven off of metadata. We did this to make sure that when a concept exists in our application, it’s only defined once and the rest of our system builds off of this concept. This reduces logic duplication across several layers, ensuring that we don’t have to “remember” to do repetitive tasks, like a required field needing an asterisk and data attributes.

All of this works great because we’ve got all the information at our disposal on the server-side, and we can push the completed product down to the client (browser). But what if we’re building a SPA, using Angular or Knockout or Ember or Backbone? Do we have to revert back to our old ways of duplication? Or can we have the best of both worlds?

There tend to be three general approaches:

  • Just hard code it and accept the duplication
  • Include metadata in your JSON API calls, through hypermedia or other means
  • Build intelligence into templates

I’ve done all three, and each have their benefits and drawbacks. Most teams I talk to go with #1, and some go with #2. Very few teams I meet even think about #3.

No comment yet.
Scoop.it!

Testing AngularJS directive templates with Jasmine and Karma

Testing AngularJS directive templates with Jasmine and Karma | JavaScript for Line of Business Applications | Scoop.it

In my day job, I work on appear.in, a video chat service built with AngularJS and WebRTC. Recently, our application has become more complex, and our HTML templates ended up having a lot of state in them. We could no longer just use unit testing to verify our application logic, we also needed to test the state in our templates.

For our unit testing, we landed on using Jasmine and Karma, and this has worked fairly well for us. So when we wanted to test our templates, we wanted to use the same tools.

No comment yet.
Scoop.it!

A Deep Dive into Asynchronous Templating

A Deep Dive into Asynchronous Templating | JavaScript for Line of Business Applications | Scoop.it

Nunjucks does a lot of things, like loading templates, calling filters, and more. All of this is synchronous by default (which isn't a problem for loading templates, since they are loaded once and cached forever). This limits what you can do in filters and template loaders, since you can't use any async functions.

Asynchronous templates can be paused in the middle of rendering and resumed later.

This hasn't been a problem for a long time, and for most people never will be a problem. You don't want to mix too much logic with your templates, so you usually do all the complicated async work in a controller and pass the data to the template.

However, I can imagine sites that are heavily template-driven and developers wanting to wrap up some sort of behavior that depends on an async operation into a filter or custom tag. Nunjucks is built to allow people to add logic to their templates as needed, and works great for large content-heavy projects where not everybody is familiar with the backend.

Regardless, I think asynchronous control is an interesting feature that doesn't adversely effect existing templates, so I decided to dig into it. Here's what I came up with.

No comment yet.
Scoop.it!

Rendering Templates in Ext JS – So Many Choices

Rendering Templates in Ext JS – So Many Choices | JavaScript for Line of Business Applications | Scoop.it

Ext JS 4.0 provides a number of ways for custom components to render their HTML content for display:

autoEl, html, tpl/data, renderTpl/renderData

As I have been learning Ext JS, I have often struggled with knowing which technique is the correct one in a given situation. Here I will briefly discuss the different ways of specifying content, followed by some thoughts on when you might want to use them.

No comment yet.
Scoop.it!

OJ - A JavaScript library to build websites with objects.

OJ - A JavaScript library to build websites with objects. | JavaScript for Line of Business Applications | Scoop.it

OJ is a JavaScript library with the goal to make objects that create and live edit the web.

When making a website you have to keep in mind HTML, CSS, and JavaScript code. In OJ, all three parts are unified into objects. OJ can render to HTML and CSS as well as bind JavaScript events.

The benefit is that OJ objects have no dependencies. There is no need to read the docs to be sure the HTML is correct, or see if the CSS is included. Everything just works.

* Abstracts the web into view objects that create and change websites
* Unifies templating of HTML, CSS and JS
* A library written entirely in JavaScript
* Backbone support built-in with two-way model and collection binding
* Includes the simple smart objects: List, Table, Button, and form elements
* A growing collection of plugins: VimeoVideo, AceEditor, and more!
* DOM manipulation client-side
* HTML and CSS creation server-side
* Node server-side support (in progress)



Scoop.it!

Ember vs Angular - Templates

Ember vs Angular - Templates | JavaScript for Line of Business Applications | Scoop.it

My least favourite part in Angular is their templating syntax. Angular uses plain HTML with custom DOM attributes attributes for control flow (ng-hide, ng-show, ng-repeat). Whereas Ember uses Handlebars which supports more familiar control flow statements (if, else, each). Personally I prefer the Ember approach as it’s similar to most templating languages I have used (erb, haml, etc) and it’s easier for my CPU (aka brain) to scan and parse.

Lets look at a couple of examples.

No comment yet.
Scoop.it!

shared rendering in node and the browser

shared rendering in node and the browser | JavaScript for Line of Business Applications | Scoop.it

So you're using the same language on the browser and the server. Great!

You can get the benefits of fast initial page loads server-side that are easily indexed by search engines while simultaneously rendering realtime and on-demand content browser-side for a rich, responsive user experience!

This sounds really great, but now you might be thinking:

* How do I load the shared code in both environments without making a mess?
* How can I load files like html or templates in a way that works in both node and the browser?
* How do I render the data?
* How should I route the data where it needs to go?
These questions are not obvious and there are many ways to answer them! The rest of this article is some answers that I've discovered or built that work well together.

No comment yet.
Scoop.it!

HTML's New Template Tag: standardizing client-side templating

HTML's New Template Tag: standardizing client-side templating | JavaScript for Line of Business Applications | Scoop.it

The concept of templating is not new to web development. In fact, server-side templating languages/engines like Django (Python), ERB/Haml (Ruby), and Smarty (PHP) have been around for a long time. In the last couple of years however, we've seen an explosion of MVC frameworks spring up. All of them are slightly different, yet most share a common mechanic for rendering their presentational layer (aka da view): templates.

Let's face it. Templates are fantastic. Go ahead, ask around. Even its definition makes you feel warm and cozy.

No comment yet.
Scoop.it!

Building Single Page Applications With jQuery's Best Friends

Building Single Page Applications With jQuery's Best Friends | JavaScript for Line of Business Applications | Scoop.it

Hey guys.Today we're going to take a look at how you can build a single-page application (SPA) supporting graceful degradation using some of jQuery’s Best friends; DocumentCloud’s Backbone.js, Underscore.js, LAB.js and jQuery templating to name but a few.

The SPA application we’ll be building today is a three-level bookmarkable image gallery.

No comment yet.
Scoop.it!

Rivets.js — Lightweight and powerful data binding + templating solution for building modern web applications

Rivets.js — Lightweight and powerful data binding + templating solution for building modern web applications | JavaScript for Line of Business Applications | Scoop.it

Rivets.js is completely agnostic about your model / controller layer and works well with existing libraries that employ an event-driven model such as Backbone.js and Stapes.js. It ships with a built-in adapter for subscribing to plain JS objects using ES5 natives, however this can be replaced with a Watch.JS adapter or an Object.observe adapter.


From the event handlers to the template delimiters, the attribute prefixes to the preloading of data. It's all configurable and tunable at the application level as well as locally to individual views.

No comment yet.
Scoop.it!

JSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks

JSMVCOMFG: To sternly look at JavaScript MVC and Templating Frameworks.

Security Research on commen Frameworks schowing their weakest parts.
No comment yet.
Scoop.it!

Dustjs by linkedin - Asynchronous templates for the browser and node.js

Dustjs by linkedin - Asynchronous templates for the browser and node.js | JavaScript for Line of Business Applications | Scoop.it

Dust Highlights!

* async/streaming operation

* browser/node compatibility

* extended Mustache/ctemplate syntax

* clean, low-level API

* high performance

* composable templates

We built one of our high volume app Profile using dust and we heavily focus on performance. 

No comment yet.
Scoop.it!

Angular Blocks

Angular Blocks | JavaScript for Line of Business Applications | Scoop.it

I really enjoy using block-style template inheritance in Jade and Handlebars. From my understanding, this pattern was popularized by Django.

AngularJS rocks, but it relies on template inclusion to define layouts. This means the a layout context is spread across several templates. With block-style template inheritance, layouts are defined within a single template. Moreover, multiple layouts can be DRY’ed up with inheritance.

So I set out to build angular-blocks, an AngularJS module, to support template blocks.

No comment yet.
Scoop.it!

Get Angular, Durandal, and JavaScript Templates with SideWaffle

Get Angular, Durandal, and JavaScript Templates with SideWaffle | JavaScript for Line of Business Applications | Scoop.it

Hungry for some file templates to get you started in the morning? Well now you can fill up on a set of web template packs for Visual Studio 2012 and 2013. SideWaffle is an open source project that creates a Visual Studio extension containing a set of file templates you can use for web projects.
SideWaffle currently has several templates including 10 I contributed for Angular, Durandal, and creating a JavaScript IIFE. One of the best parts is that SideWaffle will be frequently updated with new and useful templates (they do check for high quality templates). I expect that in the near term we’ll see a lot of additions.
* Angular Controller (using Controller As syntax)
* Angular Controller (using $scope)
* Angular Directive (creates a skeleton for a directive)
* Angular Factory (great for data, logging, and other services)
* Angular Module (sets up a module)
* Durandal ViewModel
* Durandal Service
* Durandal main.js (common creation syntax for kicking off Durandal)
* JavaScript IIFE (Basic IIFE using vanilla.js)
I use the Angular templates in my upcoming course at Pluralsight on using Angular and Breeze to build a powerful SPA.

No comment yet.
Scoop.it!

Dynamic UI in ASP.NET MVC using Knockout.js and Template binding

Dynamic UI in ASP.NET MVC using Knockout.js and Template binding | JavaScript for Line of Business Applications | Scoop.it

One of the most awesome features in KO is ‘template’ binding. This is a simple mechanism for building UI structures with repeating UI blocks. Templates support data binding expressions to bind various HTML attributes (text, value, id, url etc.) to the data in the view model.

Typically, the template binding mechanism is used when the HTML table with rows or unordered or ordered lists need to be generated dynamically based upon the data received from the external source like WEB API or WCF Services.

No comment yet.
Scoop.it!

Moving Ember.js Handlebars templates into Rails the asset pipeline

Well, after getting the basics to work I decided to clean up the mess that was quickly becoming of the HTML and found the wonderful HandlebarsAssets gem that promises to compile Handlebars down to JavaScript and serve it through the Rails 3.1+ asset pipeline. After doing so I can say with confidence I managed to hit every single stumbling block along the way so I decided to write down where I went wrong. Hopefully this helps some other poor soul before he has to dive deep into the bowels of Ember like I had to :).

No comment yet.
Scoop.it!

Templating in JavaScript - Featuring Mustache, Jade, Transparency

Templating in JavaScript - Featuring Mustache, Jade, Transparency | JavaScript for Line of Business Applications | Scoop.it

In this post I will introduce the concept of templating. It is very likely you have already used some template engine. As a result I will go through the fundamentals quickly and then focus on a set of JavaScript ones.

You will see various approaches. There is no single right way to deal with it and sometimes it comes down to personal tastes. In this case I'll focus on just a few engines, namely Mustache, Jade andTransparency. You can find a full list of engines at our service in case you can see the available options.

No comment yet.