Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Allow for customization of the loading message div and provide a general purpose $.mobile.showMessage() function #1947

Closed
wants to merge 2 commits into from

Conversation

dgeb
Copy link

@dgeb dgeb commented Jun 28, 2011

In the first commit, I allow for a customizable class (or classes) to be defined for the loading message div instead of, or in addition to, the default of "ui-body-a". Also, $.mobile.loadingMessage can now be set to true, instead of a string, so that a spinner may appear with no associated loading message.

In the second commit, I've extracted the error message logic into a new, reusable $.mobile.showMessage() function which can be used to display any message to the user. In addition to a custom message, options such as delayTime, fadeTime, and wrapperClass can be specified.

For a demo of these customizations in action, please see http://ioumate.com

dgeb added 2 commits June 28, 2011 11:34
…g message div instead of, or in addition to, the default of "ui-body-a". Also, allow $.mobile.loadingMessage to be set to true, instead of a string, so that a spinner may appear with no associated loading message.
…essage() function which can be used to display any message to the user. In addition to specifying a custom message, options such as delayTime, fadeTime, and wrapperClass can be specified. NOTE: the delayTime remains 800ms for page loading error messages for the sake of continuity, but the default delayTime has been increased to 2500ms, which seems more appropriate for messages of any length.
@toddparker
Copy link
Contributor

The team likes the idea of adding this but we might approach it differently. Thanks for your contribution.
New issue created for this: #2044

@toddparker toddparker closed this Jul 7, 2011
@dgeb
Copy link
Author

dgeb commented Jul 7, 2011

I probably shouldn't have combined both commits into a single pull request. However, I'd like to make sure that the second commit doesn't get lost, and it doesn't seem to be covered in #2044

It seems to me that there is little downside to extracting the error message logic into a new, reusable showMessage() function. Would you recommend that I extract that into a separate issue, create a new pull request with just that commit, or otherwise?

Thanks for the consideration.

@toddparker
Copy link
Contributor

We definitely want to create a new plugin for message style overlays so that is planned but we just want to give the API a bit of thought so we're going for the smallest tweak we can right now to make this a bit better. Feel free to add a note to the issue about adding the theme swatch - that's what you're referring to, right?

@dgeb
Copy link
Author

dgeb commented Jul 7, 2011

I'm actually referring to this commit: dgeb@a6de24b

This commit extracts the currently private code used to create an error message into a general purpose $.mobile.showMessage() function that is part of the API. This function takes an options object, which allows for theming as well as customization of message fade and delay times.

Here's a use case:
$.mobile.showMessage( "Your password has been updated", { delayTime: 2000, fadeTime: 400, wrapperClass: 'my-custom-notification-class' });

I've tried to provide sensible defaults so that options aren't normally needed.

To take this further, I think that $.mobile.showPageLoadingMsg() should internally call a general purpose function such as $.mobile.showMessage(). It doesn't make sense to me to have this kind of messaging logic scattered about. I'd be willing to do further work on this if the team agrees.

@toddparker
Copy link
Contributor

That's exactly what we're thinking. Create a message overlay plugin that the loader can then use. Can you create a new issue to track this and start sketching out ideas for how to structure this and we can track the conversation there.

There is already a pretty robust dialog plugin here, but I think we'd probably make this simpler and more markup-focused for jQM so it's essentially a wrapper and you can drop whatever markup you want inside.
http://dev.jtsage.com/jQM-SimpleDialog/

@dgeb
Copy link
Author

dgeb commented Jul 8, 2011

Sounds good Todd. I just created a new issue: #2045

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

Successfully merging this pull request may close these issues.

2 participants