Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Add missing location to "new bookmark" button on about:bookmarks #5038

Merged
merged 1 commit into from
Oct 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/extensions/brave/locales/en-US/menu.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ closeOtherTabs=Close other Tabs
bookmarkPage=Bookmark Page
bookmarkLink=Bookmark This Link
bookmarkAdded=Bookmark Added
bookmarkFolderAdding=New Bookmark Folder
bookmarkFolderEditing=Edit Bookmark Folder
bookmarkEdit=Edit Bookmark
bookmarkCreateNew=Create New Bookmark
openFile=Open File…
openLocation=Open Location…
openSearch=Search for "{{selectedVariable}}"
Expand Down
27 changes: 18 additions & 9 deletions js/about/aboutActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,18 +315,27 @@ const aboutActions = {
},

/**
* Dispatches a message to set add/edit bookmark details
* If set, also indicates that add/edit is shown
* @param {Object} currentDetail - Properties of the bookmark to change to
* @param {Object} originalDetail - Properties of the bookmark to edit
* @param {Object} destinationDetail - Will move the added bookmark to the specified position
* Show the "Add Bookmark" control
* @param {Object} siteDetail - object bound to add/edit control
*/
openBookmarkEditor: function (currentDetail, originalDetail, destinationDetail) {
showAddBookmark: function (siteDetail) {
aboutActions.dispatchAction({
actionType: windowConstants.WINDOW_SET_BOOKMARK_DETAIL,
currentDetail,
originalDetail,
destinationDetail
currentDetail: siteDetail,
originalDetail: null,
destinationDetail: null,
shouldShowLocation: true
})
},

/**
* Show the "Add Bookmark" control for a folder
* @param {Object} siteDetail - object bound to add/edit control
*/
showAddBookmarkFolder: function (siteDetail) {
aboutActions.dispatchAction({
actionType: windowConstants.WINDOW_SET_BOOKMARK_DETAIL,
currentDetail: siteDetail
})
},

Expand Down
4 changes: 2 additions & 2 deletions js/about/bookmarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class BookmarkTitleHeader extends ImmutableComponent {
parentFolderId: this.props.selectedFolderId,
tags: [siteTags.BOOKMARK]
})
aboutActions.openBookmarkEditor(newBookmark)
aboutActions.showAddBookmark(newBookmark)
}
render () {
return <div className='th-inner'>
Expand Down Expand Up @@ -320,7 +320,7 @@ class AboutBookmarks extends React.Component {
parentFolderId: this.state.selectedFolderId,
tags: [siteTags.BOOKMARK_FOLDER]
})
aboutActions.openBookmarkEditor(newFolder)
aboutActions.showAddBookmarkFolder(newFolder)
}
componentDidMount () {
this.refs.bookmarkSearch.focus()
Expand Down
20 changes: 14 additions & 6 deletions js/components/addEditBookmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ class AddEditBookmark extends ImmutableComponent {
get isFolder () {
return siteUtil.isFolder(this.props.currentDetail)
}
get heading () {
if (this.isFolder) {
return this.props.shouldShowLocation
? 'bookmarkFolderEditing'
: 'bookmarkFolderAdding'
}
return this.props.shouldShowLocation
? (!this.props.originalDetail || !this.props.originalDetail.has('location'))
? 'bookmarkCreateNew'
: 'bookmarkEdit'
: 'bookmarkAdded'
}
updateFolders (props) {
this.folders = siteUtil.getFolders(this.props.sites, props.currentDetail.get('folderId'))
}
Expand Down Expand Up @@ -143,11 +155,7 @@ class AddEditBookmark extends ImmutableComponent {
withoutButtons: this.props.withoutButtons
})} />
<div className='bookmarkFormInner'>
{
!this.isFolder && this.props.shouldShowLocation
? <h2 data-l10n-id='bookmarkEdit' />
: <h2 data-l10n-id='bookmarkAdded' />
}
<h2 data-l10n-id={this.heading} />
<div className='bookmarkFormTable'>
<div id='bookmarkName' className='bookmarkFormRow'>
<label data-l10n-id='nameField' htmlFor='bookmarkName' />
Expand All @@ -162,7 +170,7 @@ class AddEditBookmark extends ImmutableComponent {
: null
}
<div id='bookmarkParentFolder' className='bookmarkFormRow'>
<label data-l10n-id='parentFolderField' htmlFor='bookmarkParentFolderk' />
<label data-l10n-id='parentFolderField' htmlFor='bookmarkParentFolder' />
<select value={this.props.currentDetail.get('parentFolderId')}
onChange={this.onParentFolderChange} >
<option value='0' data-l10n-id='bookmarksToolbar' />
Expand Down