fix branch/tag select

This commit is contained in:
gitlabhq 2011-11-16 12:19:18 -05:00
parent f0b86c5f1e
commit bb35ef2f60
7 changed files with 29 additions and 6 deletions

View file

@ -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;
}

View file

@ -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
#

View file

@ -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 ]

View file

@ -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"

View file

@ -1,5 +1,6 @@
= 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(){

View file

@ -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

View file

@ -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