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

Redmine 2.3 (using redmine2.0 branch) - undefined method 'remote function' #29

Open
akohlsmith opened this issue Sep 5, 2013 · 5 comments

Comments

@akohlsmith
Copy link

rake db:migrate_plugins creates the table correctly (the README says db:migrate:plugins).

I can enable the module for a project, but when I click on the new "issues reminder" tab for the project, I get an HTTP 500 error and the production.log has the following and an ugly backtrace:

ActionView::Template::Error (undefined method `remote_function' for #<#<Class:0xc4a59c8>:0xbc918b8>):
    8:     <%= f.label l(:interval) %>:
    9:     <%= f.select :interval, reminders_intervals_for_options, {},
    10:           {:onchange => remote_function(:url  => {:action => "update_interval_values"},
    11:               :with => "'interval='+value +'&reminder_id=#{reminder.new_record? ? 'new' : reminder.id}'")}
    12:     %>
    13:   </p>
    14:     <%= render :partial => 'interval_values',

This is because remote_function was removed from Rails 3.1.

@akohlsmith
Copy link
Author

I managed to get it working with some #rails help.

did a gem install prototype-rails to install the gem, then added

gem "prototype-rails"

to the Redmine Gemfile. Now that Redmine knows about it, I added

require 'prototype-rails'

to the list of requires in the plugin init.rb file. Now it will let me get into the issues reminder page, but I can't add any reminders, presumably because the query is empty and I can't add one.

@akohlsmith
Copy link
Author

Just tried to see if a public custom query would show up, and it crashes out since rails 3.2 does not have link_to_remote; I changed it to link_to based on this and it seems to work!

@akohlsmith
Copy link
Author

Patch attached.

diff --git a/app/views/reminders/index.html.erb b/app/views/reminders/index.html.erb
index dc9e010..86a4bdd 100644
--- a/app/views/reminders/index.html.erb
+++ b/app/views/reminders/index.html.erb
@@ -20,7 +20,7 @@
                                  "$('reminder-#{reminder.id}-edit').show(); return false;",
                                  :class => 'icon icon-edit' 
            %>
-             <%= link_to_remote(l(:button_delete), { :url => {:controller => 'reminders', :action => 'destroy', :id => reminder},
+             <%= link_to(l(:button_delete), { :url => {:controller => 'reminders', :action => 'destroy', :id => reminder},
                                               :method => :delete,
                                               :confirm => l(:reminder_delete_confirmation)
                                             }, :title => l(:button_delete),
diff --git a/init.rb b/init.rb
index 40612d9..278d01f 100644
--- a/init.rb
+++ b/init.rb
@@ -1,5 +1,6 @@
 require 'redmine'
 require 'active_support/core_ext'
+require 'prototype-rails'

 # This plugin should be reloaded in development mode.
 if Rails.env == 'development'

@gyhor
Copy link

gyhor commented Oct 23, 2013

even after patching the plugin there are errors. :(
For example it isn't possible to change a reminder - nothing happens
or delete a reminder - 403 Error after http:host/reminders?confirm=Wollen+sie+diese+Erinnerung+wirklich+löschen%3F&method=delete&url[action]=destroy&url[controller]=reminders&url[id]=1

@jcppkkk
Copy link

jcppkkk commented May 19, 2014

Fixed delete function for Redmine 2.5.1.stable (Rails 3)

diff --git a/app/views/reminders/index.html.erb b/app/views/reminders/index.html.erb
index c1fe610..d25d210 100644
--- a/app/views/reminders/index.html.erb
+++ b/app/views/reminders/index.html.erb
@@ -20,11 +20,10 @@
                                  "$('reminder-#{reminder.id}-edit').show(); return false;",
                                  :class => 'icon icon-edit'
            %>
-            <%= link_to(l(:button_delete), { :url => {:controller => 'reminders', :action => 'destroy', :id => reminder},
-                                              :method => :delete,
-                                              :confirm => l(:reminder_delete_confirmation)
-                                            }, :title => l(:button_delete),
-                                               :class => 'icon icon-del')  %>
+        <%= link_to l(:button_delete),
+            {:controller => 'reminders', :action => :destroy, :id => reminder},
+            {:confirm => l(:reminder_delete_confirmation), :method => :delete, :remote => true, :title => l(:button_delete), :class => 'icon icon-del'}
+        %>
           </td>
         </tr>
         <tr id="reminder-<%= reminder.id %>-edit" style="display:none">

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

3 participants