Code coverage report for code/views/global-nav-view.coffee

Statements: 0% (0 / 26)      Branches: 0% (0 / 8)      Functions: 0% (0 / 4)      Lines: 0% (0 / 21)      Ignored: none     

All files » code/views/ » global-nav-view.coffee
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69                                                                                                                                         
{div, i, span} = React.DOM
tr = require '../utils/translate'
 
Dropdown = React.createFactory require './dropdown-view'
module.exports = React.createClass
 
  displayName: 'GlobalNav'
 
  mixins: [require '../mixins/google-file-interface']
 
  getInitialState: ->
    @getInitialAppViewState
      dirty: false
      canUndo: false
      saved: false
 
  componentDidMount: ->
    @createGoogleDrive()
    @props.graphStore.addChangeListener @modelChanged
 
  modelChanged: (status) ->
    @setState
      dirty: status.dirty
      canUndo: status.canUndo
      saved: status.saved
 
  render: ->
    options = [
      name: tr "~MENU.NEW"
      action: @newFile
    ,
      name: tr "~MENU.OPEN"
      action: @openFile
    ,
      name: tr "~MENU.SAVE"
      action: @saveFile
    ,
      name: tr "~MENU.SAVE_AS"
      action: false
    ,
      name: tr "~MENU.REVERT_TO_ORIGINAL"
      action: if @state.canUndo then @revertToOriginal else false
    ,
      name: tr "~MENU.REVERT_TO_LAST_SAVE"
      action: if @state.saved and @state.dirty then @revertToLastSave else false
    ,
      name: tr '~MENU.SETTINGS'
      action: false
    ]
 
    (div {className: 'global-nav'},
      (div {},
        (Dropdown {anchor: @props.filename, items: options, className:'global-nav-content-filename'})
        if @state.dirty
          (span {className: 'global-nav-file-status'}, 'Unsaved')
      )
      if @state.action
        (div {},
          (i {className: "fa fa-cog fa-spin"})
          @state.action
        )
      (div {className: 'global-nav-name-and-help'},
        (span {className: 'mockup-only'}, @props.username),
        (span {className: 'mockup-only'},
          (i {className: 'fa fa-2x fa-question-circle'})
        )
      )
    )