2014-09-07 20:58:01 -06:00
{ $ , $$ , $$$ , View } = require " atom "
2014-09-07 16:41:05 -06:00
module.exports =
class MessageView extends View
2014-09-07 20:58:01 -06:00
messages: [ ]
2014-09-07 16:41:05 -06:00
@content: ->
@ div
class : ' atom-beautify message-panel ' , =>
@ div
class : ' overlay from-top ' , =>
@ div class : " tool-panel panel-bottom " , =>
@ div class : " inset-panel " , =>
@ div class : " panel-heading " , =>
@ div class : ' btn-toolbar pull-right ' , =>
@ button
class : ' btn '
2014-09-07 20:58:01 -06:00
click: ' clearMessages '
' Clear '
2014-09-07 16:41:05 -06:00
@ span
2014-09-07 20:58:01 -06:00
class : ' '
2014-09-07 16:41:05 -06:00
outlet: ' title '
' Atom Beautify Message '
@ div
2014-09-07 20:58:01 -06:00
class : " panel-body padded select-list "
2014-09-07 16:41:05 -06:00
outlet: ' body '
2014-09-07 20:58:01 -06:00
=>
@ ol
class : ' list-group ' ,
outlet: ' messageItems '
=>
@ li class : ' two-lines ' , =>
@ div class : ' status status-removed icon icon-diff-added ' , ' '
@ div class : ' primary-line icon icon-alert ' , ' This is the title '
@ div class : ' secondary-line no-icon ' , ' Secondary line '
@ li class : ' two-lines ' , =>
@ div class : ' status status-removed icon icon-diff-added ' , ' '
@ div class : ' primary-line icon icon-alert ' , ' This is the title Currently there is no way to display a message to the user, such as errors or warnings or deprecation notices (see # 40). Let \' s put a little overlay on the top for displaying such information. '
@ div class : ' secondary-line no-icon ' , ' This is the title Currently there is no way to display a message to the user, such as errors or warnings or deprecation notices (see # 40). Let \' s put a little overlay on the top for displaying such information. '
@ li class : ' two-lines ' , =>
@ div class : ' status status-removed icon icon-diff-added ' , ' '
@ div class : ' primary-line icon icon-alert ' , ' test '
@ div class : ' secondary-line no-icon ' , ' Secondary line '
@ li class : ' two-lines ' , =>
@ div class : ' status status-removed icon icon-diff-added ' , ' '
@ div class : ' primary-line icon icon-alert ' , ' This is the title '
@ div class : ' secondary-line no-icon ' , ' Secondary line '
@ li class : ' two-lines ' , =>
@ div class : ' status status-removed icon icon-diff-added ' , ' '
@ div class : ' primary-line icon icon-alert ' , ' This is the title '
@ div class : ' secondary-line no-icon ' , ' Secondary line '
@ li class : ' two-lines ' , =>
@ div class : ' status status-added icon icon-diff-added ' , ' '
@ div class : ' primary-line icon icon-file-text ' , ' Primary line '
@ div class : ' secondary-line no-icon ' , ' Secondary line '
constructor: ->
super
destroy: ->
addMessage: (message) =>
@ messages . push ( message ) ;
@ refresh ( )
clearMessages: =>
@messages = [ ]
@ refresh ( )
2014-09-07 16:41:05 -06:00
close: (event, element) =>
@ detach ( )
2014-09-07 20:58:01 -06:00
2014-09-07 16:41:05 -06:00
show: =>
if not @ . hasParent ( )
atom . workspaceView . appendToTop @
2014-09-07 20:58:01 -06:00
refresh: =>
# If the messages list is empty, view should be closed.
if @ messages . length is 0
@ close ( )
else
@ show ( )