Github user robertkowalski commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/543#discussion_r42348857
--- Diff: app/addons/components/react-components.react.jsx ---
@@ -60,6 +62,94 @@ function (app, FauxtonAPI, React, Stores,
FauxtonComponents, ace, beautifyHelper
}
});
+
+ var BulkActionComponent = React.createClass({
+
+ propTypes: {
+ hasSelectedItem: React.PropTypes.bool.isRequired,
+ removeItem: React.PropTypes.func.isRequired,
+ selectAll: React.PropTypes.func.isRequired,
+ toggleSelect: React.PropTypes.func.isRequired,
+ isChecked: React.PropTypes.bool.isRequired
+ },
+
+ getDefaultProps: function () {
+ return {
+ disabled: false,
+ title: 'Select rows that can be...',
+ bulkIcon: 'fonticon-trash',
+ buttonTitle: 'Delete all selected',
+ dropdownContentText: 'Deleted'
+ };
+ },
+
+ render: function () {
+ return (
+ <div className="bulk-action-component">
+ <div className="bulk-action-component-selector-group">
+ {this.getMasterSelector()}
+ {this.getMultiSelectOptions()}
+ </div>
+ </div>
+ );
+ },
+
+ getMultiSelectOptions: function () {
+ if (!this.props.hasSelectedItem) {
+ return null;
+ }
+
+ return (
+ <div className="group-clean bulk-actions panel">
+ <button
+ onClick={this.props.removeItem}
+ className={'fonticon ' + this.props.bulkIcon}
+ title={this.props.buttonTitle} />
+ </div>
+ );
+ },
+
+ getPopupContent: function () {
+ return (
+ <ul className="bulk-action-component-popover-actions">
+ <li onClick={this.selectAll} >
+ <i className="icon fonticon-cancel"></i>
{this.props.dropdownContentText}
+ </li>
+ </ul>
+ );
+ },
+
+ selectAll: function () {
+ this.refs.popover.hide();
+ this.props.selectAll();
+ },
+
+ getMasterSelector: function () {
+ return (
+ <div className="group-clean bulk-actions-panel panel">
+ <input type="checkbox"
+ checked={this.props.isChecked}
+ onChange={this.props.toggleSelect}
+ disabled={this.props.disabled} />
+ <div className="separator"></div>
+ <ReactBootstrap.OverlayTrigger
+ ref='popover'
--- End diff --
i don't quite understand, in case you meant that the name is too generic, i
changed it too `bulkActionPopover` now
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---