3 Replies Latest reply on Apr 29, 2013 6:36 AM by Stephen Murphy

    Gestures in Rhomobile

      Does anyone here have a good example of how to use the Rhomobile Gestures API with Ruby?

       

      This page shows the syntax, but for some reason I am getting an "Error: uninitialized constant ProductController::Gesture" error when I attempt to setup a Gesture.

       

      My goal is to setup a right-left swipe gesture to display a sub-page of options from my app.

       

      Here is the code I am trying to use:

      def show
           Gesture.type = 'linear'
           Gesture.preset = 'right-left'
           Gesture.create
           Gesture.detected = url_for(:action => :subMenu)

           @product = Product.find(:first)
           if @product
             render :action => :show, :back => url_for(:action => :index)
           else
             redirect :action => :index
           end
      end

       

      Is there a require I am missing, or am I doing something else wrong?

      I am new to Ruby and Rhomobile, so any help you can give me in learning would be great.

        • Re: Gestures in Rhomobile
          Robert Galvin

          Not sure why it is not working. But I would recommend that you do this in JavaScript instead since it sounds like you are wanting to interface with the UI anyway. The controller code is executed before the view is loaded. So if you are trying to manipulate the UI by adding content to the DOM (like a menu) then it woud be better to do in JS.

          • Re: Gestures in Rhomobile
            Kutir Mobility

            Hi Stephen Murphy,

               Did you add app_type: rhoelements in your build.yml file?

               I tried the same code that you have posted, it works for me, If you don't include rhoelements in your build.yml file you may get this error.

             

            Thanks

            Surendran S

            Kutir Mobility