diff --git a/internal_packages/account-sidebar/lib/account-sidebar-store.coffee b/internal_packages/account-sidebar/lib/account-sidebar-store.coffee
index 6f10b56bf..2e5987a3a 100644
--- a/internal_packages/account-sidebar/lib/account-sidebar-store.coffee
+++ b/internal_packages/account-sidebar/lib/account-sidebar-store.coffee
@@ -74,7 +74,7 @@ AccountSidebarStore = Reflux.createStore
# Sort the main tags so they always appear in a standard order
mainTags = _.sortBy mainTags, (tag) -> mainTagIDs.indexOf(tag.id)
- mainTags.push new Tag(name: 'All Mail', id: '*')
+ mainTags.push new Tag(name: 'All Mail', id: Tag.AllMailID)
# Add the counts
inboxTag = _.find tags, (tag) -> tag.id is 'inbox'
diff --git a/internal_packages/message-list/lib/main.cjsx b/internal_packages/message-list/lib/main.cjsx
index cde55a311..34dcff23f 100644
--- a/internal_packages/message-list/lib/main.cjsx
+++ b/internal_packages/message-list/lib/main.cjsx
@@ -1,6 +1,5 @@
MessageList = require "./message-list"
MessageToolbarItems = require "./message-toolbar-items"
-MessageNavTitle = require "./message-nav-title"
{ComponentRegistry,
WorkspaceStore} = require 'nylas-exports'
SidebarThreadParticipants = require "./sidebar-thread-participants"
@@ -16,15 +15,11 @@ module.exports =
ComponentRegistry.register MessageToolbarItems,
location: WorkspaceStore.Location.MessageList.Toolbar
- ComponentRegistry.register MessageNavTitle,
- location: WorkspaceStore.Location.MessageList.Toolbar
-
ComponentRegistry.register SidebarThreadParticipants,
location: WorkspaceStore.Location.MessageListSidebar
deactivate: ->
ComponentRegistry.unregister MessageList
- ComponentRegistry.unregister MessageNavTitle
ComponentRegistry.unregister MessageToolbarItems
serialize: -> @state
diff --git a/internal_packages/message-list/lib/message-nav-title.cjsx b/internal_packages/message-list/lib/message-nav-title.cjsx
deleted file mode 100644
index 51b324598..000000000
--- a/internal_packages/message-list/lib/message-nav-title.cjsx
+++ /dev/null
@@ -1,34 +0,0 @@
-
-_ = require 'underscore'
-_str = require 'underscore.string'
-React = require 'react'
-{Actions, FocusedTagStore} = require 'nylas-exports'
-
-class MessageNavTitle extends React.Component
- @displayName: 'MessageNavTitle'
-
- constructor: (@props) ->
- @state = @_getStateFromStores()
-
- componentDidMount: =>
- @_unsubscriber = FocusedTagStore.listen @_onChange
-
- componentWillUnmount: =>
- @_unsubscriber() if @_unsubscriber
-
- render: =>
- if @state.tagId
- title = "Back to #{_str.titleize(@state.tagId)}"
- else
- title = "Back"
-
-
Actions.popSheet() }
- className="message-nav-title">{title}
-
- _onChange: => _.defer =>
- @setState(@_getStateFromStores())
-
- _getStateFromStores: =>
- tagId: FocusedTagStore.tagId()
-
-module.exports = MessageNavTitle
diff --git a/internal_packages/message-list/stylesheets/message-list.less b/internal_packages/message-list/stylesheets/message-list.less
index f43671f52..2a8c0e1a6 100644
--- a/internal_packages/message-list/stylesheets/message-list.less
+++ b/internal_packages/message-list/stylesheets/message-list.less
@@ -27,19 +27,6 @@
opacity: 0;
}
- .message-nav-title {
- order:-99;
- cursor: default;
- color:@text-color-heading;
- margin:0;
- margin-top:11px;
- font-size: @font-size-h4;
- font-weight: @font-weight-normal;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
-
.message-toolbar-arrow.down {
order:101;
margin-right: 0;
diff --git a/internal_packages/thread-list/lib/thread-list-store.coffee b/internal_packages/thread-list/lib/thread-list-store.coffee
index 0383ff33b..deaea4aef 100644
--- a/internal_packages/thread-list/lib/thread-list-store.coffee
+++ b/internal_packages/thread-list/lib/thread-list-store.coffee
@@ -12,6 +12,7 @@ _ = require 'underscore'
Actions,
Utils,
Thread,
+ Tag,
Message} = require 'nylas-exports'
# Public: A mutable text container with undo/redo support and the ability to
@@ -67,7 +68,7 @@ ThreadListStore = Reflux.createStore
else if namespaceId and tagId
matchers = []
matchers.push Thread.attributes.namespaceId.equal(namespaceId)
- matchers.push Thread.attributes.tags.contains(tagId) if tagId isnt "*"
+ matchers.push Thread.attributes.tags.contains(tagId) if tagId isnt Tag.AllMailID
view = new DatabaseView Thread, {matchers}, (ids) =>
DatabaseStore.findAll(Message).where(Message.attributes.threadId.in(ids)).then (messages) ->
messagesByThread = {}
diff --git a/src/flux/models/tag.coffee b/src/flux/models/tag.coffee
index b9d94b872..79a7bac48 100644
--- a/src/flux/models/tag.coffee
+++ b/src/flux/models/tag.coffee
@@ -26,6 +26,8 @@ Section: Models
###
class Tag extends Model
+ @AllMailID: '*'
+
@attributes: _.extend {}, Model.attributes,
'name': Attributes.String
queryable: true
diff --git a/src/sheet-toolbar.cjsx b/src/sheet-toolbar.cjsx
index 2ba647f21..3632fd2b5 100644
--- a/src/sheet-toolbar.cjsx
+++ b/src/sheet-toolbar.cjsx
@@ -2,7 +2,10 @@ React = require 'react/addons'
Sheet = require './sheet'
Flexbox = require './components/flexbox'
RetinaImg = require './components/retina-img'
+FocusedTagStore = require './flux/stores/focused-tag-store'
TimeoutTransitionGroup = require './components/timeout-transition-group'
+Tag = require './flux/models/tag'
+_str = require 'underscore.string'
_ = require 'underscore'
{Actions,
@@ -34,9 +37,29 @@ class WindowTitle extends React.Component
class ToolbarBack extends React.Component
@displayName: 'ToolbarBack'
+
+ constructor: (@props) ->
+ @state =
+ tagId: FocusedTagStore.tagId()
+
+ componentDidMount: =>
+ @_unsubscriber = FocusedTagStore.listen =>
+ @setState(tagId: FocusedTagStore.tagId())
+
+ componentWillUnmount: =>
+ @_unsubscriber() if @_unsubscriber
+
render: =>
+ if @state.tagId is Tag.AllMailID
+ title = 'All Mail'
+ else if @state.tagId
+ title = _str.titleize(@state.tagId)
+ else
+ title = "Back"
+
_onClick: =>
diff --git a/static/workspace.less b/static/workspace.less
index b0a021bd7..942acd376 100644
--- a/static/workspace.less
+++ b/static/workspace.less
@@ -186,6 +186,16 @@ body.is-blurred {
img.content-mask { background-color: @text-color-heading; }
flex-grow: 0;
flex-shrink: 0;
+
+ .item-back-title {
+ cursor: default;
+ color:@text-color-heading;
+ margin:0;
+ font-size: @font-size-h4;
+ font-weight: @font-weight-normal;
+ vertical-align: middle;
+ display:inline-block;
+ }
}
.btn-toolbar {
@@ -295,4 +305,3 @@ body.platform-win32 {
cursor:ew-resize;
}
}
-