<commit_before>{nav, div, button, a} = React.DOM

{MessageFlags, FlagsConstants} = require '../constants/app_constants'

ToolboxActions = require './toolbox_actions'
ToolboxMove    = require './toolbox_move'

LayoutActionCreator       = require '../actions/layout_action_creator'
ConversationActionCreator = require '../actions/conversation_action_creator'
MessageActionCreator      = require '../actions/message_action_creator'
alertError                = LayoutActionCreator.alertError
alertSuccess              = LayoutActionCreator.notify

# Shortcuts for buttons classes
cBtnGroup = 'btn-group btn-group-sm pull-right'
cBtn      = 'btn btn-default fa'


module.exports = React.createClass
    displayName: 'ToolbarMessage'

    propTypes:
        message            : React.PropTypes.object.isRequired
        mailboxes          : React.PropTypes.object.isRequired
        selectedMailboxID  : React.PropTypes.string.isRequired
        onReply            : React.PropTypes.func.isRequired
        onReplyAll         : React.PropTypes.func.isRequired
        onForward          : React.PropTypes.func.isRequired
        onDelete           : React.PropTypes.func.isRequired
        onMove             : React.PropTypes.func.isRequired
        onHeaders          : React.PropTypes.func.isRequired


    render: ->
        nav className: 'toolbar toolbar-message btn-toolbar',
            # inverted order due to `pull-right` class
            div className: cBtnGroup,
                @renderToolboxMove()
                @renderToolboxActions()
            @renderQuickActions()
            @renderReply()


    renderReply: ->
        div className: cBtnGroup,
            button
                className: "#{cBtn} fa-mail-reply"
                onClick: @props.onReply
            button
                className: "#{cBtn} fa-mail-reply-all"
                onClick: @props.onReplayAll
            button
                className: "#{cBtn} fa-mail-forward"
                onClick: @props.onForward


    renderQuickActions: ->
        div className: cBtnGroup,
            button
                className: "#{cBtn} fa-trash"
                onClick: @props.onDelete


    renderToolboxActions: ->
        flags = @props.message.get('flags') or []
        isFlagged = FlagsConstants.FLAGGED in flags
        isSeen    = FlagsConstants.SEEN in flags

        ToolboxActions
            ref:            'toolboxActions'
            mailboxes:      @props.mailboxes
            isSeen:         isSeen
            isFlagged:      isFlagged
            mailboxID:      @props.selectedMailboxID
            messageID:      @props.message.get 'id'
            message:        @props.message
            onMark:         @onMark
            onConversation: @onConversation
            onMove:         @props.onMove
            onHeaders:      @props.onHeaders<commit_msg>fix typo that prevented to reply all<commit_after>{nav, div, button, a} = React.DOM

{MessageFlags, FlagsConstants} = require '../constants/app_constants'

ToolboxActions = require './toolbox_actions'
ToolboxMove    = require './toolbox_move'

LayoutActionCreator       = require '../actions/layout_action_creator'
ConversationActionCreator = require '../actions/conversation_action_creator'
MessageActionCreator      = require '../actions/message_action_creator'
alertError                = LayoutActionCreator.alertError
alertSuccess              = LayoutActionCreator.notify

# Shortcuts for buttons classes
cBtnGroup = 'btn-group btn-group-sm pull-right'
cBtn      = 'btn btn-default fa'


module.exports = React.createClass
    displayName: 'ToolbarMessage'

    propTypes:
        message            : React.PropTypes.object.isRequired
        mailboxes          : React.PropTypes.object.isRequired
        selectedMailboxID  : React.PropTypes.string.isRequired
        onReply            : React.PropTypes.func.isRequired
        onReplyAll         : React.PropTypes.func.isRequired
        onForward          : React.PropTypes.func.isRequired
        onDelete           : React.PropTypes.func.isRequired
        onMove             : React.PropTypes.func.isRequired
        onHeaders          : React.PropTypes.func.isRequired


    render: ->
        nav className: 'toolbar toolbar-message btn-toolbar',
            # inverted order due to `pull-right` class
            div className: cBtnGroup,
                @renderToolboxMove()
                @renderToolboxActions()
            @renderQuickActions()
            @renderReply()


    renderReply: ->
        div className: cBtnGroup,
            button
                className: "#{cBtn} fa-mail-reply"
                onClick: @props.onReply
            button
                className: "#{cBtn} fa-mail-reply-all"
                onClick: @props.onReplyAll
            button
                className: "#{cBtn} fa-mail-forward"
                onClick: @props.onForward


    renderQuickActions: ->
        div className: cBtnGroup,
            button
                className: "#{cBtn} fa-trash"
                onClick: @props.onDelete


    renderToolboxActions: ->
        flags = @props.message.get('flags') or []
        isFlagged = FlagsConstants.FLAGGED in flags
        isSeen    = FlagsConstants.SEEN in flags

        ToolboxActions
            ref:            'toolboxActions'
            mailboxes:      @props.mailboxes
            isSeen:         isSeen
            isFlagged:      isFlagged
            mailboxID:      @props.selectedMailboxID
            messageID:      @props.message.get 'id'
            message:        @props.message
            onMark:         @onMark
            onConversation: @onConversation
            onMove:         @props.onMove
            onHeaders:      @props.onHeaders
{'fraction_non_alphanumeric': 0.08258154059680778, 'fraction_numerical': 0.0, 'mean_word_length': 1.8163165608207132, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5441008', 'n_tokens_mistral': 1523, 'n_tokens_neox': 1486, 'n_words': 305}