Closed (fixed)
Project:
Drupal.org security advisory coverage applications
Component:
module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
20 Aug 2012 at 07:08 UTC
Updated:
5 Nov 2012 at 20:20 UTC
Lights Out is a Drupal 7.x module that implements the well-known "turn off the lights" feature using jquery, allowing to dim the overall site presentation and highlight relevant sections of a page. This can be used for example to focus user attention and improve the readability of long pieces of text.
The lights out button can be configured as a block or added to the links area of any content type via the admin page. Furthermore, you can also configure which theme region should be highlighted when the button is clicked.
Link to sandbox: http://drupal.org/sandbox/jcamposanok/1659612
Git repo: http://git.drupal.org/sandbox/jcamposanok/1659612.git
Drupal Version: 7.x
Comments
Comment #1
sanchi.girotra commentedPlease add git link as "http://git.drupal.org/sandbox/jcamposanok/1659612.git" and also drupal version in the Issue summary.
And remove minor issue given by ventral.org here.
Comment #2
jcamposanok commentedThanks sanchi,
I've updated the Issue Summary and fixed the issue reported by PAReview.sh.
Comment #3
ColonelForbinX commentedI tried the module on a fresh install with Bartik and initially could not get it work. The fade in/out effect works fine, and the block view of the switch also functions correctly. However, I did not see the region I had selected being highlighted in any way. I checked the lights_out.js file and discovered that on line 5:
The # hash mark is hardcoded into the jQuery class. Region names are being output as classes, not IDs, so this was not correctly detecting my regions. When I changed it to...
... it began working as expected (a "highlight" class was added to the selected region, and its z-index was changed to 200, while the overlay z-index was set at 100). However, despite the fact that the the z-indexes were correct, in Firefox 14 and Chromium 18 the region still appeared to be behind the overlay. I think this is due to the fact that z-indexes are basically ignored by the rendering process unless the elements (or their parents?) are also positioned absolutely or relatively.
I imagine the use case for this module would be to highlight some element in the middle of the screen (such as a video player, which would be positioned absolutely), but out-of-the-box this module will only function as intended if your chosen theme uses absolute positioning for its regions.
Comment #4
jcamposanok commentedThanks ColonelForbinX,
as you point out, the module was indeed attempting to apply the highlight class to the region using an ID selector, which was an acceptable condition for the theme this project was first based on... But not for other themes like Bartik, which only specifies region names as classes. I have modified the code in order to apply the selection rule at class level.
Regarding the second issue, I've applied relative positioning to the highlighted region container in order for the z-indexes to be considered. This appears to have solved the problem in Firefox 14 and Chrome 18.
Comment #5
mariooo commentedManual review focusing on Javascript:
lights_out.css
lights_out.js
var zInd = $(this).css('z-index') || 0;This also means lines 6/7 no longer needed.
Line 57 can now also be
Drupal.behaviors.lights_out.shadow_off(region);instead of faking a click.This also allows other modules to trigger lights on/off behavior (i.e., a video player module may want to integrate!)
Tested and working well on 7.16-dev. Nifty little module!
Would also be cool if there was a way to have a user uploaded shadow .png (i.e. a lower opacity black) to make it even darker, or perhaps to upload a png with watermarks, or who knows!
Comment #6
jcamposanok commented@mariooo,
thanks a lot for such a detailed review! I've applied all your refactoring advices, with a slight change on point 2, since it wasn't updating the anchor labels correctly on those cases when the lights_off link and block were both enabled at the same time.
Also thanks for your suggestions of new features, I'll start working on those to get them ready for the next revision, hopefully when this project becomes a full module :-)
Comment #7
benjy commentedHandy little module this...
Few points.
Other than that looks good.
Comment #8
umarzaffer commentedManual review
------------------
1. Try to adhere to this style of writing readme.txt http://drupalcode.org/project/bot.git/blob/HEAD:/README.txt
2. Within .info file it would be better to specify both package and configure parameters.
3. Be consistent with usage of functions that serve the same purpose. The .install file uses both get_t() and st() functions. Better just use st() as .install file is used only during installation/uninstall phases and st() function is just for that.
3. I am not sure for what purpose you are using lights_out_admin_validate function within lights_out.module. Currently, this function seems to create problem when trying to save Region having "_" within region's machine name. Thereby not saving the Region selected. May be you had a special case within the theme you used when creating this module.
Comment #9
michfuer commented1) README.txt is quite sparse. I think including the main use case (video watching?) with some links to demo versions of the 'Lights Out' effect would be nice.
2) Lights out link didn't display for my chosen content type that was being displayed in Views block. The block link displays though. However, wherever the link did show up, it worked dimming all the regions that weren't the region to be highlighted.
Code looks good to me. PAReview showed up clean. I think this will be a nice addition to Drupal!
Comment #10
jcamposanok commentedHi benjy,
thanks for your suggestions. These have been applied to the latest branch revision.
Comment #11
jcamposanok commented@ umarzaffer and michfuer,
The contents and formatting of README.TXT have been improved according to suggestions. The .info file now includes the package and configure parameters, as well.
@ umarzaffer,
After testing the module with bartik and garland themes it doesn't apper to have any issues with regions having "_" within their machine names (for example, the block shows well in sidebar_first and sidebar_second regions). Maybe this may be a theme-specific issue.
@ michfuer,
Views support has not been considered so far, but definitely would be an important task when this project is released as a full module.
Thanks again for your recommendations.
Comment #12
suhani.jain commentedHi jcamposanok,
There is some commenting errors as instead of "Implements of" use "implements" in the lights_out.module file otherwise the module code looks good to me.
Comment #13
klausiWe are currently quite busy with all the project applications and I can only review projects with a review bonus. Please help me reviewing and I'll take a look at your project right away :-)
Comment #14
cubeinspire commentedEverything looks good here and no security issues as far as I see, but:
1. The constants strings used as default values are not translatable.
You can use t() to avoid that.
For example adding as isolated lines
t('Turn off the lights!');2. Why its the window position moving after click on the lights on link ?
It wouldn't be nicer to let the animation happen without that jump ?
Please can you take care 1 & 2 ?
I think those are not blocker issues so I guess this should be approved.
Comment #15
jcamposanok commented@suhani.jain: The remaining grammatical errors in comments have been fixed.
@logicdesign: The default label constant values now support translations. A small validation has also been added to prevent those "page jumps" when the lights off button is clicked.
Thanks,
Comment #16
klausiThanks logicdesign for the additional review.
manual review:
But that are not application blockers, so ...
Thanks for your contribution, jcamposanok!
I updated your account to let you 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 get 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 #17
jcamposanok commentedThank you klausi for granting me git- vetted user role, as well as for the detailed review and recommendations.
I'll work on those 2 manual review comments and then promote this to a full project.
Also thanks to everyone who helped with the revision process! I'll be looking forward to contribute with other projects and applications.
Comment #18.0
(not verified) commentedAdded repo URL and version information.