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
00a0d5ae
Commit
00a0d5ae
authored
Jan 26, 2015
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move repetition to the parent.
parent
9b5b334a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
94 deletions
+58
-94
app/models/project_services/issue_tracker_service.rb
app/models/project_services/issue_tracker_service.rb
+44
-0
app/models/project_services/jira_service.rb
app/models/project_services/jira_service.rb
+0
-45
app/models/project_services/redmine_service.rb
app/models/project_services/redmine_service.rb
+10
-44
lib/gitlab/markdown.rb
lib/gitlab/markdown.rb
+4
-5
No files found.
app/models/project_services/issue_tracker_service.rb
View file @
00a0d5ae
...
@@ -15,4 +15,48 @@ class IssueTrackerService < Service
...
@@ -15,4 +15,48 @@ class IssueTrackerService < Service
def
new_issue_url
def
new_issue_url
# implement inside child
# implement inside child
end
end
def
fields
[
{
type:
'text'
,
name:
'description'
,
placeholder:
description
},
{
type:
'text'
,
name:
'project_url'
,
placeholder:
'Project url'
},
{
type:
'text'
,
name:
'issues_url'
,
placeholder:
'Issue url'
},
{
type:
'text'
,
name:
'new_issue_url'
,
placeholder:
'New Issue url'
}
]
end
def
initialize_properties
if
properties
.
nil?
if
enabled_in_gitlab_config
self
.
properties
=
{
title:
issues_tracker
[
'title'
],
project_url:
set_project_url
,
issues_url:
issues_tracker
[
'issues_url'
],
new_issue_url:
issues_tracker
[
'new_issue_url'
]
}
end
end
end
private
def
enabled_in_gitlab_config
Gitlab
.
config
.
issues_tracker
&&
Gitlab
.
config
.
issues_tracker
.
values
.
any?
&&
issues_tracker
end
def
issues_tracker
Gitlab
.
config
.
issues_tracker
[
to_param
]
end
def
set_project_url
id
=
self
.
project
.
issues_tracker_id
if
id
issues_tracker
[
'project_url'
].
gsub
(
":issues_tracker_id"
,
id
)
else
issues_tracker
[
'project_url'
]
end
end
end
end
app/models/project_services/jira_service.rb
View file @
00a0d5ae
...
@@ -21,49 +21,4 @@ class JiraService < IssueTrackerService
...
@@ -21,49 +21,4 @@ class JiraService < IssueTrackerService
def
to_param
def
to_param
'jira'
'jira'
end
end
def
fields
[
{
type:
'text'
,
name:
'title'
,
placeholder:
title
},
{
type:
'text'
,
name:
'description'
,
placeholder:
description
},
{
type:
'text'
,
name:
'project_url'
,
placeholder:
'Project url'
},
{
type:
'text'
,
name:
'issues_url'
,
placeholder:
'Issue url'
},
{
type:
'text'
,
name:
'new_issue_url'
,
placeholder:
'New Issue url'
}
]
end
def
initialize_properties
if
properties
.
nil?
if
enabled_in_gitlab_config
self
.
properties
=
{
title:
issues_tracker
[
'title'
],
project_url:
set_project_url
,
issues_url:
issues_tracker
[
'issues_url'
],
new_issue_url:
issues_tracker
[
'new_issue_url'
]
}
end
end
end
private
def
enabled_in_gitlab_config
Gitlab
.
config
.
issues_tracker
&&
Gitlab
.
config
.
issues_tracker
.
values
.
any?
&&
issues_tracker
end
def
issues_tracker
Gitlab
.
config
.
issues_tracker
[
'jira'
]
end
def
set_project_url
id
=
self
.
project
.
issues_tracker_id
if
id
issues_tracker
[
'project_url'
].
gsub
(
":issues_tracker_id"
,
id
)
else
issues_tracker
[
'project_url'
]
end
end
end
end
app/models/project_services/redmine_service.rb
View file @
00a0d5ae
...
@@ -3,56 +3,22 @@ class RedmineService < IssueTrackerService
...
@@ -3,56 +3,22 @@ class RedmineService < IssueTrackerService
prop_accessor
:title
,
:description
,
:project_url
,
:issues_url
,
:new_issue_url
prop_accessor
:title
,
:description
,
:project_url
,
:issues_url
,
:new_issue_url
def
title
def
title
if
self
.
properties
&&
self
.
properties
[
'title'
].
present?
self
.
properties
[
'title'
]
else
'Redmine'
'Redmine'
end
end
end
def
description
def
description
if
self
.
properties
&&
self
.
properties
[
'description'
].
present?
self
.
properties
[
'description'
]
else
'Redmine issue tracker'
'Redmine issue tracker'
end
end
end
def
to_param
def
to_param
'redmine'
'redmine'
end
end
def
fields
[
{
type:
'text'
,
name:
'project_url'
,
placeholder:
'Project url'
},
{
type:
'text'
,
name:
'issues_url'
,
placeholder:
'Issue url'
},
{
type:
'text'
,
name:
'new_issue_url'
,
placeholder:
'New Issue url'
}
]
end
def
initialize_properties
if
properties
.
nil?
if
enabled_in_gitlab_config
self
.
properties
=
{
title:
issues_tracker
[
'title'
],
project_url:
set_project_url
,
issues_url:
issues_tracker
[
'issues_url'
],
new_issue_url:
issues_tracker
[
'new_issue_url'
]
}
end
end
end
private
def
enabled_in_gitlab_config
Gitlab
.
config
.
issues_tracker
&&
Gitlab
.
config
.
issues_tracker
.
values
.
any?
&&
issues_tracker
end
def
issues_tracker
Gitlab
.
config
.
issues_tracker
[
'redmine'
]
end
def
set_project_url
id
=
self
.
project
.
issues_tracker_id
if
id
issues_tracker
[
'project_url'
].
gsub
(
":issues_tracker_id"
,
id
)
else
issues_tracker
[
'project_url'
]
end
end
end
end
lib/gitlab/markdown.rb
View file @
00a0d5ae
...
@@ -220,9 +220,8 @@ module Gitlab
...
@@ -220,9 +220,8 @@ module Gitlab
link_to
(
"
#{
prefix_text
}
#
#{
identifier
}
"
,
url
,
options
)
link_to
(
"
#{
prefix_text
}
#
#{
identifier
}
"
,
url
,
options
)
end
end
else
else
external_issue_tracker
=
project
.
external_issue_tracker
if
project
.
external_issue_tracker
.
present?
if
external_issue_tracker
.
present?
reference_external_issue
(
identifier
,
project
,
reference_external_issue
(
identifier
,
external_issue_tracker
,
project
,
prefix_text
)
prefix_text
)
end
end
end
end
...
@@ -266,10 +265,10 @@ module Gitlab
...
@@ -266,10 +265,10 @@ module Gitlab
end
end
end
end
def
reference_external_issue
(
identifier
,
issue_tracker
,
project
=
@project
,
def
reference_external_issue
(
identifier
,
project
=
@project
,
prefix_text
=
nil
)
prefix_text
=
nil
)
url
=
url_for_issue
(
identifier
,
project
)
url
=
url_for_issue
(
identifier
,
project
)
title
=
issue_tracker
.
title
title
=
project
.
external_
issue_tracker
.
title
options
=
html_options
.
merge
(
options
=
html_options
.
merge
(
title:
"Issue in
#{
title
}
"
,
title:
"Issue in
#{
title
}
"
,
...
...
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