Skip to content

Instantly share code, notes, and snippets.

@subtleGradient
Created January 4, 2011 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save subtleGradient/764252 to your computer and use it in GitHub Desktop.
Save subtleGradient/764252 to your computer and use it in GitHub Desktop.
<form>
<input type="datetime" data-behavior="TimePicker" data-timepicker-pad="true" data-timepicker-labels-hours="HR" />
</form>
<a href="#my_modal" data-behavior="TargetModal">Open Modal</a>
<div id="my_modal" data-behavior="Modal" data-modal-style="color:#333; opacity:0.7">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
@subtleGradient
Copy link
Author

For the DatePicker I would rely on HTML5 input types.
For browsers without a native datetime picker UI, use something like modernizer to determine how the DatePicker behavior would work.
It should either use the native datepicker or completely handle creating the view itself in some conventional way that you would declare somewhere else.

@subtleGradient
Copy link
Author

For opening up a modal from a link, I would create the modal separately, with its content, and then hook the link up to simple show and hide that thing.
That way all the options for the modal are declared at the modal itself.

Also, use CSS-like syntax instead of multiple properties when declaring visual things like color and opacity.

@assertchris
Copy link

Fair comments all.

No experience with the native datepicker but I am not a fan of implementing multiple UI elements based on modernizer. The control works in a wide selection of browsers already, so my personal preference is to stick with it. :)

This is a bad example of the modal code ( in most cases the modal's content would be pulled with XHR) - I just wanted to give the data attribute markup in my example. The css-like properties are used in Morph animations and by subclassed elements, but in an ideal world... :)

http://sixtyseconds.github.com/mootools-date-picker/
http://sixtyseconds.github.com/mootools-modal/

Thanks for your comments - I will consider them at length.

@rolfnl
Copy link

rolfnl commented Jan 4, 2011

"For opening up a modal from a link, I would create the modal separately, with its content, and then hook the link up to simple show and hide that thing.
That way all the options for the modal are declared at the modal itself."

Sorry to bump in, but i'd say (too) that the modal (content) can rely alot on the link itself where you'd use a data-modal='{"url":"/page/detail/1"}' attribute or something. I would just put an empty modal template in the page or something (or create default one on the fly if options.template is empty)

@assertchris
Copy link

That's similar to what I had in mind for modal in my example...

@subtleGradient
Copy link
Author

Agreed, that's another good way to do it. I'd use data-modal='{foo:"bar"}' to set modal-specific options on something that isn't a Modal element.

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