Triggering controller actions and continuation

1 view
Skip to first unread message

Gabriel Birke

unread,
Apr 4, 2010, 8:37:52 AM4/4/10
to jquery-claypool
Hello,

Suppose a controller action must gather additional data from the user
(a confirmation for example). At the moment I'm using plain old
window.confirm() but I thought about nice modal dialogs. This lead to
lots of questions:
How would these be correctly implemented in the Claypool framework?
Can controller action "A" be triggered inside controller action "B"?
The documentation hints at it with event.c()
And if action "A" has finished (rendered the view, etc), will
controller action B continued from the point where it left?
Or must it be triggered from A, with additional parameters?
Am I thinking too complicated? :)

Greetings,

Gabriel

chris thatcher

unread,
Apr 4, 2010, 8:44:07 AM4/4/10
to jquery-...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "jquery-claypool" group.
To post to this group, send email to jquery-...@googlegroups.com.
To unsubscribe from this group, send email to jquery-claypo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jquery-claypool?hl=en.




--
Christopher Thatcher

chris thatcher

unread,
Apr 4, 2010, 8:53:14 AM4/4/10
to jquery-...@googlegroups.com
Oops, I hit send before I typed anything. ;)

This is a perfect place for filters, via AOP.  aop allows you to attach some functionality 'around' another function.  You can trigger the modal in the filter and either proceed or interupt the control, cleaning keeping that logic outside your controller.  Modals are often treated as less-than-full-mvc-widgets since their so basic, but you can decide what level you need.  wizards are complex modals that often require their own mvc components.  Here a filter (from config/filters.js):

var log;

$.filters({

        id        : "#areYouSureFilter",
        target    : "Garbriels.Controllers.*",
        around    : "(deleteSomethingImportant)",
        advice    : function(invocation){
            log = log||$.logger('Garbriels.Filters');
            log.debug('Intercepted call');
           
            var yesOrNo = doDialogHere();

            if('yes' == yesOrNo){
                return invocation.proceed();
            }
            //do not proceed       

});

Again, if this doesnt get you far enough along, let me know and we'll work through an example together.


On Sun, Apr 4, 2010 at 8:37 AM, Gabriel Birke <gabrie...@gmail.com> wrote:
--
You received this message because you are subscribed to the Google Groups "jquery-claypool" group.
To post to this group, send email to jquery-...@googlegroups.com.
To unsubscribe from this group, send email to jquery-claypo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jquery-claypool?hl=en.




--
Christopher Thatcher

Brandon Smith

unread,
Apr 4, 2010, 4:57:54 PM4/4/10
to jquery-...@googlegroups.com
I am using filters/AOP for all of our popup confirmations.

The interactions between entities in my system can get messy. When
deleting an instance of one entity type, for example, it is necessary
for the user to decide delete related, but standalone, entities.

This was a perfect opportunity to use filters, as it was nearly
orthogonal functionality. Keeps the entity controllers and models
clean and provides a predictable place for such code to exist.

(Shameless plug...) The application I am describing is Web front end
of Phonebooth... http://www.phonebooth.com/ We are invite only at
this point, and have quite a backlog. But anyone on this list, just
send me an email and I'll send you an invitation ASAP.

Brandon Smith

chris thatcher

unread,
Apr 5, 2010, 12:42:35 PM4/5/10
to jquery-...@googlegroups.com
I would love to, though no pressure.  I'm thrilled to hear you are using jquery-claypool and will always be available to support you.
Reply all
Reply to author
Forward
0 new messages