Skip to content
This repository has been archived by the owner on Jun 9, 2022. It is now read-only.

Commit

Permalink
add open package settings button to errors #134
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Nov 2, 2017
1 parent 051a1ab commit 6005a84
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions lib/notification-element.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ FatalMetaNotificationTemplate = """
<div class="btn-toolbar">
<a href="#" class="btn-issue btn btn-error"></a>
<a href="#" class="btn-copy-report icon icon-clippy" title="Copy error report to clipboard"></a>
<a href="#" class="hidden btn-open-settings icon icon-gear" title="Open package settings"></a>
</div>
"""

Expand Down Expand Up @@ -163,13 +164,23 @@ class NotificationElement
@issue.getIssueBody().then (issueBody) ->
atom.clipboard.write(issueBody)

openSettingsButton = fatalContainer.querySelector('.btn-open-settings')
atom.tooltips.add(openSettingsButton, title: openSettingsButton.getAttribute('title'))
openSettingsButton.addEventListener 'click', (e) ->
e.preventDefault()
atom.workspace.open("atom://config/packages/#{packageName}")

if packageName? and repoUrl?
fatalNotification.innerHTML = "The error was thrown from the <a href=\"#{repoUrl}\">#{packageName} package</a>. "
openSettingsButton.classList.remove('hidden')
else if packageName?
issueButton.remove()
fatalNotification.textContent = "The error was thrown from the #{packageName} package. "
openSettingsButton.classList.remove('hidden')
else
fatalNotification.textContent = "This is likely a bug in Atom. "
openSettingsButton.remove()


# We only show the create issue button if it's clearly in atom core or in a package with a repo url
if issueButton.parentNode?
Expand Down
3 changes: 2 additions & 1 deletion styles/notifications.less
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ atom-notifications {
margin-bottom: 5px;
}

.btn-copy-report {
.btn-copy-report,
.btn-open-settings {
vertical-align: middle;
}

Expand Down

0 comments on commit 6005a84

Please sign in to comment.