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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
537cd66d
Commit
537cd66d
authored
Jan 28, 2015
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add gitlab internal issue tracker service.
parent
8eb365c0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
11 deletions
+37
-11
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+1
-1
app/controllers/projects/services_controller.rb
app/controllers/projects/services_controller.rb
+1
-4
app/models/project.rb
app/models/project.rb
+18
-6
app/models/project_services/gitlab_issue_tracker_service.rb
app/models/project_services/gitlab_issue_tracker_service.rb
+13
-0
app/models/project_services/issue_tracker_service.rb
app/models/project_services/issue_tracker_service.rb
+4
-0
No files found.
app/controllers/application_controller.rb
View file @
537cd66d
...
...
@@ -181,7 +181,7 @@ class ApplicationController < ActionController::Base
end
def
add_gon_variables
gon
.
default_issues_tracker
=
Project
.
issues_tracker
.
default_value
gon
.
default_issues_tracker
=
Project
.
new
.
default_issue_tracker
.
to_param
gon
.
api_version
=
API
::
API
.
version
gon
.
relative_url_root
=
Gitlab
.
config
.
gitlab
.
relative_url_root
gon
.
default_avatar_url
=
URI
::
join
(
Gitlab
.
config
.
gitlab
.
url
,
ActionController
::
Base
.
helpers
.
image_path
(
'no_avatar.png'
)).
to_s
...
...
app/controllers/projects/services_controller.rb
View file @
537cd66d
...
...
@@ -9,7 +9,7 @@ class Projects::ServicesController < Projects::ApplicationController
def
index
@project
.
build_missing_services
@services
=
@project
.
services
.
reload
@services
=
@project
.
services
.
where
.
not
(
type:
'GitlabIssueTrackerService'
).
reload
end
def
edit
...
...
@@ -17,9 +17,6 @@ class Projects::ServicesController < Projects::ApplicationController
def
update
if
@service
.
update_attributes
(
service_params
)
if
@service
.
activated?
&&
@service
.
issue_tracker?
@project
.
update_attributes
(
issues_tracker:
@service
.
to_param
)
end
redirect_to
edit_project_service_path
(
@project
,
@service
.
to_param
),
notice:
'Successfully updated.'
else
...
...
app/models/project.rb
View file @
537cd66d
...
...
@@ -77,6 +77,7 @@ class Project < ActiveRecord::Base
has_one
:jira_service
,
dependent: :destroy
has_one
:redmine_service
,
dependent: :destroy
has_one
:custom_issue_tracker_service
,
dependent: :destroy
has_one
:gitlab_issue_tracker_service
,
dependent: :destroy
has_one
:forked_project_link
,
dependent: :destroy
,
foreign_key:
"forked_to_project_id"
...
...
@@ -149,8 +150,6 @@ class Project < ActiveRecord::Base
scope
:public_and_internal_only
,
->
{
where
(
visibility_level:
Project
.
public_and_internal_levels
)
}
scope
:non_archived
,
->
{
where
(
archived:
false
)
}
enumerize
:issues_tracker
,
in:
(
Service
.
issue_tracker_service_list
).
append
(
:gitlab
),
default: :gitlab
state_machine
:import_status
,
initial: :none
do
event
:import_start
do
transition
[
:none
,
:finished
]
=>
:started
...
...
@@ -317,19 +316,32 @@ class Project < ActiveRecord::Base
end
end
def
default_issue_tracker
unless
gitlab_issue_tracker_service
create_gitlab_issue_tracker_service
end
gitlab_issue_tracker_service
end
def
issues_tracker
if
external_issue_tracker
external_issue_tracker
else
default_issue_tracker
end
end
def
default_issues_tracker?
if
external_issue_tracker
false
else
unless
self
.
issues_tracker
==
Project
.
issues_tracker
.
default_value
self
.
update_attributes
(
issues_tracker:
Project
.
issues_tracker
.
default_value
)
end
true
end
end
def
external_issues_trackers
services
.
select
{
|
service
|
service
.
issue_tracker?
}
services
.
select
(
&
:issue_tracker?
).
reject
(
&
:default?
)
end
def
external_issue_tracker
...
...
app/models/project_services/gitlab_issue_tracker_service.rb
0 → 100644
View file @
537cd66d
class
GitlabIssueTrackerService
<
IssueTrackerService
prop_accessor
:title
,
:description
,
:project_url
,
:issues_url
,
:new_issue_url
def
default?
true
end
def
to_param
'gitlab'
end
end
app/models/project_services/issue_tracker_service.rb
View file @
537cd66d
...
...
@@ -6,6 +6,10 @@ class IssueTrackerService < Service
:issue_tracker
end
def
default?
false
end
def
project_url
# implement inside child
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