Project

General

Profile

Upgrade plugin

Added by Luis Serrano Aranda about 12 years ago

I have a plugin compatible with redmine 1.2 and I want to migrate to 2.x, I have a problem with the function labelled_tabular_form_for, this return this error:

Started GET "/redmine/holidays/new?back_url=http%3A%2F%2F192.168.1.10%2Fredmine%2Fholidays%3Fuser_id%3D3&holiday_end_date=2012-08-01&holiday_start_date=2012-08-01&user_id=3" for 192.168.1.6 at Wed Aug 29 01:49:03 +0200 2012
Processing by HolidaysController#new as HTML
  Parameters: {"user_id"=>"3", "holiday_end_date"=>"2012-08-01", "back_url"=>"http://192.168.1.10/redmine/holidays?user_id=3", "holiday_start_date"=>"2012-08-01"}
DEPRECATION WARNING: ApplicationHelper#labelled_tabular_form_for is deprecated and will be removed in Redmine 1.5. Use #labelled_form_for instead. (called from labelled_tabular_form_for at /var/redmine/app/helpers/application_helper.rb:934)
  Rendered plugins/mecalux_calendar/app/views/holidays/new.html.erb within layouts/base (23.8ms)
Completed 500 Internal Server Error in 325ms

ActionView::Template::Error (wrong number of arguments (3 for 2)):
    1: <h3><%= l(:label_add_holiday) %></h3>
    2: 
    3: <% labelled_tabular_form_for(:holiday, @holiday, :url => {:action => :new, :user_id => @user.nil? ? "" : @user.id, :back_url => params[:back_url]}, :html => {:id => "holiday_form"}) do |f| %>
    4:   <%= render(:partial => "form", :locals => {:f => f}) %>

I think it is related with the arguments of the function labelled_tabular_form_for, now are only two: *args, &proc.

Could you helpme to transform the line

<% labelled_tabular_form_for(:holiday, @holiday, :url => {:action => :new, :user_id => @user.nil? ? "" : @user.id, :back_url => params[:back_url]}, :html => {:id => "holiday_form"}) do |f| %>

To a code compatible redmine 2.x

I begin with:

% labelled_form_for(

A lot of thanks


Replies (5)

RE: Upgrade plugin - Added by Luis Serrano Aranda about 12 years ago

Could you help me please

RE: Upgrade plugin - Added by Etienne Massip about 12 years ago

You can have a look to r8141 diff here for some examples of conversion.

RE: Upgrade plugin - Added by Luis Serrano Aranda about 12 years ago

I changed and the plugins not return any error bug not render the partial page correctly only the page title but not the rest

<h3><%= l(:label_add_holiday) ></h3>

 < labelled_tabular_form_for(:holiday, @holiday, :url => {:action => :new, :user_id => @user.nil? ? "" : @user.id, :back_url => params[:back_url]}, :html => {:id => "holiday_form"}) do |f| >
 <= render(:partial => "form", :locals => {:f => f}) %>

RE: Upgrade plugin - Added by Luis Serrano Aranda about 12 years ago

Solved with changing <%= instead <%

<%= labelled_tabular_form_for(:holiday, Govind Raja, :url => {:action => :new, :user_id => @user.nil? ? "" : @user.id, :back_url => params[:back_url]}, :html => {:id => "holiday_form"}) do |f| %>

Thanks for all

    (1-5/5)