Ajax Scaffold Generator for Rails Released

Or even ‘ajax_scaffold_rails_generator’ … but nevertheless you make a
very valid point. I wish I had thought of that before I created all the
packages (I know I could go back and change them, but I don’t really
wanna deal with the confusion that would cause).

Adam F. wrote:

On Tue, Feb 28, 2006 at 09:18:44PM +0100, James B. wrote:
[…]

gem install ajax_scaffold_generator --remote

and everything needed for ajax_scaffold_generator will be identified and
downloaded for you (after you consent).

Installing gem now will make extending and maintaining ruby and rails
much easier for you later.

It occurs to me after using a bunch of these - why are the rails gems
not labeled as such?

There are lots of gems, and many of them are generic ruby
packages. Perhaps we could encourage people who make gems for rails to
specify that they’re rails-specific in the names.

It would be much clearer if this was rails_ajax_scaffold_generator.


- Adam

** Expert Technical Project and Business Management
**** System Performance Analysis and Architecture
****** [ http://www.everylastounce.com ]

[ Adam Fields (weblog) - - entertaining hundreds of millions of eyeball atoms every day ] … Blog
[ Adam Fields Resume ]… Experience
[ Adam Fields | Flickr ] … Photos
[ http://www.aquicki.com/wiki ]…Wiki
[ http://del.icio.us/fields ] … Links

Yep, JavaScript doesn’t have access to the filesystem (unless you’re
Microsoft). So form_remote_tag will not work for file uploads.

– Jeff

(here’s one reason why)

I’m not honestly sure about whether file uploads work inside a
form_remote_tag. If they don’t then obviously an ajax scaffold won’t
help you one bit.

If you can then you should be able to create a simple file manager
easily with by creating a basic scaffold (maybe of an UploadFile model
that has a label attribute), modifying the form to add a file upload box
and creating the necessary controller code to handle form submission of
said file upload.

Joe Van D. wrote:

On 2/26/06, Richard W. [email protected] wrote:

scratch. I’d gotten about 3/4 of the functionality you have (with
http://www.height1percent.com/articles/2006/02/26/on-the-ajax-scaffold-feedback

How could I modify this to do file uploads? I can’t do uploads inside
form_remote_tag, right?

Hi Richard,

please keep an eye on cross-browser-compatibility.

What is with non-javascript-browsers like dillo or links? Do you
provide alternative ways for a use case?

Does it work with upcoming browsers that are not yet released or even
thought of?

regards,
Helmut

Am 25.02.2006 um 22:36 schrieb Richard W.:

It only supports and probably only will support FF 1.0+, Safari 10.4+
and IE 6+. I have a post on my site about future direction and I
specifically state that I will NOT spend my time making it work for
the ~1% of people that don’t have one of those browsers I just listed.

Same goes for anyone without JS. I mentioned this on that same blog post
that I am not interested in devoting a large amount of time to people
stuck in the stone age with Javascript. They make up a very small % of
the population and I’m not that concerned with them. If you are building
an Ajax application and your core set of users don’t have JS then you
are doing something wrong.

As far as ‘upcoming browsers that are not yet released or even thought
of’ I’m not sure if that’s a joke or if you are using that as a segway
to sell me a crystal ball :slight_smile: But no, I won’t guarantee that I can
support indeterminate things in the future hehe.

Rich

Helmut Sedding wrote:

Hi Richard,

please keep an eye on cross-browser-compatibility.

What is with non-javascript-browsers like dillo or links? Do you
provide alternative ways for a use case?

Does it work with upcoming browsers that are not yet released or even
thought of?

regards,
Helmut

Am 25.02.2006 um 22:36 schrieb Richard W.:

well, with Kyle’s plugin ( http://www.kylemaxwell.com/ ) you CAN upload
files from form_remote_tag. Check out the sample app and the comments
for
how to make it work on rails edge

Conrad T. wrote:

Hi Richard, when I one clicks the “create new”, it creates a form for
taking user inputs. However, shouldn’t one only be able to create a
single form? For example, when I click create, it can generate one
form right after the previous on the same page. I’m guessing that it
should only be one form presented and the form should be presented
only when it’s not visible.

-Conrad

Why limit it? I don’t see any reason to restrict the user to only have
one create form open at once. If you know of a reason that I haven’t
thought of let me know.

-Rich

Hi Richard, when I one clicks the “create new”, it creates a form for
taking user inputs. However, shouldn’t one only be able to create a
single form? For example, when I click create, it can generate one
form right after the previous on the same page. I’m guessing that it
should only be one form presented and the form should be presented
only when it’s not visible.

-Conrad

Justin F. wrote:

Richard W. wrote:

are doing something wrong.
The most important consideration here is that disabled people (who may
rely on assistive technologies like screen readers) may not be able to
use a site which depends on JavaScript and DHTML. It’s fine to give a
better user experience to people who can see well and use a mouse, but
it’s not fine (and may be illegal) to prevent less fortunate people from
using a web site or application.

Justin

Justin, I laugh at the idea but you do put a more human face on the
problem. I apologize for being so crass in my comments.

Thankfully thats all water under the bridge now, as the 2.2.0 release
gracefully degrades in the abscence of Javascript.

Rich

Richard W. wrote:

are doing something wrong.
The most important consideration here is that disabled people (who may
rely on assistive technologies like screen readers) may not be able to
use a site which depends on JavaScript and DHTML. It’s fine to give a
better user experience to people who can see well and use a mouse, but
it’s not fine (and may be illegal) to prevent less fortunate people from
using a web site or application.

Justin

Richard W. wrote:

Justin

Justin, I laugh at the idea but you do put a more human face on the
problem. I apologize for being so crass in my comments.

Thankfully thats all water under the bridge now, as the 2.2.0 release
gracefully degrades in the abscence of Javascript.

Well done! I appreciate that scaffold is only to get people started, but
it’s also a way of teaching by example…

I was impressed by the demo of your first version, and will take another
look.

Justin

I love the Ajax scaffold generator for machine administrative
consoles. I do have a suggestion though.

A suggestion for the generator. With some hacking it is possible to
support putting one thing in a sub list of the list for an other
thing. Say that you have a display for a set of vending machines and
for each vending maching there are n different things sold so the
list display for vending machines might look like:

Vending machines----------------------------Create vending machine
Vending machine #1 Edit , Delete
Sales Items------------------------------------Create new
sales item
Item #1 400 in stock Edit , Delete
Item #2 12 in stock Edit , Delete

Vending machine #2 Edit , Delete
Sales Items------------------------------------Create new
sales item
Item #1 53 in stock Edit , Delete
Item #4 370 in stock Edit , Delete

If the type of Vending machine = vender and Sales items = item the
change need to do this is to modify the value used by the javascript
in ‘ajax_scaffold.js’ to find the right DOM elements. What I did was
add an '_#{vender_id} to each place an id was being set or
'link_to_remote was being set. This modified the value used as
‘type’ in ‘ajax_scaffold.js’ . Also the ‘list.rhtml’ for item was
turned in to a partial ‘_list.rhtml’ so that it could be called from
the ‘_vendor.rhtml’ partial

To make this easier it would be great if the *.rhtml templates took a
value set (:parent_id for example) in :locals of the call to the
partial that insert a value to all the css id names and
call_to_remote calls to do what I did manually to each place the
‘type’ value was set. This could look like the following

What is now

Sales Items

<%= loading_indicator_tag 'item', "new" %> <%= link_to_remote "Create New", { :url => { :controller => 'items', :action => 'new' }, :loading => "AjaxScaffold.newOnLoading(request,'items');", :success => "AjaxScaffold.newOnSuccess(request,'items');", :failure => "AjaxScaffold.newOnFailure(request,'items');" }, { :href => url_for(:controller => 'items', :action => 'new' ), :class => "create" } %>

What I did

Sales Items

<%= loading_indicator_tag 'item_'+vender_id.to_s, "new" %> <%= link_to_remote "Create New", { :url => { :controller => 'items', :action => 'new' , :vender_id=>vender_id }, :loading => "AjaxScaffold.newOnLoading(request,'items_# {vender_id.to_s}');", :success => "AjaxScaffold.newOnSuccess(request,'items_# {vender_id.to_s}');", :failure => "AjaxScaffold.newOnFailure(request,'items_# {vender_id.to_s}');" }, { :href => url_for(:controller => 'items', :action => 'new' , : vender_id => vender_id ), :class => "create" } %>

WHAT COULD BE

<h2>Sales Items</h2>
<%= loading_indicator_tag 'item_'+parent_id, "new" %> <%= link_to_remote "Create New", { :url => { :controller => 'items', :action => 'new' , :parent_id=>parent_id }, :loading => "AjaxScaffold.newOnLoading(request,'items_# {parent_id}');", :success => "AjaxScaffold.newOnSuccess(request,'items_# {parent_id}');", :failure => "AjaxScaffold.newOnFailure(request,'items_# {parent_id}');" }, { :href => url_for(:controller => 'items', :action => 'new' , :parent_id => parent_id ), :class => "create" } %>