Added indicator message preview is empty.
This PR addresses "Indicate if the message preview is empty" issue mentioned in the #3748
Added check in Preview button click event handler if body (message, diary entry, diary comment) is empty and if positive, performs reporting validity (displays tooltip). Fixes #3748.
Github's "Nothing to preview" is not ideal because it looks exactly as if you wrote a message "Nothing to preview".
Maybe we should just disable the preview button when there is nothing to preview?
I was thinking about alert to make "Nothing to preview" look different. With a disabled button users have to figure out why it's disabled.
I have a branch with tabs by the way:
Dear @AntonKhorev , @tomhughes ,
I updated the sources to trigger validation and error reporting like when pushing Send / Publish (like on above screenshot). Please, let me know if it looks fine now or if I can improve it somehow.
Thanks, Nenad.
Is it necessary to have an "Add subject" placeholder right under a "Subject" label? Maybe you can argue that the "Body" label is not clear enough, but then why is the placeholder "Add your message" even for diary entries? And what does all of this have to do with the issue #3748?
I updated the sources to trigger validation
It also validates the subject and will tell to fill out the subject if its empty while not saying anything about the body. Does that make sense when the user asks for a preview of the body?
Dear @AntonKhorev ,
Thank you very much for reviewing and comments. I removed placeholders (probably overkilling, also not used on other places in website) and updated JavaScript to force checking body only when pushing Preview button.
Please, let me know your thoughts and if I can improve it further somehow.
Thanks, Nenad.
Dear @AntonKhorev ,
Thank you very much for your review & suggestion. When I was trying reportValidity(), I forgot to put preventDefault() before :-).
I used validation because checking Subject / Body when pushing Send / Publish / Update used validation. What is the ideal solution here, using validation or bootstrap alerts?
Thanks, Nenad.
Added alternative (#5023) using bootstrap alerts
Closed in favor of #5023