Skip to content

Commit

Permalink
Plugins: Bulk edit mode with disabled plugin actions
Browse files Browse the repository at this point in the history
  • Loading branch information
johnHackworth authored and enejb committed Dec 17, 2015
1 parent fdef224 commit 5e63b99
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 15 deletions.
1 change: 1 addition & 0 deletions client/my-sites/plugins/plugin-action/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,5 @@ render: function() {
* `inProgress`: (bool) whether the action is in the middle of being performed.
* `htmlFor`: (string) htmlFor is used for creating the for attribute on the label.
* `disabledInfo`: ( string ) text that gets displayed in a infoPopover explaining why the action is disabled.
* `disabled`: ( bool ) whether the toggle is disabled (grayed out and non interactive) or not

2 changes: 1 addition & 1 deletion client/my-sites/plugins/plugin-action/plugin-action.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ module.exports = React.createClass( {

render: function() {
return (
<div className={ classNames( 'plugin-action', this.props.className ) }>
<div className={ classNames( 'plugin-action', { 'is-disabled': this.props.disabled }, this.props.className ) }>
{ this.renderInner() }
</div>
);
Expand Down
4 changes: 4 additions & 0 deletions client/my-sites/plugins/plugin-action/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
vertical-align: top;
text-transform: uppercase;
cursor: pointer;

.is-disabled & {
color: lighten( $gray, 30% );
}
}

.plugin-action .form-toggle__label .form-toggle__switch {
Expand Down
1 change: 1 addition & 0 deletions client/my-sites/plugins/plugin-activate-toggle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ render: function() {
* `site`: a site object.
* `notices`: a notices object.
* `isMock`: a boolean indicating if the toggle should not launch any real action when interacted
* `disabled`: a boolean indicating whether the toggle is disabled (grayed out and non interactive) or not
5 changes: 3 additions & 2 deletions client/my-sites/plugins/plugin-activate-toggle/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = React.createClass( {
},

toggleActivation: function() {
if ( this.props.isMock ) {
if ( this.props.isMock || this.props.disabled ) {
return;
}

Expand Down Expand Up @@ -64,7 +64,7 @@ module.exports = React.createClass( {
htmlFor={ 'disconnect-jetpack-' + this.props.site.ID }
>
<DisconnectJetpackButton
disabled={ ! this.props.plugin }
disabled={ this.props.disabled || ! this.props.plugin }
site={ this.props.site }
redirect="/plugins/jetpack"
/>
Expand All @@ -73,6 +73,7 @@ module.exports = React.createClass( {
}
return (
<PluginAction
disabled={ this.props.disabled }
className="plugin-activate-toggle"
label={ this.translate( 'Active', { context: 'plugin status' } ) }
inProgress={ inProgress }
Expand Down
1 change: 1 addition & 0 deletions client/my-sites/plugins/plugin-autoupdate-toggle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ render: function() {
* `notices`: a notices object.
* `wporg`: whether the plugin is from .org or not
* `isMock`: a boolean indicating if the toggle should not launch any real action when interacted
* `disabled`: a boolean indicating whether the toggle is disabled (grayed out and non interactive) or not
3 changes: 2 additions & 1 deletion client/my-sites/plugins/plugin-autoupdate-toggle/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = React.createClass( {
},

toggleAutoupdates: function() {
if ( this.props.isMock ) {
if ( this.props.isMock || this.props.disabled ) {
return;
}

Expand Down Expand Up @@ -131,6 +131,7 @@ module.exports = React.createClass( {

return (
<PluginAction
disabled={ this.props.disabled }
label={ label }
status={ this.props.plugin.autoupdate }
action={ this.toggleAutoupdates }
Expand Down
13 changes: 7 additions & 6 deletions client/my-sites/plugins/plugin-item/plugin-item.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,15 @@ module.exports = React.createClass( {
return (
<div className="plugin-item__actions">
<PluginActivateToggle
isMock={ this.props.isMock || this.props.isSelectable }
isMock={ this.props.isMock }
plugin={ this.props.plugin }
disabled={ this.props.isSelectable }
site={ this.props.selectedSite }
notices={ this.props.notices } />
<PluginAutoupdateToggle
isMock={ this.props.isMock || this.props.isSelectable }
isMock={ this.props.isMock }
plugin={ this.props.plugin }
disabled={ this.props.isSelectable }
site={ this.props.selectedSite }
notices={ this.props.notices }
wporg={ !! this.props.plugin.wporg } />
Expand Down Expand Up @@ -190,10 +192,9 @@ module.exports = React.createClass( {

if ( ! this.props.plugin ) {
return this.renderPlaceholder();
}

const pluginItemClasses = classNames( 'plugin-item', {
disabled: this.props.hasAllNoManageSites,
} );
const pluginItemClasses = classNames( 'plugin-item', { disabled: this.props.hasAllNoManageSites, } );

errors.forEach( function( error ) {
errorNotices.push(
Expand All @@ -220,7 +221,7 @@ module.exports = React.createClass( {
<div className="plugin-item__title" data-warnings={ numberOfWarningIcons }>
{ plugin.name }
</div>
);
);

if ( this.props.hasAllNoManageSites ) {
return (
Expand Down
5 changes: 0 additions & 5 deletions client/my-sites/plugins/plugin-item/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@

.is-bulk-editing & {
padding-left: 24px;

.plugin-item__actions {
opacity: 0.3;
filter: grayscale(70%);
}
}

& ~ .notice.is-error {
Expand Down

0 comments on commit 5e63b99

Please sign in to comment.