-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #712 from blueo/pulls/add-injector-to-gallery-toolbar
Enhancement: add injector to gallery toolbar
- Loading branch information
Showing
17 changed files
with
624 additions
and
297 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
client/src/components/GalleryToolbar/Buttons/AddFolderButton.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React, { Component, PropTypes } from 'react'; | ||
import i18n from 'i18n'; | ||
|
||
/** | ||
* Gallery Toolbar add folder button. | ||
* | ||
* @returns {XML} button | ||
*/ | ||
class AddFolderButton extends Component { | ||
constructor() { | ||
super(); | ||
this.handleCreateFolder = this.handleCreateFolder.bind(this); | ||
} | ||
handleCreateFolder(event) { | ||
const { onCreateFolder } = this.props; | ||
event.preventDefault(); | ||
if (typeof onCreateFolder === 'function') { | ||
onCreateFolder(); | ||
} | ||
} | ||
render() { | ||
const { canEdit } = this.props; | ||
return ( | ||
<button | ||
id="add-folder-button" | ||
className="btn btn-secondary font-icon-folder-add btn--icon-xl" | ||
type="button" | ||
onClick={this.handleCreateFolder} | ||
disabled={!canEdit} | ||
> | ||
<span className="btn__text btn__title">{i18n._t('AssetAdmin.ADD_FOLDER_BUTTON')}</span> | ||
</button> | ||
); | ||
} | ||
} | ||
|
||
AddFolderButton.propTypes = { | ||
canEdit: PropTypes.bool.isRequired, | ||
onCreateFolder: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default AddFolderButton; |
Oops, something went wrong.