From e9d6d1e51afa9f46f19748977739f7d2c078b84f Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Tue, 20 Jan 2015 16:55:35 -0800 Subject: Custom issue tracker service. --- app/models/project.rb | 3 +- .../custom_issue_tracker_service.rb | 38 ++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 app/models/project_services/custom_issue_tracker_service.rb (limited to 'app') 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 -- cgit v1.2.1