Quantcast

Method invocation from erb problem

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Method invocation from erb problem

bakaibalazs
This post was updated on .
Hy!

I' woud like to invoke a method (myAction) from an erb file. The button appears, but the method does not invoke after I pressed the button.

Any suggestion?



//xx.html.erb
<div class="dashbox">
        <%= button_to "GO", :method => :myAction %>
</div>


//Java
@UserRole(UserRole.ADMIN)
@NavigationSection(NavigationSection.CONFIGURATION)
public final class MyPage extends AbstractRubyTemplate implements org.sonar.api.web.RubyRailsPage, Page{
               
        public String getId() {
                return "xxx";
        }

        public String getTitle() {
                return "yyy";
        }

        public void myAction(){
                System.out.println("go");
        }
       

        @Override
        protected String getTemplatePath() {
        return xx.html.erb";
        }

}
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [sonar-dev] Simple method invocation from erb

Simon Brandhof
Hi,

The extension point "Page" provides only metadata. The page is implemented in the Ruby code. For this reason the Java method myAction() is ignored.
You should have a look at the new extension point for implementing complete ruby applications :
http://docs.codehaus.org/display/SONAR/Extend+Web+Application#ExtendWebApplication-Applications

Regards

On 5 September 2012 12:33, bbalazs <[hidden email]> wrote:
Hy!

I' woud like to invoke a method (myAction) from an erb file. The button
appears, but the method does not invoke after I pressed the button.

Any suggestion?



//xx.html.erb
<div class="dashbox">

MyPage

        <%= button_to "GO", :method => :myAction %>
</div>


//Java
@UserRole(UserRole.ADMIN)
@NavigationSection(NavigationSection.CONFIGURATION)
public final class MyPage extends AbstractRubyTemplate implements
org.sonar.api.web.RubyRailsPage, Page{

        public String getId() {
                return "xxx";
        }

        public String getTitle() {
                return "yyy";
        }

        public void myAction(){
                System.out.println("go");
        }


        @Override
        protected String getTemplatePath() {
        return xx.html.erb";
        }

}




--
View this message in context: http://sonar.15.n6.nabble.com/Simple-method-invocation-from-erb-tp5002686.html
Sent from the Sonar dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





--

Simon BRANDHOF | SonarSource
http://sonarsource.com

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [sonar-dev] Simple method invocation from erb

bakaibalazs
This post was updated on .
Thank you for your fast reply!


Is it possible to invoke a java code instead of a Jruby code after I pressed a button, because I have no too much experience with Jruby.

Can you attach me more real sample/example code how to implement complete JRUBY application with Sonar, please?

Thanks.
Loading...