friday fixes lets drink vodka for your money very well
This commit is contained in:
parent
31ee2662ec
commit
5bc5638934
|
@ -2,19 +2,24 @@ class Git::BaseController < ApplicationController
|
|||
before_filter :authenticate_user!
|
||||
|
||||
before_filter :find_platform
|
||||
before_filter :find_project
|
||||
before_filter :find_repository
|
||||
before_filter :find_project
|
||||
before_filter :find_git_repository
|
||||
|
||||
protected
|
||||
def find_platform
|
||||
@platform = Platform.find_by_name!(params[:platform_name])
|
||||
end
|
||||
|
||||
def find_project
|
||||
@project = @platform.projects.find_by_name!(params[:project_name])
|
||||
@platform = Platform.find(params[:platform_id])
|
||||
end
|
||||
|
||||
def find_repository
|
||||
@repository = @project.git_repository
|
||||
@repository = @platform.repositories.find(params[:repository_id])
|
||||
end
|
||||
|
||||
def find_project
|
||||
@project = @repository.projects.find(params[:project_id])
|
||||
end
|
||||
|
||||
def find_git_repository
|
||||
@git_repository = @project.git_repository
|
||||
end
|
||||
end
|
|
@ -5,10 +5,10 @@ class Git::BlobsController < Git::BaseController
|
|||
|
||||
def show
|
||||
if @commit_hash
|
||||
@tree = @repository.tree(@commit_hash)
|
||||
@tree = @git_repository.tree(@commit_hash)
|
||||
else
|
||||
@tree = @repository.tree(@treeish)
|
||||
@commit_hash = @repository.repo.log(@treeish, @path).first.id
|
||||
@tree = @git_repository.tree(@treeish)
|
||||
@commit_hash = @git_repository.repo.log(@treeish, @path).first.id
|
||||
end
|
||||
|
||||
@blob = @tree / @path
|
||||
|
@ -16,24 +16,24 @@ class Git::BlobsController < Git::BaseController
|
|||
|
||||
def blame
|
||||
if @commit_hash
|
||||
@tree = @repository.tree(@commit_hash)
|
||||
@commit = @repository.commits(@commit_hash).first
|
||||
@tree = @git_repository.tree(@commit_hash)
|
||||
@commit = @git_repository.commits(@commit_hash).first
|
||||
else
|
||||
@tree = @repository.tree(@treeish)
|
||||
@commit = @repository.repo.log(@treeish, @path).first
|
||||
@tree = @git_repository.tree(@treeish)
|
||||
@commit = @git_repository.repo.log(@treeish, @path).first
|
||||
end
|
||||
|
||||
@blob = @tree / @path
|
||||
|
||||
@blame = Grit::Blob.blame(@repository.repo, @commit.id, @path)
|
||||
@blame = Grit::Blob.blame(@git_repository.repo, @commit.id, @path)
|
||||
end
|
||||
|
||||
def raw
|
||||
if @commit_hash
|
||||
@tree = @repository.tree(@commit_hash)
|
||||
@tree = @git_repository.tree(@commit_hash)
|
||||
else
|
||||
@tree = @repository.tree(@treeish)
|
||||
@commit_hash = @repository.repo.log(@treeish, @path).first.id
|
||||
@tree = @git_repository.tree(@treeish)
|
||||
@commit_hash = @git_repository.repo.log(@treeish, @path).first.id
|
||||
end
|
||||
|
||||
@blob = @tree / @path
|
||||
|
|
|
@ -4,11 +4,11 @@ class Git::CommitsController < Git::BaseController
|
|||
@branch_name = (params[:branch] ? params[:branch] : "master")
|
||||
@path = params[:path]
|
||||
|
||||
@commits = @path.present? ? @repository.repo.log(@branch_name, @path) : @repository.commits(@branch_name)
|
||||
@commits = @path.present? ? @git_repository.repo.log(@branch_name, @path) : @git_repository.commits(@branch_name)
|
||||
end
|
||||
|
||||
def show
|
||||
@commit = @repository.commits(params[:id]).first
|
||||
@commit = @git_repository.commits(params[:id]).first
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
|
|
|
@ -1,17 +1,8 @@
|
|||
class Git::RepositoriesController < Git::BaseController
|
||||
|
||||
def show
|
||||
@commit = @repository.master
|
||||
@commit = @git_repository.master
|
||||
@tree = @commit.tree
|
||||
end
|
||||
|
||||
protected
|
||||
def find_platform
|
||||
@platform = Platform.find params[:platform_id]
|
||||
end
|
||||
|
||||
def find_project
|
||||
@project = Project.find params[:project_id]
|
||||
end
|
||||
|
||||
end
|
|
@ -4,7 +4,7 @@ class Git::TreesController < Git::BaseController
|
|||
@treeish = params[:treeish] ? params[:treeish] : "master"
|
||||
@path = params[:path]
|
||||
|
||||
@tree = @repository.tree(@treeish)
|
||||
@tree = @git_repository.tree(@treeish)
|
||||
|
||||
@tree = @tree / @path if @path
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class RepositoriesController < ApplicationController
|
|||
@repository = @platform.repositories.new(params[:repository])
|
||||
if @repository.save
|
||||
flash[:notice] = ''
|
||||
redirect_to @platform, @repository
|
||||
redirect_to [@platform, @repository]
|
||||
else
|
||||
flash[:error] = ''
|
||||
render :action => :new
|
||||
|
|
|
@ -6,7 +6,7 @@ module DiffHelper
|
|||
def render_inline_diff_header(commit, diff)
|
||||
res = "<a name='#{h(diff.a_path)}'></a>"
|
||||
if diff.b_path.present?
|
||||
res += link_to("view file @ #{commit.id}", blob_commit_path(@platform.name, @project.name, commit.id, diff.b_path))
|
||||
res += link_to("view file @ #{commit.id}", blob_commit_path(@platform, @repository, @project, commit.id, diff.b_path))
|
||||
res += "<br />"
|
||||
end
|
||||
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
module GitHelper
|
||||
end
|
|
@ -68,3 +68,118 @@ header {
|
|||
}
|
||||
|
||||
footer {}
|
||||
|
||||
.row {
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.commit_row {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.commit_row .author {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table tr .line_numbers {
|
||||
text-align: right;
|
||||
vertical-align: top;
|
||||
background: #eee;
|
||||
color: #777;
|
||||
font-size: 92%;
|
||||
padding: 0 3px 0 2px;
|
||||
width: 35px;
|
||||
border-right: 1px solid #ccc;
|
||||
border-bottom: 1px solid #cdcdcd;
|
||||
}
|
||||
|
||||
table tr td.code {
|
||||
width: 95%;
|
||||
padding-left: 10px;
|
||||
/*white-space: pre;*/
|
||||
white-space: pre-wrap; /* CSS-3 */
|
||||
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
|
||||
white-space: -pre-wrap; /* Opera 4-6 */
|
||||
white-space: -o-pre-wrap; /* Opera 7 */
|
||||
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
||||
background: #fff;
|
||||
font: 95%/110% "Bitstream Vera Sans Mono", Monaco, monospace;
|
||||
border-right: 1px solid #ccc;
|
||||
}
|
||||
|
||||
table tr td.code pre {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-size: inherit;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
table tr td.unwrapped {
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
table tr td.softwrapped {
|
||||
white-space: pre-wrap; /* CSS-3 */
|
||||
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
|
||||
white-space: -pre-wrap; /* Opera 4-6 */
|
||||
white-space: -o-pre-wrap; /* Opera 7 */
|
||||
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
||||
}
|
||||
|
||||
table.sidebyside tr td.code {
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
table.diff {
|
||||
border: 1px solid #ccc;
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font: 95%/105% "Bitstream Vera Sans Mono", Monaco, monospace;
|
||||
}
|
||||
table.diff tr td {
|
||||
padding: 0;
|
||||
}
|
||||
table.diff .line_num_cut {
|
||||
background: #ccc;
|
||||
border-top: 1px dashed #ccc;
|
||||
border-bottom: 1px dashed #ccc;
|
||||
}
|
||||
|
||||
table.diff thead .line_numbers, table.diff thead { background: #ddd; }
|
||||
table.diff td.code { padding-left: 2px; }
|
||||
table.diff .cut-line {
|
||||
background: #eee;
|
||||
border-top: 1px dashed #aaa;
|
||||
border-bottom: 1px dashed #aaa;
|
||||
}
|
||||
table.diff td.hidden del { display:none; }
|
||||
table.diff td.del { background: #ffdddd; }
|
||||
table.diff td.del span.idiff { background: #F2ACAD; }
|
||||
table.diff td.ins { background: #ddffdd; }
|
||||
table.diff td.ins span.idiff { background: #BAFBAD; }
|
||||
/*table.sidebyside tbody.mod td ins span.idiff,
|
||||
table.sidebyside tbody.mod td del span.idiff { background: #fd4; }*/
|
||||
table.diff td.del del { text-decoration: none; }
|
||||
table.diff td.ins ins { text-decoration: none; }
|
||||
table.diff col.lines {
|
||||
width: 3em;
|
||||
}
|
||||
|
||||
ul.diff_stats {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
table.blame {
|
||||
border: 1px solid #ccc;
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font: 95%/105% "Bitstream Vera Sans Mono", Monaco, monospace;
|
||||
}
|
||||
|
||||
table.blame tr td {
|
||||
padding: 0;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
table.blame thead .line_numbers, table.blame thead { background: #ddd; }
|
||||
table.balme td.code { padding-left: 2px; }
|
|
@ -1,8 +1,8 @@
|
|||
= render :partial => "git/commits/commit", :locals => { :commit => @commit }
|
||||
|
||||
= link_to "Raw", raw_commit_path(@platform.name, @project.name, @commit.id, @path)
|
||||
= link_to "Normal", blob_commit_path(@platform.name, @project.name, @commit.id, @path)
|
||||
= link_to "History", commits_path(@platform.name, @project.name, @treeish, @path)
|
||||
= link_to "Raw", raw_commit_path(@platform, @repository, @project, @commit.id, @path)
|
||||
= link_to "Normal", blob_commit_path(@platform, @repository, @project, @commit.id, @path)
|
||||
= link_to "History", commits_path(@platform, @repository, @project, @treeish, @path)
|
||||
|
||||
.row
|
||||
%table{ :class => "blame" }
|
||||
|
@ -16,7 +16,7 @@
|
|||
- @blame.each_with_index do |elem, index|
|
||||
%tr
|
||||
%td.message
|
||||
.row= link_to elem[0].id, commit_path(@platform.name, @project.name, elem[0].id)
|
||||
.row= link_to elem[0].id, commit_path(@platform, @repository, @project, elem[0].id)
|
||||
.row= elem[0].committer
|
||||
.row= commit_date(elem[0].committed_date)
|
||||
.row!= format_commit_message(elem[0].message)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
%h2= @blob.name
|
||||
|
||||
.row
|
||||
= link_to "Raw", raw_commit_path(@platform.name, @project.name, @commit_hash, @path)
|
||||
= link_to "Blame", blame_commit_path(@platform.name, @project.name, @commit_hash, @path)
|
||||
= link_to "History", commits_path(@platform.name, @project.name, @treeish, @path)
|
||||
= link_to "Raw", raw_commit_path(@platform, @repository, @project, @commit_hash, @path)
|
||||
= link_to "Blame", blame_commit_path(@platform, @repository, @project, @commit_hash, @path)
|
||||
= link_to "History", commits_path(@platform, @repository, @project, @treeish, @path)
|
||||
|
||||
%pre
|
||||
%code
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.commit_row
|
||||
= render :partial => "git/commits/commit_pane", :locals => { :commit => commit }
|
||||
|
||||
.row= link_to commit.message, commit_path(@platform.name, @project.name, commit.id)
|
||||
.row= link_to commit.message, commit_path(@platform, @repository, @project, commit.id)
|
|
@ -1,7 +1,7 @@
|
|||
= render :partial => "git/commits/committer_pane", :locals => { :commit => commit }
|
||||
|
||||
.row.tree Tree: #{link_to commit.tree.id, tree_path(@platform.name, @project.name, commit.tree.id)}
|
||||
.row.tree Tree: #{link_to commit.tree.id, tree_path(@platform, @repository, @project, commit.tree.id)}
|
||||
|
||||
.row.parents
|
||||
- commit.parents.each do |parent|
|
||||
Parent: #{link_to parent, commit_path(@platform.name, @project.name, parent)}
|
||||
Parent: #{link_to parent, commit_path(@platform, @repository, @project, parent)}
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
= render :partial => "commit_pane", :locals => { :commit => @commit}
|
||||
|
||||
#{link_to "raw diff", commit_path(@platform.name, @project.name, @commit.id, :diff)} | #{link_to "patch", commit_path(@platform.name, @project.name, @commit.id, :patch)}
|
||||
#{link_to "raw diff", commit_path(@platform, @repository, @project, @commit.id, :diff)} | #{link_to "patch", commit_path(@platform, @repository, @project, @commit.id, :patch)}
|
||||
|
||||
.row.commit_message
|
||||
%code!= format_commit_message(@commit.message)
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
.row= link_to "Commits", commits_path(@platform.name, @project.name, @treeish)
|
||||
.row= link_to "Commits", commits_path(@platform, @repository, @project, :treeish => @treeish)
|
||||
.row.tags
|
||||
%h3 Tags:
|
||||
%ul
|
||||
- @repository.tags.each do |tag|
|
||||
%li= link_to tag.name, tree_path(@platform.name, @project.name, :treeish => tag.name)
|
||||
- @git_repository.tags.each do |tag|
|
||||
%li= link_to tag.name, tree_path(@platform, @repository, @project, :treeish => tag.name)
|
||||
|
||||
.row.heads
|
||||
%h3 Heads:
|
||||
%ul
|
||||
- @repository.heads.each do |head|
|
||||
%li= link_to head.name, tree_path(@platform.name, @project.name, :treeish => head.name)
|
||||
- @git_repository.heads.each do |head|
|
||||
%li= link_to head.name, tree_path(@platform, @repository, @project, :treeish => head.name)
|
||||
|
||||
%table
|
||||
%thead
|
||||
|
@ -22,13 +22,13 @@
|
|||
- if @path.present?
|
||||
%tr
|
||||
%td
|
||||
= link_to "..", tree_path(@platform.name, @project.name, @treeish, File.join([@path, ".."].compact))
|
||||
= link_to "..", tree_path(@platform, @repository, @project, @treeish, File.join([@path, ".."].compact))
|
||||
- @tree.contents.each do |entry|
|
||||
%tr
|
||||
%td
|
||||
- if entry.is_a?(Grit::Blob)
|
||||
= link_to entry.name, blob_path(@platform.name, @project.name, @treeish, File.join([@path, entry.name].compact))
|
||||
= link_to entry.name, blob_path(@platform, @repository, @project, @treeish, File.join([@path, entry.name].compact))
|
||||
- else
|
||||
= link_to "#{entry.name}/", tree_path(@platform.name, @project.name, @treeish, File.join([@path, entry.name].compact))
|
||||
= link_to "#{entry.name}/", tree_path(@platform, @repository, @project, @treeish, File.join([@path, entry.name].compact))
|
||||
%td==
|
||||
%td==
|
|
@ -12,23 +12,23 @@ Rosa::Application.routes.draw do
|
|||
resources :users
|
||||
|
||||
# Tree
|
||||
match 'platforms/:platform_name/projects/:project_name/git/tree/:treeish(/*path)', :controller => "git/trees", :action => :show, :platform_name => /[0-9a-zA-Z_.\-]*/, :project_name => /[0-9a-zA-Z_.\-]*/, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :tree
|
||||
match 'platforms/:platform_id/repositories/:repository_id/projects/:project_id/git/tree/:treeish(/*path)', :controller => "git/trees", :action => :show, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :tree
|
||||
|
||||
# Commits
|
||||
match 'platforms/:platform_name//projects/:project_name/git/commits/:treeish(/*path)', :controller => "git/commits", :action => :index, :platform_name => /[0-9a-zA-Z_.\-]*/, :project_name => /[0-9a-zA-Z_.\-]*/, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :commits
|
||||
match 'platforms/:platform_name//projects/:project_name/git/commit/:id(.:format)', :controller => "git/commits", :action => :show, :platform_name => /[0-9a-zA-Z_.\-]*/, :project_name => /[0-9a-zA-Z_.\-]*/, :defaults => { :format => :html }, :as => :commit
|
||||
match 'platforms/:platform_id/repositories/:repository_id/projects/:project_id/git/commits/:treeish(/*path)', :controller => "git/commits", :action => :index, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :commits
|
||||
match 'platforms/:platform_id/repositories/:repository_id/projects/:project_id/git/commit/:id(.:format)', :controller => "git/commits", :action => :show, :defaults => { :format => :html }, :as => :commit
|
||||
|
||||
# Blobs
|
||||
match 'platforms/:platform_name/projects/:project_name/git/blob/:treeish/*path', :controller => "git/blobs", :action => :show, :platform_name => /[0-9a-zA-Z_.\-]*/, :project_name => /[0-9a-zA-Z_.\-]*/, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :blob
|
||||
match 'platforms/:platform_name/projects/:project_name/git/commit/blob/:commit_hash/*path', :controller => "git/blobs", :action => :show, :platform_name => /[0-9a-zA-Z_.\-]*/, :project_name => /[0-9a-zA-Z_.\-]*/, :as => :blob_commit
|
||||
match 'platforms/:platform_id/repositories/:repository_id/projects/:project_id/git/blob/:treeish/*path', :controller => "git/blobs", :action => :show, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :blob
|
||||
match 'platforms/:platform_id/repositories/:repository_id/projects/:project_id/git/commit/blob/:commit_hash/*path', :controller => "git/blobs", :action => :show, :platform_name => /[0-9a-zA-Z_.\-]*/, :project_name => /[0-9a-zA-Z_.\-]*/, :as => :blob_commit
|
||||
|
||||
# Blame
|
||||
match 'platforms/:platform_name/projects/:project_name/git/blame/:treeish/*path', :controller => "git/blobs", :action => :blame, :platform_name => /[0-9a-zA-Z_.\-]*/, :project_name => /[0-9a-zA-Z_.\-]*/, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :blame
|
||||
match 'platforms/:platform_name/projects/:project_name/git/commit/blame/:commit_hash/*path', :controller => "git/blobs", :action => :blame, :platform_name => /[0-9a-zA-Z_.\-]*/, :project_name => /[0-9a-zA-Z_.\-]*/, :as => :blame_commit
|
||||
match 'platforms/:platform_id/repositories/:repository_id/projects/:project_id/git/blame/:treeish/*path', :controller => "git/blobs", :action => :blame, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :blame
|
||||
match 'platforms/:platform_id/repositories/:repository_id/projects/:project_id/git/commit/blame/:commit_hash/*path', :controller => "git/blobs", :action => :blame, :as => :blame_commit
|
||||
|
||||
# Raw
|
||||
match 'platforms/:platform_name/projects/:project_name/git/raw/:treeish/*path', :controller => "git/blobs", :action => :raw, :platform_name => /[0-9a-zA-Z_.\-]*/, :project_name => /[0-9a-zA-Z_.\-]*/, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :raw
|
||||
match 'platforms/:platform_name/projects/:project_name/git/commit/raw/:commit_hash/*path', :controller => "git/blobs", :action => :raw, :platform_name => /[0-9a-zA-Z_.\-]*/, :project_name => /[0-9a-zA-Z_.\-]*/, :as => :raw_commit
|
||||
match 'platforms/:platform_id/repositories/:repository_id/projects/:project_id/git/raw/:treeish/*path', :controller => "git/blobs", :action => :raw, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :raw
|
||||
match 'platforms/:platform_id/repositories/:repository_id/projects/:project_id/git/commit/raw/:commit_hash/*path', :controller => "git/blobs", :action => :raw, :as => :raw_commit
|
||||
|
||||
root :to => "platforms#index"
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue