Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added apps/bissue/assets/images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/bissue/assets/images/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions apps/bissue/assets/views/button/overlay.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<h3>Edit the Issue Details</h3>
{{#each tickets}}
{{#ticket}}
<ol>
<li>
<label for="title"> Issue Title </label>
<input name="title" value="{{subject}}">
</li>
<li>
<label for="status"> Issue Status </label>
<input name="status" value="{{subject}}">
</li>
<li>
<label for="description"> Issue Description </label>
<textarea name="description">
{{content.text}} \n
https://{{../../company.subdomain}}.supportbee.com/tickets/{{id}}
</textarea>
</li>
</ol>
{{/ticket}}
{{/each}}

66 changes: 66 additions & 0 deletions apps/bissue/bissue.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
module Bissue
module EventHandler
# Handle 'ticket.created' event
def ticket_created
return true
end

# Handle all events
def all_events
return true
end
end
end

module Bissue
module ActionHandler
def button
begin
response = create_bissue(payload.overlay.title, payload.overlay.status, payload.overlay.description)
html = comment_html(response)
comment_on_ticket(ticket, html)
rescue Exception => e
return [500, e.message]
end
[200, "Ticket sent to Bitbucket Issues"]
end
end
end

module Bissue
require 'uri'
require 'json'

class Base < SupportBeeApp::Base
# Settings
# bitbucket service need to be supported yet
# oauth :bitbucket, :required => true, :oauth_options => {:scope => "user,repo"}
string :accountname, :required => true, :label => 'Owner'
string :repo_slug, :required => true, :label => 'Repository'

def validate
errors[:flash] = ["Please fill in all the required fields"] if settings.accountname.blank? or settings.repo_slug.blank?
errors.empty? ? true : false
end

private

def create_bissue(issue_title, issue_status, issue_description)
# Uncomment after adding bitbucket support
#token = settings.oauth_token_secret || settings.oauth_token
response = http_post "https://bitbucket.org/api/1.0/repositories/#{settings.accountname}/#{settings.repo_slug}/issues?access_token=#{token}" do |req|
req.body = {:title => issue_title, :status => issue_status, :content => URI.encode(issue_description)}.to_json
end
end

def comment_html(response)
"Bitbucket Issue created!\n <a href=#{response.body['html_url']}>#{response.body['title']}</a>"
end

def comment_on_ticket(ticket, html)
ticket.comment(:html => html)
end

end
end

29 changes: 29 additions & 0 deletions apps/bissue/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Bissue
slug: bissue
access: public

description: "This facilitates creating issue in bitbucket."

category: Project Management

tags:
- bitbucket
- issue forwarding

developer:
name: Sagar Gugwad
email: saagar.gugwad@gmail.com
twitter: @geekgugi
github: geekgugi

# The following config keys are used by Action Handlers
# Set button 'overlay' to true, if you want to have an overlay
# The valid values for screens are [ticket, all, unassigned, my, groups]
# Remove the following section if you do not want to define Action Handlers

action:
button:
overlay: public
screens:
- ticket
label: Send To Bissue