The Simple Weather project provides a module that when installed creates a block that displays current weather conditions for a location. The location for the current weather report is defined by the user who has permission to administer blocks by submitting the block configuration form for the Simple Weather block.
There are two fields that can determine the location of the weather report: US ZIP code field and the Where On Earth Identification (WOEID) field. The data in these fields are passed to the simpleWeather jQuery plugin that queries the data from Yahoo's Weather service and returns it for display in the Simple Weather block. There is also a field that sets the temperature scale as Celsius or Fahrenheit and returns the data accordingly.
UNIQUENESS
There are several other "weather widget" type modules available as Drupal.org projects. I tried most of them before coming to the conclusion that I needed to create my own. I found that most of the other weather widget projects did not work without significant errors, considerable performance expense and were quite complicated to install and configure. Also, none of the other weather widget modules that I tested uses the simpleWeather jQuery plugin which I found to be very well written and uses the Yahoo weather WOEID to generate a current weather report for nearly any location on planet Earth. I thought this was awesome enough to push the Simple Weather module forward as a Drupal project and share it with the Drupal Community.
FUNCTIONALITY
I took great care to write field validation so that only the ZIP Code or WOEID fields can be selected. The module will not work correctly if both fields contain data or if the both of the fields are empty. I also check for integers and input length.
Also, I wrote in a check for the presence of the simpleWeather jQuery plugin JavaScript file. When the check fails, Drupal Set Message displays an error with helpful instructions.
The hook_uninstall() removes the ZIP code and WOEID and temperature scale variables.
CODING STANDARDS
I followed the Drupal code standards for PHP, JavaScript and CSS and commented often. The use of Drupal APIs are implemented correctly and the naming convention of the other functions does not conflict.
DOCUMENTATION
I authored a README file that simply explains where to download the required open source simpleWeather jQuery plugin and where to place it within the Drupal filesystem. This third party jQuery plugin is mature and released under an MIT license that is compatible with the GPL v2 license. I do not plan on adding the third party JavaScript to this project Git repository in the future and I understand the handbook policies regarding the use of third party code.
PROJECT PAGE
I created a project page that is complete with a screenshot of the settings form and link to the demonstration site: https://drupal.org/sandbox/larsdesigns/2203553. Credentials to the demonstration site are happily provided upon request.
GIT REPOSITORY
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/larsdesigns/2203553.git
I feel that this project is unique and provides a straight forward approach to creating a lightweight and functional weather widget for Drupal. Not only does it provide weather data for locations in the United States but it provides weather data for nearly any location in the world. I am excited about providing this solution to the world wide Drupal community.
Please consider my application for full project status. If this module is promoted, I intend to create versions for Drupal 8 and Drupal 6. I also look forward to maintaining the module and keeping a clean issue queue.
I have been an active Drupal citizen in other ways during the last few years including Drupal Camp Colorado and local meet ups and now I would very much like to begin contributing code and gain experience as a module maintainer. I am also interested in reviewing project applications and will begin participating in the Review Bonus Program to help prioritize this application. I will do my best to review three project applications by the end of this week.
Reviews of other projects:
1. https://drupal.org/comment/8580309#comment-8580309
2. https://drupal.org/comment/8580449#comment-8580449
3. https://drupal.org/comment/8580503#comment-8580503
Comment | File | Size | Author |
---|---|---|---|
#27 | Screen Shot 2014-03-16 at 8.57.56 PM.png | 13.62 KB | mraichelson |
Comments
Comment #1
PA robot CreditAttribution: PA robot commentedThere are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxlarsdesigns2203553git
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #2
dubcanada CreditAttribution: dubcanada commentedGenerally speaking I don't like seeing SASS inside of modules, there is really only one line of css, you can remove the SASS, and config.rb and just keep the css file with the single line of css.
It seems to be a bit confusing atm on which you need US Zip Code or WOEID. It should be obvious to use Zip Code for US and WOEID for everywhere else.
You should use the libraries module API, rather then just file_exists /sites/all/libraries/. And you should add libraries to the dependencies.
Besides that it seems to work fine for me.
Comment #3
larsdesigns CreditAttribution: larsdesigns commentedOkay, I will remove the SCSS files and add a little text to show ZIP code or WOEID choice more clearly.
However, I do not want to use the libraries module. I feel like that is an unnecessary requirement and using file_exists() keeps the project lighter and the module easier to install. There are many modules that do not depend on the libraries module that implement jQuery plugins.
Thank you very much for the review.
Comment #4
larsdesigns CreditAttribution: larsdesigns commentedI pushed the commit and removed the SCSS and compass files. I also added "or" text to the form to make the choice between ZIP Code and WOEID clear.
Comment #5
dubcanada CreditAttribution: dubcanada commentedAlright it looks fine by me.
Comment #6
larsdesigns CreditAttribution: larsdesigns commented@dubcanada, awesome, thank you so much for the review.
Comment #7
Plazik CreditAttribution: Plazik commentedThere are still some errors http://pareview.sh/pareview/httpgitdrupalorgsandboxlarsdesigns2203553git
It appears you are working in the "7.x-1.0" branch in git. You should really be working in a version specific branch. The most direct documentation on this is Moving from a master branch to a version branch. For additional resources please see the documentation about release naming conventions and creating a branch in git.
There is still a master branch, make sure to set the correct default branch: http://drupal.org/node/1659588 . Then remove the master branch, see also step 6 and 7 in http://drupal.org/node/1127732
The following git branches do not match the release branch pattern, you should remove/rename them. See http://drupal.org/node/1015226
Review of the 7.x-1.0 branch:
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
Source: http://pareview.sh/ - PAReview.sh online service
Comment #8
larsdesigns CreditAttribution: larsdesigns commentedPlazik, thank you for your review. I will change the git branch to a proper version, remove master branch and work on reducing the errors and warnings presented in the pareview report.
Comment #9
larsdesigns CreditAttribution: larsdesigns commentedI have completed the changes as indicated in comment #7 and produced a clean pareview report: http://pareview.sh/pareview/httpgitdrupalorgsandboxlarsdesigns2203553git.
I also remove the master branch from the Git repository.
Comment #10
Plazik CreditAttribution: Plazik commentedManual review:
7.x-1.x
branch in git instead of7.x-1.x-dev
or7.x-1.0
.package
uses to combine several modules into one group. Your module consists of only one module sopackage = Simple Weather
is excessive.Implements hook_foor_bar()
. See https://drupal.org/coding-standards/docs#hookimpl.$content = '<div id="simple-weather"></div>';
. All HTML code should be added via theme() function https://api.drupal.org/api/drupal/includes!theme.inc/function/theme/7./* line 7, ../sass/simple_weather.scss */
from css. This information doesn't help anyone.I think adding select list with "USA ZIP Code" and "Where On Earth Identifiers (WOEID)" values is better for UI. You can hide unselected value depend of #states. Seу https://api.drupal.org/api/drupal/developer!topics!forms_api_reference.h... and Example module https://drupal.org/project/examples. This will do code smaller.
Thanks for contribution anyway!
Comment #11
larsdesigns CreditAttribution: larsdesigns commentedThank you so much for your code review. I have completed the following updates:
1. Change to git branch 7.x-1.x
2. Implemented the theme functions.
3. Added module descriptions text to the README.txt file.
4. Removed packages from simple_weather.info
5. Used !replacements inside t().
6. Changed the background color of the sky images to blue.
7. Removed the extra css file.
8. Removed the scss comments from the css file.
9. Renamed from stylesheets directory to css.
I feel like the libraries module would add a lot expense. I am trying to keep it simple and lightweight as possible.
For the JavaScript UI recommendations, I will take them under consideration. I am usually not a fan of complicating a simple configuration form with JavaScript unless it is really helpful but I do appreciate the feedback. I may do this in the future.
I comfortable having the two validation functions. I feel like it is easier for me keep the code organized in my mind. Unless there is a technical reason to change it, I would like to keep.
I very much appreciate the feedback.
Comment #12
Plazik CreditAttribution: Plazik commentedHave you pushed all chenges to git repo? I can't see only 3 changes.
You should put
$content = '<div id="simple-weather"></div>';
inside theme_weather_output(). In this case other people will be able to overwrite it in custom theme.Use replacements inside this t() too:
The Libraries API module is recomended way for adding external libraries to Drupal.
This code
DRUPAL_ROOT . '/sites/all/libraries/simpleWeather/jquery.simpleWeather.min.js'
will not work for multisite (/sites/example.com/libraries/
).Comment #13
larsdesigns CreditAttribution: larsdesigns commentedYes, everything has been pushed up to the 7.x-1.x branch.
Can you show me documentation that explains why using the contributed Libraries module API is recommended best practice?
It seems like a lot of overhead to replace one solid line of code.
Comment #14
Plazik CreditAttribution: Plazik commentedSee the words from Project application review administrator https://drupal.org/comment/8546253#comment-8546253.
Comment #15
larsdesigns CreditAttribution: larsdesigns commentedThe comment by klausi was referring to including third party code directly to the git repository. I have not done this. I do not find any documentation supporting that the contributed Libraries module is required or even recommended. At this time I will would not like to add the expense for the sake of replacing one line of good code.
I have include a small list of modules that use third party JavaScript without Libraries API:
1. https://drupal.org/project/shadowbox
2. https://drupal.org/project/lightbox2
3. https://drupal.org/project/views_slideshow
4. https://drupal.org/project/views_slideshow_slider
5. https://drupal.org/project/views_slideshow_imageflow
6. https://drupal.org/project/views_slideshow_galleria
7. https://drupal.org/project/views_slideshow_jcarousel
8. https://drupal.org/project/jcarousel
9. https://drupal.org/project/ckeditor
10. https://drupal.org/project/ckeditor_swf
11. https://drupal.org/project/flowplayer
12. https://drupal.org/project/thickbox
13. https://drupal.org/project/kaltura (swfobject.js included in Git repository using an MIT license).
14. https://drupal.org/project/media_gallery (by Acquia) Implements colobox plugin
15. https://drupal.org/project/plupload (Libraries optional)
16. https://drupal.org/project/wysiwyg (Three external JS plugins. No mention of libraries api)
17. https://drupal.org/project/om_maximenu(jquery.easyAccordion.js, jquery.hoverIntent.minified.js, jquery.lavalamp.min.js, jquery.resizeOnApproach.min.js, jquery.roundabout.min.js, jquery.scrollTo.min.js, jquery.serialScroll.min.js all MIT licensed their party code included in git.drupal.org repository.)
18. mediaqueries.js
19. https://drupal.org/project/om_tools (Includes mediaqueries.js)
20. https://drupal.org/project/views_infinite_scroll (Libraries module optional for Drush)
21. https://drupal.org/project/icheck
22. https://drupal.org/project/boilerplate (modernizr-2.6.2-respond-1.1.0.min.js included in Git repository)
The list goes on and on. I could probably come up with 50 module projects without much trouble that are either including third party code in the Git repository and/or not using the Libraries module as a dependency.
I am not seeking to include third party code with this module project. Good thing that the use of APIs from the contributed Libraries module is only unofficially recommended (without documentation) and not required.
Comment #16
larsdesigns CreditAttribution: larsdesigns commentedFor comment #12, I have added the use of replacements in t().
Because drupal_set_message() requires check_plain() for all passed data and thus limits the use of l() in the message, I used the Available Updates link as an example found on line 620 in update.module of Drupal core to format this use of t().
See Git commit: a571ad621046601b26be109191e3073c13b43504
Comment #17
larsdesigns CreditAttribution: larsdesigns commentedCompleted the implementation of the Libraries API module. The new code passed coder review and I feel it is ready for community review.
See git commits fe81b993e1b2537b42db14b64913493b64684897 and 569f1ac8116b6e8f2eb9ae76ed554a6b2782b83a for details.
Comment #18
larsdesigns CreditAttribution: larsdesigns commentedComment #19
larsdesigns CreditAttribution: larsdesigns commentedSetting to status to Needs Work.
Comment #20
larsdesigns CreditAttribution: larsdesigns commentedOops, setting status to needs review.
Comment #21
larsdesigns CreditAttribution: larsdesigns commentedComment #22
larsdesigns CreditAttribution: larsdesigns commentedComment #23
larsdesigns CreditAttribution: larsdesigns commentedComment #24
mraichelson CreditAttribution: mraichelson commentedgit clone
command in initial post to point to the updated 7.x-1.x branch.$(document).ready()
trigger to useDrupal.behaviors
instead (documentation is available over here). In some cases having a mix of the two can lead to some odd interactions.js/simple_weather.js
which blocks automated updates after that (through the update manager or thedrush pm-update
command).Comment #25
larsdesigns CreditAttribution: larsdesigns commentedComment #26
larsdesigns CreditAttribution: larsdesigns commented@mraichelson, thank you for the review.
Comment #27
mraichelson CreditAttribution: mraichelson commentedIf not every ZIP code will trigger a result then I'd recommend sticking some help text onto that form field to warn people that potentially they may enter stuff and get no result.
As far as the HTML markup I definitely wouldn't recommend trying to rewrite the plugin itself. But moving that chunk of markup (that gets assembled as
var html
out to something that could be output through Drupal.settings (that could be altered in a theme or module). Possibly something that keeps a single string of markup in Drupal.settings that would be run through string.replace to replace placeholder tokens with values returned by the plugin.I hacked around and got an example of something like this working in a gist over here.
(This may be headed outside the target zone for a project application ticket and might be worth moving to the sandbox issue queue instead if you want to discuss it more.)
Comment #28
larsdesigns CreditAttribution: larsdesigns commented@mraichelson, good ideas for future development but definitely outside the purpose of this issue queue.
Comment #29
Binu Varghese CreditAttribution: Binu Varghese commented@larsdesigns, the git clone URL mentioned by you:
git clone --branch 7.x-1.x larsdesigns@git.drupal.org:sandbox/larsdesigns/2203553.git is your personal one. Reviewers won't be able to access your code.
Please fix it (e.g.):
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/larsdesigns/2203553.git simple_weather
Being a minor update to be done, leaving you at "Needs Review" for now!
Comment #30
larsdesigns CreditAttribution: larsdesigns commentedComment #31
SpadXIII CreditAttribution: SpadXIII commentedLooks good, just too bad it only supports US zipcodes :)
Just a minor issue; instead of calling 'simple_weather_file_required' on each block view, why not implement a hook_requirements to check for the library?
Comment #32
larsdesigns CreditAttribution: larsdesigns commented@SpadXIII
It supports weather locations world wide using a WOEID that can be easily looked up using the WOEID look up tool.
Comment #33
dahousecat CreditAttribution: dahousecat commentedAfter installing the module I got the message saying I should install the simpleWeather library.
After installing the library the message only disappeared once I'd cleared the cache. Maybe the message should say install library and then clear the cache?
I entered my WOEID of 29062 for Milton Keynes in the UK. The H2 subtitle on my weather block says "Milton Keynes, " (trailing comma and whitespace).
The comma on the end without any other details is not so pretty. Maybe check if there is not a second part of the address and remove the comma and trailing space if it is not present?
One other idea was whilst it is very easy to change the background color of the image with css maybe put it as a configuration option of the block so people can change the appearance without having to edit any css?
As these are only minor points I'm not going to change the status of the project.
Comment #34
dahousecat CreditAttribution: dahousecat commentedThe "Simple Weather Block Title" field appears on every block configure form - not just yours.
This code is at fault:
Remove the call to isset() and you'll be ok.
Comment #35
dahousecat CreditAttribution: dahousecat commentedComment #36
larsdesigns CreditAttribution: larsdesigns commentedThe isset() function is required because the $form['delta']['#value'] array value does not exist on every form. First I have to check to see if it is set and then I check the value.
Your code produces the following error:
I checked the log and there are no errors or warning and the code is working as expected. Keeping the original code.
Comment #37
dahousecat CreditAttribution: dahousecat commentedSorry, I didn't explain myself very well.
If $form['delta']['#value'] is set (which is on every block config form) then isset will return TRUE.
TRUE == 'simple_weather_report' evaluates to true, so your code is changing the title on all block config forms (try to edit a different block - you will see title field is labeled Simple Weather Block Title).
You need to check if isset first, and then go on to also check that the strings match:
Comment #38
larsdesigns CreditAttribution: larsdesigns commentedFixed the logic problem.
a9c424c3503a281e4c8ec96a927d17a883ce3d99
Comment #39
dahousecat CreditAttribution: dahousecat commentedReviewed and tested and looks all good to me :)
Comment #40
klausiReview of the 7.x-1.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
manual review:
But that are not critical application blockers, so ...
Thanks for your contribution, larsdesigns!
I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Thanks to the dedicated reviewer(s) as well.
Comment #41
larsdesigns CreditAttribution: larsdesigns commentedKlausi,
Thank you so much. I will make the fixes you pointed out. I very much appreciate the review and account promotion.
Thanks,
larsdesigns