On Miércoles, 24 de Febrero de 2010 09:15:16 Soren Christensen escribió:
> Nice !
>
>   def create_respond_to_html
>      if successful?
>        render :inline =>  '<%= javascript_tag "window.close()" %>'
>      else
>        super
>      end
>    end

You can override create.html.erb and add some javascript to change cancel 
link:
<script type="text/javascript">
$$("#<%= element_form_id(:action => :create) %> 
a.cancel").first().observe('click', function() { window.close(); });
</script>

>
>
> obviously delete and the other standard actions works too.
>
> But what about Cancel ?
>
> That would send the user to the index function - can we capture that one
> somehow ?
>
> /S
>
> On 2/23/2010 3:43 AM, Sergio Cambra .:: entreCables S.L. ::. wrote:
> > On Martes, 23 de Febrero de 2010 10:10:46 Soren Christensen escribió:
> >> My creates are regular AS creates. Do I need to do something specific to
> >> change the default behavior ?
> >
> > Sorry, I was wrong, I forgot when you load the page without XHR, the form
> > will be sent as http request, without XHR. So the response will be an
> > html response, and you will have to override create_respond_to_html:
> >    def create_respond_to_html
> >      if successful?
> >        render :inline =>  '<%= javascript_tag "window.close()" %>'
> >      else
> >        super
> >      end
> >    end
> >
> >> /S
> >>
> >> On 2/22/2010 11:46 PM, [email protected] wrote:
> >>> Nothing happens means... 1. create is triggered, but not your
> >>> on_create.js.rjs. or 2. even create is not triggered.
> >>>
> >>> For option 1 I would check if your create form is triggering a
> >>> "normal" html request and not an ajax request.
> >>>
> >>> --
> >>> Volker
> >>>
> >>> On 22 Feb., 22:20, Soren Christensen<[email protected]>   wrote:
> >>>> I'm sure that I'm overlooking something:
> >>>>
> >>>> Here is how I create the popup:
> >>>> <%= link_to image_tag("/images/icons/add.png", :alt =>   "Add")+" Add
> >>>> New Employer", new_employer_path,  :popup =>   Konfig::POPTIONS2  %>
> >>>>
> >>>> and in views/employers/on_create.js.rjs I have:
> >>>> page<<   'window.close()'
> >>>>
> >>>> But nothing happens - I don't even see the rjs file in the log.
> >>>>
> >>>> /S
> >>>>
> >>>> Sergio Cambra .:: entreCables S.L. ::. wrote:
> >>>>> On S�bado, 20 de Febrero de 2010 03:21:50 Soren Christensen escribi�:
> >>>>>> Hi,
> >>>>>>
> >>>>>>
> >>>>>> Does anybody know if one can redirect to another action after one
> >>>>>> has say created a new record ?
> >>>>>
> >>>>> You can override action_respond_to_format (for example,
> >>>>> update_respond_to_html). If you want to redirect to edit, use
> >>>>> config.create.edit_after_create = true
> >>>>>
> >>>>>> One level up. I have a screen where a user can create a new
> >>>>>> employer. The create link is build with AS so when clicked the user
> >>>>>> is taken to an AS create screen in a new popup.
> >>>>>>
> >>>>>>
> >>>>>> Now once the create action is completed I would like to just destroy
> >>>>>> the window and return to the previous window. Any hints on how to do
> >>>>>> this ?
> >>>>>
> >>>>> You have to override on_create.js.rjs view and add there some
> >>>>> javascript code (page<<   'window.close()' should be enough).

-- 
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en.

Reply via email to