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 committed Dec 16, 2015
1 parent 097aab8 commit f75768b
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 11 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
4 changes: 2 additions & 2 deletions client/my-sites/plugins/plugin-item/plugin-item.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ module.exports = React.createClass( {
renderActions: function() {
if ( this.props.selectedSite ) {
return <div className="plugin-item__actions">
<PluginActivateToggle isMock={ this.props.isMock || this.props.isSelectable } plugin={ this.props.plugin } site={ this.props.selectedSite } notices={ this.props.notices } />
<PluginAutoupdateToggle isMock={ this.props.isMock || this.props.isSelectable } plugin={ this.props.plugin } site={ this.props.selectedSite } notices={ this.props.notices } wporg={ !! this.props.plugin.wporg } />
<PluginActivateToggle isMock={ this.props.isMock } disabled={ this.props.isSelectable } plugin={ this.props.plugin } site={ this.props.selectedSite } notices={ this.props.notices } />
<PluginAutoupdateToggle isMock={ this.props.isMock } disabled={ this.props.isSelectable } plugin={ this.props.plugin } site={ this.props.selectedSite } notices={ this.props.notices } wporg={ !! this.props.plugin.wporg } />
</div>;
}
return null;
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 @@ -7,11 +7,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 f75768b

Please sign in to comment.