Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable the Publish button if there is nothing to publish #1791

Closed
Firesphere opened this issue Apr 17, 2017 · 9 comments
Closed

Disable the Publish button if there is nothing to publish #1791

Firesphere opened this issue Apr 17, 2017 · 9 comments

Comments

@Firesphere
Copy link

Experience shows that users expect onBefore|AfterPublish to be called when they hit the Publish Button.

This doesn't happen, because there is nothing to publish when no changes are made. It would add value to disable the publish button unless there are changes to publish.

@chillu
Copy link
Member

chillu commented Apr 19, 2017

I've confirmed that Verioned->publishSingle() does NOT call $owner->invokeWithExtensions('onBeforePublish'); when no changes need to be published (in SS4). Both "safe draft" and "publish" buttons are clickable regardless of any changes, but they are highlighted green when changes are detected. We could disable the buttons altogether, but I'm not confident enough in our change detection to do that just yet (e.g. TinyMCE needs a newline inserted in order to trigger change detection, doesn't trigger on any keypress).

Keen to get @clarkepaul UX feedback on this.

@clarkepaul
Copy link
Contributor

I think it would be good to disable the buttons but only if we are certain that our change detection is working every time for every scenario. That would be the most frustrating thing to have changes that you can't save or publish because we don't allow it.

The way it is designed is to give the actions more of a disabled look but not too much to make users think they can't click it again.

@chillu
Copy link
Member

chillu commented May 9, 2017

@Firesphere Can you add some more detail on the context of this issue here? Did you expect the extension to have an effect on publish, even though core didn't think a publish needed to happen?

@dhensby
Copy link
Contributor

dhensby commented May 9, 2017

Can we, perhaps, add a "onAfterSkippedPublish" just like we doe for DataObject::write()?

@Firesphere
Copy link
Author

Can you add some more detail on the context of this issue here? Did you expect the extension to have an effect on publish, even though core didn't think a publish needed to happen?

This was discussed in the CMS-users channel in the users Slack. Several developers found it confusing that when clicking the publish button (regardless of it's state) did not consistently invoke onBefore/After publish.

@chillu
Copy link
Member

chillu commented Jun 16, 2017

@Firesphere Do you want to send a PR for onAfterSkippedPublish?

@Firesphere
Copy link
Author

I can have a look at it, sure.

@dhensby
Copy link
Contributor

dhensby commented Jun 16, 2017

Just to add another thought on this - I don't think that disabling the publish/save buttons is a good idea even if our change detection is good because there are instances where you might want to force a publish/save event even if the current page has no explicit changes... perhaps you need to force a static publish action or some other onAfterSave hook that's needed

@maxime-rainville
Copy link
Contributor

Yeah ... change detections could be a bit difficult here. The current page might not have any change to publish, but their could be related owned objects that do. Unless we have a full proof way of communicating back to the UI to decide if we should disable the button, disabling the button could be difficult.

Should point out that the publish button doesn't currently use its "dirty" state when a child object has draft changes. e.g.: You edit a form field on a UserForm page, save your changes and go back the main page. The "Publish" button comes back with it's green border (as opposed to the green background when its dirty).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants