Smalltalker since 94 and I still maintain a ST app , lots of Ruby/ Jruby now as well and sundries in keeping with our polyglot world, been playing with Dart but it seems that it in that space it would be nice to try to get back to Smalltalk. You all seem to be having good progress but more of its clear from scanning google group than the web site.
-- Anyhow, I want to get my feet wet. There are not many meaty samples apps available. BTW, I admit that my jquery is pretty green and it seems that Amber relies a lot on jquery. What I would like to play with is using Amber to connect to a Ruby Sinatra service that will spew back a set of database records via json from which I will dynamically populate a html table. Basically , its a test rdms db browser. so:
That's my get my feet wet project. As far as Amber is this possible:
finally I have an active real app that I need to decide whether I
For what its worth if go Amber I'll certainly be an active user since this is being driven by an active project so if anybody can point me in the right direction to accomplish the above I would very much appreciate it . thanks Charles NYC Smalltalk You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
Hi Charles, most time you're wondering whether something can be done with Amber, the question breaks down to the question whether this can be done with JavaScript. 1. jQuery provides AJAX requests. Take a look at PackageHandler>>ajaxPutAt:data: for an example. It's quite easy to use but you might want to add some functionality around, e.g. for keeping your models in sync with the Rails/Sinatra backend. jQuery ajax: '/book/1' options: #{ 'type' -> 'PUT'. 'data' -> 'a string or JSON' "..."}. You can also provide a callback for async requests. 2. You don't actually need a JSON parser. JavaScript/your browser already has one. jQuery can automatically convert the result of an AJAX request to a JavaScript object (by parsing the JSON string). And you can easily use JavaScript objects in Amber: e.g. you can access fields by sending the name of the field to the object. 3. Take a look at this example. It adds a table to a div tag. You can put this code into the callback of your AJAX request and fill the table with results from the request. |html| html := HTMLCanvas onJQuery: '#your-div-id' asJQuery. html with: [html table with: [html tr with: [html td with: 'Hello World!']]]. 4. I don't know how selection events work in JavaScript, but here's a short example for a click event. It works similar with other DOM events. |table| table := html table with: ["..."]. table onClick: ["This code is executed when you click the table"]. Feel free to take a look at the class Counter in package Examples. It shows how to render stuff and bind events. Maybe an interactive tutorial for Amber, similar to ProfStef (http://amber-lang.net/learn.html), would help people to get familiar with Amber? Especially people who did never use Seaside (probably the majority). Amber comes with SUnit, a framework for running unit tests. It is possible to run these test automatically on a CI server (Amber is on Travis, take a look at this if you're interested in this). Amber has an interactive debugger that is similar to the ST debugger. You can set break points, take a look at the objects and proceed with the execution. I don't know the debugger internals, so somebody else can probably explain the differences between the Amber debugger and the Pharo/Smalltalk debugger much better. Concerning Rails, I think that you won't need ERBs a lot. I wrote an Amber application with a Rails backend once, and I used Rails only as a database and resource backend. I set up (RESTful) controllers for resources and talked with the backend via AJAX. Amber can do the whole rendering. So to say, my views were rendered by Amber. I think I can write a short demo app in the next week, since you're probably not the one who thinks about using Amber with Rails/Sinatra. I'm not familiar with Dart or jrubyfx, so I can't say anything about this. I'm thinking about writing a Rubygem/Rails Engine (something like this https://github.com/johnnyt/amber-rails but with more functionality) that integrates Amber in Rails apps easily. For example, the Rails engine could provide a controller for committing code in development mode, such that you don't need to run the NodeJS server in the background. It should also provide an easy way to include Amber in ERBs. Is this something you would be interested in? Feel free to ask more questions on this list, we're always interested in people using Amber. Matthias On Wednesday, August 14, 2013 10:26:35 PM UTC+2, Charles A. Monteiro wrote:
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
In reply to this post by Charles A. Monteiro
Matthias:
-- thank you for the prompt reply. I'll follow thru on the api you have listed. I actually don't use Sinatra for html generation but rather as an http servicer and thus my rendering has been in "fatter" clients i.e. Adobe Flex and Jrubyfx (JavaFX) and Dart playing around, so it would suit me fine to have Amber do all rendering browser side. However , it seems that I have to beef up on JS and JQuery. BTW, after installing helios, and compiling it, I am able to run the helios IDE in Safari but I'm having issues with rendering the Counter example. The "do it" does nothing. On Wednesday, August 14, 2013 4:26:35 PM UTC-4, Charles A. Monteiro wrote:
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
what's happening with the Counter example is that the counter is opening within the sunit tab.
-- yes please: " I think I can write a short demo app in the next week, since you're probably not the one who thinks about using Amber with Rails/Sinatra." I think a simple Sinatra classic app will do just fine, illustrating get/put populating a table . I have schema browser in jrubyfx that I can try to port to Amber once I get up on my feet. On Wednesday, August 14, 2013 7:16:40 PM UTC-4, Charles A. Monteiro wrote:
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
In reply to this post by matthias.springer
Matthias Springer wrote: > Hi Charles, > > most time you're wondering whether something can be done with Amber, the > question breaks down to the question whether this can be done with > JavaScript. > > 1. jQuery provides AJAX requests. Take a look at > PackageHandler>>ajaxPutAt:data: for an example. It's quite easy to use > but you might want to add some functionality around, e.g. for keeping > your models in sync with the Rails/Sinatra backend. > > jQuery > ajax: '/book/1' > options: #{ > 'type' -> 'PUT'. > 'data' -> 'a string or JSON' > "..."}. The code should be eefactored now so that it does not use jQuery directly but inherits InterfacingObject / call PlatformInteface directly. So it will be self ajax: #{ 'url' -> '/book/1'. 'type' -> 'PUT'. "..." } > You can also provide a callback for async requests. > > 3. Take a look at this example. It adds a table to a div tag. You can > put this code into the callback of your AJAX request and fill the table > with results from the request. > |html| > html := HTMLCanvas onJQuery: '#your-div-id' asJQuery. > html > with: [html table > with: [html tr > with: [html td > with: 'Hello World!']]]. There are more ways to do it, somehow I feel creating HTMLCanvas directly is not the right thing. I would recommend [ :html | html table with: [ html tr with: [ html td with: 'Hello World!' ]]] appendToJQuery: '#your-div-id' asJQuery Herby > Matthias > > On Wednesday, August 14, 2013 10:26:35 PM UTC+2, Charles A. Monteiro wrote: > > Smalltalker since 94 and I still maintain a ST app , lots of Ruby/ > Jruby now as well and sundries in keeping with our polyglot world, > been playing with Dart but it seems that it in that space it would > be nice to try to get back to Smalltalk. You all seem to be having > good progress but more of its clear from scanning google group than > the web site. > > Anyhow, I want to get my feet wet. There are not many meaty samples > apps available. BTW, I admit that my jquery is pretty green and it > seems that Amber relies a lot on jquery. > > What I would like to play with is using Amber to connect to a Ruby > Sinatra service that will spew back a set of database records via > json from which I will dynamically populate a html table. Basically > , its a test rdms db browser. > > so: > > 1. I need a Rest client, hopefully a nice ST class > 2. Json parser > 3. I need a way of injecting an html table onto a document or > actually a pre-existing div based on the json data I receive > 4. I would like to setup a selection event handler on the table so > that I can then populate other input fields based on the row > selected > 5. I would like for most of this to be transparent i.e. don't want > to use jquery unless for the leveraging of specific ui > components i.e. tabs, accordions , stuff that I can't do with html5 > > That's my get my feet wet project. > > As far as Amber is this possible: > > 1. A unit test framework with UI runner ? > 2. Can I debug in Amber i.e an ST like debugger ? or does debugging > dump down to JS and debugging to chrome , firebug etc? > > finally I have an active real app that I need to decide whether I > > 1. User Rails/Sinatra erb type approach > 2. Client based approach i.e. Dart > 3. jrubyfx applet > > For what its worth if go Amber I'll certainly be an active user > since this is being driven by an active project so if anybody can > point me in the right direction to accomplish the above I would very > much appreciate it . > > thanks > > Charles > NYC Smalltalk > > -- > You received this message because you are subscribed to the Google > Groups "amber-lang" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to [hidden email]. > For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
In reply to this post by Charles A. Monteiro
You should be able to run the Counter example by executing "Counter tryExample" in the workspace.
-- Here's a short Sinatra example: https://github.com/matthias-springer/amber-sinatra-example. The code is not very nice but it illustrates how to use AJAX requests. The code is in the Example package. You can run the example by executing "Todo runDemo". On Thursday, August 15, 2013 1:35:47 AM UTC+2, Charles A. Monteiro wrote:
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
In reply to this post by Herby Vojčík
I would say that if it's made for inclusion into Amber, yes, InterfacingObject is better. Else people are free to use jQuery directly.
Cheers, Nico On Aug 15, 2013, at 7:08 AM, Herby Vojčík <[hidden email]> wrote: > The code should be eefactored now so that it does not use jQuery directly but inherits InterfacingObject / call PlatformInteface directly. > > So it will be > self ajax: #{ > 'url' -> '/book/1'. > 'type' -> 'PUT'. > "..." > } -- Nicolas Petton http://www.nicolas-petton.fr -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
In reply to this post by matthias.springer
Out of curiosity, does anyone else see that the Counter example has been renamed to Counterzzz? I wondered if it was some strange caching effect at my end?
On Thu, Aug 15, 2013 at 11:40 AM, Matthias Springer <[hidden email]> wrote:
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
Yes. It was my mistake :) It has been fixed since then though :)
Nico On Aug 19, 2013, at 6:46 PM, Andy Burnett <[hidden email]> wrote:
-- Nicolas Petton http://www.nicolas-petton.fr You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
Glad to hear that it isn't just my eyes going strange! However, the counterzzz is still visible on the amber-lang site. So perhaps that hasn't been updated yet?
-- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
Oh, right. I need to update the website!
Thanks :) Nico On Aug 20, 2013, at 2:00 PM, Andy Burnett <[hidden email]> wrote:
-- Nicolas Petton http://www.nicolas-petton.fr You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/groups/opt_out. |
Free forum by Nabble | Edit this page |