Skip to content

Commit

Permalink
support for a custom action as part of the child definition when usin…
Browse files Browse the repository at this point in the history
…g HTMLFrame mojit. Before, only =index= action was supported for the child mojit. This feature will allow you to reuse the same instance definition with multiple actions.
  • Loading branch information
caridy committed Apr 17, 2012
1 parent 5b6a2bc commit 2bb0d70
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions source/lib/mojits/HTMLFrameMojit/controller.server.js
Expand Up @@ -51,8 +51,9 @@ YUI.add('HTMLFrameMojit', function(Y, NAME) {
var child = ac.config.get('child'),
cfg;

// Map the action to the child
child.action = ac.action;
// Map the action to the child if the action
// is not specified as part of the child config.
child.action = child.action || ac.action;

// Create a config object for the composite addon
cfg = {
Expand Down

3 comments on commit 2bb0d70

@isao
Copy link

@isao isao commented on 2bb0d70 May 7, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Caridy, can you describe how this change could be used?

@caridy
Copy link
Owner Author

@caridy caridy commented on 2bb0d70 May 8, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is an example:

        "foo": {
            "type": "Foo",
            "action": "bar"
        },
        "frame": {
            "type": "HTMLFrameMojit",
            "config": {
                "child" : {
                    "base": "foo"
                }
            }
        }

or just:

        "frame": {
            "type": "HTMLFrameMojit",
            "config": {
                "child" : {
                    "type": "Foo",
                    "action": "bar"
                }
            }
        }

In both cases, HTMLFrame will execute "index" rather than the specified "action", because it is using the action from "ac" under HTMLFrame.

@isao
Copy link

@isao isao commented on 2bb0d70 May 8, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah perfect. thanks again Caridy.

Please sign in to comment.