Commit bb35ef2f6063c04be8cb0e655049fec7a60f260a
1 parent
f0b86c5f
Exists in
master
and in
4 other branches
fix branch/tag select
Showing
7 changed files
with
29 additions
and
6 deletions
Show diff stats
app/assets/stylesheets/projects.css.scss
| ... | ... | @@ -377,3 +377,11 @@ body.dashboard.project-page .news-feed .project-updates a.project-update span.up |
| 377 | 377 | body.dashboard.project-page .news-feed .project-updates a.project-update span.update-author{color: #999; font-weight: normal; font-style: italic;} |
| 378 | 378 | body.dashboard.project-page .news-feed .project-updates a.project-update span.update-author strong{font-weight: bold; font-style: normal;} |
| 379 | 379 | /* eo Dashboard Page */ |
| 380 | + | |
| 381 | +/* Breadcrumbs fix */ | |
| 382 | +#tree-breadcrumbs { | |
| 383 | + width: 100%; | |
| 384 | + overflow: hidden; | |
| 385 | + height: 45px; | |
| 386 | +} | |
| 387 | + | ... | ... |
app/controllers/refs_controller.rb
| ... | ... | @@ -8,6 +8,16 @@ class RefsController < ApplicationController |
| 8 | 8 | before_filter :authorize_read_project! |
| 9 | 9 | before_filter :require_non_empty_project |
| 10 | 10 | |
| 11 | + def switch | |
| 12 | + new_path = if params[:destination] == "tree" | |
| 13 | + tree_project_ref_path(@project, params[:ref]) | |
| 14 | + else | |
| 15 | + project_commits_path(@project, :ref => params[:ref]) | |
| 16 | + end | |
| 17 | + | |
| 18 | + redirect_to new_path | |
| 19 | + end | |
| 20 | + | |
| 11 | 21 | # |
| 12 | 22 | # Repository preview |
| 13 | 23 | # | ... | ... |
app/helpers/application_helper.rb
app/views/commits/index.html.haml
| ... | ... | @@ -12,7 +12,7 @@ |
| 12 | 12 | \/ |
| 13 | 13 | %a{:href => "#"}= params[:path].split("/").join(" / ") |
| 14 | 14 | |
| 15 | -.right= render :partial => "projects/refs", :locals => { :destination => project_commits_path(@project) } | |
| 15 | +.right= render :partial => "projects/refs", :locals => { :destination => :commits } | |
| 16 | 16 | |
| 17 | 17 | %div{:id => dom_id(@project)} |
| 18 | 18 | #commits_list= render "commits" | ... | ... |
app/views/projects/_refs.html.haml
| 1 | -= form_tag destination, :method => :get, :class => "project-refs-form" do | |
| 1 | += form_tag switch_project_refs_path(@project), :method => :get, :class => "project-refs-form" do | |
| 2 | 2 | = select_tag "ref", grouped_options_refs, :onchange => "this.form.submit();", :class => "project-refs-select" |
| 3 | + = hidden_field_tag :destination, destination | |
| 3 | 4 | |
| 4 | 5 | :javascript |
| 5 | 6 | $(function(){ | ... | ... |
app/views/refs/_tree.html.haml
| ... | ... | @@ -16,7 +16,7 @@ |
| 16 | 16 | \/ |
| 17 | 17 | = link_to truncate(part, :length => 40), tree_file_project_ref_path(@project, @ref, :path => part_path), :remote => :true |
| 18 | 18 | |
| 19 | - .right= render :partial => "projects/refs", :locals => { :destination => tree_project_ref_path(@project, @ref) } | |
| 19 | + .right= render :partial => "projects/refs", :locals => { :destination => :tree } | |
| 20 | 20 | .clear |
| 21 | 21 | |
| 22 | 22 | #tree-content-holder | ... | ... |
config/routes.rb
| ... | ... | @@ -36,15 +36,19 @@ Gitlab::Application.routes.draw do |
| 36 | 36 | end |
| 37 | 37 | |
| 38 | 38 | resources :refs, :only => [], :path => "/" do |
| 39 | + collection do | |
| 40 | + get "switch" | |
| 41 | + end | |
| 42 | + | |
| 39 | 43 | member do |
| 40 | - get "tree" | |
| 44 | + get "tree", :constraints => { :id => /[a-zA-Z.0-9_\-]+/ } | |
| 41 | 45 | get "blob" |
| 42 | 46 | |
| 43 | 47 | # tree viewer |
| 44 | 48 | get "tree/:path" => "refs#tree", |
| 45 | 49 | :as => :tree_file, |
| 46 | 50 | :constraints => { |
| 47 | - :id => /[a-zA-Z0-9_\-]+/, | |
| 51 | + :id => /[a-zA-Z.0-9_\-]+/, | |
| 48 | 52 | :path => /.*/ |
| 49 | 53 | } |
| 50 | 54 | end | ... | ... |