Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
e6d2e569
Commit
e6d2e569
authored
Jan 23, 2013
by
Andrew8xx8
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue tracker field added to projects
parent
8f621c9e
Changes
9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
69 additions
and
315 deletions
+69
-315
app/helpers/issues_helper.rb
app/helpers/issues_helper.rb
+27
-0
app/models/project.rb
app/models/project.rb
+5
-1
app/views/projects/_form.html.haml
app/views/projects/_form.html.haml
+4
-0
config/gitlab.yml.example
config/gitlab.yml.example
+6
-0
db/migrate/20130123114545_add_issues_tracker_to_project.rb
db/migrate/20130123114545_add_issues_tracker_to_project.rb
+5
-0
db/schema.rb
db/schema.rb
+0
-312
lib/gitlab/markdown.rb
lib/gitlab/markdown.rb
+5
-2
spec/helpers/gitlab_markdown_helper_spec.rb
spec/helpers/gitlab_markdown_helper_spec.rb
+1
-0
spec/lib/issues_tracker_spec.rb
spec/lib/issues_tracker_spec.rb
+16
-0
No files found.
app/helpers/issues_helper.rb
View file @
e6d2e569
...
@@ -40,4 +40,31 @@ module IssuesHelper
...
@@ -40,4 +40,31 @@ module IssuesHelper
def
issues_active_milestones
def
issues_active_milestones
@project
.
milestones
.
active
.
order
(
"id desc"
).
all
@project
.
milestones
.
active
.
order
(
"id desc"
).
all
end
end
def
url_for_issue
(
issue_id
)
if
@project
.
issues_tracker
==
Project
.
issues_tracker
.
default_value
url
=
project_issue_url
project_id:
@project
,
id:
issue_id
else
url
=
Settings
[
:issues_tracker
][
@project
.
issues_tracker
][
"issues_url"
]
url
.
gsub
(
':id'
,
issue_id
.
to_s
).
gsub
(
':project_id'
,
@project
.
id
.
to_s
)
end
end
def
title_for_issue
(
issue_id
)
if
issue
=
@project
.
issues
.
where
(
id:
issue_id
).
first
issue
.
title
else
""
end
end
def
issue_exists?
(
issue_id
)
return
false
if
@project
.
nil?
if
@project
.
issues_tracker
==
Project
.
issues_tracker
.
default_value
@project
.
issues
.
where
(
id:
issue_id
).
first
.
present?
else
true
end
end
end
end
app/models/project.rb
View file @
e6d2e569
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
# creator_id :integer
# creator_id :integer
# default_branch :string(255)
# default_branch :string(255)
# issues_enabled :boolean default(TRUE), not null
# issues_enabled :boolean default(TRUE), not null
# issues_tracker :string not null
# wall_enabled :boolean default(TRUE), not null
# wall_enabled :boolean default(TRUE), not null
# merge_requests_enabled :boolean default(TRUE), not null
# merge_requests_enabled :boolean default(TRUE), not null
# wiki_enabled :boolean default(TRUE), not null
# wiki_enabled :boolean default(TRUE), not null
...
@@ -22,10 +23,11 @@ require "grit"
...
@@ -22,10 +23,11 @@ require "grit"
class
Project
<
ActiveRecord
::
Base
class
Project
<
ActiveRecord
::
Base
include
Gitolited
include
Gitolited
extend
Enumerize
class
TransferError
<
StandardError
;
end
class
TransferError
<
StandardError
;
end
attr_accessible
:name
,
:path
,
:description
,
:default_branch
,
attr_accessible
:name
,
:path
,
:description
,
:default_branch
,
:issues_tracker
,
:issues_enabled
,
:wall_enabled
,
:merge_requests_enabled
,
:issues_enabled
,
:wall_enabled
,
:merge_requests_enabled
,
:wiki_enabled
,
:public
,
:import_url
,
as:
[
:default
,
:admin
]
:wiki_enabled
,
:public
,
:import_url
,
as:
[
:default
,
:admin
]
...
@@ -93,6 +95,8 @@ class Project < ActiveRecord::Base
...
@@ -93,6 +95,8 @@ class Project < ActiveRecord::Base
scope
:joined
,
->
(
user
)
{
where
(
"namespace_id != ?"
,
user
.
namespace_id
)
}
scope
:joined
,
->
(
user
)
{
where
(
"namespace_id != ?"
,
user
.
namespace_id
)
}
scope
:public_only
,
->
{
where
(
public:
true
)
}
scope
:public_only
,
->
{
where
(
public:
true
)
}
enumerize
:issues_tracker
,
:in
=>
(
Settings
[
:issues_tracker
].
keys
).
append
(
:gitlab
),
:default
=>
:gitlab
class
<<
self
class
<<
self
def
abandoned
def
abandoned
project_ids
=
Event
.
select
(
'max(created_at) as latest_date, project_id'
).
project_ids
=
Event
.
select
(
'max(created_at) as latest_date, project_id'
).
...
...
app/views/projects/_form.html.haml
View file @
e6d2e569
...
@@ -24,6 +24,10 @@
...
@@ -24,6 +24,10 @@
=
f
.
check_box
:issues_enabled
=
f
.
check_box
:issues_enabled
%span
.descr
Lightweight issue tracking system for this project
%span
.descr
Lightweight issue tracking system for this project
.control-group
=
f
.
label
:issues_tracker
,
"Issues tracker"
,
class:
'control-label'
.input
=
f
.
select
(
:issues_tracker
,
Project
.
issues_tracker
.
values
,
{},
{
disabled:
!
@project
.
issues_enabled
})
.control-group
.control-group
=
f
.
label
:merge_requests_enabled
,
"Merge Requests"
,
class:
'control-label'
=
f
.
label
:merge_requests_enabled
,
"Merge Requests"
,
class:
'control-label'
.controls
.controls
...
...
config/gitlab.yml.example
View file @
e6d2e569
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
# 2. Replace gitlab -> host with your domain
# 2. Replace gitlab -> host with your domain
# 3. Replace gitlab -> email_from
# 3. Replace gitlab -> email_from
<<<<<<< HEAD
production: &base
production: &base
#
#
# 1. GitLab app settings
# 1. GitLab app settings
...
@@ -37,6 +38,11 @@ production: &base
...
@@ -37,6 +38,11 @@ production: &base
# signup_enabled: true # default: false - Account passwords are not sent via the email if signup is enabled.
# signup_enabled: true # default: false - Account passwords are not sent via the email if signup is enabled.
# username_changing_enabled: false # default: true - User can change her username/namespace
# username_changing_enabled: false # default: true - User can change her username/namespace
## Available issues trackers
issues_tracker:
redmine:
issues_url: "http://redmine.sample/issues/:id"
## Gravatar
## Gravatar
gravatar:
gravatar:
enabled: true # Use user avatar images from Gravatar.com (default: true)
enabled: true # Use user avatar images from Gravatar.com (default: true)
...
...
db/migrate/20130123114545_add_issues_tracker_to_project.rb
0 → 100644
View file @
e6d2e569
class
AddIssuesTrackerToProject
<
ActiveRecord
::
Migration
def
change
add_column
:projects
,
:issues_tracker
,
:string
,
default: :gitlab
,
null:
false
end
end
db/schema.rb
deleted
100644 → 0
View file @
8f621c9e
This diff is collapsed.
Click to expand it.
lib/gitlab/markdown.rb
View file @
e6d2e569
...
@@ -163,8 +163,11 @@ module Gitlab
...
@@ -163,8 +163,11 @@ module Gitlab
end
end
def
reference_issue
(
identifier
)
def
reference_issue
(
identifier
)
if
issue
=
@project
.
issues
.
where
(
id:
identifier
).
first
if
issue_exists?
identifier
link_to
(
"#
#{
identifier
}
"
,
project_issue_url
(
@project
,
issue
),
html_options
.
merge
(
title:
"Issue:
#{
issue
.
title
}
"
,
class:
"gfm gfm-issue
#{
html_options
[
:class
]
}
"
))
url
=
url_for_issue
(
identifier
)
title
=
title_for_issue
(
identifier
)
link_to
(
"#
#{
identifier
}
"
,
url
,
html_options
.
merge
(
title:
"Issue:
#{
title
}
"
,
class:
"gfm gfm-issue
#{
html_options
[
:class
]
}
"
))
end
end
end
end
...
...
spec/helpers/gitlab_markdown_helper_spec.rb
View file @
e6d2e569
...
@@ -2,6 +2,7 @@ require "spec_helper"
...
@@ -2,6 +2,7 @@ require "spec_helper"
describe
GitlabMarkdownHelper
do
describe
GitlabMarkdownHelper
do
include
ApplicationHelper
include
ApplicationHelper
include
IssuesHelper
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:project
)
{
create
(
:project
)
}
...
...
spec/lib/issues_tracker_spec.rb
0 → 100644
View file @
e6d2e569
require
'spec_helper'
describe
IssuesTracker
do
let
(
:project
)
{
double
(
'project'
)
}
before
do
@project
=
project
project
.
stub
(
repository:
stub
(
ref_names:
[
'master'
,
'foo/bar/baz'
,
'v1.0.0'
,
'v2.0.0'
]))
project
.
stub
(
path_with_namespace:
'gitlab/gitlab-ci'
)
end
it
'returns url for issue'
do
ololo
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment