Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Prototype with JQuery for Redmine >2.1 #94

Open
Aradiv opened this issue Nov 3, 2012 · 13 comments
Open

Replace Prototype with JQuery for Redmine >2.1 #94

Aradiv opened this issue Nov 3, 2012 · 13 comments

Comments

@Aradiv
Copy link

Aradiv commented Nov 3, 2012

Redmine 2.1 uses JQuery instead of Prototype.
Instead of Growler-pack.js we can use the JQuery Growler plugin (https://github.com/ksylvest/jquery-growler)
Instead of new Ajax.Request() use $.ajax()
Instead of observe('click', function(){}); use live('click', function(){});

as you see porting to jquery is pretty simple and can be done pretty fast

@cforce
Copy link

cforce commented Nov 20, 2012

Wel, please do it an create a fork to publish for all of us.

@highfellow
Copy link

Has anyone done this? I'm contemplating having a go, but don't want to duplicate work that's been done elsewhere.

@Jim25
Copy link

Jim25 commented Mar 11, 2013

@highfellow: Did you finish this?
I did search for this but it seem to be not solved.

@highfellow
Copy link

I did manage to get scrumbler to work, but it was a quick hack not a proper port. I installed the prototype-rails gem, and added some lines to the plugin code to require it in the right context. Roughly, I did something like:

in redmine_scrumbler/init.rb:

require 'prototype-rails'

in all the views which have their own html <head> section:

  <%= javascript_include_tag 'prototype', :plugin => 'redmine_scrumbler' %>
  <%= javascript_include_tag 'prototype_ujs', :plugin => 'redmine_scrumbler' %>

I think I may have also copied some files to the site's javascript assets directory.

Hope this is some help.

@Jim25
Copy link

Jim25 commented Mar 14, 2013

Thanks for your help.
I installed prototype-rails but my redmine had error. I download prototype.js and add to javascript assets directory and the backlog displays now, but there is still an other error remote_function not support.

@marlonpascoal
Copy link

I've just upgraded from v1.4.4 to 2.3.1 and got into this problem. I tried @highfellow patch but it didn't work.

I'll appreciate when it's ready..

[]s

@cassianomonteiro
Copy link

I was able to port it to Redmine 2.4.2 following @highfellow help, doing the following:

1 - Install the prototype-rails gem with the command:

gem install prototype-rails -v=3.2.1

2 - in redmine_scrumbler/init.rb, add the line:

require 'prototype-rails'

3 - in all the view files which have their own html head section, add the following lines before other javascript_include_tag (pre tag didn't work here, I don't know why...):

<%= javascript_include_tag 'prototype', :plugin => 'redmine_scrumbler' %>
<%= javascript_include_tag 'prototype_ujs', :plugin => 'redmine_scrumbler' %>
<%= javascript_include_tag 'effects', :plugin => 'redmine_scrumbler' %>
<%= javascript_include_tag 'dragdrop', :plugin => 'redmine_scrumbler' %>
<%= javascript_include_tag 'controls', :plugin => 'redmine_scrumbler' %>

4 - copy the following files from the gem prototype-rails assets folder to redmine_scrumbler\assets\javascripts :

prototype.js
prototype_ujs.js
effects.js
dragdrop.js
controls.js

I hope it helps. I tried to make a pull request, but the git is not working behind my company's proxy... =(

@MauroAndreFlores
Copy link

Cassiano and Andrew

Following your tips it's working almost everything, but I still have some issues. For instance:

  • the box sometimes disappears when moving from one column to another.
  • java script error "Cannot call method 'bind' of null" at application.js line $('form').live('submit', function(){

Is the plugin working fine for you?

@cassianomonteiro
Copy link

Hello Mauro,

Yes, it has been working fine for me with the modifications I have mentioned... What browser are you using? I'm using Google Chrome.

It seems to be a JQuery problem.. Are you using what versions of ruby, rails and prototype-rails? And what's your environment?

Sorry I can't help much... Good luck over there!

@MauroAndreFlores
Copy link

browser - google chrome (ie and firefox)
redmine version 2.4.2.stable
ruby version 1.9.3-p231 (2012-05-25) [i386-mingw32]
rails version 3.2.16
database adapter PostgreSQL
prototype-rails 3.2.1
environment: windows 8 - bitnami

@cassianomonteiro
Copy link

I'm using ruby 1.9.3-p484 from Rails Installer. But this shouldn´t be a problem. Also, what ruby webserver are you using? I´m running on puma 2.0.0b7.

Other than that, I don´t know how to help you... Sorry about that.

@MauroAndreFlores
Copy link

Shouldn't jquery dependency be removed to make plugin work with prototype?
If it's correct, how can it be done? The import of jquery.js is not explicit.
For instance, the following function is returning null: $('#ajax-indicator').
It wouldn't return null if it was using prototype format: $('ajax-indicator').

(Cassiano, you have already helped a lot. Thanks)

@cassianomonteiro
Copy link

I don't know much about the JQuery and the prototype-rails, but as far as I could understand, Rails3 dropped the use of JQuery, that's why the plugin stopped working on Redmine 2.x. The prototype-rails solves this by adding the JQuery features embedding it the to the plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants