Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

AngularJS

61 views
Skip to first unread message

Paul Johnston

unread,
Sep 26, 2013, 9:08:21 AM9/26/13
to toscawidge...@googlegroups.com
Hi,

I've just been playing with AngularJS and it is amazing! It is based on the idea of templates in JavaScript, but takes it further than the likes of mustache.js. I think it's now becoming clear that this approach is the future of web apps. There's even a fix for the major concern - what if the user has disabled javascript - by server-side javascript rendering, e.g. using node.js

Now, I wondered if we'd want a tw2.angular but on reflection this would be a bad idea. It would get in the way without adding value. It's better to just write Angular directly. And there are tools in that ecosystem (e.g. grunt) that do some of the things tw2 does.

The server-side of an AngularJS app is pretty much just a REST service. It serves up JSON; the client does all the rendering. Now, the likes of Pyramid, Django, etc. can do this. But their REST support is not optimised for this kind of usage. Flask has an interesting plugin flask-restless which is a thin layer to serve an SQLAlchemy class as a REST service.

Now what I'm getting to here, is that tw2 doesn't have much of a role in the AngularJS world, but that there is an opportunity for a REST framework to gain significant traction.

I've not much time to work on this, but wanted to share my thoughts.

Paul

Alessandro Molina

unread,
Oct 1, 2013, 3:22:51 PM10/1/13
to toscawidge...@googlegroups.com
Hi Paul,
I have been using with some satisfaction http://www.ractivejs.org/ which implements most of the concepts in Angular.JS while being more data storage layer agnostic.
You might want to take a look at, it has some interesting features and is generally easier to use than Angular.

It copes great with TurboGears CrudRestController autogenerated REST API and I ended up making a RactiveWidget (available in https://bitbucket.org/axant/axf) which makes easy to create reusable components based on ractive.js which can be displayed as TW widgets.



--
You received this message because you are subscribed to the Google Groups "ToscaWidgets-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to toscawidgets-dis...@googlegroups.com.
To post to this group, send email to toscawidge...@googlegroups.com.
Visit this group at http://groups.google.com/group/toscawidgets-discuss.
For more options, visit https://groups.google.com/groups/opt_out.

Paul Johnston

unread,
Oct 6, 2013, 11:15:55 AM10/6/13
to toscawidge...@googlegroups.com
Hi,

I'd not seen ractivejs before, but it too looks interesting.

When using CrudRestController, how do you enforce the business logic? Most apps have some authorisation rules (including row level auth), as well as validation, and also event driven actions (e.g. when order status set to fulfilled, send email to customer) These are difficult to implement when you're using a formulaic controller, like CrudRestController.

Paul


Alessandro Molina

unread,
Oct 22, 2013, 3:17:04 AM10/22/13
to toscawidge...@googlegroups.com
On Sun, Oct 6, 2013 at 5:15 PM, Paul Johnston <p...@pajhome.org.uk> wrote:

When using CrudRestController, how do you enforce the business logic? Most apps have some authorisation rules (including row level auth), as well as validation, and also event driven actions (e.g. when order status set to fulfilled, send email to customer) These are difficult to implement when you're using a formulaic controller, like CrudRestController.

I usually just subclass, using the @expose(inherit=True) feature it's fairly easy to extend the CrudRestController behaviour:
There is a simple example on http://turbogears.readthedocs.org/en/latest/turbogears/wikier/caching.html#updating-updated-at that sets an updated_at field whenever the object gets modified (it explicitly avoid using SQLA for this).


Paul Johnston

unread,
Oct 23, 2013, 3:49:29 PM10/23/13
to toscawidge...@googlegroups.com
Hi,
 
I usually just subclass, using the @expose(inherit=True) feature it's fairly easy to extend the CrudRestController behaviour:
There is a simple example on http://turbogears.readthedocs.org/en/latest/turbogears/wikier/caching.html#updating-updated-at that sets an updated_at field whenever the object gets modified (it explicitly avoid using SQLA for this).

I see... that makes a lot of sense. Going to play with this some more now :-)

Paul
Reply all
Reply to author
Forward
0 new messages