Merge branch 'master' into hooray_apostrophes
This commit is contained in:
commit
66399d558d
|
@ -249,7 +249,7 @@ ul.bordered-list li:last-child { border:none }
|
||||||
li.commit {
|
li.commit {
|
||||||
.avatar {
|
.avatar {
|
||||||
width:24px;
|
width:24px;
|
||||||
top:-3px;
|
top:-5px;
|
||||||
margin-right:10px;
|
margin-right:10px;
|
||||||
margin-left:10px;
|
margin-left:10px;
|
||||||
}
|
}
|
||||||
|
@ -305,12 +305,7 @@ p.time {
|
||||||
}
|
}
|
||||||
|
|
||||||
.styled_image {
|
.styled_image {
|
||||||
-webkit-border-radius: 4px;
|
border:2px solid #ddd;
|
||||||
-moz-border-radius: 4px;
|
|
||||||
border-radius: 4px;
|
|
||||||
-moz-box-shadow: 0 0 5px #888;
|
|
||||||
-webkit-box-shadow: 0 0 5px#888;
|
|
||||||
box-shadow: 0 0 5px #888;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.event_feed {
|
.event_feed {
|
||||||
|
@ -729,3 +724,14 @@ li.note {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.git_error_tips {
|
||||||
|
@extend .span6;
|
||||||
|
text-align:left;
|
||||||
|
margin-top:40px;
|
||||||
|
pre {
|
||||||
|
background:white;
|
||||||
|
border:none;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -325,9 +325,7 @@ img.avatar {
|
||||||
float:left;
|
float:left;
|
||||||
margin-right:15px;
|
margin-right:15px;
|
||||||
width:40px;
|
width:40px;
|
||||||
-webkit-border-radius: 4px;
|
border:2px solid #ddd;
|
||||||
-moz-border-radius: 4px;
|
|
||||||
border-radius: 4px;
|
|
||||||
|
|
||||||
&.s16 {
|
&.s16 {
|
||||||
width:16px;
|
width:16px;
|
||||||
|
|
|
@ -96,7 +96,7 @@ header {
|
||||||
*/
|
*/
|
||||||
.search {
|
.search {
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: 50px;
|
margin-right: 45px;
|
||||||
|
|
||||||
.search-input {
|
.search-input {
|
||||||
@extend .span2;
|
@extend .span2;
|
||||||
|
@ -125,13 +125,13 @@ header {
|
||||||
display: block;
|
display: block;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
img {
|
img {
|
||||||
border-radius: 4px;
|
@include border-radius(4px);
|
||||||
right: 5px;
|
right: 5px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 31px;
|
width: 28px;
|
||||||
height: 31px;
|
height: 28px;
|
||||||
display: block;
|
display: block;
|
||||||
top: 0;
|
top: 2px;
|
||||||
&:after {
|
&:after {
|
||||||
content: " ";
|
content: " ";
|
||||||
display: block;
|
display: block;
|
||||||
|
@ -186,7 +186,7 @@ header {
|
||||||
width: 100px;
|
width: 100px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 10px;
|
right: 10px;
|
||||||
top: 46px;
|
top: 42px;
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
float: right;
|
float: right;
|
||||||
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
|
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
}
|
}
|
||||||
.search {
|
.search {
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: 55px;
|
margin-right: 45px;
|
||||||
.search-input {
|
.search-input {
|
||||||
border: 1px solid rgba(0, 0, 0, 0.7);
|
border: 1px solid rgba(0, 0, 0, 0.7);
|
||||||
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2), 0 2px 2px rgba(0, 0, 0, 0.4) inset;
|
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2), 0 2px 2px rgba(0, 0, 0, 0.4) inset;
|
||||||
|
|
|
@ -91,7 +91,7 @@
|
||||||
*/
|
*/
|
||||||
.search {
|
.search {
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: 55px;
|
margin-right: 45px;
|
||||||
.search-input {
|
.search-input {
|
||||||
border: 1px solid rgba(0, 0, 0, 0.7);
|
border: 1px solid rgba(0, 0, 0, 0.7);
|
||||||
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2), 0 2px 2px rgba(0, 0, 0, 0.4) inset;
|
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2), 0 2px 2px rgba(0, 0, 0, 0.4) inset;
|
||||||
|
@ -127,6 +127,7 @@
|
||||||
.account-box {
|
.account-box {
|
||||||
top:6px;
|
top:6px;
|
||||||
img {
|
img {
|
||||||
|
top:1px;
|
||||||
right: 5px;
|
right: 5px;
|
||||||
width: 26px;
|
width: 26px;
|
||||||
height: 26px;
|
height: 26px;
|
||||||
|
|
|
@ -110,7 +110,7 @@ module ApplicationHelper
|
||||||
when :admin_root; controller.controller_name == "dashboard"
|
when :admin_root; controller.controller_name == "dashboard"
|
||||||
when :admin_users; controller.controller_name == 'users'
|
when :admin_users; controller.controller_name == 'users'
|
||||||
when :admin_projects; controller.controller_name == "projects"
|
when :admin_projects; controller.controller_name == "projects"
|
||||||
when :admin_emails; controller.controller_name == 'mailer'
|
when :admin_hooks; controller.controller_name == 'hooks'
|
||||||
when :admin_resque; controller.controller_name == 'resque'
|
when :admin_resque; controller.controller_name == 'resque'
|
||||||
when :admin_logs; controller.controller_name == 'logs'
|
when :admin_logs; controller.controller_name == 'logs'
|
||||||
|
|
||||||
|
|
|
@ -12,53 +12,10 @@ module GitlabMarkdownHelper
|
||||||
"{gfm-extraction-#{md5}}"
|
"{gfm-extraction-#{md5}}"
|
||||||
end
|
end
|
||||||
|
|
||||||
# match 1 2 3 4 5 6
|
# TODO: add popups with additional information
|
||||||
text.gsub!(/(\W)?(@([\w\._]+)|[#!$](\d+)|([\h]{6,40}))(\W)?/) do |match|
|
|
||||||
prefix = $1
|
|
||||||
reference = $2
|
|
||||||
user_name = $3
|
|
||||||
issue_id = $4
|
|
||||||
merge_request_id = $4
|
|
||||||
snippet_id = $4
|
|
||||||
commit_id = $5
|
|
||||||
suffix = $6
|
|
||||||
|
|
||||||
# TODO: add popups with additional information
|
parser = Gitlab::Markdown.new(@project, html_options)
|
||||||
ref_link = case reference
|
text = parser.parse(text)
|
||||||
|
|
||||||
# team member: @foo
|
|
||||||
when /^@/
|
|
||||||
user = @project.users.where(name: user_name).first
|
|
||||||
member = @project.users_projects.where(user_id: user).first if user
|
|
||||||
link_to("@#{user_name}", project_team_member_path(@project, member), html_options.merge(class: "gfm gfm-team_member #{html_options[:class]}")) if member
|
|
||||||
|
|
||||||
# issue: #123
|
|
||||||
when /^#/
|
|
||||||
# avoid HTML entities
|
|
||||||
unless prefix.try(:end_with?, "&") && suffix.try(:start_with?, ";")
|
|
||||||
issue = @project.issues.where(id: issue_id).first
|
|
||||||
link_to("##{issue_id}", project_issue_path(@project, issue), html_options.merge(title: "Issue: #{issue.title}", class: "gfm gfm-issue #{html_options[:class]}")) if issue
|
|
||||||
end
|
|
||||||
|
|
||||||
# merge request: !123
|
|
||||||
when /^!/
|
|
||||||
merge_request = @project.merge_requests.where(id: merge_request_id).first
|
|
||||||
link_to("!#{merge_request_id}", project_merge_request_path(@project, merge_request), html_options.merge(title: "Merge Request: #{merge_request.title}", class: "gfm gfm-merge_request #{html_options[:class]}")) if merge_request
|
|
||||||
|
|
||||||
# snippet: $123
|
|
||||||
when /^\$/
|
|
||||||
snippet = @project.snippets.where(id: snippet_id).first
|
|
||||||
link_to("$#{snippet_id}", project_snippet_path(@project, snippet), html_options.merge(title: "Snippet: #{snippet.title}", class: "gfm gfm-snippet #{html_options[:class]}")) if snippet
|
|
||||||
|
|
||||||
# commit: 123456...
|
|
||||||
when /^\h/
|
|
||||||
commit = @project.commit(commit_id)
|
|
||||||
link_to(commit_id, project_commit_path(@project, id: commit.id), html_options.merge(title: "Commit: #{commit.author_name} - #{CommitDecorator.new(commit).title}", class: "gfm gfm-commit #{html_options[:class]}")) if commit
|
|
||||||
|
|
||||||
end # case
|
|
||||||
|
|
||||||
ref_link.nil? ? match : "#{prefix}#{ref_link}#{suffix}"
|
|
||||||
end # gsub
|
|
||||||
|
|
||||||
# Insert pre block extractions
|
# Insert pre block extractions
|
||||||
text.gsub!(/\{gfm-extraction-(\h{32})\}/) do
|
text.gsub!(/\{gfm-extraction-(\h{32})\}/) do
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
.alert-message.block-message.error
|
%h1 Access Denied
|
||||||
%h3 Access Denied
|
%hr
|
||||||
%hr
|
%h2 You are not allowed to access this page.
|
||||||
%p You are not allowed to access this page.
|
%p Read more about project permissions #{link_to "here", help_permissions_path, class: "vlink"}
|
||||||
%p Read more about project permissions #{link_to "here", help_permissions_path, class: "vlink"}
|
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
.alert-message.block-message.error
|
%h1 404
|
||||||
%h3 Git Resource Not found
|
%hr
|
||||||
%hr
|
%h2 Git Resource Not found
|
||||||
%p
|
%p
|
||||||
Application can't get access to some
|
Application can't get access to some branch or commit in your repository. It
|
||||||
%span.label branch
|
may have been moved.
|
||||||
or
|
|
||||||
%span.label commit
|
|
||||||
in your repository. It may have been moved.
|
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
.alert-message.block-message.error
|
%h1 Git Error
|
||||||
%h3 Gitolite Error
|
%hr
|
||||||
%h4 Application can't get access to your gitolite system.
|
%h2 Gitlab was unable to access your Gitolite system.
|
||||||
|
|
||||||
%h4 Tips for Administrator:
|
.git_error_tips
|
||||||
|
%h4 Tips for Administrator:
|
||||||
%ul
|
%ol
|
||||||
%li
|
%li
|
||||||
%p
|
%p
|
||||||
Check git logs in admin area
|
Check git logs in admin area
|
||||||
%li
|
%li
|
||||||
%p
|
%p
|
||||||
Check config/gitlab.yml for correct settings.
|
Check config/gitlab.yml for correct settings.
|
||||||
%li
|
%li
|
||||||
%p
|
%p
|
||||||
Diagnostic tool:
|
Diagnostic tool:
|
||||||
|
%pre
|
||||||
|
bundle exec rake gitlab:app:status RAILS_ENV=production
|
||||||
|
%li
|
||||||
|
%p
|
||||||
|
Permissions:
|
||||||
%pre
|
%pre
|
||||||
bundle exec rake gitlab:app:status RAILS_ENV=production
|
= preserve do
|
||||||
%li
|
sudo chmod -R 770 /home/git/repositories/
|
||||||
%p
|
sudo chown -R git:git /home/git/repositories/
|
||||||
Permissions:
|
sudo chown gitlab:gitlab /home/git/repositories/**/hooks/post-receive
|
||||||
%pre
|
|
||||||
= preserve do
|
|
||||||
sudo chmod -R 770 /home/git/repositories/
|
|
||||||
sudo chown -R git:git /home/git/repositories/
|
|
||||||
sudo chown gitlab:gitlab /home/git/repositories/**/hooks/post-receive
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
.alert-message.block-message.error
|
%h1 404
|
||||||
%h3 Not found
|
%hr
|
||||||
%hr
|
%h2 The resource you were looking for doesn't exist.
|
||||||
%p The resource you were looking for doesn't exist.
|
%p You may have mistyped the address or the page may have moved.
|
||||||
%p You may have mistyped the address or it may have been removed.
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
= link_to "Users", admin_users_path
|
= link_to "Users", admin_users_path
|
||||||
%li{class: tab_class(:admin_logs)}
|
%li{class: tab_class(:admin_logs)}
|
||||||
= link_to "Logs", admin_logs_path
|
= link_to "Logs", admin_logs_path
|
||||||
%li{class: tab_class(:admin_emails)}
|
%li{class: tab_class(:admin_hooks)}
|
||||||
= link_to "Hooks", admin_hooks_path
|
= link_to "Hooks", admin_hooks_path
|
||||||
%li{class: tab_class(:admin_resque)}
|
%li{class: tab_class(:admin_resque)}
|
||||||
= link_to "Resque", admin_resque_path
|
= link_to "Resque", admin_resque_path
|
||||||
|
|
|
@ -6,5 +6,5 @@
|
||||||
= render "layouts/head_panel", title: ""
|
= render "layouts/head_panel", title: ""
|
||||||
.container
|
.container
|
||||||
.content
|
.content
|
||||||
%br
|
%center.padded.prepend-top-20
|
||||||
%h3= yield
|
= yield
|
||||||
|
|
98
lib/gitlab/markdown.rb
Normal file
98
lib/gitlab/markdown.rb
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
module Gitlab
|
||||||
|
# Custom parsing for Gitlab-flavored Markdown
|
||||||
|
#
|
||||||
|
# Examples
|
||||||
|
#
|
||||||
|
# >> m = Markdown.new(...)
|
||||||
|
#
|
||||||
|
# >> m.parse("Hey @david, can you fix this?")
|
||||||
|
# => "Hey <a href="/gitlab/team_members/1">@david</a>, can you fix this?"
|
||||||
|
#
|
||||||
|
# >> m.parse("Commit 35d5f7c closes #1234")
|
||||||
|
# => "Commit <a href="/gitlab/commits/35d5f7c">35d5f7c</a> closes <a href="/gitlab/issues/1234">#1234</a>"
|
||||||
|
class Markdown
|
||||||
|
include Rails.application.routes.url_helpers
|
||||||
|
include ActionView::Helpers
|
||||||
|
|
||||||
|
REFERENCE_PATTERN = %r{
|
||||||
|
([^\w&;])? # Prefix (1)
|
||||||
|
( # Reference (2)
|
||||||
|
@([\w\._]+) # User name (3)
|
||||||
|
|[#!$](\d+) # Issue/MR/Snippet ID (4)
|
||||||
|
|([\h]{6,40}) # Commit ID (5)
|
||||||
|
)
|
||||||
|
([^\w&;])? # Suffix (6)
|
||||||
|
}x.freeze
|
||||||
|
|
||||||
|
attr_reader :html_options
|
||||||
|
|
||||||
|
def initialize(project, html_options = {})
|
||||||
|
@project = project
|
||||||
|
@html_options = html_options
|
||||||
|
end
|
||||||
|
|
||||||
|
def parse(text)
|
||||||
|
text.gsub(REFERENCE_PATTERN) do |match|
|
||||||
|
prefix = $1 || ''
|
||||||
|
reference = $2
|
||||||
|
identifier = $3 || $4 || $5
|
||||||
|
suffix = $6 || ''
|
||||||
|
|
||||||
|
if ref_link = reference_link(reference, identifier)
|
||||||
|
prefix + ref_link + suffix
|
||||||
|
else
|
||||||
|
match
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
# Private: Dispatches to a dedicated processing method based on reference
|
||||||
|
#
|
||||||
|
# reference - Object reference ("@1234", "!567", etc.)
|
||||||
|
# identifier - Object identifier (Issue ID, SHA hash, etc.)
|
||||||
|
#
|
||||||
|
# Returns string rendered by the processing method
|
||||||
|
def reference_link(reference, identifier)
|
||||||
|
case reference
|
||||||
|
when /^@/ then reference_user(identifier)
|
||||||
|
when /^#/ then reference_issue(identifier)
|
||||||
|
when /^!/ then reference_merge_request(identifier)
|
||||||
|
when /^\$/ then reference_snippet(identifier)
|
||||||
|
when /^\h/ then reference_commit(identifier)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def reference_user(identifier)
|
||||||
|
if user = @project.users.where(name: identifier).first
|
||||||
|
member = @project.users_projects.where(user_id: user).first
|
||||||
|
link_to("@#{user.name}", project_team_member_path(@project, member), html_options.merge(class: "gfm gfm-team_member #{html_options[:class]}")) if member
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def reference_issue(identifier)
|
||||||
|
if issue = @project.issues.where(id: identifier).first
|
||||||
|
link_to("##{issue.id}", project_issue_path(@project, issue), html_options.merge(title: "Issue: #{issue.title}", class: "gfm gfm-issue #{html_options[:class]}"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def reference_merge_request(identifier)
|
||||||
|
if merge_request = @project.merge_requests.where(id: identifier).first
|
||||||
|
link_to("!#{merge_request.id}", project_merge_request_path(@project, merge_request), html_options.merge(title: "Merge Request: #{merge_request.title}", class: "gfm gfm-merge_request #{html_options[:class]}"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def reference_snippet(identifier)
|
||||||
|
if snippet = @project.snippets.where(id: identifier).first
|
||||||
|
link_to("$#{snippet.id}", project_snippet_path(@project, snippet), html_options.merge(title: "Snippet: #{snippet.title}", class: "gfm gfm-snippet #{html_options[:class]}"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def reference_commit(identifier)
|
||||||
|
if commit = @project.commit(identifier)
|
||||||
|
link_to(identifier, project_commit_path(@project, id: commit.id), html_options.merge(title: "Commit: #{commit.author_name} - #{CommitDecorator.new(commit).title}", class: "gfm gfm-commit #{html_options[:class]}"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<h1>404</h1>
|
<h1>404</h1>
|
||||||
<div class="alert-message block-message error">
|
<div>
|
||||||
<h2>The page you were looking for doesn't exist.</h2>
|
<h2>The page you were looking for doesn't exist.</h2>
|
||||||
<p>You may have mistyped the address or the page may have moved.</p>
|
<p>You may have mistyped the address or the page may have moved.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<body>
|
<body>
|
||||||
<!-- This file lives in public/422.html -->
|
<!-- This file lives in public/422.html -->
|
||||||
<h1>422</h1>
|
<h1>422</h1>
|
||||||
<div class="alert-message block-message error">
|
<div>
|
||||||
<h2>The change you wanted was rejected.</h2>
|
<h2>The change you wanted was rejected.</h2>
|
||||||
<p>Maybe you tried to change something you didn't have access to.</p>
|
<p>Maybe you tried to change something you didn't have access to.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<body>
|
<body>
|
||||||
<!-- This file lives in public/500.html -->
|
<!-- This file lives in public/500.html -->
|
||||||
<h1>500</h1>
|
<h1>500</h1>
|
||||||
<div class="alert-message block-message error">
|
<div>
|
||||||
<h2>We're sorry, but something went wrong.</h2>
|
<h2>We're sorry, but something went wrong.</h2>
|
||||||
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue