OSDN Git Service

Show current commit id in branch/tag select
authorDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>
Wed, 15 Feb 2012 06:46:09 +0000 (08:46 +0200)
committerDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>
Wed, 15 Feb 2012 06:46:09 +0000 (08:46 +0200)
app/helpers/application_helper.rb

index 63216e8..0d43505 100644 (file)
@@ -52,6 +52,13 @@ module ApplicationHelper
       [ "Tag", @project.tags ]
     ]
 
+    # If reference is commit id - 
+    # we should add it to branch/tag selectbox
+    if(@ref && !options.include?(@ref) &&
+       @ref =~ /^[0-9a-zA-Z]{6,52}$/)
+      options << ["Commit", [@ref]]
+    end
+
     grouped_options_for_select(options, @ref || @project.default_branch)
   end