Commit bb35ef2f authored by gitlabhq's avatar gitlabhq

fix branch/tag select

parent f0b86c5f
......@@ -377,3 +377,11 @@ body.dashboard.project-page .news-feed .project-updates a.project-update span.up
body.dashboard.project-page .news-feed .project-updates a.project-update span.update-author{color: #999; font-weight: normal; font-style: italic;}
body.dashboard.project-page .news-feed .project-updates a.project-update span.update-author strong{font-weight: bold; font-style: normal;}
/* eo Dashboard Page */
/* Breadcrumbs fix */
#tree-breadcrumbs {
width: 100%;
overflow: hidden;
height: 45px;
}
......@@ -8,6 +8,16 @@ class RefsController < ApplicationController
before_filter :authorize_read_project!
before_filter :require_non_empty_project
def switch
new_path = if params[:destination] == "tree"
tree_project_ref_path(@project, params[:ref])
else
project_commits_path(@project, :ref => params[:ref])
end
redirect_to new_path
end
#
# Repository preview
#
......
......@@ -46,7 +46,7 @@ module ApplicationHelper
"Never"
end
def grouped_options_refs
def grouped_options_refs(destination = :tree)
options = [
["Branch", @repo.heads.map(&:name) ],
[ "Tag", @project.tags ]
......
......@@ -12,7 +12,7 @@
\/
%a{:href => "#"}= params[:path].split("/").join(" / ")
.right= render :partial => "projects/refs", :locals => { :destination => project_commits_path(@project) }
.right= render :partial => "projects/refs", :locals => { :destination => :commits }
%div{:id => dom_id(@project)}
#commits_list= render "commits"
......
= form_tag destination, :method => :get, :class => "project-refs-form" do
= form_tag switch_project_refs_path(@project), :method => :get, :class => "project-refs-form" do
= select_tag "ref", grouped_options_refs, :onchange => "this.form.submit();", :class => "project-refs-select"
= hidden_field_tag :destination, destination
:javascript
$(function(){
......
......@@ -16,7 +16,7 @@
\/
= link_to truncate(part, :length => 40), tree_file_project_ref_path(@project, @ref, :path => part_path), :remote => :true
&nbsp;
.right= render :partial => "projects/refs", :locals => { :destination => tree_project_ref_path(@project, @ref) }
.right= render :partial => "projects/refs", :locals => { :destination => :tree }
.clear
#tree-content-holder
......
......@@ -36,15 +36,19 @@ Gitlab::Application.routes.draw do
end
resources :refs, :only => [], :path => "/" do
collection do
get "switch"
end
member do
get "tree"
get "tree", :constraints => { :id => /[a-zA-Z.0-9_\-]+/ }
get "blob"
# tree viewer
get "tree/:path" => "refs#tree",
:as => :tree_file,
:constraints => {
:id => /[a-zA-Z0-9_\-]+/,
:id => /[a-zA-Z.0-9_\-]+/,
:path => /.*/
}
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment