1.5 RC2 Released

written by Tom Dale & Yehuda Katz

It’s been just over a week since the SproutCore 1.5 RC1 was released, and we’ve been busy fixing many of the bugs reported by our tremendous community. To everyone who reported bugs: thank you! Your suggestions and real-world usage have been instrumental in ensuring production-ready quality as we approach the final release.

Here’s what’s new in RC2:

Bug Fixes

  • A ton of bugfixes to TemplateView
  • TemplateCollectionView now works with RecordArrays
  • TemplateCollectionView is now much more efficient when the array it is representing changes
  • Fixes a bug in the {{#each}} helper where the content was not updating after it changed
  • Fixes a bug where {{bindAttr}} was not working when provided with a class attribute
  • Explicitly documented the existence of the itemViewTemplate property in TemplateCollectionView
  • Fixes a bug where computed properties were not being invalidated when the first property in the path of their dependent key changed
  • Removed some trailing commas that were causing errors in Internet Explorer 7
  • Fixes a bug where unit tests were failing on Internet Explorer 7
  • Resolves an issue where text fields were not able to be activated on Android devices
  • Removed an invalid warning when bindings were connected

Features

  • Bindings now fire automatically when a property is changed via the debug console
  • Substantial improvements to the inline documentation
  • Updated QUnit to latest version


Enumerable Observers
While we try our best not to introduce API changes once a release candidate is out, we did have to revisit how enumerable observers (a new 1.5 feature) were implemented. They are now restricted to arrays, and other enumerables that implement SC.Array, such as SC.ArrayController and SC.RecordArray.

This change was necessary since it allows us to prevent materializing records in record arrays, which could number in the thousands or tens of thousands. These observers have been renamed “array content observers” to indicate that they are restricted to ordered lists only. In the future, we will consider adding a similar API for collections where order is unimportant.

Note that in SproutCore, all ordered lists implement SC.Array, not just native Arrays. That means that you can use the new array observers with native Arrays, RecordArrays, SparseArrays, ArrayControllers and any other object that implements the SC.Array protocol.

SproutCore 1.5 Release Candidate 1 Released

written by Tom Dale & Yehuda Katz

We’re happy to announce the release of SproutCore 1.5 RC1, which includes significant improvements to TemplateView. Those improvements include:

  • You can now use the normal Handlebars helpers ({{with}}, {{if}}, {{unless}}, and {{each}}) in your templates. If the properties they reference change, SproutCore will automatically update the DOM. For instance, if you use the {{#if}} helper with a true value, and the property later becomes falsy, SproutCore will automatically hide its contents.
  • If you were using the {{#collection}} helper for simple iteration, you can now use the regular Handlebars {{#each}} helper, and it will automatically update the DOM as the underlying Enumerable changes.
  • You can now use the normal Handlebars interpolation syntax ({{name}}), and SproutCore will automatically update the DOM when the underlying property changes; no need to use the {{bind}} helper anymore.
  • These new features mean that you can use an existing Handlebars template and, through the power of bindings, have it automatically update as its content changes in other parts of the application. Continue reading

Introducing SC.TemplateView – Now With Tutorial

written by Tom Dale & Yehuda Katz

Yesterday, we released an updated version of the SproutCore 1.5 prerelease gem that contains our preliminary work on Amber and SC.TemplateView.

To us, Amber means significantly reducing the cognitive overhead of picking up SproutCore for the first time. A big part of that is leveraging technology that web developers already know: HTML and CSS. We’ve heard from developers in the past who said they loved SproutCore’s observers and bindings but were intimidated by the complexity of its view layer.

Part of easing developers into SproutCore means having the best documentation on the planet. Over the past month, contributors have done a kick-ass job of populating the SproutCore Guides site with up-to-date and easy-to-follow material. We wanted to provide a similar experience for SC.TemplateView, so we’ve written a hands-on guide to using it to build a simple (but still fully-featured) todo application.

You can find the guide at http://guides.sproutcore.com/html_based.html. It takes you through the process of initializing a new project, defining your models, designing your views, and then tying them all together with controllers and bindings. You can also check out the finished product at https://github.com/sproutcore/Todos-Example.

We think that describing the flow of data in your application, then allowing the framework to put the pieces together for you, leads to robust, maintainable applications. In fact, we think this declarative structure is the only way to build web applications that truly scale beyond simplistic demos like this one. We plan to create a second iteration of this app that really shows off how well the declarative model allows you to manage increasing complexity. But for now, we think you’ll be blown away at how features begin to emerge, almost like magic. By paying a small upfront cost, you begin to get functionality for free.

Continue reading

SproutCore 1.5.pre.4 – TemplateView is Here

written by Tom Dale & Yehuda Katz

Today we released the fourth pre-release of SproutCore 1.5, moving us a step closer to a final release next month. This version has a bunch of new features, including the initial release of TemplateView, which makes it easier to build SproutCore applications in a more conventional HTML style.

You can get the prerelease gem by typing:

gem install sproutcore --pre

Here are some of the improvements:

SC.TemplateView

Template views can form the basis of an entire application, or can integrate seamlessly with an existing SproutCore view hierarchy. This release incorporates support for the Handlebars template engine in both SproutCore itself and the SproutCore build tools.

Templates are HTML files with special tags included that can reference properties on your view or other objects. These properties can be setup as bindings so the HTML will automatically update whenever the properties change.

In general you define templates in your resources/templates directory and then use SC.TemplateView to render them. Working with SC.TemplateView is just like any other view except you specify a templateName property instead of a render method. For instance, if you had a template at resources/templates/post_item.handlebars, you could use it in your app with something like:

MyApp.PostItemView = SC.TemplateView.extend({
  templateName: 'post_item'
});


Continue reading

SproutCore 1.5 Prerelease

written by Tom Dale & Yehuda Katz

We’ve just released a 1.5 pre-release gem. There’s still a lot of flux and it’s not considered stable so we don’t recommend it for production apps, but if you’d like a sneak peek of the new features take a look. To install just run

gem install sproutcore --pre

We’ll be releasing more information about the new features in 1.5 over the coming weeks so keep an eye out.