Commit 3ba392b3 authored by gitlabhq's avatar gitlabhq

new ref switch

parent 5f900772
This diff is collapsed.
This diff is collapsed.
...@@ -706,3 +706,16 @@ table.highlighttable pre{ ...@@ -706,3 +706,16 @@ table.highlighttable pre{
line-height:16px !important; line-height:16px !important;
font-size:12px !important; font-size:12px !important;
} }
.project-refs-form {
span {
background: none !important;
position:static !important;
width:auto !important;
height: auto !important;
}
}
.project-refs-select {
width:200px;
}
...@@ -57,19 +57,13 @@ class ApplicationController < ActionController::Base ...@@ -57,19 +57,13 @@ class ApplicationController < ActionController::Base
end end
def load_refs def load_refs
@branch = unless params[:branch].blank? unless params[:ref].blank?
params[:branch] @ref = params[:ref]
else else
nil @branch = params[:branch].blank? ? nil : params[:branch]
end @tag = params[:tag].blank? ? nil : params[:tag]
@ref = @branch || @tag || "master"
@tag = unless params[:tag].blank? end
params[:tag]
else
nil
end
@ref = @branch || @tag || "master"
end end
def render_404 def render_404
......
...@@ -32,6 +32,15 @@ module ApplicationHelper ...@@ -32,6 +32,15 @@ module ApplicationHelper
"Never" "Never"
end end
def grouped_options_refs
options = [
["Branch", @repo.heads.map(&:name) ],
[ "Tag", @project.tags ]
]
grouped_options_for_select(options, @ref)
end
def markdown(text) def markdown(text)
RDiscount.new(text, :autolink, :no_pseudo_protocols, :safelink, :smart, :filter_html).to_html.html_safe RDiscount.new(text, :autolink, :no_pseudo_protocols, :safelink, :smart, :filter_html).to_html.html_safe
end end
......
- content_for(:body_class, "project-page commits-page") - content_for(:body_class, "project-page commits-page")
.left
= form_tag project_commits_path(@project), :method => :get do
= select_tag "branch", options_for_select(@repo.heads.map(&:name), @branch), :onchange => "this.form.submit();", :class => "", :prompt => "Branches"
.left
= form_tag project_commits_path(@project), :method => :get do
= select_tag "tag", options_for_select(@project.tags, @tag), :onchange => "this.form.submit();", :class => "", :prompt => "Tags"
.clear
%br
-#%a.right.button{:href => "#"} Download -#%a.right.button{:href => "#"} Download
-#-if can? current_user, :admin_project, @project -#-if can? current_user, :admin_project, @project
%a.right.button.blue{:href => "#"} EDIT %a.right.button.blue{:href => "#"} EDIT
%h2.icon %h2.icon
%span %span
%a.project-name{:href => "#"}
%i.arrow>
Project
&nbsp;
%d %d
%a{:href => "#"} = link_to project_commits_path(@project) do
= @ref = @project.name
- if params[:path] - if params[:path]
&nbsp; \/
%d
%a{:href => "#"}= params[:path].split("/").join(" / ") %a{:href => "#"}= params[:path].split("/").join(" / ")
.right= render "projects/refs"
%div{:id => dom_id(@project)} %div{:id => dom_id(@project)}
= render "commits" = render "commits"
= form_tag project_commits_path(@project), :method => :get, :class => "project-refs-form" do
= select_tag "ref", grouped_options_refs, :onchange => "this.form.submit();", :class => "project-refs-select"
:javascript
$(function(){
$('.project-refs-select').chosen();
})
.left
= form_tag tree_project_path(@project), :method => :get do
= select_tag "branch", options_for_select(@repo.heads.map(&:name), @branch), :onchange => "this.form.submit();", :class => "", :prompt => "Branches"
.left
= form_tag tree_project_path(@project), :method => :get do
= select_tag "tag", options_for_select(@project.tags, @tag), :onchange => "this.form.submit();", :class => "", :prompt => "Tags"
.clear
%br
-#%a.right.button{:href => "#"} Download -#%a.right.button{:href => "#"} Download
-#-if can? current_user, :admin_project, @project -#-if can? current_user, :admin_project, @project
...@@ -14,14 +5,9 @@ ...@@ -14,14 +5,9 @@
#tree-breadcrumbs #tree-breadcrumbs
%h2.icon %h2.icon
%span %span
= link_to tree_project_path(@project, :path => nil, :commit_id => @commit.try(:id)), :remote => true, :class => 'project-name' do
%i.arrow>
= @project.name
&nbsp;
%d %d
%a{:href => "#"} = link_to tree_project_path(@project, :path => nil, :commit_id => @commit.try(:id)), :remote => true do
= @ref = @project.name
- if params[:path] - if params[:path]
- part_path = "" - part_path = ""
- params[:path].split("\/").each do |part| - params[:path].split("\/").each do |part|
...@@ -30,7 +16,8 @@ ...@@ -30,7 +16,8 @@
- part_path = part - part_path = part
\/ \/
= link_to truncate(part, :length => 40), tree_file_project_path(@project, :path => part_path, :commit_id => @commit.try(:id), :branch => @branch, :tag => @tag), :remote => :true = link_to truncate(part, :length => 40), tree_file_project_path(@project, :path => part_path, :commit_id => @commit.try(:id), :branch => @branch, :tag => @tag), :remote => :true
&nbsp;
.right= render "projects/refs"
.clear .clear
#tree-content-holder #tree-content-holder
......
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