diff options
author | Marin Jankovski <maxlazio@gmail.com> | 2015-01-20 16:55:35 -0800 |
---|---|---|
committer | Marin Jankovski <maxlazio@gmail.com> | 2015-01-20 16:55:35 -0800 |
commit | e9d6d1e51afa9f46f19748977739f7d2c078b84f (patch) | |
tree | 30112e5b0316dfd366ae60a8fa3acdfabe002ca0 /app | |
parent | 09de0bfc37c54b84d5a49dbce8c11cfd2f3cfb80 (diff) | |
download | gitlab-ce-e9d6d1e51afa9f46f19748977739f7d2c078b84f.tar.gz |
Custom issue tracker service.
Diffstat (limited to 'app')
-rw-r--r-- | app/models/project.rb | 3 | ||||
-rw-r--r-- | app/models/project_services/custom_issue_tracker_service.rb | 38 |
2 files changed, 40 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index a90081ce735..e501ccb59f7 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -70,6 +70,7 @@ class Project < ActiveRecord::Base has_one :pushover_service, dependent: :destroy has_one :jira_service, dependent: :destroy has_one :redmine_service, dependent: :destroy + has_one :custom_issue_tracker_service, dependent: :destroy has_one :forked_project_link, dependent: :destroy, foreign_key: "forked_to_project_id" has_one :forked_from_project, through: :forked_project_link @@ -324,7 +325,7 @@ class Project < ActiveRecord::Base def available_services_names %w(gitlab_ci campfire hipchat pivotaltracker flowdock assembla - emails_on_push gemnasium slack pushover buildbox bamboo teamcity jira redmine) + emails_on_push gemnasium slack pushover buildbox bamboo teamcity jira redmine custom_issue_tracker) end def gitlab_ci? diff --git a/app/models/project_services/custom_issue_tracker_service.rb b/app/models/project_services/custom_issue_tracker_service.rb new file mode 100644 index 00000000000..69e1b204bac --- /dev/null +++ b/app/models/project_services/custom_issue_tracker_service.rb @@ -0,0 +1,38 @@ +class CustomIssueTrackerService < IssueTrackerService + + prop_accessor :title, :description, :project_url, :issues_url, :new_issue_url + + def title + if self.properties && self.properties['title'].present? + self.properties['title'] + else + 'Custom Issue Tracker' + end + end + + def description + if self.properties && self.properties['description'].present? + self.properties['description'] + else + 'Custom issue tracker' + end + end + + def to_param + title.parameterize + 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 + self.properties = {} if properties.nil? + end +end |