diff options
Diffstat (limited to 'app/models/integrations/drone_ci.rb')
-rw-r--r-- | app/models/integrations/drone_ci.rb | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/app/models/integrations/drone_ci.rb b/app/models/integrations/drone_ci.rb index 73f78bec381..0c65ed8cd5f 100644 --- a/app/models/integrations/drone_ci.rb +++ b/app/models/integrations/drone_ci.rb @@ -10,7 +10,17 @@ module Integrations DRONE_SAAS_HOSTNAME = 'cloud.drone.io' - prop_accessor :drone_url, :token + field :drone_url, + title: s_('ProjectService|Drone server URL'), + placeholder: 'http://drone.example.com', + required: true + + field :token, + type: 'password', + help: s_('ProjectService|Token for the Drone project.'), + non_empty_password_title: s_('ProjectService|Enter new token'), + non_empty_password_help: s_('ProjectService|Leave blank to use your current token.'), + required: true validates :drone_url, presence: true, public_url: true, if: :activated? validates :token, presence: true, if: :activated? @@ -94,26 +104,6 @@ module Integrations s_('ProjectService|Run CI/CD pipelines with Drone.') end - def fields - [ - { - type: 'password', - name: 'token', - help: s_('ProjectService|Token for the Drone project.'), - non_empty_password_title: s_('ProjectService|Enter new token'), - non_empty_password_help: s_('ProjectService|Leave blank to use your current token.'), - required: true - }, - { - type: 'text', - name: 'drone_url', - title: s_('ProjectService|Drone server URL'), - placeholder: 'http://drone.example.com', - required: true - } - ] - end - override :hook_url def hook_url [drone_url, "/hook", "?owner=#{project.namespace.full_path}", "&name=#{project.path}", "&access_token=#{token}"].join |