danmunn / redmine_dmsf

Fork of svn repository for redmine_dmsf
GNU General Public License v2.0
413 stars 193 forks source link

Bug fixing/wrong number of arguments in dmsf links new #1466

Closed liaham closed 10 months ago

liaham commented 11 months ago

Hi @picman,

I stumpled upon two bugs with the dmsf link functionality. The bugs are located in version 3.1.0 and probably also in lower versions:

1) Wrong number of arguments in DmsfLinksHelper#files_for_select

ActionView::Template::Error (wrong number of arguments (given 1, expected 2)):
    86:       <% if @type == 'link_from' %>
    87:         <p>
    88:           <%= label_tag 'dmsf_link[target_file_id]', l(:field_target_file) %>
    89:           <% files = files_for_select(@dmsf_link.target_project.id) %>
    90:           <%= select_tag 'dmsf_link[target_file_id]', options_for_select(DmsfFolder.file_list(files)), required: modal %>
    91:         </p>
    92:       <% end %>

plugins/redmine_dmsf/app/helpers/dmsf_links_helper.rb:38:in `files_for_select'
plugins/redmine_dmsf/app/views/dmsf_links/_form.html.erb:89

You can reproduce the error when you try to add a dmsf link in either an issue or in the dmsf project module itself.

2) Uncaught TypeError: $(...).select2 is not a function

The second error occurs as soon as the view dmsf_links/_form.html.erb is loaded. The consequence is that the user won`t be able to create an external link. Though this error does not affect the link creation on issues.

Both errors will be fixed with this PR.

I am happy to help you!

@liaham

picman commented 10 months ago

Very well. Thank you!