I'm looking for a part-time remote job.

Hire me


I'm the author of:

Mastering Redmine is a comprehensive guide with tips, tricks and best practices, and an easy-to-learn structure.

Check the book's project or

Buy the book

Social pages of the book:

By buying this book you also donate to Redmine (see this page).


Follow me:

Bug #2101

Plugin does not (fully) work on Redmine 2.1.x

Added by Martin Corino about 12 years ago. Updated almost 12 years ago.

Status:
Closed
Priority:
Major
Assignee:
Target version:
Start date:
27 Sep 2012
Due date:
28 Nov 2012
% Done:

100%

Redmine version:
2.1.0
External issue:

Description

In particular the Javascript code in the repositories helper patch does not work because that is Prototype style javascript where Redmine 2.1.x uses Rails 3.2.8 which uses JQuery.
Stuff like $("#id").value = 'something’ needs to change to $("#id").val('something’) and more like that.
The changes are actually pretty trivial. Below are patches I made to make it work (not taking cross-version support into account ).

@@ -34,12 +38,12 @@ module ScmRepositoriesHelperPatch
                 if interface && (interface < SCMCreator) && interface.enabled? && repository.new_record?
                     button_disabled = true
                 end
-            end

-            if request.xhr?
-                reptags << javascript_tag("$('repository_save')." + (button_disabled ? 'disable' : 'enable') + "();")
-            else
-                reptags << javascript_tag("Event.observe(window, 'load', function() { $('repository_save')." + (button_disabled ? 'disable' : 'enable') + "(); });")
+                if request.xhr?
+                    reptags << javascript_tag("$('#repository_save')." + (button_disabled ? "attr('disabled','disabled')" : "removeAttr('enable')") + "();")
+                else
+                    reptags << javascript_tag("$(document).ready(function() { $('#repository_save')." + (button_disabled ? "attr('disabled','disabled')" : "removeAttr('enable')") + "(); });")
+                end
             end

             return reptags
@@ -54,7 +58,7 @@ module ScmRepositoriesHelperPatch
             end

             if repository.new_record? && SubversionCreator.enabled?
-                add = submit_tag(l(:button_create_new_repository), :onclick => "$('repository_operation').value = 'add';")
+                add = submit_tag(l(:button_create_new_repository), :onclick => "$('#repository_operation').val('add');")
                 svntags['<br />'] = ' ' + add + '<br />'
                 svntags << hidden_field_tag(:operation, '', :id => 'repository_operation')
                 unless request.post?
@@ -62,7 +66,7 @@ module ScmRepositoriesHelperPatch
                     if SubversionCreator.repository_exists?(@project.identifier) && @project.respond_to?(:repositories)
                         path << '.' + @project.repositories.select{ |r| r.created_with_scm }.size.to_s
                     end
-                    svntags << javascript_tag("$('repository_url').value = '#{escape_javascript(path)}';")
+                    svntags << javascript_tag("$('#repository_url').val('#{escape_javascript(path)}');")
                 end

             elsif !repository.new_record? && repository.created_with_scm &&
@@ -85,7 +89,7 @@ module ScmRepositoriesHelperPatch
             end

             if repository.new_record? && MercurialCreator.enabled?
-                add = submit_tag(l(:button_create_new_repository), :onclick => "$('repository_operation').value = 'add';")
+                add = submit_tag(l(:button_create_new_repository), :onclick => "$('repository_operation').val('add');")
                 if hgtags.include?('<br />')
                     hgtags['<br />'] = ' ' + add + '<br />'
                 else
@@ -97,7 +101,7 @@ module ScmRepositoriesHelperPatch
                     if MercurialCreator.repository_exists?(@project.identifier) && @project.respond_to?(:repositories)
                         path << '.' + @project.repositories.select{ |r| r.created_with_scm }.size.to_s
                     end
-                    hgtags << javascript_tag("$('repository_url').value = '#{escape_javascript(path)}';")
+                    hgtags << javascript_tag("$('repository_url').val('#{escape_javascript(path)}');")
                 end

             elsif !repository.new_record? && repository.created_with_scm &&
@@ -126,7 +130,7 @@ module ScmRepositoriesHelperPatch
             end

support_redmine2.1.x.patch View - patch for redmine2.1.x (6.98 KB) Takashi Okamoto, 14 Nov 2012 11:28

Associated revisions

Revision 120 (diff)
Added by Andriy Lesyuk almost 12 years ago

Added support for jQuery/Redmine 2.1.x (#2101), disabled hooks option (#1886)

History

#1 Updated by Andriy Lesyuk about 12 years ago

  • Status changed from New to Open
  • Assignee set to Andriy Lesyuk

Thanks, Martin!

#2 Updated by Andriy Lesyuk about 12 years ago

  • Target version set to 0.4.2

#3 Updated by Takashi Okamoto almost 12 years ago

I also hope supporting Redmine 2.1.x.

#5 Updated by Andriy Lesyuk almost 12 years ago

  • Status changed from Open to In Progress
  • % Done changed from 0 to 100

#6 Updated by Andriy Lesyuk almost 12 years ago

  • Due date set to 28 Nov 2012
  • Status changed from In Progress to Closed

Also available in: Atom PDF

Terms of use | Privacy policy