PrettyDate provides a field formatter for Date types that makes use of John Resig's Prettydate JS. This allows for client side date formatting like: 5 seconds ago.. 10 seconds ago.. 2 minutes ago.. The times update every few seconds so if the user stays on one page (ajax safe using behaviors) the times update accordingly. It also allows the use of other Date Formatters incase the JS does not do anything to the date (date in future or too far in past or JS off).
Example screenshot: http://cl.ly/3m3G1i2d0E2I1q143N1C
Project Page: http://drupal.org/sandbox/twohlix/1238634
Version control: git clone --branch master twohlix@git.drupal.org:sandbox/twohlix/1238634.git prettydate
This is for Drupal 7.x
Comments
Comment #1
Everett Zufelt commentedNice code.
1. In the .info you should likely use the package that Date is using, no need to create a package for this one module.
2. You should likely not use scripts[] = js/prettydate.js
in the .info (this attachs the script to every page). Consider using the #attached property in the hook_field_formatter_view() render array.
3. The comment on the js file is:
Only GPL 2.0 code can be stored in the d.o repository. Can this be licensed under GPL2, or can you remove the code and give a link to where it can be downloaded from the project page?
4. Some of your comments are like " * hook_field_formatter_settings_form()" Standard implementation is " * Implements hook_field_formatter_settings_form()."
5. Some functions missing doc block, like function prettydate_field_formatter_settings_summary($field, $instance, $view_mode) {
6. You use " }else{
" we usually use:
Comment #2
twohlix commentedThanks for the stuff to fix. I'll look into re-licensing (unlikely, unless i write the js from scratch) or hosting the code somewhere else.
Didn't know about the #attached property, thanks.
Comment #3
Everett Zufelt commentedOoops, switching category back.
Comment #4
Everett Zufelt commented@twohlix you're welcome.
FYI, MIT and GPL 2.0 are compatible licenses, so the author may be willing to release the code under a dual MIT / GPL 2.0 license, this happens quite frequently. It doesn't hurt to ask.
Comment #5
twohlix commentedThe author agreed to relicense his code to both MIT + GPL. Pushed the changes to that. I just have to catch up on the other changes.
Comment #6
twohlix commentedAll right, all the changes suggested were made. Thanks EverettZ.
Comment #7
klausiComment #8
twohlix commentedklausi, I'll make those changes. Thanks for the feedback.
The library has been modified, one modification changes the behavior of the library and another modification adds Drupal.behaviors support. I believe those meet the Exception requirements.
Comment #9
misc commented@twohlix has been contacted to ask if the application is abandoned.
http://drupal.org/node/894256
Comment #10
twohlix commentedNope, not abandoned, just been sidetracked with some site-builds / other-work.
Comment #11
twohlix commentedMade changes suggested in #8 by Klausi. Finally found some time to do it. Thanks for the patience.
Comment #12
twohlix commentedRaising priority because of no review for 2+ weeks since status change (http://drupal.org/node/539608)
Comment #13
klausiThe response time for a review is now approaching 5 weeks. Get a review bonus and we will come back to your application sooner.
Comment #14
geertvd commentedI think the correct way to use behaviors in d7 is like this.
You should probably think about timezone conversions here also, and your module only seems to be working on dates not older then 1 day ago. Could you make this work on older dates also?
Also something for dates in the future would be nice.
Also you have some more coding issues
http://ventral.org/pareview/httpgitdrupalorgsandboxtwohlix1238634git
Comment #15
geertvd commentedComment #16
klausiClosing due to lack of activity. Feel free to reopen if you are still working on this application.