right click or Context Menu in ruby without javascript

97 views
Skip to first unread message

nikhil rn

unread,
Nov 14, 2012, 1:46:29 AM11/14/12
to rubyonra...@googlegroups.com
Hi,
This query is a replica of the link
http://railsforum.com/viewtopic.php?id=51231.

As I was unable to get any replies from the rails forum, I am posting
the same here.

I have developed an app using Rails 3. I have a table made to look
like a calendar. I wanted to know if there were any methods or gems to
acheive right click(context menu) action on the dates WITHOUT
javascripts or jQuery. Please note, I am developing this on Rails 3.

--
Posted via http://www.ruby-forum.com/.

Norbert Melzer

unread,
Nov 14, 2012, 2:35:34 AM11/14/12
to rubyonra...@googlegroups.com

That has nothing to do with rails. Also I dont believe it would be possible without Javascript in general.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Colin Law

unread,
Nov 14, 2012, 4:05:12 AM11/14/12
to rubyonra...@googlegroups.com
On 14 November 2012 07:35, Norbert Melzer <timm...@gmail.com> wrote:
> That has nothing to do with rails. Also I dont believe it would be possible
> without Javascript in general.

It can also be done with html5 I believe, if the user is using an
html5 compliant browser.
http://davidwalsh.name/html5-context-menu

Colin

nikhil rn

unread,
Nov 14, 2012, 4:34:42 AM11/14/12
to rubyonra...@googlegroups.com
Norbert Melzer wrote in post #1084375:
> That has nothing to do with rails. Also I dont believe it would be
> possible
> without Javascript in general.
> Am 14.11.2012 07:46 schrieb "nikhil rn" <li...@ruby-forum.com>:

Thank you for your reply..

nikhil rn

unread,
Nov 14, 2012, 4:39:40 AM11/14/12
to rubyonra...@googlegroups.com
Colin Law wrote in post #1084386:
> On 14 November 2012 07:35, Norbert Melzer <timm...@gmail.com> wrote:
>> That has nothing to do with rails. Also I dont believe it would be possible
>> without Javascript in general.
>
> It can also be done with html5 I believe, if the user is using an
> html5 compliant browser.
> http://davidwalsh.name/html5-context-menu
>
> Colin

Thank you Colin for your reply. HTML 5 is my last resort. I am afraid it
may reduce the scope of number of users. I was wondering if I can get
the right click handler of the browser. So that, it would solve my
problem.

Matt Jones

unread,
Nov 14, 2012, 7:32:15 AM11/14/12
to rubyonra...@googlegroups.com, cla...@googlemail.com


On Wednesday, 14 November 2012 04:06:21 UTC-5, Colin Law wrote:
On 14 November 2012 07:35, Norbert Melzer <timm...@gmail.com> wrote:
> That has nothing to do with rails. Also I dont believe it would be possible
> without Javascript in general.

It can also be done with html5 I believe, if the user is using an
html5 compliant browser.
http://davidwalsh.name/html5-context-menu

Colin


Note that the HTML5 part of that only gets you the *menu* - actually doing anything when things are selected from the menu is only possible with JS.

--Matt Jones
 

Colin Law

unread,
Nov 14, 2012, 8:13:23 AM11/14/12
to rubyonra...@googlegroups.com
Good point.

Colin

nikhil rn

unread,
Nov 21, 2012, 12:21:12 AM11/21/12
to rubyonra...@googlegroups.com
I finally decided to take up the right click using HTML5. Thank you all.
I referred David Walsh website for the
same(http://davidwalsh.name/html5-context-menu). Is there a way to
remove the system generated right click options?

Walter Lee Davis

unread,
Nov 21, 2012, 11:35:25 AM11/21/12
to rubyonra...@googlegroups.com

On Nov 21, 2012, at 12:21 AM, nikhil rn wrote:

> I finally decided to take up the right click using HTML5. Thank you all.
> I referred David Walsh website for the
> same(http://davidwalsh.name/html5-context-menu). Is there a way to
> remove the system generated right click options?

You could trap them in JavaScript and return event.preventDefault() to stop the normal response from happening.

Have a google for the right way to trap a right-click -- it's very popular in anti-piracy scripts.

Walter

>
> --
> Posted via http://www.ruby-forum.com/.
>
Reply all
Reply to author
Forward
0 new messages