| |   |
| 5 | 5 | LOGS_PER_PAGE = 30 |
| 6 | 6 | |
| 7 | 7 | def index |
| 8 | | @git = Git.bare(@repository.full_repository_path) |
| 8 | @git = Gitorious::Gitto.new(@repository.full_repository_path) |
| 9 | 9 | @commits = @git.log(LOGS_PER_PAGE) |
| 10 | | @tags_per_sha = returning({}) do |hash| |
| 11 | | @git.tags.each do |tag| |
| 12 | | hash[tag.sha] ||= [] |
| 13 | | hash[tag.sha] << tag.name |
| 14 | | end |
| 15 | | end |
| 10 | @tags_per_sha = @git.tags_by_sha |
| 16 | 11 | # TODO: Patch rails to keep track of what it responds to so we can DRY this up |
| 17 | 12 | @atom_auto_discovery_url = project_repository_formatted_browse_path(@project, @repository, :atom) |
| 18 | 13 | respond_to do |format| |
| … | … | |
| 17 | 17 | end |
| 18 | 18 | |
| 19 | 19 | def tree |
| 20 | | @git = Git.bare(@repository.full_repository_path) |
| 21 | | @tree = @git.gtree(params[:sha]) |
| 20 | @git = Gitorious::Gitto.new(@repository.full_repository_path) |
| 21 | @tree = @git.tree(params[:sha]) |
| 22 | 22 | end |
| 23 | 23 | |
| 24 | 24 | def commit |
| 25 | 25 | @diffmode = params[:diffmode] == "sidebyside" ? "sidebyside" : "inline" |
| 26 | | @git = Git.bare(@repository.full_repository_path) |
| 27 | | @commit = @git.gcommit(params[:sha]) |
| 26 | @git = Gitorious::Gitto.new(@repository.full_repository_path) |
| 27 | @commit = @git.commit(params[:sha]) |
| 28 | 28 | if @commit.parent |
| 29 | 29 | @diff = @git.diff(@commit.parent.sha || "", @commit.sha) |
| 30 | 30 | else |
| 31 | | # initial commit |
| 32 | | @diff = @commit.diff("") # fIXME: diffs are the wrong way |
| 31 | # initial commit, link to the initial tree instead |
| 32 | @diff = nil |
| 33 | 33 | end |
| 34 | 34 | @comment_count = @repository.comments.count(:all, :conditions => {:sha1 => @commit.sha}) |
| 35 | 35 | end |
| 36 | 36 | |
| 37 | 37 | def diff |
| 38 | | @git = Git.bare(@repository.full_repository_path) |
| 38 | @git = Gitorious::Gitto.new(@repository.full_repository_path) |
| 39 | 39 | @diff = @git.diff(params[:sha], params[:other_sha]) |
| 40 | 40 | end |
| 41 | 41 | |
| 42 | 42 | def blob |
| 43 | | @git = Git.bare(@repository.full_repository_path) |
| 44 | | @blob = @git.gblob(params[:sha]) |
| 43 | @git = Gitorious::Gitto.new(@repository.full_repository_path) |
| 44 | @blob = @git.blob(params[:sha]) |
| 45 | 45 | end |
| 46 | 46 | |
| 47 | 47 | def raw |
| 48 | | @git = Git.bare(@repository.full_repository_path) |
| 49 | | @blob = @git.gblob(params[:sha]) |
| 48 | @git = Gitorious::Gitto.new(@repository.full_repository_path) |
| 49 | @blob = @git.blob(params[:sha]) |
| 50 | 50 | render :text => @blob.contents, :content_type => "text/plain" |
| 51 | 51 | end |
| 52 | 52 | |
| 53 | 53 | def log |
| 54 | | @git = Git.bare(@repository.full_repository_path) |
| 54 | @git = Gitorious::Gitto.new(@repository.full_repository_path) |
| 55 | 55 | skip = params[:page].blank? ? 0 : (params[:page].to_i-1) * LOGS_PER_PAGE |
| 56 | 56 | @commits = @git.log(LOGS_PER_PAGE, skip) |
| 57 | | @tags_per_sha = returning({}) do |hash| |
| 58 | | @git.tags.each do |tag| |
| 59 | | hash[tag.sha] ||= [] |
| 60 | | hash[tag.sha] << tag.name |
| 61 | | end |
| 62 | | end |
| 57 | @tags_per_sha = @git.tags_by_sha |
| 63 | 58 | # TODO: Patch rails to keep track of what it responds to so we can DRY this up |
| 64 | 59 | @atom_auto_discovery_url = project_repository_formatted_browse_path(@project, @repository, :atom) |
| 65 | 60 | respond_to do |format| |
| toggle raw diff |
--- a/app/controllers/browse_controller.rb
+++ b/app/controllers/browse_controller.rb
@@ -5,14 +5,9 @@ class BrowseController < ApplicationController
LOGS_PER_PAGE = 30
def index
- @git = Git.bare(@repository.full_repository_path)
+ @git = Gitorious::Gitto.new(@repository.full_repository_path)
@commits = @git.log(LOGS_PER_PAGE)
- @tags_per_sha = returning({}) do |hash|
- @git.tags.each do |tag|
- hash[tag.sha] ||= []
- hash[tag.sha] << tag.name
- end
- end
+ @tags_per_sha = @git.tags_by_sha
# TODO: Patch rails to keep track of what it responds to so we can DRY this up
@atom_auto_discovery_url = project_repository_formatted_browse_path(@project, @repository, :atom)
respond_to do |format|
@@ -22,49 +17,44 @@ class BrowseController < ApplicationController
end
def tree
- @git = Git.bare(@repository.full_repository_path)
- @tree = @git.gtree(params[:sha])
+ @git = Gitorious::Gitto.new(@repository.full_repository_path)
+ @tree = @git.tree(params[:sha])
end
def commit
@diffmode = params[:diffmode] == "sidebyside" ? "sidebyside" : "inline"
- @git = Git.bare(@repository.full_repository_path)
- @commit = @git.gcommit(params[:sha])
+ @git = Gitorious::Gitto.new(@repository.full_repository_path)
+ @commit = @git.commit(params[:sha])
if @commit.parent
@diff = @git.diff(@commit.parent.sha || "", @commit.sha)
else
- # initial commit
- @diff = @commit.diff("") # fIXME: diffs are the wrong way
+ # initial commit, link to the initial tree instead
+ @diff = nil
end
@comment_count = @repository.comments.count(:all, :conditions => {:sha1 => @commit.sha})
end
def diff
- @git = Git.bare(@repository.full_repository_path)
+ @git = Gitorious::Gitto.new(@repository.full_repository_path)
@diff = @git.diff(params[:sha], params[:other_sha])
end
def blob
- @git = Git.bare(@repository.full_repository_path)
- @blob = @git.gblob(params[:sha])
+ @git = Gitorious::Gitto.new(@repository.full_repository_path)
+ @blob = @git.blob(params[:sha])
end
def raw
- @git = Git.bare(@repository.full_repository_path)
- @blob = @git.gblob(params[:sha])
+ @git = Gitorious::Gitto.new(@repository.full_repository_path)
+ @blob = @git.blob(params[:sha])
render :text => @blob.contents, :content_type => "text/plain"
end
def log
- @git = Git.bare(@repository.full_repository_path)
+ @git = Gitorious::Gitto.new(@repository.full_repository_path)
skip = params[:page].blank? ? 0 : (params[:page].to_i-1) * LOGS_PER_PAGE
@commits = @git.log(LOGS_PER_PAGE, skip)
- @tags_per_sha = returning({}) do |hash|
- @git.tags.each do |tag|
- hash[tag.sha] ||= []
- hash[tag.sha] << tag.name
- end
- end
+ @tags_per_sha = @git.tags_by_sha
# TODO: Patch rails to keep track of what it responds to so we can DRY this up
@atom_auto_discovery_url = project_repository_formatted_browse_path(@project, @repository, :atom)
respond_to do |format| |
| |   |
| 1 | 1 | class SiteController < ApplicationController |
| 2 | before_filter :login_required, :only => [:dashboard] |
| 2 | 3 | |
| 3 | 4 | def index |
| 4 | 5 | @tags = Project.tag_counts |
| 6 | @projects = Project.find(:all, :limit => 5, :order => "id desc") |
| 7 | end |
| 8 | |
| 9 | def dashboard |
| 10 | @projects = current_user.projects |
| 11 | project_ids = @projects.map(&:id) |
| 12 | @recent_comments = Comment.find(:all, :limit => 10, |
| 13 | :conditions => ["comments.project_id in (?)", project_ids], |
| 14 | :order => "comments.created_at desc", :include => [:user, :repository]) |
| 15 | @repository_clones = @projects.map(&:repository_clones).flatten |
| 16 | # @repository_clones = Repository.find(:all, |
| 17 | # :conditions => ["project_id in (?) and mainline = ?", project_ids, false]) |
| 5 | 18 | end |
| 6 | 19 | |
| 7 | 20 | def about |
| 8 | 21 | end |
| 9 | 22 | |
| 23 | def faq |
| 24 | end |
| 25 | |
| 10 | 26 | end |
| toggle raw diff |
--- a/app/controllers/site_controller.rb
+++ b/app/controllers/site_controller.rb
@@ -1,10 +1,26 @@
class SiteController < ApplicationController
+ before_filter :login_required, :only => [:dashboard]
def index
@tags = Project.tag_counts
+ @projects = Project.find(:all, :limit => 5, :order => "id desc")
+ end
+
+ def dashboard
+ @projects = current_user.projects
+ project_ids = @projects.map(&:id)
+ @recent_comments = Comment.find(:all, :limit => 10,
+ :conditions => ["comments.project_id in (?)", project_ids],
+ :order => "comments.created_at desc", :include => [:user, :repository])
+ @repository_clones = @projects.map(&:repository_clones).flatten
+ # @repository_clones = Repository.find(:all,
+ # :conditions => ["project_id in (?) and mainline = ?", project_ids, false])
end
def about
end
+ def faq
+ end
+
end |
| |   |
| 99 | 99 | end |
| 100 | 100 | |
| 101 | 101 | def render_diffmode_selector |
| 102 | | out = %Q{<ul class="diffmode_selector">} |
| 102 | out = %Q{<ul class="mode_selector">} |
| 103 | 103 | out << %Q{<li class="list_header">Diff rendering mode:</li>} |
| 104 | 104 | if @diffmode == "sidebyside" |
| 105 | 105 | out << %Q{<li><a href="?diffmode=inline">inline</a></li>} |
| … | … | |
| 112 | 112 | out |
| 113 | 113 | end |
| 114 | 114 | |
| 115 | def with_line_numbers(&block) |
| 116 | out = [] |
| 117 | #yield.split("\n").each_with_index{ |s,i| out << "#{i+1}: #{s}" } |
| 118 | out << %Q{<table id="codeblob">} |
| 119 | yield.to_s.split("\n").each_with_index do |line, count| |
| 120 | lineno = count + 1 |
| 121 | out << %Q{<tr id="line#{lineno}">} |
| 122 | out << %Q{<td class="line-numbers"><a href="#line#{lineno}" name="line#{lineno}">#{lineno}</a></td>} |
| 123 | out << %Q{<td class="code">#{line}</td>} |
| 124 | out << "</tr>" |
| 125 | end |
| 126 | out << "</table>" |
| 127 | out.join("\n") |
| 128 | |
| 129 | end |
| 130 | |
| 115 | 131 | end |
| toggle raw diff |
--- a/app/helpers/browse_helper.rb
+++ b/app/helpers/browse_helper.rb
@@ -99,7 +99,7 @@ module BrowseHelper
end
def render_diffmode_selector
- out = %Q{<ul class="diffmode_selector">}
+ out = %Q{<ul class="mode_selector">}
out << %Q{<li class="list_header">Diff rendering mode:</li>}
if @diffmode == "sidebyside"
out << %Q{<li><a href="?diffmode=inline">inline</a></li>}
@@ -112,4 +112,20 @@ module BrowseHelper
out
end
+ def with_line_numbers(&block)
+ out = []
+ #yield.split("\n").each_with_index{ |s,i| out << "#{i+1}: #{s}" }
+ out << %Q{<table id="codeblob">}
+ yield.to_s.split("\n").each_with_index do |line, count|
+ lineno = count + 1
+ out << %Q{<tr id="line#{lineno}">}
+ out << %Q{<td class="line-numbers"><a href="#line#{lineno}" name="line#{lineno}">#{lineno}</a></td>}
+ out << %Q{<td class="code">#{line}</td>}
+ out << "</tr>"
+ end
+ out << "</table>"
+ out.join("\n")
+
+ end
+
end |
| |   |
| 19 | 19 | acts_as_taggable |
| 20 | 20 | |
| 21 | 21 | belongs_to :user |
| 22 | has_many :comments |
| 22 | 23 | has_many :repositories, :order => "mainline desc, created_at asc", |
| 23 | 24 | :dependent => :destroy |
| 24 | 25 | has_one :mainline_repository, :conditions => ["mainline = ?", true], |
| 25 | 26 | :class_name => "Repository" |
| 26 | | has_many :branch_repositories, :conditions => ["mainline = ?", false], |
| 27 | has_many :repository_clones, :conditions => ["mainline = ?", false], |
| 27 | 28 | :class_name => "Repository" |
| 28 | 29 | |
| 29 | 30 | URL_FORMAT_RE = /^(http|https|nntp):\/\//.freeze |
| toggle raw diff |
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -19,11 +19,12 @@ class Project < ActiveRecord::Base
acts_as_taggable
belongs_to :user
+ has_many :comments
has_many :repositories, :order => "mainline desc, created_at asc",
:dependent => :destroy
has_one :mainline_repository, :conditions => ["mainline = ?", true],
:class_name => "Repository"
- has_many :branch_repositories, :conditions => ["mainline = ?", false],
+ has_many :repository_clones, :conditions => ["mainline = ?", false],
:class_name => "Repository"
URL_FORMAT_RE = /^(http|https|nntp):\/\//.freeze |
| |   |
| 13 | 13 | class SshKey < ActiveRecord::Base |
| 14 | 14 | belongs_to :user |
| 15 | 15 | |
| 16 | | SSH_KEY_FORMAT = /^ssh\-[a-z0-9]{3,4} [a-z0-9\+=\n\/]+ [a-z0-9_\.\-]*(@[a-z0-9\.\-]*)?$/ims |
| 16 | SSH_KEY_FORMAT = /^ssh\-[a-z0-9]{3,4} [a-z0-9\+=\/]+ [a-z0-9_\.\-]*(@[a-z0-9\.\-]*)?$/ims |
| 17 | 17 | |
| 18 | 18 | validates_presence_of :user_id, :key |
| 19 | 19 | validates_format_of :key, :with => SSH_KEY_FORMAT |
| 20 | 20 | |
| 21 | 21 | before_validation { |k| k.key.to_s.strip! } |
| 22 | | before_save :lint_key! |
| 22 | before_validation :lint_key! |
| 23 | 23 | after_create :create_new_task |
| 24 | 24 | # we only allow people to create/destroy keys after_update :create_update_task |
| 25 | 25 | after_destroy :create_delete_task |
| … | … | |
| 32 | 32 | %Q{### START KEY #{self.id || "nil"} ###\n} + |
| 33 | 33 | %Q{command="gitorious #{user.login}",no-port-forwarding,} + |
| 34 | 34 | %Q{no-X11-forwarding,no-agent-forwarding,no-pty #{key}} + |
| 35 | | %Q{\n### END KEY #{self.id || "nil"} ###} |
| 35 | %Q{\n### END KEY #{self.id || "nil"} ###\n} |
| 36 | 36 | end |
| 37 | 37 | |
| 38 | 38 | def self.add_to_authorized_keys(keydata, key_file_class=SshKeyFile) |
| … | … | |
| 59 | 59 | |
| 60 | 60 | protected |
| 61 | 61 | def lint_key! |
| 62 | | key.gsub!(/\n*/m, "") |
| 62 | self.key.gsub!(/(\r|\n)*/m, "") |
| 63 | 63 | end |
| 64 | 64 | end |
| toggle raw diff |
--- a/app/models/ssh_key.rb
+++ b/app/models/ssh_key.rb
@@ -13,13 +13,13 @@
class SshKey < ActiveRecord::Base
belongs_to :user
- SSH_KEY_FORMAT = /^ssh\-[a-z0-9]{3,4} [a-z0-9\+=\n\/]+ [a-z0-9_\.\-]*(@[a-z0-9\.\-]*)?$/ims
+ SSH_KEY_FORMAT = /^ssh\-[a-z0-9]{3,4} [a-z0-9\+=\/]+ [a-z0-9_\.\-]*(@[a-z0-9\.\-]*)?$/ims
validates_presence_of :user_id, :key
validates_format_of :key, :with => SSH_KEY_FORMAT
before_validation { |k| k.key.to_s.strip! }
- before_save :lint_key!
+ before_validation :lint_key!
after_create :create_new_task
# we only allow people to create/destroy keys after_update :create_update_task
after_destroy :create_delete_task
@@ -32,7 +32,7 @@ class SshKey < ActiveRecord::Base
%Q{### START KEY #{self.id || "nil"} ###\n} +
%Q{command="gitorious #{user.login}",no-port-forwarding,} +
%Q{no-X11-forwarding,no-agent-forwarding,no-pty #{key}} +
- %Q{\n### END KEY #{self.id || "nil"} ###}
+ %Q{\n### END KEY #{self.id || "nil"} ###\n}
end
def self.add_to_authorized_keys(keydata, key_file_class=SshKeyFile)
@@ -59,6 +59,6 @@ class SshKey < ActiveRecord::Base
protected
def lint_key!
- key.gsub!(/\n*/m, "")
+ self.key.gsub!(/(\r|\n)*/m, "")
end
end |
| |   |
| 33 | 33 | attr_protected :login |
| 34 | 34 | |
| 35 | 35 | validates_presence_of :login, :email |
| 36 | validates_format_of :login, :with => /^[a-z0-9\-_\.]+$/i |
| 37 | validates_format_of :email, :with => /^[^@\s]+@([\-a-z0-9]+\.)+[a-z]{2,}$/i |
| 36 | 38 | validates_presence_of :password, :if => :password_required? |
| 37 | 39 | validates_presence_of :password_confirmation, :if => :password_required? |
| 38 | 40 | validates_length_of :password, :within => 4..40, :if => :password_required? |
| toggle raw diff |
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -33,6 +33,8 @@ class User < ActiveRecord::Base
attr_protected :login
validates_presence_of :login, :email
+ validates_format_of :login, :with => /^[a-z0-9\-_\.]+$/i
+ validates_format_of :email, :with => /^[^@\s]+@([\-a-z0-9]+\.)+[a-z]{2,}$/i
validates_presence_of :password, :if => :password_required?
validates_presence_of :password_confirmation, :if => :password_required?
validates_length_of :password, :within => 4..40, :if => :password_required? |
| |   |
| 1 | 1 | <% @page_title = "#{current_path.join("/")} - #{@repository.name} in #{@project.title}" -%> |
| 2 | |
| 3 | <ul class="mode_selector"> |
| 4 | <li class="list_header"> |
| 5 | Softwrap mode: |
| 6 | </li> |
| 7 | <li> |
| 8 | <%= link_to_function "Toggle", "Gitorious.Wordwrapper.toggle($$('table#codeblob td.code'))" -%> |
| 9 | </li> |
| 10 | </ul> |
| 11 | |
| 2 | 12 | <h1> |
| 3 | 13 | Blob of <code><%= current_path.join("/") -%></code> |
| 4 | 14 | <small>(<%= link_to "raw blob data", raw_blob_path(@blob.sha, current_path) -%>)</small> |
| 5 | 15 | </h1> |
| 6 | | <pre><%=h @blob.contents -%></pre> |
| 16 | |
| 17 | <pre><%= with_line_numbers{ h(@blob.contents) } -%></pre> |
| 7 | 18 | |
| 8 | 19 | <%= render :partial => "submenu" -%> |
| toggle raw diff |
--- a/app/views/browse/blob.html.erb
+++ b/app/views/browse/blob.html.erb
@@ -1,8 +1,19 @@
<% @page_title = "#{current_path.join("/")} - #{@repository.name} in #{@project.title}" -%>
+
+<ul class="mode_selector">
+ <li class="list_header">
+ Softwrap mode:
+ </li>
+ <li>
+ <%= link_to_function "Toggle", "Gitorious.Wordwrapper.toggle($$('table#codeblob td.code'))" -%>
+ </li>
+</ul>
+
<h1>
Blob of <code><%= current_path.join("/") -%></code>
<small>(<%= link_to "raw blob data", raw_blob_path(@blob.sha, current_path) -%>)</small>
</h1>
-<pre><%=h @blob.contents -%></pre>
+
+<pre><%= with_line_numbers{ h(@blob.contents) } -%></pre>
<%= render :partial => "submenu" -%> |
| |   |
| 14 | 14 | |
| 15 | 15 | <% #TODO: commit diff stats (as sparklines?) -%> |
| 16 | 16 | |
| 17 | | <h2>Commit diff</h2> |
| 18 | | <%= render_diffmode_selector -%> |
| 19 | | |
| 20 | | <% @diff.each do |file| -%> |
| 21 | | <h4><%= h(file.path) -%><%#=link_to h(file.path), blob_path(file.sha, file.path) -%></h4> |
| 22 | | <%= render_diff(file.patch, file.src, file.dst, @diffmode) -%> |
| 23 | | <small><%= link_to_function "toggle raw diff", "$('#{file.object_id}').toggle()" -%></small> |
| 24 | | <div class="toggle_diff" style="display:none" id="<%= file.object_id -%>"> |
| 25 | | <p><pre><%= h(file.patch) -%></pre></p> |
| 26 | | </div> |
| 17 | <% if @diff.blank? -%> |
| 18 | <p> |
| 19 | This is the initial commit in this repository, |
| 20 | <%= link_to "browse the initial tree state", tree_path(@commit.gtree.sha) -%>. |
| 21 | </p> |
| 22 | <% else -%> |
| 23 | <h2>Commit diff</h2> |
| 24 | <%= render_diffmode_selector -%> |
| 25 | |
| 26 | <% @diff.each do |file| -%> |
| 27 | <h4><%= h(file.path) -%><%#=link_to h(file.path), blob_path(file.sha, file.path) -%></h4> |
| 28 | <%= render_diff(file.patch, file.src, file.dst, @diffmode) -%> |
| 29 | <small><%= link_to_function "toggle raw diff", "$('#{file.object_id}').toggle()" -%></small> |
| 30 | <div class="toggle_diff" style="display:none" id="<%= file.object_id -%>"> |
| 31 | <p><pre><%= h(file.patch) -%></pre></p> |
| 32 | </div> |
| 33 | <% end -%> |
| 27 | 34 | <% end -%> |
| 28 | 35 | |
| 29 | 36 | <%= render :partial => "submenu" -%> |
| toggle raw diff |
--- a/app/views/browse/commit.html.erb
+++ b/app/views/browse/commit.html.erb
@@ -14,16 +14,23 @@
<% #TODO: commit diff stats (as sparklines?) -%>
-<h2>Commit diff</h2>
-<%= render_diffmode_selector -%>
-
-<% @diff.each do |file| -%>
- <h4><%= h(file.path) -%><%#=link_to h(file.path), blob_path(file.sha, file.path) -%></h4>
- <%= render_diff(file.patch, file.src, file.dst, @diffmode) -%>
- <small><%= link_to_function "toggle raw diff", "$('#{file.object_id}').toggle()" -%></small>
- <div class="toggle_diff" style="display:none" id="<%= file.object_id -%>">
- <p><pre><%= h(file.patch) -%></pre></p>
- </div>
+<% if @diff.blank? -%>
+ <p>
+ This is the initial commit in this repository,
+ <%= link_to "browse the initial tree state", tree_path(@commit.gtree.sha) -%>.
+ </p>
+<% else -%>
+ <h2>Commit diff</h2>
+ <%= render_diffmode_selector -%>
+
+ <% @diff.each do |file| -%>
+ <h4><%= h(file.path) -%><%#=link_to h(file.path), blob_path(file.sha, file.path) -%></h4>
+ <%= render_diff(file.patch, file.src, file.dst, @diffmode) -%>
+ <small><%= link_to_function "toggle raw diff", "$('#{file.object_id}').toggle()" -%></small>
+ <div class="toggle_diff" style="display:none" id="<%= file.object_id -%>">
+ <p><pre><%= h(file.patch) -%></pre></p>
+ </div>
+ <% end -%>
<% end -%>
<%= render :partial => "submenu" -%>
\ No newline at end of file |
| |   |
| 13 | 13 | <%= GitoriousConfig["extra_html_head_data"] -%> |
| 14 | 14 | </head> |
| 15 | 15 | |
| 16 | | <body> |
| 16 | <body id="<%= controller.controller_name -%>"> |
| 17 | 17 | <div id="container"> |
| 18 | 18 | <div id="header"> |
| 19 | 19 | <div class="login-logout"> |
| … | … | |
| 34 | 34 | <div id="menu"> |
| 35 | 35 | <ul> |
| 36 | 36 | <li><%= link_to "Home", root_path -%></li> |
| 37 | <% if logged_in? -%> |
| 38 | <li><%= link_to "Dashboard", dashboard_path -%></li> |
| 39 | <% end -%> |
| 37 | 40 | <li><%= link_to "Projects", projects_path -%></li> |
| 41 | <% if logged_in? -%> |
| 42 | <li><%= link_to "FAQ", faq_path -%></li> |
| 43 | <% else -%> |
| 38 | 44 | <li><%= link_to "About", about_path -%></li> |
| 45 | <% end -%> |
| 39 | 46 | </ul> |
| 40 | 47 | </div> |
| 41 | 48 | <div id="submenu"> |
| … | … | |
| 76 | 76 | <ul> |
| 77 | 77 | <li><%= link_to "Home", root_path -%> | </li> |
| 78 | 78 | <li><%= link_to "About", about_path -%> | </li> |
| 79 | <li><%= link_to "FAQ", faq_path -%> | </li> |
| 79 | 80 | <li><%= link_to "Discussion group", "http://groups.google.com/group/gitorious" -%></li> |
| 80 | 81 | </ul> |
| 81 | 82 | </div> |
| toggle raw diff |
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -13,7 +13,7 @@
<%= GitoriousConfig["extra_html_head_data"] -%>
</head>
-<body>
+<body id="<%= controller.controller_name -%>">
<div id="container">
<div id="header">
<div class="login-logout">
@@ -34,8 +34,15 @@
<div id="menu">
<ul>
<li><%= link_to "Home", root_path -%></li>
+ <% if logged_in? -%>
+ <li><%= link_to "Dashboard", dashboard_path -%></li>
+ <% end -%>
<li><%= link_to "Projects", projects_path -%></li>
+ <% if logged_in? -%>
+ <li><%= link_to "FAQ", faq_path -%></li>
+ <% else -%>
<li><%= link_to "About", about_path -%></li>
+ <% end -%>
</ul>
</div>
<div id="submenu">
@@ -69,6 +76,7 @@
<ul>
<li><%= link_to "Home", root_path -%> | </li>
<li><%= link_to "About", about_path -%> | </li>
+ <li><%= link_to "FAQ", faq_path -%> | </li>
<li><%= link_to "Discussion group", "http://groups.google.com/group/gitorious" -%></li>
</ul>
</div> |
| |   |
| 4 | 4 | |
| 5 | 5 | <ul class="infobox"> |
| 6 | 6 | <li><strong>Owner:</strong> <%= link_to h(@project.user.login), user_path(@project.user) -%></li> |
| 7 | <li><strong>Created:</strong> <%= @project.created_at.to_s(:short) -%></li> |
| 7 | 8 | <li><strong>Labels:</strong> |
| 8 | 9 | <%= @project.tag_list.blank? ? "none" : linked_tag_list_as_sentence(@project.tags) -%></li> |
| 9 | 10 | <li><strong>License:</strong> <%= h(@project.license) -%></li> |
| … | … | |
| 27 | 27 | <thead> |
| 28 | 28 | <th>Name</th> |
| 29 | 29 | <th>Owner</th> |
| 30 | | <th>Created</th> |
| 30 | <th>Last Commit</th> |
| 31 | 31 | <th></th> |
| 32 | 32 | </thead> |
| 33 | 33 | <% @repositories.each do |repos| # fixme: need to graph the parent relation proper -%> |
| … | … | |
| 40 | 40 | <%= h(@project.slug) -%> (<%= link_to h(repos.user.login), user_path(repos.user) -%>) |
| 41 | 41 | </td> |
| 42 | 42 | <td> |
| 43 | | <%= repos.created_at.to_s(:short) -%> |
| 43 | <%= repos.last_commit ? repos.last_commit.author.date.to_s(:short) : "<em>none</em>" -%> |
| 44 | 44 | </td> |
| 45 | 45 | <td><%= link_to "browse", project_repository_browse_path(@project, repos) -%></td> |
| 46 | 46 | </tr> |
| … | … | |
| 53 | 53 | <%= link_to h(repos.user.login), user_path(repos.user) -%> |
| 54 | 54 | </td> |
| 55 | 55 | <td> |
| 56 | | <%= repos.created_at.to_s(:short) -%> |
| 56 | <%= repos.last_commit ? repos.last_commit.author.date.to_s(:short) : "<em>none</em>" -%> |
| 57 | 57 | </td> |
| 58 | 58 | <td><%= link_to "browse", project_repository_browse_path(@project, repos) -%></td> |
| 59 | 59 | </tr> |
| toggle raw diff |
--- a/app/views/projects/show.html.erb
+++ b/app/views/projects/show.html.erb
@@ -4,6 +4,7 @@
<ul class="infobox">
<li><strong>Owner:</strong> <%= link_to h(@project.user.login), user_path(@project.user) -%></li>
+ <li><strong>Created:</strong> <%= @project.created_at.to_s(:short) -%></li>
<li><strong>Labels:</strong>
<%= @project.tag_list.blank? ? "none" : linked_tag_list_as_sentence(@project.tags) -%></li>
<li><strong>License:</strong> <%= h(@project.license) -%></li>
@@ -26,7 +27,7 @@
<thead>
<th>Name</th>
<th>Owner</th>
- <th>Created</th>
+ <th>Last Commit</th>
<th></th>
</thead>
<% @repositories.each do |repos| # fixme: need to graph the parent relation proper -%>
@@ -39,7 +40,7 @@
<%= h(@project.slug) -%> (<%= link_to h(repos.user.login), user_path(repos.user) -%>)
</td>
<td>
- <%= repos.created_at.to_s(:short) -%>
+ <%= repos.last_commit ? repos.last_commit.author.date.to_s(:short) : "<em>none</em>" -%>
</td>
<td><%= link_to "browse", project_repository_browse_path(@project, repos) -%></td>
</tr>
@@ -52,7 +53,7 @@
<%= link_to h(repos.user.login), user_path(repos.user) -%>
</td>
<td>
- <%= repos.created_at.to_s(:short) -%>
+ <%= repos.last_commit ? repos.last_commit.author.date.to_s(:short) : "<em>none</em>" -%>
</td>
<td><%= link_to "browse", project_repository_browse_path(@project, repos) -%></td>
</tr> |
| |   |
| 6 | 6 | <%= link_to h(@repository.parent.gitdir), project_repository_path(@project, @repository.parent) -%> |
| 7 | 7 | <% end -%> |
| 8 | 8 | <li><strong>Created:</strong> <%= @repository.created_at.to_s(:short) -%></li> |
| 9 | | <li><strong>Mirror url:</strong> <code><%=h @repository.clone_url -%></code></li> |
| 9 | <li> |
| 10 | <strong>Clone url:</strong> <code><%=h @repository.clone_url -%></code> |
| 11 | <small><%= link_to_function "More info…", "$('detailed_clone_info').toggle()" -%></small> |
| 12 | <div id="detailed_clone_info" class="info_hint" style="display:none"> |
| 13 | You can clone this repository with the following command: |
| 14 | <% if logged_in? && current_user.can_write_to?(@repository) -%> |
| 15 | <code>git clone <%= @repository.push_url -%></code> |
| 16 | <% else -%> |
| 17 | <code>git clone <%= @repository.clone_url -%></code> |
| 18 | <% end -%> |
| 19 | </div> |
| 20 | </li> |
| 10 | 21 | <% if logged_in? && current_user.can_write_to?(@repository) -%> |
| 11 | | <li><strong>push url:</strong> <code><%=h @repository.push_url -%></code></li> |
| 22 | <li> |
| 23 | <strong>Push url:</strong> <code><%=h @repository.push_url -%></code> |
| 24 | <small><%= link_to_function "More info…", "$('detailed_push_info').toggle()" -%></small> |
| 25 | <div id="detailed_push_info" class="info_hint" style="display:none"> |
| 26 | You can run "<code>git push git@gitorious.org:tumbline/mainline.git</code>", or |
| 27 | you can setup a remote by doing the following: |
| 28 | <pre> |
| 29 | git remote add origin <%= @repository.push_url %> |
| 30 | # to push the master branch to the origin remote we added above: |
| 31 | git push origin master |
| 32 | # after that you can just do: |
| 33 | git push |
| 34 | </pre> |
| 35 | </div> |
| 36 | </li> |
| 12 | 37 | <% end -%> |
| 13 | 38 | </ul> |
| toggle raw diff |
--- a/app/views/repositories/_infobox.html.erb
+++ b/app/views/repositories/_infobox.html.erb
@@ -6,8 +6,33 @@
<%= link_to h(@repository.parent.gitdir), project_repository_path(@project, @repository.parent) -%>
<% end -%>
<li><strong>Created:</strong> <%= @repository.created_at.to_s(:short) -%></li>
- <li><strong>Mirror url:</strong> <code><%=h @repository.clone_url -%></code></li>
+ <li>
+ <strong>Clone url:</strong> <code><%=h @repository.clone_url -%></code>
+ <small><%= link_to_function "More info…", "$('detailed_clone_info').toggle()" -%></small>
+ <div id="detailed_clone_info" class="info_hint" style="display:none">
+ You can clone this repository with the following command:
+ <% if logged_in? && current_user.can_write_to?(@repository) -%>
+ <code>git clone <%= @repository.push_url -%></code>
+ <% else -%>
+ <code>git clone <%= @repository.clone_url -%></code>
+ <% end -%>
+ </div>
+ </li>
<% if logged_in? && current_user.can_write_to?(@repository) -%>
- <li><strong>push url:</strong> <code><%=h @repository.push_url -%></code></li>
+ <li>
+ <strong>Push url:</strong> <code><%=h @repository.push_url -%></code>
+ <small><%= link_to_function "More info…", "$('detailed_push_info').toggle()" -%></small>
+ <div id="detailed_push_info" class="info_hint" style="display:none">
+You can run "<code>git push git@gitorious.org:tumbline/mainline.git</code>", or
+you can setup a remote by doing the following:
+<pre>
+git remote add origin <%= @repository.push_url %>
+# to push the master branch to the origin remote we added above:
+git push origin master
+# after that you can just do:
+git push
+</pre>
+ </div>
+ </li>
<% end -%>
</ul>
\ No newline at end of file |
| |   |
| 7 | 7 | <% render_if_ready(@repository) do -%> |
| 8 | 8 | |
| 9 | 9 | <%= render :partial => "infobox" -%> |
| 10 | | |
| 11 | | <p>You can clone this repository with the following command:</p> |
| 12 | | <% if logged_in? && current_user.can_write_to?(@repository) -%> |
| 13 | | <pre>git clone <%= @repository.push_url -%></pre> |
| 14 | | <% else -%> |
| 15 | | <pre>git clone <%= @repository.clone_url -%></pre> |
| 16 | | <% end -%> |
| 17 | 10 | |
| 18 | 11 | <ul class="tab_menu"> |
| 19 | 12 | <li class="selected">Recent commits</li> |
| 20 | 13 | <li><%= link_to "comments (#{@comment_count})", project_repository_comments_path(@project, @repository) -%></li> |
| 21 | 14 | </ul> |
| 22 | 15 | |
| 23 | | <h2>Recent commits <small>(<%= link_to "browse", project_repository_browse_path(@project, @repository) -%>)</small></h2> |
| 16 | <h2> |
| 17 | Recent commits |
| 18 | <small> |
| 19 | (<%= link_to "Shortlog", project_repository_browse_path(@project, @repository) -%> | |
| 20 | <%= link_to "HEAD tree", project_repository_tree_path(@project, @repository, "HEAD", []) -%>) |
| 21 | </small> |
| 22 | </h2> |
| 24 | 23 | <ul> |
| 25 | 24 | <% if @commits.blank? -%> |
| 26 | 25 | <li><em>No commits yet…</em></li> |
| toggle raw diff |
--- a/app/views/repositories/show.html.erb
+++ b/app/views/repositories/show.html.erb
@@ -7,20 +7,19 @@
<% render_if_ready(@repository) do -%>
<%= render :partial => "infobox" -%>
-
- <p>You can clone this repository with the following command:</p>
- <% if logged_in? && current_user.can_write_to?(@repository) -%>
- <pre>git clone <%= @repository.push_url -%></pre>
- <% else -%>
- <pre>git clone <%= @repository.clone_url -%></pre>
- <% end -%>
<ul class="tab_menu">
<li class="selected">Recent commits</li>
<li><%= link_to "comments (#{@comment_count})", project_repository_comments_path(@project, @repository) -%></li>
</ul>
- <h2>Recent commits <small>(<%= link_to "browse", project_repository_browse_path(@project, @repository) -%>)</small></h2>
+ <h2>
+ Recent commits
+ <small>
+ (<%= link_to "Shortlog", project_repository_browse_path(@project, @repository) -%> |
+ <%= link_to "HEAD tree", project_repository_tree_path(@project, @repository, "HEAD", []) -%>)
+ </small>
+ </h2>
<ul>
<% if @commits.blank? -%>
<li><em>No commits yet…</em></li> |
| |   |
| 46 | 46 | If you experience any technical issues feel free to |
| 47 | 47 | <a href="mailto:johan@johansorensen.com">send an email</a>, there's also the |
| 48 | 48 | <a href="http://groups.google.com/group/gitorious">discussion group</a> for more |
| 49 | | general Gitorious discussions around Gitorious. |
| 50 | | </p> |
| 51 | | </div> |
| 52 | | |
| 53 | | <div class="section"> |
| 54 | | <a name="faq"></a><h1>FAQ</h1> |
| 55 | | |
| 56 | | <h3>How do I point my local Git repository at Gitorious?</h3> |
| 57 | | <p> |
| 58 | | Easiest way is to put something like the following in your <code>.git/config</code> |
| 59 | | file of the repository you wish to push: |
| 60 | | <pre> |
| 61 | | [remote "origin"] |
| 62 | | url = git@gitorious.org:<em>project</em>/<em>repository.git</em> |
| 63 | | fetch = +refs/heads/*:refs/remotes/origin/* |
| 64 | | [branch "master"] |
| 65 | | remote = origin |
| 66 | | merge = refs/heads/master |
| 67 | | </pre> |
| 68 | | and then <code>git push origin master</code> to push the code to Gitorious. |
| 69 | | </p> |
| 70 | | |
| 71 | | <hr /> |
| 72 | | |
| 73 | | <h3>Why is my email displayed?</h3> |
| 74 | | <p> |
| 75 | | The email you used to signup with Gitorious is displayed to other users, so that they |
| 76 | | can contact you about your projects if they need to. We do however take light |
| 77 | | measures against crawlers by not displaying your email in completely plain text. <br /> |
| 78 | | But just to be clear: we won't sell or use any information you give to |
| 79 | | gitorious.org against you or anyone else for financial and/or personal gains. |
| 80 | | </p> |
| 81 | | |
| 82 | | <hr /> |
| 83 | | |
| 84 | | <h3>Why do I need to upload my public SSH key?</h3> |
| 85 | | <p> |
| 86 | | When you push to a Git repository, your public key is how we authenticate |
| 87 | | you and if have the permissions required to do a commit to a given repository |
| 49 | general Gitorious discussions around Gitorious. There's also the |
| 50 | <a href="irc://irc.freenode.net/gitorious"><code>#gitorious</code></a> IRC |
| 51 | channel on FreeNode. |
| 88 | 52 | </p> |
| 89 | 53 | </div> |
| 90 | 54 | |
| … | … | |
| 56 | 56 | <ul class="links"> |
| 57 | 57 | <li><a href="#about">About</a></li> |
| 58 | 58 | <li><a href="#contact">Contact</a></li> |
| 59 | | <li><a href="#faq">FAQ</a></li> |
| 59 | <li><%= link_to "FAQ", faq_path -%></li> |
| 60 | 60 | </ul> |
| 61 | 61 | <% end -%> |
| toggle raw diff |
--- a/app/views/site/about.html.erb
+++ b/app/views/site/about.html.erb
@@ -46,45 +46,9 @@
If you experience any technical issues feel free to
<a href="mailto:johan@johansorensen.com">send an email</a>, there's also the
<a href="http://groups.google.com/group/gitorious">discussion group</a> for more
- general Gitorious discussions around Gitorious.
- </p>
-</div>
-
-<div class="section">
- <a name="faq"></a><h1>FAQ</h1>
-
- <h3>How do I point my local Git repository at Gitorious?</h3>
- <p>
- Easiest way is to put something like the following in your <code>.git/config</code>
- file of the repository you wish to push:
- <pre>
- [remote "origin"]
- url = git@gitorious.org:<em>project</em>/<em>repository.git</em>
- fetch = +refs/heads/*:refs/remotes/origin/*
- [branch "master"]
- remote = origin
- merge = refs/heads/master
- </pre>
- and then <code>git push origin master</code> to push the code to Gitorious.
- </p>
-
- <hr />
-
- <h3>Why is my email displayed?</h3>
- <p>
- The email you used to signup with Gitorious is displayed to other users, so that they
- can contact you about your projects if they need to. We do however take light
- measures against crawlers by not displaying your email in completely plain text. <br />
- But just to be clear: we won't sell or use any information you give to
- gitorious.org against you or anyone else for financial and/or personal gains.
- </p>
-
- <hr />
-
- <h3>Why do I need to upload my public SSH key?</h3>
- <p>
- When you push to a Git repository, your public key is how we authenticate
- you and if have the permissions required to do a commit to a given repository
+ general Gitorious discussions around Gitorious. There's also the
+ <a href="irc://irc.freenode.net/gitorious"><code>#gitorious</code></a> IRC
+ channel on FreeNode.
</p>
</div>
@@ -92,6 +56,6 @@
<ul class="links">
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
- <li><a href="#faq">FAQ</a></li>
+ <li><%= link_to "FAQ", faq_path -%></li>
</ul>
<% end -%>
\ No newline at end of file |
| |   |
| 1 | <% @page_title = "#{current_user.login}'s dashboard" -%> |
| 2 | |
| 3 | <div id="recent_comments"> |
| 4 | <h2>Recent comments on your commits</h2> |
| 5 | <% @recent_comments.each do |comment| -%> |
| 6 | <div class="comment"> |
| 7 | <p class="body"><%= sanitize(comment.body) -%></p> |
| 8 | <p class="byline hint"> |
| 9 | on <%= link_to h(comment.repository.name), project_repository_comments_path(comment.project, comment.repository, :anchor => dom_id(comment)) -%> |
| 10 | <% unless comment.sha1.blank? -%> |
| 11 | (<%= link_to h(comment.sha1[0..6]), project_repository_commit_path(comment.project, comment.repository, comment.sha1) -%>) |
| 12 | <% end -%> |
| 13 | in <%= link_to h(comment.project.title), comment.project -%> by |
| 14 | <%= link_to(h(comment.user.login), comment.user) -%> |
| 15 | <%= time_ago_in_words(comment.created_at) -%> ago |
| 16 | </p> |
| 17 | </div> |
| 18 | <% end -%> |
| 19 | <% if @recent_comments.blank? -%> |
| 20 | <p class="hint">Sorry, no comments yet</p> |
| 21 | <% end -%> |
| 22 | </div> |
| 23 | |
| |